fix(libSceNKWebKit): validate guest pointers in WtfThreading exports #27949
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27949"
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 JJenkx on 2026-11-27T22:13:11Z.
What
Validate guest
WTF::Mutex*andWTF::ThreadCondition*pointers across all 13WtfThreadingexports (WTF::Mutexconstructors, destructors,lock,tryLock,unlock, andWTF::ThreadConditiondestructors,wait,timedWait,signal,broadcast) before accessing guest memory or forwarding tolibkernelpthread routines:std::invalid_argumentbehavior for null object pointers andNaNtimeouts.GuestArenaPrepareHostRead_nid_no_patch+GuestReadable_nid_no_patch), and guest writability under an activeGuestArena::HostWriteguard for mutating exports, callingNotImplementedAt_nid_no_patchon invalid or misaligned guest memory.WTF::Mutexhandles into a local slot and publish viaGuestCopyOut_nid_no_patch(destroying the handle if publication fails), and read handles viaGuestCopyIn_nid_no_patchforMutex::unlockand the mutex argument ofThreadCondition::wait/timedWait.core/libs/prx/libSceNKWebKit/tests/WtfThreading.cppand record the technical debt fragment indocs/dev/debt/changes/fix-libSceNKWebKit-wtf-threading-guest-pointers.md.Tested
/usr/local/bin/cmake --build /mnt/sas-ssd/AnyPS5-work/agy/build-spec --target nkwebkit_wtfthreading_tests):WtfThreading.cpp):ctest -R '^nkwebkit_wtfthreading$' --output-on-failurefailed (Subprocess aborted, 0/1 passed).75a638d38ba):ctest -R '^nkwebkit_wtfthreading$' --output-on-failurepassed (1/1,0.10 sec).python3 tools/guest_pointer_audit.py libSceNKWebKit: 0 hits inWtfThreading.cpp.python3 tools/check_conventions.py --base origin/main: All conventions checks passed.python3 tools/pr_overlap.py --branch fix/libSceNKWebKit-wtf-threading-guest-pointers: No overlap with open pull requests.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-27T22:16:10Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
75a638d38b:tools/check_conventions.pypassed.nkwebkit_wtfthreading_testsbuilt cleanly.nkwebkit_wtfthreading):core/libs/prx/libSceNKWebKit/src/WtfThreading.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T22:21:02Z.
Review: COMMENTED
Actionable comments posted: 1
1ae96231-e520-461d-b141-e23679b2aa4fReviewing files that changed from the base of the PR and between
b19e5a8a96and75a638d38b.core/libs/prx/libSceNKWebKit/src/WtfThreading.cppcore/libs/prx/libSceNKWebKit/tests/WtfThreading.cppdocs/dev/debt/changes/fix-libSceNKWebKit-wtf-threading-guest-pointers.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-27T22:32:16Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
6be3102013:tools/check_conventions.pypassed.nkwebkit_wtfthreading_testsbuilt cleanly.nkwebkit_wtfthreading):core/libs/prx/libSceNKWebKit/src/WtfThreading.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T22:35:52Z.
Review: COMMENTED
Actionable comments posted: 1
6231276d-8419-48cd-99b7-bd2d9133ce3aReviewing files that changed from the base of the PR and between
75a638d38band6be3102013.core/libs/prx/libSceNKWebKit/src/WtfThreading.cppcore/libs/prx/libSceNKWebKit/tests/WtfThreading.cppLimit details: You’ve used all 10 included reviews currently available.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-28T05:39:30Z.
Review: APPROVED
Checked head
6be3102013. All on Windows 11 with WinLibs GCC 15.2 (Release), applied tomain4c7578e0a4together with #27997, #27996, #27978, #27975, #27973, #27971, #27969, #27967, #27964, #27958, #27950, #27946, #27945, #27943, #27938, #27936.tools/check_conventions.py --headandtools/debt_fold.py --checkpassed and the full build succeeded.nkwebkit_wtfthreadingandjsc_wtf_threadingpass. In the full CPU suite (5,131 tests) the only failures are unrelated:windows_read_trap_unknownfails onmaintoo (fixed in #28028), andframe_capture_minimizeis a timeout under load that passes on its own.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T08:16:01Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the code and tests support merging based on the inspected evidence.
What I ran
No commands were run. I reviewed head
6be3102013d97dc642d481212cfaddeab1a3b734using the prepared diff and reader. Author-reported build, tests, and audits were not run by me.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the Linux build, regression tests, convention checks, or guest-pointer audit. Console behavior remains unverified as documented by the author. The review artifacts excluded no changed files; all three changed files were read, along with relevant guest-memory helpers and the ABI type definition.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T08:12:48Z.
Review: COMMENTED
The threading fixture passed its normal synchronization tests and rejected read-only or cross-page condition variables, plus misaligned and cross-page mutex pointers.
I ran the exact fixture and changed translation unit in a focused Linux build linked against the project’s guest libraries.
AI-assisted: yes.