libkernel: AvailableDirectMemorySize reports first gap, Mprotect rejects host stack memory #3143
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 xXPBSXx on 2026-10-10T23:00:02Z.
AI-assisted (Claude Code), reviewed by the contributor.
Two small libkernel findings from running RE4 (PPSA07411) on Windows. Each has its own branch on current
main, a regression test incore/libs/tests/GuestMemory.cpp(both tests fail without the change, pass with it) and passestools/check_conventions.py.sceKernelAvailableDirectMemorySizereturned the first free gap in the range instead of the largest free block. The title got about 1.9 MiB reported and then failed a 96 MiB allocation. Branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/libkernel-available-direct-memory-largest-block (it now returns EAGAIN when nothing fits).sceKernelMprotecton committed private host memory outside the guest registry (a thread stack) threw instead of applying the native protection. Branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/libkernel-mprotect-host-memoryNot verified: that these two alone get RE4 further; other blockers remain. Not opened as PRs because intake is paused for new contributors; a maintainer is welcome to carry the commits.
Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T05:42:54Z.
Carried the first fix (
sceKernelAvailableDirectMemorySize,aace6a3f) as #3292 with your commit unchanged. On Windows 11 (GCC 15.2),guest_memorypasses 3/3 and fails at the first largest-block check withExport.cppreverted tomain. I didn't carry themprotectfix because #2982 (TheAggie) changes the same thread-stack protection path.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T07:13:09Z.
Evidence that the
sceKernelAvailableDirectMemorySizechange matters beyond RE4: Sifu (PPSA03001, #3209) faulted inRenderThread 1on a free-list head of0xFFFFFFFFFFFFFFFF; with this branch it runs on, and with only that file's change reverted it faults again at the same address (same build otherwise). Details in #3209.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:27:11Z.
Fixed in part by #3292:
sceKernelAvailableDirectMemorySizenow reports the largest free block, covered byguest_memory; thesceKernelMprotecton host thread stacks item is still open (see #2982).Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T08:21:37Z.
Thanks again @AchrafReyani for #3292. The other half of this issue,
sceKernelMprotecton committed host memory outside the guest registry (a thread stack), is not onmainyet. I rebased it onto currentmain(1be0a7ce): https://github.com/xXPBSXx/AnyPS5/tree/fix/libkernel-mprotect-host-memory-v2 (one commit, testCheckMprotectOfHostMemoryOutsideTheGuestRegistry,guest_memoryand the conventions check pass). Windows only, as before.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T23:33:11Z.
Both parts of this issue are on
main:sceKernelAvailableDirectMemorySizereports the largest free block (#3292, merged 2026-10-11, carried from this branch) andsceKernelMprotectsets the native protection of committed host memory outside the guest registry (#3788, merged 2026-10-11) with a Windows test (CheckMprotectOfHostMemoryOutsideTheGuestRegistry) and a test for the first part (CheckAvailableDirectMemoryIsLargestFreeBlock) inguest_memory. Closing.AI-assisted (Claude Code).