Skip to content

Commit c45c56b

Browse files
committed
Expose hard-coded dynamic load address for ELF sections
This should hopefully provide more programmatic access to plugins and other support code/scripts about where Manticore loads dynamic ELF sections in memory (example: position-independent executables).
1 parent e02099a commit c45c56b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

manticore/platforms/linux.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ class Linux(Platform):
439439
# from /usr/include/asm-generic/resource.h
440440
FCNTL_FDCWD = -100 # /* Special value used to indicate openat should use the cwd */
441441

442+
# Hard-coded base load address for dynamic elf binaries (ET_DYN in pyelftools)
443+
BASE_DYN_ADDR_32 = 0x56555000
444+
BASE_DYN_ADDR = 0x555555554000
445+
442446
def __init__(self, program, argv=None, envp=None, disasm="capstone", **kwargs):
443447
"""
444448
Builds a Linux OS platform
@@ -1007,9 +1011,9 @@ def load(self, filename, env):
10071011
if base == 0 and elf.header.e_type == "ET_DYN":
10081012
assert vaddr == 0
10091013
if addressbitsize == 32:
1010-
base = 0x56555000
1014+
base = self.BASE_DYN_ADDR_32
10111015
else:
1012-
base = 0x555555554000
1016+
base = self.BASE_DYN_ADDR
10131017

10141018
perms = perms_from_elf(flags)
10151019
hint = base + vaddr

0 commit comments

Comments
 (0)