Repository navigation
Conversation
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS This record covers head The measurements were recorded at Unpatched The CaRT load and the direct payload load recorded the same fields: The fixture in angr/binaries#190 wraps the existing This change touches the same hunk as #727 and #728. If one lands first, the |
|
Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_780 |
5abacfc to
cd51b11
Compare
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS This reproducer loads a Mach-O MH_EXECUTE from a CaRT container. The fixture Reproducerimport logging, os
logging.getLogger("cle").setLevel(logging.CRITICAL)
import cle
BIN = os.environ["BINARIES"] # a checkout of angr/binaries
T = lambda *p: os.path.join(BIN, "tests", *p)
path = T("x86_64", "fauxware.macho.cart")
ld = cle.Loader(path, auto_load_libs=False,
main_opts={"arc4_key": b"\x02\xf53asdf\x00\x00\x00\x00\x00\x00\x00\x00\x00"})
obj = ld.main_object
print(f"main object: {type(obj).__name__} os={obj.os} "
f"mapped_base={obj.mapped_base:#x} entry={obj.entry:#x}")Before this change, the container owns the child until the loader promotes it. cle master at
|
570ea2b to
5c0a030
Compare
A container backend (CaRT, universal binary, static archive) registers itself as the loader's main object before calling _load_object_isolated, so every child it loads is constructed with is_main_bin=False. For a CaRT-wrapped Mach-O the loader then promotes the child through force_main_object, but only after the backend has already been constructed, so MachO.__init__ saw is_main_bin=False and asserted. Nothing in MachO needs the fact. The two other uses of is_main_bin are in the MH_DYLIB branches, which this branch excludes, and the base address this branch computes -- 2**32 for a 64-bit PIC executable, whose segment vaddrs are relative to 0x100000000 -- is correct whether or not the object ends up being the main binary; Loader._map_object already places a non-main PIC object with a free linked_base at that address, and rebases it elsewhere when the address is taken. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5c0a030 to
0df1c17
Compare
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Problem
cle cannot load a Mach-O executable from a container. The failure occurs with
binaries/tests/x86_64/fauxware.macho.cart:Every CaRT-wrapped Mach-O executable reaches this assertion during construction.
Cause
A container registers itself as
loader._main_objectbefore it loads its children.The child is therefore constructed with
is_main_bin=False. The loader laterpromotes the child through
force_main_object. The assertion runs before thatpromotion.
Fix
This change removes the assertion. The guarded branch sets
linked_baseandmapped_baseto0x100000000. These values do not depend on the object beingthe main binary. A bare
assertalso disappears underpython -O, while cleuses
CLEErrorfor load failures.universal2.pyhas a workaround for the same assertion. Removing that workaroundchanges fat-binary placement, so it belongs in a separate change.
Validation: #780 (comment)
sync: angr/binaries#190