fix(libkernel): report reserved virtual ranges in sceKernelVirtualQuery #700
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/700"
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 merwie on 2026-10-05T16:56:21Z.
What
sceKernelReserveVirtualRangeregisters its range as not readable, andsceKernelVirtualQueryonly searches readable registrations (GuestAllocationsAcquire). A query inside a reservation therefore fell through to the host query and returnedSCE_KERNEL_ERROR_EACCES.DirectMemory.cppfromDoReserveVirtual(including the fixed re-reserve over a mapping) untilDoMapDirect,DoMapAnonorDoMunmapcovers them.sceKernelVirtualQueryanswers an address inside a reservation first: success, extent of the reserved piece, protection 0,is_committed,is_directandis_flexibleclear.GuestMemory: newCheckReservedRangeIsNotCommitted(a reservation queries as uncommitted; after a fixed direct mapping of its first page, that page is committed and direct and the second page is still a reserved piece).CheckFixedVirtualReservationexpected the query on a range re-reserved over a mapping to fail; it now expects the reserved, uncommitted answer.PPSA12544 (Hollow Knight: Silksong) reserves 1 MiB, queries it, and maps direct memory into it only when the query reports it uncommitted. The error was handled as a failed commit and the allocator then wrote to the inaccessible range (access violation at
reserve + 0xfffe0).Tested
Windows 11, WinLibs GCC 15.2.0 r7, Ryzen 7 9800X3D, Radeon RX 9070 XT.
ctest: 286/288 passed, includingguest_memory.agc_driver_lds_atomics64andagc_driver_vopc_compare_tablefail on this machine onmainas well (Vulkan device tests).remap fixed 0x210000000+0x100000) and continues until the unknown libkernel exportNH6xARDOVv8throws. Without this change it crashes in the allocator.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code