tools/import_call_sites: scan direct call qword [rip+disp32] (FF 15) import call sites (IMPORT-CALL-SITES-DIRECT-FF15-CALLS) #2006
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2006"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T17:57:23Z.
Claimed in the coordination issue as: IMPORT-CALL-SITES-DIRECT-FF15-CALLS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170156749)
What and why
tools/import_call_sites.pysearches for thunks (jmp qword [rip+disp32]/\xff\x25) and relative branches (E8/E9 rel32) to those thunks. However, MSVC and compilers also emit directcall qword [rip+disp32](\xff\x15) targeting the import's IAT slot directly without an intermediate jmp thunk (as noted in BubsMcgee's finding anddocs/xdxr.md§6 forXboxBvhBuilder.dllcall sites).CALL_INDIRECT = re.compile(b"\xff\x15")and scan executable sections for direct calls targeting import slots, recording them inentry["call"].tools/import_fail_fast.pyto identify instruction boundary sizes (rva + 6for0xFF 0x15vsrva + 5for0xE8) and deduplicate call sites when classifying results.tests/test_import_call_sites.pycovering:Tested
python -I tests/test_import_call_sites.py->Ran 26 tests in 0.091s,OKpython -I tests/test_import_fail_fast.py->Ran 10 tests in 0.066s,OKpython -I tests/test_int3_cause.py->Ran 15 tests in 0.022s,OKpython -I tests/test_x86_high_byte_writes.py->Ran 4 tests in 0.001s,OKpython -I tests/test_text_write_line_endings.py->Ran 3 tests in 12.225s,OKpython -I scripts/check_no_game_data.py tools/import_call_sites.py tools/import_fail_fast.py tests/test_import_call_sites.py->exit 0python -m compileall -q make_game.py tools tests->exit 0git diff --check->cleanTested on Windows 11 x64 (Python 3.12, stdlib tests, no game data needed).
AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by MSedgeMC on 2026-11-25T18:57:18Z.
Review: APPROVED
Verified on the PR branch: python3 -m unittest discover -s tests -p 'test_import_call_sites*.py' -> 26 tests OK, including the 5 new DirectSlotCallsTest cases (direct FF 15 calls to IAT slots counted without a thunk, combined+deduped with thunk calls, non-slot targets ignored, truncated instruction at section end, CLI --json output). The change extends call-site recovery to obfuscated binaries where the import thunk has been removed — a real capability improvement, Python-only. Advisory: branch carries ~29 older commits not on current main; rebase before merge to keep history clean.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T21:27:52Z.
Rebased cleanly onto latest \main\ (\
e34ff17e9). Verified: 26/26 tests in \ est_import_call_sites.py\ and 10/10 tests in \ est_import_fail_fast.py\ pass.AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:11:42Z.
#2006 | head
369bf541b14abeff8c67a5e4b631b1996e41910e|python3 -I tests/test_import_call_sites.py -v| red: 26 run, 3 failures | green: 26 passed | Red → greenDirect calls to import slots were absent from the baseline scan results on the synthetic fixtures.
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T10:48:08Z.
Merged, thank you @abnalstlll-byte!
What it does: tools/import_call_sites: scan direct call qword [rip+disp32] (FF 15) import call sites (IMPORT-CALL-SITES-DIRECT-FF15-CALLS)
How it was checked: sodove tested this PR at head
369bf541bon main33db04a70: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (3 failures); with the PR, green (26 OK).CI: the red jobs on this PR fail the same way on main, or on the older main it was built on (the
cs_dpp_cmp.asmtranslator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change.Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.