fix(libSceNKWebKit): validate guest pointers in JscObject exports #27975
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27975"
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-27T23:55:42Z.
What
Validate guest memory reads and writes across
JscObjectexports incore/libs/prx/libSceNKWebKit/src/JscObject.cpp:JSClassDefinition,className,staticValues/staticFunctionsarrays and name strings, and guardparentClassrefcount updates inJSClassCreate(using a scopedOpaqueJSClassdeleter so failed mid-copy guest reads leak nothing).OpaqueJSClass::~OpaqueJSClass(D1Ev/D2Ev) with activeGuestArena::HostWrite+ readability/writability checks.parameterNamesreadability before allocating host snapshots inJSObjectMakeFunction, and validate guestargumentsreadability before allocating argument vectors inJSObjectMakeArray,JSObjectMakeDate,JSObjectMakeError,JSObjectMakeRegExp,JSObjectCallAsFunction, andJSObjectCallAsConstructor.resolveandrejectoutput pointers with activeGuestArena::HostWritescopes before callingJS_NewPromiseCapabilityand write them viaGuestCopyOut_nid_no_patchinJSObjectMakeDeferredPromise.JSValueRef* exceptionoutput writes acrossJscObject.cpp(includingJSObjectMakeTypedArrayWithBytesNoCopy) through activeGuestArena::HostWrite+GuestWritable_nid_no_patch+GuestCopyOut_nid_no_patch.TestGuestPointers) incore/libs/prx/libSceNKWebKit/tests/JscMakeObjects.cppand record the unmeasured console fault behavior indocs/dev/debt/changes/fix-libSceNKWebKit-jsc-object-guest-pointers.md.Tested
TestGuestPointerstests inJscMakeObjects.cppagainst unmodifiedJscObject.cpp):nkwebkit_jscmakeobjectsfailed with***Exception: SegFault(0/1 passed).nkwebkit_jsc,nkwebkit_jscclasscallbacks,nkwebkit_jscclassprototype,nkwebkit_jscconstructor,nkwebkit_jscfinalize,nkwebkit_jscglobalclassrelease,nkwebkit_jscmakeobjects,nkwebkit_jscobjectextensibility);ctestpassed (8/8,0.23 sec).python3 tools/guest_pointer_audit.py libSceNKWebKitreports 0 direct guest pointer accesses insrc/JscObject.cpp.python3 tools/check_conventions.py --base origin/mainpassed.python3 tools/pr_overlap.py --branch fix/libSceNKWebKit-jsc-object-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-27T23:56:53Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a934c5159c:tools/check_conventions.pypassed.nkwebkit_jscmakeobjects_testsbuilt cleanly.nkwebkit_jscmakeobjects):core/libs/prx/libSceNKWebKit/src/JscObject.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 Plyxen on 2026-11-28T05:39:09Z.
Review: APPROVED
Checked head
a934c5159c. All on Windows 11 with WinLibs GCC 15.2 (Release), applied tomain4c7578e0a4together with #27997, #27996, #27978, #27973, #27971, #27969, #27967, #27964, #27958, #27950, #27949, #27946, #27945, #27943, #27938, #27936.tools/check_conventions.py --headandtools/debt_fold.py --checkpassed and the full build succeeded.nkwebkit_jscmakeobjectspasses. 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:26:02Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the documented console behavior remains unmeasured, and I did not run the supplied Linux checks.
What I ran
Read the prepared diff and changed files at head
a934c5159c9d51376df668de2886fb23d5157641. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The author reports a passing Linux build/test run and pointer audit; these were not independently run. Console behavior is unmeasured. Read:
JscObject.cpp,JscMakeObjects.cpp, and the new debt note. No changed file was excluded; all three manifest entries were included and read.files.jsonwas unavailable through the reader.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T08:17:04Z.
Review: COMMENTED
The JSC object fixture passed with the pinned QuickJS library. It covered array, Date, Error and RegExp construction with guarded argument vectors, function and constructor calls, and a property getter that throws while the exception output is read-only.
I compiled the changed translation unit and exact fixture in a focused Linux build linked against the project’s guest libraries.
AI-assisted: yes.