fix(libSceNKWebKit): take WTF::pageSize from the guest sysconf #19993
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19993"
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 MatteoSid on 2026-11-14T10:32:31Z.
What
WTF::pageSize()in libSceNKWebKit (_ZN3WTF8pageSizeEv, NIDZopRN-OA-qs) returned a fixed 4096. Nothing recorded a reason for that value: it arrived in1383e29dacwith no debt entry, and the PS5 11.x WebKit tree the library follows does not hardcode it. That tree's PageBlock.cpp takes the page size fromsysconf(_SC_PAGESIZE)onOS(UNIX). The PS5 compiler defines__FreeBSD__, which givesOS(FREEBSD)and soOS(UNIX)(PlatformOS.h). Its PageBlock.h sets a 16 KiBCeilingOnPageSizeforPLATFORM(PLAYSTATION). The console'shw.pagesizeis 16384: the entry indocs/dev/debt/libkernel.mdrecords it as read on a PS5 (firmware 13.60) and found as a constant in firmware 10.01 kernel data.Changes:
pageSize()now asks guest libkernelsysconf(47)(_SC_PAGESIZE), which returnsPS5_PAGE_SIZE, 16384. libSceNKWebKit already links libkernel.RELEASE_ASSERTs that the size is a power of two and not aboveCeilingOnPageSizethrowstd::runtime_errorwhere WebKit crashes. The third assertion, that the ceiling is a multiple of the page size, always holds after those two and is not repeated. The value is computed once, as WebKit caches it.src/WtfPageBlock.cpp, which starts with aDerived fromline and the PageBlock notice copied verbatim.WtfSystem.cpponly changes the export's body and declares the helper.WTF::pageMaskin libSceJsc (#19989), which uses the same sysconf call.Reachability:
pageSize()takes no arguments and needs no object, so any module that imports it from libSceNKWebKit reaches it directly. JSC and WebKit use it for page-aligned sizes, such asPageBlockandisPageAligned.Tested
Linux (Ubuntu 24.04 container, GCC 13.3), Release,
-DBUILD_TESTING=ON, on headab5e25cfcdbased onmain18eac5d896: builtlibSceNKWebKit, the patchedcore/libs/libs/libSceNKWebKit.prxand every libSceNKWebKit test target.ctest -R 'nkwebkit|^public_headers$'passes 80 of 80.nkwebkit_wtfnow checks thatpageSize()is exactly 16384, where it pinned 4096 before, and that a second call returns the same value. All 5 mutations, applied one at a time, make it fail:sysconf(48)instead of 47;nm -Don the patchedlibSceNKWebKit.prxlistsZopRN-OA-qsat the address of_ZN3WTF8pageSizeEv.tools/check_conventions.py --base origin/main --head HEADpasses andgit diff --check origin/mainis clean.Overlap: no open PR mentions
pageSizein libSceNKWebKit or its NID.tools/pr_overlap.py --branchmerged 110 PRs without overlap. I checked the 9 it could not compare by hand:tests/Wtf.cpparound lines 6, 562-573, 1132 and 1424, far fromTestSystem(line 280);pageSizeor the "WTF host services" entry.git merge-tree --write-treemerges this branch cleanly with #19302, #19523, #19380 and #19823. #19380 and #19823 also editWtfSystem.cpp, but their hunks are separated from this one by unchanged lines. No title tested.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-14T10:46:52Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ab5e25cfcd:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_wtf_testsbuilt cleanly.nkwebkit_wtf):core/libs/prx/libSceNKWebKit/src/WtfSystem.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 MarcZX10 on 2026-11-14T13:08:54Z.
Review: APPROVED
Reviewed — looks good
The changed export delegates to a cached guest page-size query with power-of-two and upper-bound checks; the inspected implementation and test support the stated behavior, though the new helper’s full source was excluded from review.
What I ran
No build or test commands were run. The author reports Linux build and test results in the PR description; these were not independently verified.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full
WtfPageBlock.cpptext was available through the pinned repository reader and inspected, but the PR description says that file was excluded from the prepared diff by rule. No files were excluded frommanifest.json’s reviewed list. The PR’s claimed build, test, mutation, ABI, and console results were not run or independently verified.docs/dev/debt/libSceNKWebKit.mdwas read at the changed entry only; its remaining contents were not read.To get this to a good state
Nothing is required.