startup-tools: the launcher drops concurrent hits on a hooked function #1281
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#1281
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@triggered02 on GitHub · 2026-11-24 06:38 UTC · original
Problem
The startup launcher's function-entry hooks are one patched byte per function. When two threads enter
the same hooked function at the same time, one of them runs through the window where the original
byte is restored for a single-step, so that call is never traced. Any behaviour that depends on the
hook — file tracing, the offline socket deny, and the
-MapDriverewrite — silently misses thosecalls.
Measured
Source-built consumer with two threads calling
NtCreateFile32 times each through a mapped letter(so every call must be rewritten to succeed), run under
tools/startup/debug_launch.py, Windows 11build 26200:
--map-drive Z=<folder>The first row matters: without any rewrite the same two-thread pattern is 64/64, so the loss is not in
the consumer, the file system, or general tracing — it is the entry hook dropping concurrent hits on
the same function. The second row is a direct count of
NtCreateFileentry traces versus the 64 callsthe consumer made.
Why it matters beyond
-MapDrivethe run was supposed to refuse.
files.txtunder-reports opens during multi-threaded loading.I have not measured how often the title enters the same hooked function concurrently, so the practical
rate for a startup run is unknown.
Possible directions
int3byte,so concurrent entries are each trapped.
them for the step or single-step the faulting thread with the byte still in place and emulate the
original instruction.
Done when
Two threads calling the same hooked function get the same treatment as one (the overlap control in
startup_map_drive_overlapbecomes a normal pass), or the launcher reports that it dropped hits soruns can be interpreted.
Context:
docs/startup-runtime.md(#1135). Do not attach game files, dumps or logs that containaddresses or names from an executable; describe results in terms of the component tested.
AI-assisted (Claude Code).
@tedin7 on GitHub · 2026-11-24 10:40 UTC · original
Working on this (AI-assisted). Plan: hold every other thread while one steps over a hook byte, defer a hit that trapped before the hold, give each window a deadline and always report how many windows were unprotected. Python parts are checked on Linux; the two-thread run needs Windows.
@SimSalabimse on GitHub · 2026-11-24 10:45 UTC · original
@tedin7 Happy to run the two-thread test on Windows once there's a PR. I have Windows 11 (26200) with MSVC 19.42 and an RTX 4070 Ti. Ping me and I'll post the results.
@tedin7 on GitHub · 2026-11-24 11:02 UTC · original
@SimSalabimse #1408 is ready for review at
3cfa1726— passes 3/3 Debug & Release on our Windows Server 2025 box (ctest --preset release -R '^(startup_launch|startup_hook_window|startup_hook_overlap)$' -V). Would appreciate a sanity-check on Windows 11 26200 / MSVC 19.42 whenever you have a moment!