Commit Graph
3 Commits
Author SHA1 Message Date
SamandClaude Opus 5.5 928a11bf2a fix(libkernel): keep the Windows APR read staging buffer off the stack
Windows APR reads are staged through a 64 KiB std::array on the stack of
the thread that submits them (f7953ecac). Titles submit reads from fibers
whose stacks they allocate themselves, which can be smaller than that and
have no guard page, so the array runs past the bottom of the fiber stack
and the file data lands on whatever lies below it. Demon's Souls
(PPSA01341) then crashes in scePthreadMutexLock about half a second after
start, on a mutex that holds bytes of playgo-chunkdefs.xml.

The staging buffer is now allocated for each read, at most 64 KiB. The
new guest_apr_read_stack test reads on a thread with a 64 KiB stack; with
the stack array it ends in a stack overflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:03:55 +01:00
Werner 8bd8c1c338 test(libkernel): read through APR while 600 guest streams are open 2026-10-19 10:32:45 +02:00
Izamaru f7953ecac3 fix(libkernel): stage Windows APR reads through host memory
Copy bounded host reads into the destination in user mode so demand-committed pages can be handled by the process. Preserve short-read validation, zero-fill at EOF and HostWrite protection checks. Add synthetic read and Windows page-fault regressions. AI-assisted: yes.
2026-10-19 02:52:01 +02:00