Conversation
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Validation record for head
Corpus A/B, 1,557 PE objects, one process per object:
Reproduction without the corpus: $ dotnet new classlib -o readytorun --framework net9.0 && cd readytorun
$ dotnet publish -c Release -r linux-x64 --self-contained false -p:PublishReadyToRun=true
$ python -c 'import cle; cle.Loader("bin/Release/net9.0/linux-x64/publish/readytorun.dll")'Caveats: the corpus is a private dataset, so objects are named by machine type and count rather than by path; the fixture in angr/binaries#183 is built by exactly the recipe above with .NET SDK 9.0.316. Only the Linux override is exercised by real images here; the other five constants come from the .NET runtime's CI on this PR: all 20 checks are green at head Correction, 2026-09-03. An earlier version of this comment said that Rebased 2026-08-27. This record was measured at CI status, head
The repair belongs on the sibling. The population this closes (measured 2026-08-28)Private corpus; objects are cited by architecture, container format and sha256 only. This is the same defect the record above measures against a larger PE population, scored here against a different body of objects — the two do not share objects, so the counts are not comparable and neither supersedes the other.
99.0% of that population is a correct refusal, not a defect. ia64 (9,095), alpha (7,352), vax (5,589), sparc (612), sm83 (197), 65816 (70) and 32-bit s390 (2) have no definition in archinfo and no SLEIGH language in pypcode 4.0.1.dev0 to fall back to: of its 187 languages, The defects inside it are three small cle sub-populations, and this change closes the largest of them: all 124 cil objects. Every one is a PE32+ ReadyToRun image whose COFF The other two are 107 hppa Re-keyed 2026-09-04, after a rebase onto cle master Hosted CI at
Re-keyed 2026-09-04, after an amendment at the same base. The branch moved from That repairs the The figures above were measured on the previous head and still describe this one, because the two rewritten expressions are equivalent to the ones they replace on every input the field can hold. Hosted CI at
|
|
Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/cle_757 |
ecae05b to
eb57694
Compare
a6b36df to
b9496b5
Compare
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Loading the ReadyToRun assembly published for linux-x64, before and after this change. The fixture comes from the angr/binaries pull request linked from the description. the 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", "readytorun_linux_x64.dll")
obj = cle.Loader(path, auto_load_libs=False).main_object
print(f"loaded {os.path.basename(path)}: arch={obj.arch.name} os={obj.os} entry={obj.entry:#x}")Before — the operating system override in the COFF machine type makes architecture selection raise, so nothing loads: cle master at
|
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Rebased onto cle master The conflict was #800, which added The change itself did not move: comparing the branch's own diff before and after the rebase with context discarded gives a byte-identical set of added and removed lines. Validation at the new head: |
b9496b5 to
1b8dcae
Compare
1b8dcae to
26ad7c6
Compare
…system A .NET ReadyToRun assembly published for a target other than Windows could not be loaded at all: arch_from_id raised ArchNotFound for machine type 0xfd1d. The ReadyToRun compiler exclusive-ors the COFF machine type with a constant naming the target operating system so that the Windows loader refuses a file that is not for it, and 0xfd1d is IMAGE_FILE_MACHINE_AMD64 ^ 0x7b79. Recognise those constants, which the .NET runtime defines as IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE in src/coreclr/inc/pedecoder.h, when the raw machine type is unknown and the image really is ReadyToRun.
26ad7c6 to
304d3e5
Compare
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
Problem
A .NET ReadyToRun assembly published for a target other than Windows cannot be
loaded at all. On
binaries/tests/x86_64/readytorun_linux_x64.dll:The failure is at architecture selection, so nothing about the image is
recoverable: no sections, no symbols, no entry point.
Root cause
The backend takes the COFF machine type at face value:
The ReadyToRun compiler exclusive-ors that field with a constant naming the
target operating system, so that the Windows loader refuses a file that is not
for it.
0xfd1disIMAGE_FILE_MACHINE_AMD64 ^ 0x7b79, and0x7b79is thevalue the .NET runtime gives
IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDEfor Linux insrc/coreclr/inc/pedecoder.h.MACHINE_TYPE.getmisses,hex(0xfd1d)is not anarchitecture name, and
arch_from_idraises.Fix
machine_type_nameundoes the override before naming the architecture. It triesthe six documented constants only when the raw machine type is unknown and the
image really is ReadyToRun -- a managed assembly whose CLR header points at a
native header beginning with
RTR\0-- so a corruptMachinefield elsewherecannot be rescued by an exclusive-or that happens to land on a valid value.
osstays
"windows", because the file is still a PE.Testing
tests/test_pe.py::TestPEBackend::test_readytorun_machine_os_overridereads theMachinefield out of the file, asserts it is0x8664 ^ 0x7b79, then loads thefixture and asserts
arch.name == "AMD64"andis_dotnet; it raisesArchNotFoundon the merge base.#805 changes how a machine-type name becomes an
archinfo.Arch, at the same twocall sites this branch rewrites, so the two conflict in
cle/backends/pe/pe.pyand whichever merges second needs a rebase. The resolution is
arch_from_machine_type(machine_type_name(...))at both sites, with both helperfunctions kept. #805 can land first: it asserts the mapping rather than loading
a PE, so it needs no fixture, while this branch needs the one named in the
sync:line below.Fixes #751. Validation: #757 (comment)
sync: angr/binaries#183
session: sharpen