Cover object placement in an address space narrower than a granule - #717
Cover object placement in an address space narrower than a granule#717zardus wants to merge 1 commit into
Conversation
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Validation record for head Rebase: the conflict was in
Caveats: the tests need Corpus measurement of the open queue, 2026-08-15The open pull-request queue was scored against 733 objects drawn from a sweep's own failing units (35 error classes, 49 architectures, 16 containers), with each repository's current master as the baseline rather than the revisions the sweep pinned. Each object is loaded with Four of the narrow-p-code-architecture changes form a chain. Applied alone, each one clears part of its own class and leaves the rest of it standing on the next change's defect:
Applied together — angr#6793 + cle#721 + cle#717 + archinfo#363 — the One qualification about cle#717, which is included in the combination above: since its rebase onto cle#735 it carries no production change, only regression coverage, so nothing in the movement here is attributable to it. It guards the placement rule the other three depend on rather than supplying it. Recorded here because this PR is part of the combination that was measured, not because the measurement credits it with anything: as the description says, the production change it was opened for landed as cle#735, and what is left is the guard for that ladder's one-byte step. Nothing else in the queue covers it. |
|
Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_717 |
A 16-bit p-code architecture has an address space of 64 KiB, smaller than the default 1 MiB rebase granularity. Placing an object by aligning up to the granularity therefore jumped past the end of memory, and loading a z80 blob failed with "Ran out of room in address space" as soon as the extern object needed an address. Searching the free space instead, and treating the granularity as a preference that gives way to a finer alignment, already fixes this, but nothing in the suite loads an architecture narrower than 32 bits, so the rule that makes it work is unguarded. Load a z80 blob and check that the extern object lands inside the address space and is reachable, then fill that space with more objects than it has granules. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
8a792e9 to
27f641b
Compare
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
This PR no longer changes
cle/loader.py. #735 fixed the bug it was opened for; only the coverage is left.A 16-bit p-code architecture has a 64 KiB address space, smaller than the default 1 MiB rebase granularity, so
Loader._find_safe_rebase_addraligned the extern object past the end of memory and loading a z80 blob failed withRan out of room in address space. The original fix here was to use a one-byte alignment below 32 bits.#735 has since landed and fixes that generally: placement searches the free space, and the granularity gives way to
0x1000and then to one byte when a gap is too tight for it. A narrow address space is just the extreme case of the gap that PR is about, so its ladder already covers this one and the one-byte special case forarch.bits < 32would only change which working address gets picked. It is dropped rather than rebased.What is missing is a guard. Nothing in the suite loads an architecture narrower than 32 bits, and every test #735 added still passes when the one-byte step is removed from the ladder, so the step that makes narrow architectures work is untested. Two tests in
tests/test_rebase.pycover it:test_address_space_narrower_than_the_granularityloads a z80 blob and checks that the extern object lands behind it, inside the address space, and is readable throughLoader.memory. This is the original reproducer.test_narrow_address_space_holds_more_objects_than_granulesthen loads 24 more objects into the same 64 KiB, which is fewer than one granule wide. It fails withRan out of room in address spaceif the ladder stops at0x1000.Validation: #717 (comment)
Related: angr/archinfo#363, angr/angr#6793. angr/angr#6793 passes
rebase_granularity=0x100to load a 16-bit shellcode; with #735 in place the default granularity works, so that workaround can go.