feat(libSceNKWebKit): store the measured fields #14391

Merged
edubox merged 11 commits from upstream-pr/14391 into main 2026-11-06 08:10:10 +00:00
edubox commented 2026-11-01 11:15:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by edubox on 2026-11-01T11:15:43Z.


What

Implement 55 libSceNKWebKit exports that store an argument into a fixed field of the object in the PS5 11.00 module:

  • 43 store the second argument at offset 0 (Inspector frontend dispatcher constructors, SQLiteStatementAutoResetScope, ProtoCallFrame::setCodeBlock, ...).
  • 9 store it at offsets 8, 16, 24, 32, 48 or 56 (ProtoCallFrame, GraphicsLayer::setClient, TextureMapperLayer::setBackingStore/setContentsLayer, ApplicationCacheStorage::setMaximumSize/setDefaultOriginQuota, InspectorConsoleAgent::setHeapAgent).
  • 3 store a 32-bit value at offsets 8, 16 and 32 (RemoteControllableTarget::setTargetIdentifier, ProtoCallFrame::setArgumentCountIncludingThis/setPaddedArgCount).

The bodies, sizes and offsets come from the 11.00 libSceNKWebKit.sprx (SHA-256 3af992253665387feeb5df90ff27dff683e3aa270cc4d92a0535b46ab18fa20d). The 55 declarations now carry these definitions' signatures in include/FieldSettersExports.hpp, which the umbrella header reaches; the no-parameter placeholders are gone from InventoryExports.hpp and the test no longer redeclares them. Object layouts, field meanings, wider values and other ABI cases are unverified, so only the measured store width is covered.

The per-export measurement record (module fingerprint and store width/offset for each export) is in https://gist.github.com/edubox/bf9fdb5fa43930e1404a19621623cea9.

The debt counts drop by these 55 additional-callable rows: 7,311 of 8,703 remain; the known-name group stays at 127.

Tested

  • Linux, GCC 16.2.1, rebased on main ab6f5d32ed: all NKWebKit tests 10/10, including the new nkwebkit_fieldsetters, which calls every setter with a sentinel and checks that only the measured field bytes change.
  • python3 tools/check_conventions.py --base origin/main: passed.
  • git diff --check: clean.
  • python3 tools/pr_overlap.py --branch feat/nkwebkit-field-setters --jobs 32: no overlap with open pull requests.
  • Not tested in a game: no title is known to reach these setters.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Measurement record

The 55 store widths and offsets, with the 11.00 module SHA-256, are listed in this gist: https://gist.github.com/edubox/5779a2e70dbec6a3ecb1f5de9d49b8bc

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5106819118 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14391). Originally posted by [edubox](https://github.com/edubox) on 2026-11-01T11:15:43Z. --- ### What Implement 55 libSceNKWebKit exports that store an argument into a fixed field of the object in the PS5 11.00 module: - 43 store the second argument at offset 0 (Inspector frontend dispatcher constructors, `SQLiteStatementAutoResetScope`, `ProtoCallFrame::setCodeBlock`, ...). - 9 store it at offsets 8, 16, 24, 32, 48 or 56 (`ProtoCallFrame`, `GraphicsLayer::setClient`, `TextureMapperLayer::setBackingStore`/`setContentsLayer`, `ApplicationCacheStorage::setMaximumSize`/`setDefaultOriginQuota`, `InspectorConsoleAgent::setHeapAgent`). - 3 store a 32-bit value at offsets 8, 16 and 32 (`RemoteControllableTarget::setTargetIdentifier`, `ProtoCallFrame::setArgumentCountIncludingThis`/`setPaddedArgCount`). The bodies, sizes and offsets come from the 11.00 `libSceNKWebKit.sprx` (SHA-256 `3af992253665387feeb5df90ff27dff683e3aa270cc4d92a0535b46ab18fa20d`). The 55 declarations now carry these definitions' signatures in `include/FieldSettersExports.hpp`, which the umbrella header reaches; the no-parameter placeholders are gone from `InventoryExports.hpp` and the test no longer redeclares them. Object layouts, field meanings, wider values and other ABI cases are unverified, so only the measured store width is covered. The per-export measurement record (module fingerprint and store width/offset for each export) is in https://gist.github.com/edubox/bf9fdb5fa43930e1404a19621623cea9. The debt counts drop by these 55 additional-callable rows: 7,311 of 8,703 remain; the known-name group stays at 127. ### Tested - Linux, GCC 16.2.1, rebased on `main` `ab6f5d32ed`: all NKWebKit tests **10/10**, including the new `nkwebkit_fieldsetters`, which calls every setter with a sentinel and checks that only the measured field bytes change. - `python3 tools/check_conventions.py --base origin/main`: passed. - `git diff --check`: clean. - `python3 tools/pr_overlap.py --branch feat/nkwebkit-field-setters --jobs 32`: **no overlap with open pull requests**. - Not tested in a game: no title is known to reach these setters. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes ### Measurement record The 55 store widths and offsets, with the 11.00 module SHA-256, are listed in this gist: https://gist.github.com/edubox/5779a2e70dbec6a3ecb1f5de9d49b8bc
MarcZX10 commented 2026-11-01 14:33:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T14:33:00Z.

Review: COMMENTED


Reviewed — no blocking findings

The 55 field setters are simple stores at the offsets the PR gives, and they match the test; they write through the object pointer with no null or writability check, so a bad object pointer from a title crashes the host, which is the class of problem other PRs in this queue are fixing. The firmware offsets were not checked here.

What I ran

  • Exact head 12db53231df734606b7e964d04da7842202d3150, base 929e8d8442 (the precheck base).
  • Environment: Linux, /usr/bin/python3 3.11.2, no build.
  • Precheck: python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14391 --output-dir /dev/shm/reviewer-run/precheck/14391
  • ABI audit by hand (helper absent from the head tree): python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 929e8d8442 --head 12db53231df734606b7e964d04da7842202d3150 --json (exit 0; passed; 0 findings; 10,105 symbols).
  • Test-quality helper on core/libs/prx/libSceNKWebKit/tests/FieldSetters.cpp from a head extract: one literal-path registration heuristic.
  • Source read at head: src/FieldSetters.cpp (227 lines, the store functions at the offsets listed in the PR) and a repository search in core/libs/prx/libSceNKWebKit for raw field writes through an object pointer: at head FieldSetters.cpp is the only file that does this, and the library has no GuestArena::HostWrite or GuestCopyOut calls.

Results

Precheck report, checks table, unedited (/dev/shm/reviewer-run/precheck/14391/report.md):

Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check 929e8d8442bb23635f7a55ff3e1232cdcd52c379...12db53231df734606b7e964d04da7842202d3150
conventions_and_pr_template passed /usr/bin/python3 tools/check_conventions.py --base 929e8d8442bb23635f7a55ff3e1232cdcd52c379 --head 12db53231df734606b7e964d04da7842202d3150 --title feat(libSceNKWebKit): store the measured fields --body /dev/shm/reviewer-run/precheck/14391/pr-body.md
changed_export_abi_audit failed /usr/bin/python3 tools/pr_abi_audit.py --base 929e8d8442bb23635f7a55ff3e1232cdcd52c379 --head 12db53231df734606b7e964d04da7842202d3150 --json
python_syntax not_applicable No changed Python implementation files.
related_python_unit_tests not_applicable No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.
python_test_registration not_applicable No changed test_*.py files.
live_dependency_and_mergeability_check passed /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14391 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14391/stack
build_dependent_cpp_tests not_applicable Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.
test_quality_heuristics failed /usr/bin/python3 /dev/shm/reviewer-run/precheck/14391/head-12db53231df7-fe5d39fd/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14391/head-12db53231df7-fe5d39fd --json core/libs/prx/libSceNKWebKit/Export.cpp core/libs/prx/libSceNKWebKit/include/FieldSettersExports.hpp core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp core/libs/prx/libSceNKWebKit/src/FieldSetters.cpp core/libs/prx/libSceNKWebKit/tests/FieldSetters.cpp docs/dev/debt/libSceNKWebKit.md
negative_controls not_applicable No changed Python test module in tools/ can be run as a no-build base-source control.

Negative control

Not run here. The C++ test needs a build.

Findings

Blocking: none.

Non-blocking:

  • No null check or writability check on self in any of the 55 setters (for example _ZN3JSC14ProtoCallFrame12setCodeBlockEPNS_9CodeBlockE writes at self + 0). A null self faults in host space. Other libraries in this repository check arguments before writing guest memory (for example the GuestCopyOut_nid_no_patch uses in libSceMbus and libSceBeisobmf), so the setters should throw on null or use that helper. This is the change I would ask for before merge.
  • The object sizes are not checked either. The offsets (up to 56 bytes into the object) are the PR's reading of the 11.00 module; a shorter object would be overwritten past its end. The PR should record the minimum object size each setter assumes.

Sources

Not verified

  • The firmware 11.00 offsets and the object sizes behind them were not checked; they come from the PR's disassembly.
  • The C++ test guest_nkwebkit_field_setters was not built or run here.
  • Hosted: at this head conventions, eligibility, labels, library-portability and report succeeded; windows was in progress; linux, register-context, relinker, relinker-asan and write-watch were skipped.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5728630468 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14391#pullrequestreview-5728630468). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T14:33:00Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The 55 field setters are simple stores at the offsets the PR gives, and they match the test; they write through the object pointer with no null or writability check, so a bad object pointer from a title crashes the host, which is the class of problem other PRs in this queue are fixing. The firmware offsets were not checked here. ## What I ran - Exact head `12db53231df734606b7e964d04da7842202d3150`, base `929e8d8442` (the precheck base). - Environment: Linux, `/usr/bin/python3` 3.11.2, no build. - Precheck: `python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14391 --output-dir /dev/shm/reviewer-run/precheck/14391` - ABI audit by hand (helper absent from the head tree): `python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base 929e8d8442 --head 12db53231df734606b7e964d04da7842202d3150 --json` (exit 0; `passed`; 0 findings; 10,105 symbols). - Test-quality helper on `core/libs/prx/libSceNKWebKit/tests/FieldSetters.cpp` from a head extract: one literal-path registration heuristic. - Source read at head: `src/FieldSetters.cpp` (227 lines, the store functions at the offsets listed in the PR) and a repository search in `core/libs/prx/libSceNKWebKit` for raw field writes through an object pointer: at head `FieldSetters.cpp` is the only file that does this, and the library has no `GuestArena::HostWrite` or `GuestCopyOut` calls. ## Results Precheck report, checks table, unedited (`/dev/shm/reviewer-run/precheck/14391/report.md`): | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check 929e8d8442bb23635f7a55ff3e1232cdcd52c379...12db53231df734606b7e964d04da7842202d3150` | | conventions_and_pr_template | passed | `/usr/bin/python3 tools/check_conventions.py --base 929e8d8442bb23635f7a55ff3e1232cdcd52c379 --head 12db53231df734606b7e964d04da7842202d3150 --title feat(libSceNKWebKit): store the measured fields --body /dev/shm/reviewer-run/precheck/14391/pr-body.md` | | changed_export_abi_audit | failed | `/usr/bin/python3 tools/pr_abi_audit.py --base 929e8d8442bb23635f7a55ff3e1232cdcd52c379 --head 12db53231df734606b7e964d04da7842202d3150 --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14391 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14391/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/usr/bin/python3 /dev/shm/reviewer-run/precheck/14391/head-12db53231df7-fe5d39fd/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14391/head-12db53231df7-fe5d39fd --json core/libs/prx/libSceNKWebKit/Export.cpp core/libs/prx/libSceNKWebKit/include/FieldSettersExports.hpp core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp core/libs/prx/libSceNKWebKit/src/FieldSetters.cpp core/libs/prx/libSceNKWebKit/tests/FieldSetters.cpp docs/dev/debt/libSceNKWebKit.md` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | ## Negative control Not run here. The C++ test needs a build. ## Findings **Blocking:** none. **Non-blocking:** - No null check or writability check on `self` in any of the 55 setters (for example `_ZN3JSC14ProtoCallFrame12setCodeBlockEPNS_9CodeBlockE` writes at `self + 0`). A null `self` faults in host space. Other libraries in this repository check arguments before writing guest memory (for example the `GuestCopyOut_nid_no_patch` uses in `libSceMbus` and `libSceBeisobmf`), so the setters should throw on null or use that helper. This is the change I would ask for before merge. - The object sizes are not checked either. The offsets (up to 56 bytes into the object) are the PR's reading of the 11.00 module; a shorter object would be overwritten past its end. The PR should record the minimum object size each setter assumes. ## Sources - Setters at head: https://github.com/boykopovar/AnyPS5/blob/12db53231df734606b7e964d04da7842202d3150/core/libs/prx/libSceNKWebKit/src/FieldSetters.cpp - Test at head: https://github.com/boykopovar/AnyPS5/blob/12db53231df734606b7e964d04da7842202d3150/core/libs/prx/libSceNKWebKit/tests/FieldSetters.cpp ## Not verified - The firmware 11.00 offsets and the object sizes behind them were not checked; they come from the PR's disassembly. - The C++ test `guest_nkwebkit_field_setters` was not built or run here. - Hosted: at this head `conventions`, `eligibility`, `labels`, `library-portability` and `report` succeeded; `windows` was in progress; `linux`, `register-context`, `relinker`, `relinker-asan` and `write-watch` were skipped.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14391
No description provided.