Repository navigation
Conversation
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS This evidence applies to head On the baseline, a load through At Master changed cle#835 changes the same PE code. A tree with both changes still has the same single short file out of 106. The separate coupling note gives the mapping details. An earlier paired census loaded 493 objects on each arm. The set contained 92 PE files from No mapped image became shorter. No object changed The change adds 72,615 zero bytes across 13 of the 493 loads. It adds no bytes to the other 480 loads. The largest increase is 38,511 bytes. The largest increase in
The branch was rebased from head
The two commit messages keep their original text so the rebase remains easy to compare. One message says "88 of the 92 by exactly one byte." That figure used |
|
Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_790 |
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS This change affects string recovery in angr. Zero-filling a PE section's unmapped tail makes angr/angr#6943 adds In The two PRs can therefore produce different recovered string sets. The result depends on their merge order. |
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS This output compares Before the change, the backend builds 0xa600 bytes for an object that declares 0xb000 bytes. The object does not back its last address or the uninitialized cle master (d2ecea0)After the change, the image covers the declared range. The with this change (6ae4329) |
6ae4329 to
d34beb5
Compare
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS The branch was rebased onto cle master The conflict was in The branch diff has the same added and removed lines before and after the rebase. |
d34beb5 to
9eab3c5
Compare
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS This corpus result uses a separate denominator from the PR evidence. The change fixes this load failure: The clamp in One affected object has a relocation at RVA Both arms use the same objects, matched by SHA-256. Each arm loads them with The collection contains 385 objects. On master, 375 objects load. This branch does not change the result class for any of those 375 objects. The five fixed objects are the only regression-related difference. Six other pull requests and the current master head fix 0 of the 5 objects. Those changes affect ELF, COFF, DWARF, or the The five objects are 1.30% of this 385-object collection. The Wilson 95% interval is 0.56–3.00%. A separate uniform sample contains 3,422 PE objects in a set of 11,989 objects. None of those PE objects hit this crash, so that sample gives a rate below 0.12% at 95%. All five affected objects are 32-bit x86 PE files between 620 and 660 KB. Each has one symbol and three relocations. The relocations are one The five samples cannot be shared. None is byte-identical to a fixture in the binaries repository. None of the 95 PE fixtures there has a relocation on the lost byte. No public sample reproduces this crash. session: sharpen |
Backend.max_addr is the last address an object covers, not one past it, so the mapped image spans max_addr - min_addr + 1 bytes. The backend clamped it to the difference alone and dropped the final byte of the last section. The clamp is not a rare path: _get_memory_mapped_image() builds from raw section data and pads between sections, so it usually runs past the last section's virtual end and the branch is taken. Every PE in angr/binaries ends up with part of its declared range unbacked, 88 of the 92 by exactly one byte. Clemory.load returns up to the length it is asked for, so a base relocation whose field ends on the missing byte reads short and IMAGE_REL_BASED_HIGHLOW raises struct.error out of Backend.relocate, through Loader, and out of Project: the binary does not load at all. Five PE objects in a corpus sweep failed this way, each one a .NET assembly whose single fixup patches the operand of the jmp [_CorExeMain] stub in a sixteen-byte final section. Loader already sizes an object as max_addr - min_addr + 1 and hands the next one the space above max_addr, so the byte was already this object's own. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A section is mapped over its whole virtual size, and the bytes past the raw data the file holds for it are zero. That padding is emitted ahead of the next section, so the last section of all has nothing to back its own, and the image ends at its raw data while max_addr covers its virtual size. A section the file cuts short is excluded: those bytes are unknown rather than zero, which is what PE.Preserve incomplete sections already decided.
9eab3c5 to
0015420
Compare
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS cle#835 changes This PR computes
All three arms have 0 load errors. The alternative formula is The two changes are independent. They can land in either order. session: sharpen |
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Problem
cle maps fewer bytes than a PE object declares. In
binaries/tests/i386/windows/rain32.upx,.rsrcdeclaresmemsize=0x1000overfilesize=0x600:Every PE loses the last byte of its image this way. A section also loses its tail when its virtual size exceeds its raw data. All 106 PEs tracked by
angr/binariesatfc07821cback fewer bytes than they declare.A base relocation can place its field in the missing range. The relocation then gets a short buffer.
IMAGE_REL_BASED_HIGHLOWraisesstruct.error, andLoaderrejects the object.Root cause
cle/backends/pe/pe.pyhas two separate range errors.Backend.max_addris the last covered address. It is not the first address after the object. The clamp usedself.max_addr - self.min_addr, so it removed the last byte of the declared range._get_memory_mapped_image()also stops at the last section's raw data. It emits the zero padding for a section before the next section. The last section gets no padding. Inrain32.upx,.rsrcis last, so its final 0xa00 bytes have no backing.Fix
The clamp now uses
max_addr - min_addr + 1. The image now gets zero padding through the highestvirtual address + Misc_VirtualSize. This padding applies only when the file contains all of the section's raw data.A section keeps an unbacked tail when its raw data extends beyond the file. Those bytes are unknown, so this change does not fill them with zeroes.
angr/angr#6943 treats an unbacked byte differently from a real zero byte. The merge order can therefore change the recovered string set. The first coupling note explains this interaction.
cle#835 changes the same PE code. The two changes are independent, and neither loses a byte. The second coupling note records that interaction.
session: sharpen