Place rebased objects in the free space, not one granule at a time - #735
Conversation
_find_safe_rebase_addr only ever stepped forward from the main object's max_addr, rounding each object up to the rebase granularity, so it ran out of room with the address space nearly empty. A two-segment i386 image whose segments sit 4 GB apart has nowhere to put the extern object, and a static archive is capped at one member per granule regardless of member size. The fallback meant to cover this read segments.raw_list, which is in program-header order rather than address order, so it computed negative gaps and missed the free space; when the headers did happen to be sorted it returned an address inside the main object's span, where the object is unreachable through Loader.memory, since the main object is a single backer covering that whole span. Enumerate the free space between the loaded objects instead, and retry at finer alignments before declaring the space full. Placement is unchanged for every image that fits at the configured granularity. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Validation record for head
Placement is identical to the baseline on every image that already loaded. Each sweep records
That includes Beyond the synthesized regressions, a 5000-member Caveats: an object still cannot be placed inside another object's |
|
Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_735 |
|
Finally! I'm moving the test binary to the |
The 16-bit test passed rebase_granularity=0x100 because cle aligned a rebased object up to the default 1 MiB granularity, which lands past the end of a 16-bit address space, so placing the extern object raised "Ran out of room in address space". angr/cle#735 now searches the free space with an alignment ladder that falls back to 0x1000 and then to a single byte when the granularity does not fit, so the default works and the argument only obscures what the test is about. angr resolves cle from master, which carries that fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The 16-bit test passed rebase_granularity=0x100 because cle aligned a rebased object up to the default 1 MiB granularity, which lands past the end of a 16-bit address space, so placing the extern object raised "Ran out of room in address space". angr/cle#735 now searches the free space with an alignment ladder that falls back to 0x1000 and then to a single byte when the granularity does not fit, so the default works and the argument only obscures what the test is about. angr resolves cle from master, which carries that fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The 16-bit test passed rebase_granularity=0x100 because cle aligned a rebased object up to the default 1 MiB granularity, which lands past the end of a 16-bit address space, so placing the extern object raised "Ran out of room in address space". angr/cle#735 now searches the free space with an alignment ladder that falls back to 0x1000 and then to a single byte when the granularity does not fit, so the default works and the argument only obscures what the test is about. angr resolves cle from master, which carries that fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The 16-bit test passed rebase_granularity=0x100 because cle aligned a rebased object up to the default 1 MiB granularity, which lands past the end of a 16-bit address space, so placing the extern object raised "Ran out of room in address space". angr/cle#735 now searches the free space with an alignment ladder that falls back to 0x1000 and then to a single byte when the granularity does not fit, so the default works and the argument only obscures what the test is about. angr resolves cle from master, which carries that fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Loader._find_safe_rebase_addrsteps upward from the main object'smax_addrone rebase granule at a time, so it raisesCLEOperationError("Ran out of room in address space")with the address space nearly empty: an i386 firmware image with twoPT_LOADs 4 GB apart has nowhere to put the extern object, and a static archive is capped at one member per granule however small the members are.The fallback meant to cover that reads
segments.raw_list, which is in program-header order rather than address order, so it computes a negative gap, or returns an address inside the main object's span, whereLoader.memorycannot read it.This enumerates the free space between the loaded objects and retries at finer alignments before giving up. Placement is unchanged for images that fit at the configured granularity, and the regression test synthesizes its own input, so there is no new fixture.
Validation: #735 (comment).