test(libkernel): audit virtual memory management (madvise, mprotect) bounds and page alignment limits #20978
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20978"
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-11-15T18:56:34Z.
What
Fold new virtual memory management edge cases into
core/libs/tests/GuestMemory.cppper maintainer feedback:mprotectwithSIZE_MAXlength returning -1 withEINVALmprotectreturning -1 withEINVAL0x8000and0x10000masked and preservedsceKernelMprotectwith length 0 returning 0madvisewith advice 100 returning -1 withEINVALTested
python tools/check_conventions.py --base upstream/main: 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 PrivacyOnion on 2026-11-16T01:29:49Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
d23d59ad41:tools/check_conventions.pypassed;git diff --checkclean.guest_kernel_virtual_memory_bounds_testsbuilt cleanly.guest_kernel_virtual_memory_bounds):Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T18:14:30Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
3a215f44ec:tools/check_conventions.pypassed.guest_kernel_virtual_memory_bounds_testsbuilt cleanly.guest_kernel_virtual_memory_bounds):Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T20:41:37Z.
Review: COMMENTED
Reviewed — no blocking findings
The change adds a standalone virtual memory bounds test and its CTest registration; I found no verified blocking defect in the code read.
What I ran
Inspected the prepared diff and changed source at head
57cd45d5336f8c2f06b024578e303ee941b1cc5fusingrepo_read.py. No test command was run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The author reports running
ctest --test-dir build -R guest_kernel_virtual_memory_bounds_tests; I did not run it. No repository files were excluded by the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T01:42:34Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the added assertions match the current implementations for zero-length protection, overflow validation, ignored protection bits, and invalid advice values.
What I ran
Reviewed head
117f2a2832586554d1cbaabe81bcb8b8f195884d. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The test executable was not run. Reviewed
core/libs/tests/GuestMemory.cppand the relevant implementations incore/libs/prx/libkernel/DirectMemory/PosixMemory.cppandcore/libs/prx/libkernel/DirectMemory/Export.cpp. No changed files were excluded;files.jsonwas not available through the review reader.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T17:26:33Z.
Review: COMMENTED
The undefined-bit cases call both APIs with read/write protection just after the fixture has already restored read/write protection. Their return-code and writable assertions would also pass if either call ignored the whole request. Can each check start from a different protection and verify the resulting permissions immediately after the call? That would show that the known bits still take effect when the unknown bit is present.
This finding is from source inspection. I confirmed the branch conflicts in
GuestMemory.cppagainstmainat9fcd37e4ea, which already has aSIZE_MAXprotection-length check.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.