Repository navigation
Diagnostics: the return-address scan reads call bytes only from readable code - #48
Conversation
|
hey, thanks for this! main picked up a fix for the same crash last night (98d9727). it queries the page of the 6 call bytes on every scan, so this conflicts in ReturnAddresses now. i'd rather not cache the ranges per image though. pages inside an image can get decommitted later, and then the cache says readable when it isn't, which is the exact fault we're dodging. the part of yours i really like is requiring a readable execute protection. main's IsReadable lets PAGE_EXECUTE through, and we do map execute-only sections that way. could you rebase and turn this into just that mask inside CallBytesReadable (no cache)? maybe also reuse Win32Constants for commit/guard and add a named const for 0x80. happy to merge that |
…ble code A page inside an image's range can be execute-only (the loader maps sections that way), and reading its call bytes faults like an uncommitted page. CallBytesReadable now also requires PAGE_EXECUTE_READ, _READWRITE or _WRITECOPY (GameHangWatch.IsReadable takes the accepted protections); the page is queried on every scan, no cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f5b1d81 to
a122adc
Compare
|
Done: rebased on 98d9727 and reduced to the readable-code mask inside |
|
In game: without this fix, a run crashed the .NET host with an AccessViolation in the return-address scan, which read an unmapped page of an image. With it, the next run went on to about 375 s, where the hang watch could name the stalled job (fixed by #49). Since then, runs reach the opening cinematic and last the full 600 s. |
|
thanks for turning this around so fast! rebased onto 98d9727 and keeping the readable-execute mask inside CallBytesReadable is exactly what i was after, the rest of IsReadable stays the same. nice touch naming 0x80 in Win32Constants and making the test a theory over the page protections, that covers the execute-only case nicely. merged 👍 |
Rebased on main's fix (98d9727) and reduced to the protection mask, as asked:
CallBytesReadablerequires the call bytes' page to be committed readable code:PAGE_EXECUTE_READ,PAGE_EXECUTE_READWRITEorPAGE_EXECUTE_WRITECOPY.PAGE_EXECUTEalone is refused, since execute-only sections fault on read.GameHangWatch.IsReadabletakes an optional mask of accepted protections.Win32ConstantsgainsPageExecuteWriteCopy(0x80).Tests:
WaitObjectsTests12/12.docs/debugging.mdupdated.🤖 Generated with Claude Code