fix(libkernel): return EINVAL for null mutexattr output pointers #11085
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11085"
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-25T17:19:18Z.
What
Align pthread_mutexattr_getprotocol, pthread_mutexattr_getprioceiling, pthread_mutexattr_gettype, and pthread_mutexattr_getpshared in core/libs/prx/libkernel/Pthread/Posix/Mutex.cpp:
Tested
python tools/check_conventions.py --base upstream/main --head HEAD(0 findings) andpython core/libs/tests/test_public_headers.py --audit-only(passed).guest_pthread_mutexattrpasses 3/3; baseline from main aborts with null type check).Checklist
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T17:21:08Z.
Review: CHANGES_REQUESTED
The new
GuestPthreadMutexattr.cppassertions are the relevant functional tests, but theTestedsection lists only the conventions check andtest_public_headers.py --audit-only; that audit does not run the mutex-attribute test binary. The hosted feature test jobs are also skipped. Please run and report the focusedGuestPthreadMutexattrtest (OS/toolchain and exact command), or state clearly that it was not run before opening the PR. I found no separate behavioral issue in the null-check ordering on this static pass.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-27T01:47:58Z.
Review: CHANGES_REQUESTED
Thanks for the update. Findings:
core/libs/prx/libkernel/Pthread/Posix/Mutex.cpp:118,139,152,163: the null output pointer now returnsEINVAL, but no source says that is the result. FreeBSD 11.4thr_mutexattr.cchecks onlyattr/*attrand then writes through the pointer, so a null output faults there; no console measurement showsEINVALeither. An unknown result must throw (asmaindoes), not return a made-up error. Please drop the behaviour change, or add a measurement of the console returningEINVALand cite it.docs/dev/debt/libkernel.md:10: the new entry says the null-outputEINVALis "as in FreeBSD 11.4 libthr", which is false for that case. It also duplicates the existingpthread_mutexattr_setprotocol, ...entry at line 8 instead of amending it. If a choice is kept, say it is a choice and edit the existing entry.pthread_mutexattr_gettypeguard; rebase after it lands and keep both checks.Feel free to push again once these are addressed.
Pull request closed