startup: with X2W_HOST_CPU=1 a second thread faulting on a site just rewritten stops the run #2196

Closed
opened 2026-11-27 00:04:47 +00:00 by github-bot · 0 comments
Owner

@⁠lukaslw-lab on GitHub · 2026-11-25 04:00 UTC · original

AI-assisted (Claude Code). With X2W_HOST_CPU=1, debug_launch.py rewrites a missing instruction on its first fault. When two threads run the same site at about the same time, the second thread's fault arrives after the rewrite. The site already holds the replacement, so rewrite_for_host finds nothing to rewrite. The fault is not handled, and the run stops at a second-chance illegal instruction.

Seen in a startup run (Windows 10, i7-4790K, which has no SSE4a). events.txt, title module and address replaced:

192.061 host-cpu insertq at <title>+<site> rewritten
192.067 exception 0xc000001d illegal instruction at <title>+<site> first-chance params=[]
192.070 exception 0xc000001d illegal instruction at <title>+<site> second-chance params=[]
  • The bytes at the stop are the replacement jmp to the stub, not the original instruction.
  • The same site was rewritten without trouble in another run (one thread).
  • Reproducible with the source-built probe: eight threads reach RDPID sites together on a host without RDPID. 3 of 3 runs stopped at the first site.

Related, but a different mechanism: #1281 (threads entering a hooked function while its byte is stepped over).

**@⁠lukaslw-lab** on GitHub · 2026-11-25 04:00 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2196) _AI-assisted (Claude Code)._ With `X2W_HOST_CPU=1`, `debug_launch.py` rewrites a missing instruction on its first fault. When two threads run the same site at about the same time, the second thread's fault arrives after the rewrite. The site already holds the replacement, so `rewrite_for_host` finds nothing to rewrite. The fault is not handled, and the run stops at a second-chance illegal instruction. Seen in a startup run (Windows 10, i7-4790K, which has no SSE4a). `events.txt`, title module and address replaced: ``` 192.061 host-cpu insertq at <title>+<site> rewritten 192.067 exception 0xc000001d illegal instruction at <title>+<site> first-chance params=[] 192.070 exception 0xc000001d illegal instruction at <title>+<site> second-chance params=[] ``` - The bytes at the stop are the replacement `jmp` to the stub, not the original instruction. - The same site was rewritten without trouble in another run (one thread). - Reproducible with the source-built probe: eight threads reach RDPID sites together on a host without RDPID. 3 of 3 runs stopped at the first site. Related, but a different mechanism: #1281 (threads entering a hooked function while its byte is stepped over).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:04:47 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#2196
No description provided.