Skip to content

Commit

Permalink
Log discovered base address
Browse files Browse the repository at this point in the history
Note the base address that is going into created kernel elf.  Seeing the
actual address can help determine if something wonky is going on.
  • Loading branch information
TheBitshifter committed Jan 16, 2025
1 parent da14e78 commit 8693be8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vmlinux_to_elf/elf_symbolizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@ def __init__(self, file_contents : bytes, output_file : str,

if base_address is not None:
progbits.section_header.sh_addr = base_address
logging.info(f"[+] Explicit base address given ({progbits.section_header.sh_addr:x})")
elif kallsyms_finder.kernel_text_candidate:
progbits.section_header.sh_addr = kallsyms_finder.kernel_text_candidate
logging.info(f"[+] Base address using kernel_text_candidate ({progbits.section_header.sh_addr:x})")
else:
progbits.section_header.sh_addr = first_symbol_virtual_address & 0xfffffffffffff000
logging.info(f"[+] Base address fallback, using first_symbol_virtual_address ({progbits.section_header.sh_addr:x})")

progbits.section_contents = file_contents

Expand Down

0 comments on commit 8693be8

Please sign in to comment.