fix(libSceSaveData): hold a host write over save memory reads into guest buffers #12444
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12444"
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?
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-10-28T13:42:41Z.
What
sceSaveDataGetSaveDataMemory2reads the requested range of the save memory file withstd::ifstream::readstraight intodata->buf, with noGuestArena::HostWriteover it. A read larger than the stream buffer reachesReadFiledirectly, so the kernel writes into guest memory. CONVENTIONS requires aHostWriteover such a write.On Windows, when
data->bufis in a shared view whose pages the write watch left read-only, the read fails. The call then returnsSAVE_DATA_ERROR_INTERNAL(0x809F000B) and the save data is not read.This PR opens a
HostWriteoverbuf/buf_sizebefore the read. A destination the guest mapped read-only throws, since the console's result for that case is not known.Tested
Windows 11, WinLibs GCC 15.2.0 (Release):
savedata_memory_host_write(Windows only, modelled onguest_socket_host_write):Export.cppfrommain(same test): fails 3/3 atread save memory into watched memory; the call returns0x809F000B.ctest -R savedata: 14/14 pass.python tools/check_conventions.py --base upstream/main: passed.python tools/pr_overlap.py --branch fix/savedata-memory-host-write --base main:core/libs/CMakeLists.txt, except #11720, which changessceSaveDataCancelin the sameExport.cpp, not this function.python tools/progress.py --compare: unchanged.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T13:50:26Z.
Review: COMMENTED
I reviewed the exact head
ff2e92939f. The newHostWritespans the validated save-memory destination beforeifstream::read, and the Windows-only regression covers a write-watched buffer across page boundaries, byte/guard preservation, dirty-page reporting, and rejection of a read-only destination. I found no issue in the changed path. I could not execute this Windows-specific test in the current Linux environment; the author reports the focused regression andsavedatasuite passing, while hosted CI was still queued at my last check.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T14:09:04Z.
Review: APPROVED
Approved at exact head
ff2e92939f. I reviewed the save-memory read path and the Windows-specific regression. TheHostWriteguard covers the validated guest destination beforeifstream::read; the test checks a watched buffer spanning page boundaries, preserved surrounding bytes, dirty-page reporting, and refusal of a read-only destination. The PR reports the focused regression and savedata suite passing on Windows, and the hosted Windows, conventions, eligibility, intake, labels, and report checks now pass. I could not run the Windows-only test locally on this Linux host.