fix(libkernel): return EFAULT from cpuset and pthread affinity for invalid memory #13908
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13908"
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 DeveshB-1 on 2026-10-31T12:27:21Z.
What
Safely copy in and copy out CPU affinity masks using
GuestCopyIn_nid_no_patchandGuestCopyOut_nid_no_patchincpuset_getaffinity,cpuset_setaffinity,pthread_getaffinity_np, andpthread_setaffinity_np, returningEFAULTwhen the caller provides invalid or unmapped memory pointers.Tested
Linux (Ubuntu 24.04, x86_64). Added negative control assertions passing unmapped pointer stores (
0x10) toGuestAvailableCpumask.cpp. Verified that the unpatched base crashed withSIGSEGVand that the change cleanly returnsEFAULT/ setserrnotoEFAULT(14). Verifiedguest_available_cpumaskpasses cleanly across repeated test runs. Ranpython3 tools/check_conventions.py --base origin/mainandpython3 tools/pr_overlap.py --branch fix/cpuset-affinity-efault(no overlap).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 MarcZX10 on 2026-10-31T12:32:15Z.
Review: APPROVED
Reviewed — looks good
The exact head
64ff517803b7017e2116c7348f46713d4c8bb9e7safely copies affinity masks through the guest-memory helpers and reportsEFAULTfor invalid pointers.I reviewed it against base
60bdb061356db736928eee431cd8bd4c9ba68036. The no-build precheck passed diff, conventions, and mergeability; its ABI/test-quality helper scripts were unavailable in the isolated PR checkout. The separate ABI audit passed with no findings. The author reports repeated focused Linux tests and a negative control; hosted Windows was still running and Linux was skipped in CI. I did not run a local C++ build or test binary.