Commit Graph

8 Commits

Author SHA1 Message Date
53b77df14f Merge pull request #941 from TheGeogeo/fix/fail-fast-selectors
Reject unmatched --import/--dll selectors in import_fail_fast (FAIL-FAST-SELECTORS)
2026-11-29 02:22:23 +01:00
369bf541b1 tools/import_call_sites: scan direct call qword [rip+disp32] (FF 15) import call sites
Support direct import calls through call qword [rip+disp32] (\xff\x15)
in tools/import_call_sites.py alongside thunks (jmp qword [rip+disp32] / \xff\x25).
This enables discovering call sites in images where imports are called
directly without an intermediate jmp thunk (e.g. XboxBvhBuilder.dll calls).
Harden tools/import_fail_fast.py to identify instruction boundary sizes
(5 bytes for E8 vs 6 bytes for FF 15) when classifying call sites.
Add unit tests in tests/test_import_call_sites.py for direct slot call
detection, combined thunk/direct calls, non-slot skips, and CLI reports.

AI-assisted (Claude Code)
2026-11-26 00:27:21 +03:00
a8e334e377 Reject unmatched --import/--dll selectors in import_fail_fast 2026-11-25 20:33:34 +01:00
85825a26a7 Three tools from our PRs set errors='replace' on stdout
tools/f16misc_diff.py, tools/import_fail_fast.py and tools/vrel_diff.py came in with
our open PRs and were the only new entries test_tool_stdout_encoding reports on mangrove
over upstream main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 22:19:07 +00:00
5d17841407 import_fail_fast: the counts are heuristic, not a lower bound
Straight-line reading misses sites, and a stray call byte pair can add a false one, so the count can be off in
both directions (review on #7010).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 21:36:00 +00:00
14dc0b8e72 import_fail_fast: the summary line says how many imports are named, not only how many are called
On the 1.0.2.1 image it now reads "515 of 587 import(s) called directly, ...": the 72 imports with no direct call
site were the first question a tester asked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:25:21 +00:00
0e1582826f import_fail_fast: say that --json lists imports with no call site too
Reported on #7010: on the retail image the JSON has 587 entries while the
table line says 515 imports called. Both are right; the docstring now says
the JSON keeps calls == 0 entries and the line counts only calls > 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:30:13 +00:00
c6f15b1628 RT-5: import_fail_fast.py lists where the retail executable stops itself on an import's result
From the file alone, per import: the call sites that test the returned value and branch to int3, ud2,
int 29h or a call that does not return, with the value that takes that side. Call sites come from
import_call_sites.py's thunk calls plus `call [rip+slot]` for the api-ms-win-* imports; the result is
tracked through mov/movzx/movsx copies and cdqe, and each side is followed through up to two jumps.

On the retail 1.0.2.1 executable: 515 imports called, 27 with a fatal result check, 78 sites.
docs/exe_fail_fast.md groups them by how main binds each import: XMemVirtualAlloc stops on NULL at 14
of its 23 sites, and the unbound xmem physical-page imports stop on the default return of 0 at 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 15:41:05 +00:00