Repository navigation
RT-5: int3_cause.py, the call whose result sends the retail executable to an int3, read statically - #8408
RT-5: int3_cause.py, the call whose result sends the retail executable to an int3, read statically#8408TreXito wants to merge 7 commits into
Conversation
…3, statically tools/int3_cause.py <image> <address>... finds every branch that reaches the int3 (also from other functions), reads its condition and follows the tested register back to the import, vtable slot or function whose result it holds. An int3 that ends a never-returning function is read at its call sites. Synthetic PE tests; docs/boot.md points to it from LEONIDA_SKIP_INT3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 8a314ee on Arch Linux, Python 3.14.10, CPU only: pass — first Linux check. new test_int3_cause 8/8 + import_call_sites 8/8 + gdk_runtime_calls 23/23 OK. Negative control: tool absent at base → import error (test is load-bearing on the new tool). No game files. AI-assisted. |
…lock entry by its one jump When the register a guard tests is one of the function's arguments (nothing wrote it since the start, through copies, lea r,[r2+disp] and added constants), each direct call site is read for what it passes, as a tally. A block after a return or jump is entered through the one jump reaching it. explain() now caps links after filtering them, so the not-followed count is right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
No addresses or output from the executable here. AI-assisted (Claude Code). |
…stores A load's pointer register is traced too (two levels). When the guard's value comes from a global, or a field of an object a global points to, each mov [rip+x], r / mov [rip+x], imm storing to that global is read for what it stores (a call's result, a constant). Most title asserts test such a global rather than a call's result directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…constants keep their value With --any the address may be any instruction: the guards are the branches that decide whether it runs, and callers are not followed. A traced constant now carries its value (mov r, imm in every width, xor r, r, mov r/m, imm). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
For each ret, list every value that can reach it (constant, call result, argument, global, stack slot) together with the branches that set it, so a bool-returning setup function reads as "0 when X fails, 1 when Y succeeds". Path walking is shared with trace() through step(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested b689ee5 (noting 8a314ee was superseded mid-verification) merged onto main 867d922 (tree bdf9ee275): tests/test_int3_cause.py Ran 14 OK, test_import_call_sites (helper source) Ran 8 OK, test_missing_input_exit_codes Ran 2 OK; missing image = one line + exit 2. On clean main the test file can't import (tool absent) — vacuity N/A by construction. Tests are synthetic-image only; the constants test uses a stub flow harness rather than patching the tool, which is the right call. Two nits: the missing-file line is "int3_cause.py: [Errno 2] ..." rather than the ERROR:-prefixed one-liner the BUILD-1046 family uses (the tool isn't in that suite's list yet — aligning would be cheap); CI so far is change-scope + no-game-data only. Overlap: docs/boot.md with #4227, mechanical. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Tested
|
|
Independent Windows / Python 3.14 check of On an offline Sandbox boot with #8379, #6582 and #8461, the analyzer identified the first guest breakpoint as a negative HRESULT guard on the public Only outcomes and public API/slot names are shared; analysis output and traces stay local. AI-assisted. |
rel32_sources and global_writers scanned every code byte on each call, and explain calls them at every level it follows (up to six scans per level). On a 100 MB .text that is about 2 s a scan, so a stop with many incoming jumps took minutes. Build two sorted indexes on first use (target, rva, kind packed in one integer) and bisect them instead. Results are the same matches in the same address order; a new test checks every target against a full scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested 745062c on Linux (CachyOS, Python 3.14): pass
Review of AI-assisted (Claude Code), run by a person; tests run in a sandbox without network. |
|
Checked Pass
Needs changes
AI-assisted: Codex GPT-6.2 Sol ran the checks, Claude Opus 5.5 reviewed the report. The retail executable (SHA-256 |
…arch recovers The search stops at a step and source limit, so "every path" overstated what it reads (review on ItsNotRexed#8408). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. At AI-assisted. |
Claimed in the coordination issue as: #8186 (comment)
What and why
Boot runs now report a title
int3as an address (LEONIDA_SKIP_ASSERTS,LEONIDA_SKIP_INT3, the fault log). Until now each one was disassembled by hand to find which call failed.tools/int3_cause.py <image> <address>...reads that from the file alone, with nothing run:int3,ud2orint 29h. An address one past anint3(Wine's breakpoint address) is taken as thatint3..pdatabounds) from which every path reaches the stop without a return.test,cmp,and,sub,bt, register or memory operand), for exampleeax < 0,al == 0,bit 5 of eax is set.lea r, [r2+disp]and added constants: an import (dll!Name), a vtable slot (withthisnoted when it came from a global), or a function of the image. A block after a return or jump is entered through the one jump that reaches it. When the register is one of the function's arguments, each direct call site is read for what it passes, as a tally. For a load, the pointer register is followed too. When the value comes from a global, or a field of an object a global points to, eachmov [rip+x], r/immto that global is read for what it stores.int3ends a function that never returns, its direct call sites are read the same way, up to 3 functions away.--anylets the address be any instruction, for example thexor eax, eaxof areturn 0path or a fallback's first instruction. The tool then names the branches that decide whether it runs, without following callers.--returnstakes a function and lists, for eachret, every value that can reach it (a constant, a call's result, an argument, a global or a stack slot) together with the branches on that path. A setup function that returns a bool then reads as "0 when this call fails, 1 when that one succeeds", which is where a caller'sint3on the result comes from.Call, jump and store sources come from two sorted indexes built once per image (about 3 s on the retail
.text), so following callers and globals several levels deep costs a bisect per target, not a scan of the code. It reusesgdk_runtime_calls' decoder and.pdatabounds andimport_call_sites.import_slots. Text by default,--jsonfor the same structure. Exit 0 when every address is a stop it could read, 1 when one isn't, 2 for an unreadable image. Standard library only.docs/boot.mdpoints to it from theLEONIDA_SKIP_INT3entry.Not seen: stops reached through a jump table or a function pointer, values passed through the stack, flags set by forms outside step 4 (the tool says so and names the instruction).
Tested
python -I tests/test_int3_cause.py: 15 tests OK, on a PE built byte by byte (test_import_call_sites.build_imageplus a.pdatadirectory). They cover an import result tested far from the stop, a vtable slot result copied to another register, a cold chunk reached byjnefrom another function, a never-returning handler read at its caller, a check that ends in a handler for some values of its argument (read at the check's call sites), a field of a returned object, a global tested for null (read at its two stores),--anyon a success path and on a function's first instruction, constants of every width,--returnson a function that returns 1 only when an import's result is not negative, the Wine +1 address, a virtual address, condition text forcmp/test/and/bt, text output and the exit codes. One more checks that the call, jump and store indexes find, for every target in the image, what a scan of every code byte finds, in the same order.test_import_call_sitesandtest_gdk_runtime_callsstill OK.int3stops in one device setup function to a call: device slots 48 (4), 9 (4), 73 (2) and 79,xmem.dll!XMemVirtualAlloc, and one in-image check (4). The device-lost handler was reported as never returning and was read at its one call site, the title's shared result check. There, the guard tests a value derived from argument 1, and the tool tallied what the check's 51 call sites pass: device slots 8, 41, 48, 133, 14, 32 and others,XGCreateTextureComputer,D3D12XboxCreateDeviceandD3D12SerializeVersionedRootSignature. After a one-time index build of about 3 s, well under a second per address.--returnson the same device setup function (theD3D12XboxCreateDevicecaller, 1ret): it returns a constant 0 whenRegisterClassExAreturns 0, whenCreateWindowExAreturns 0, when device slot 8 or slot 41 returns a negative value (slot 41 at four sites), and on several in-image checks. It returns 1 only when slot 41 succeeds. About 0.2 s.--returnson each and--anyon its first and middle instruction finish with no errors.--returnsfinished on all 998, over the paths its bounded static analysis recovers. The slowest--anytakes 2.1 s; before the indexes it took up to 22 s, and one run stalled for over half an hour. On the same functions, the output with the indexes is identical to the output without them: 300--returns/--anyreports and all 20int3stops, 337 s of scanning before against 0.1 s after.int3stops; counts only):AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code