fix(libkernel): enforce FreeBSD 11.4 error precedence and vector copyout in mincore #12854
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12854"
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 slopgobblercobbler on 2026-10-29T12:51:06Z.
What
core/libs/prx/libkernel/DirectMemory/PosixMemory.cpp, validate that the rounded address range insys_mincoredoes not exceedGuestUserAddressEnd(0x800000000000) or wrap around (end < first).ENOMEM(12) before testing vector writability (EFAULT), and length 0 over a mapped page succeeds without dereferencing or copying out to the vector.std::fill_n(vec + ...)) with chunked stack buffering and safeGuestCopyOut_nid_no_patch, returningEFAULTwhenvecpoints to unmapped or unwritable guest memory without triggering host memory access violations.docs/dev/debt/libkernel.mdthat the range is checked in full before any write, and a vector that faults partway gets no bytes.Tested
core/libs/tests/GuestMemory.cppcovering unwritable non-null vectors (reinterpret_cast<char*>(0x10)), zero-length invocations,GuestUserAddressEndbounds violations, and unmapped page precedence over vector validity.guest_memorypasses 3/3, 7/7 memory tests pass (guest_memory*,guest_mmap_executable,guest_mmap_fixed_anonymous,guest_mprotect_unmapped); negative control withPosixMemory.cppfrommainconfirmed segfaulting 3/3 in unwritable vector test.python tools/check_conventions.py --base upstream/main --head HEADpassed with 0 findings.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)Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-30T14:00:00Z.
Review: COMMENTED
First Linux run of this head (the body and the thread have Windows only).
Ubuntu 26.04, i7-8700, GCC 15.2, Release,
BUILD_TESTING=ON. Headc51719a97fmerged (--no-commit) onto currentmainf91137142e; the merge is clean.guest_memory: passes 3/3.guest_memory*,guest_mmap_executable,guest_mmap_fixed_anonymous,guest_mprotect_unmapped: 7/7 pass.public_headers: passes.PosixMemory.cppfrommainand this PR's test kept,guest_memorysegfaults 3/3 (the write through the unwritable vector).Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.