feat(libSceNKWebKit): implement WTF accumulated logs and dataLogFString #19828

Merged
B-Howell merged 6 commits from upstream-pr/19828 into main 2026-11-17 19:31:44 +00:00
B-Howell commented 2026-11-14 00:50:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by B-Howell on 2026-11-14T00:50:08Z.


What

Implements three WTF logging exports in libSceNKWebKit that were throwing stubs:

  • WTF::resetAccumulatedLogs() clears the process-wide log accumulator.
  • WTF::getAndResetAccumulatedLogs() returns the accumulated text as an 8-bit WTF::String and clears it. With nothing logged it returns the empty, non-null string.
  • WTF::dataLogFString(const char*) forwards to the existing dataLogF("%s", str), so both exports write to the same place.

WTFLog now fills the accumulator. On a channel in the OnWithAccumulation state (2), it formats the message, adds a trailing newline when there isn't one, appends the message to the accumulator under a lock, and writes it to stderr. Off (0) and On (1) behave as before.

This follows the pinned PS5 WebKit 11.x source:

The PR also adds static_assert checks for the existing WTFLogChannel layout (state at 0, name at 8, level at 16, subsystem at 24, size 32). It removes the three inventory rows and adds a debt entry. That entry notes that WTFLogWithLevel does not route accumulating channels through this path yet.

tools/progress.py: libSceNKWebKit done goes from 3000 to 3003 and todo from 8258 to 8255, so 3 stubs are now implemented.

Tested

WSL Ubuntu, g++, focused targets only:

  • Red control, on this branch with the three exports throwing and the accumulation branch removed (main's behaviour): 1/1 Test #3930: nkwebkit_wtf .....Subprocess aborted***Exception (what(): _ZN3WTF20resetAccumulatedLogsEv).
  • With this change, three runs: 1/1 Test #3930: nkwebkit_wtf ..... Passed 0.01 sec each time.
  • ctest -R '^public_headers': 100% tests passed, 0 tests failed out of 65.

The new test in tests/Wtf.cpp checks:

  • With no accumulating channel, the result is an empty, non-null 8-bit string.
  • Off and On channels add nothing.
  • On a state-2 channel, "a%d", 1, then "b\n", then an empty message, then "%c", 0xE9 give "a1\nb\n\n\xE9\n", and a second read is empty.
  • resetAccumulatedLogs discards a pending entry.
  • dataLogFString writes without throwing.

Not tested on Windows or on a console.

  • @JJenkx, Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, ccd0689b64 merged onto main 2ac33b4563 (report): nkwebkit_wtf passed 3/3, none skipped.
  • Main merge 66b9997f23: merged main 3ae84d01bd3; Export.cpp and InventoryExports.hpp conflicted only on the adjacent dataLogFString and dupCloseOnExec stubs, and both are now gone (this PR and #19103 implement them). The union merge re-added the dupCloseOnExecEi inventory row, which was dropped. The debt entry stays in libSceNKWebKit.md until #21200: with only a fragment, check_conventions.py flags the // Derived from lines. WSL2 Ubuntu: nkwebkit_wtf_tests built and ctest -R ^nkwebkit_wtf$ passed 1/1; check_conventions.py --base origin/main passes.
  • Main merge e9f4cb7580d onto main 1d3c669c843: conflict only in the main() call list of tests/Wtf.cpp, where #19380 added TestStackBounds and TestTimingScope beside this PR's TestAccumulatedLogs; all three calls are kept. WSL2 Ubuntu, GCC, Release: nkwebkit_wtf_tests built and ctest -R ^nkwebkit_wtf$ --repeat until-fail:3 passed. debt_fold.py --check and check_conventions.py --base origin/main pass.
  • @ycbuzi, Windows Server 2022 and Windows Server 2025 (GitHub-hosted runners), WinLibs GCC 15.2.0, full build, 742090164c merged onto main 802a0aeb2d (report): full ctest suite run twice per machine; 2022 had 5 and 4 failures out of 6013, 2025 had 1 and 1, the same counts as main on the same runners, so none come from this PR.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5305284247 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19828). Originally posted by [B-Howell](https://github.com/B-Howell) on 2026-11-14T00:50:08Z. --- ### What Implements three WTF logging exports in libSceNKWebKit that were throwing stubs: - `WTF::resetAccumulatedLogs()` clears the process-wide log accumulator. - `WTF::getAndResetAccumulatedLogs()` returns the accumulated text as an 8-bit `WTF::String` and clears it. With nothing logged it returns the empty, non-null string. - `WTF::dataLogFString(const char*)` forwards to the existing `dataLogF("%s", str)`, so both exports write to the same place. `WTFLog` now fills the accumulator. On a channel in the `OnWithAccumulation` state (2), it formats the message, adds a trailing newline when there isn't one, appends the message to the accumulator under a lock, and writes it to stderr. Off (0) and On (1) behave as before. This follows the pinned PS5 WebKit 11.x source: - [Assertions.cpp L407-L501](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/Assertions.cpp#L407-L501): `WTFLoggingAccumulator` and the `OnWithAccumulation` branch of `WTFLogVaList`, which runs `createWithFormatAndArguments` then `if (!loggingString.endsWith('\n'))` before `accumulate` and `logToStderr`. - [L767-L775](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/Assertions.cpp#L767-L775): the two free functions. - [StringBuilder.cpp L61-L62](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/text/StringBuilder.cpp#L61-L62): an empty builder gives `StringImpl::empty()`. - [DataLog.cpp L194-L197](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WTF/wtf/DataLog.cpp#L194-L197): `dataFile().printf("%s", str)`. The PR also adds `static_assert` checks for the existing `WTFLogChannel` layout (`state` at 0, `name` at 8, `level` at 16, `subsystem` at 24, size 32). It removes the three inventory rows and adds a debt entry. That entry notes that `WTFLogWithLevel` does not route accumulating channels through this path yet. `tools/progress.py`: libSceNKWebKit done goes from 3000 to 3003 and todo from 8258 to 8255, so 3 stubs are now implemented. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> WSL Ubuntu, g++, focused targets only: - Red control, on this branch with the three exports throwing and the accumulation branch removed (main's behaviour): `1/1 Test #3930: nkwebkit_wtf .....Subprocess aborted***Exception` (`what(): _ZN3WTF20resetAccumulatedLogsEv`). - With this change, three runs: `1/1 Test #3930: nkwebkit_wtf ..... Passed 0.01 sec` each time. - `ctest -R '^public_headers'`: `100% tests passed, 0 tests failed out of 65`. The new test in `tests/Wtf.cpp` checks: - With no accumulating channel, the result is an empty, non-null 8-bit string. - Off and On channels add nothing. - On a state-2 channel, `"a%d", 1`, then `"b\n"`, then an empty message, then `"%c", 0xE9` give `"a1\nb\n\n\xE9\n"`, and a second read is empty. - `resetAccumulatedLogs` discards a pending entry. - `dataLogFString` writes without throwing. Not tested on Windows or on a console. - @JJenkx, Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, ccd0689b64 merged onto main 2ac33b4563 ([report](https://github.com/boykopovar/AnyPS5/pull/19828#issuecomment-6870088832)): `nkwebkit_wtf` passed 3/3, none skipped. - Main merge `66b9997f23`: merged main `3ae84d01bd3`; `Export.cpp` and `InventoryExports.hpp` conflicted only on the adjacent `dataLogFString` and `dupCloseOnExec` stubs, and both are now gone (this PR and #19103 implement them). The union merge re-added the `dupCloseOnExecEi` inventory row, which was dropped. The debt entry stays in `libSceNKWebKit.md` until #21200: with only a fragment, `check_conventions.py` flags the `// Derived from` lines. WSL2 Ubuntu: `nkwebkit_wtf_tests` built and `ctest -R ^nkwebkit_wtf$` passed 1/1; `check_conventions.py --base origin/main` passes. - Main merge `e9f4cb7580d` onto main `1d3c669c843`: conflict only in the `main()` call list of `tests/Wtf.cpp`, where #19380 added `TestStackBounds` and `TestTimingScope` beside this PR's `TestAccumulatedLogs`; all three calls are kept. WSL2 Ubuntu, GCC, Release: `nkwebkit_wtf_tests` built and `ctest -R ^nkwebkit_wtf$ --repeat until-fail:3` passed. `debt_fold.py --check` and `check_conventions.py --base origin/main` pass. - @ycbuzi, Windows Server 2022 and Windows Server 2025 (GitHub-hosted runners), WinLibs GCC 15.2.0, full build, 742090164c merged onto main 802a0aeb2d ([report](https://github.com/boykopovar/AnyPS5/pull/19828#issuecomment-6937074930)): full ctest suite run twice per machine; 2022 had 5 and 4 failures out of 6013, 2025 had 1 and 1, the same counts as main on the same runners, so none come from this PR. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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
PrivacyOnion commented 2026-11-14 01:26:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-14T01:26:15Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against ccd0689b64:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_wtf_tests built cleanly.
  • CTest (nkwebkit_wtf):
    1/1 Test #3933: nkwebkit_wtf .....................   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that WTFLog checks !ch and ch->state == 0 before evaluating channel state, correctly handling LogChannelStateOn (1) versus accumulating channels (state 2).
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified thread safety and lock scoping across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv, confirming AccumulatorLock() protects all mutations of Accumulator() and that swap avoids holding the mutex during StringImpl::create.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified bounds check in AccumulateAndLog ensuring text.size() > INT32_MAX - accumulator.size() guards against integer overflow prior to accumulator concatenation.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that AccumulateAndLog accurately transcodes 8-bit Latin-1 code units to 2-byte UTF-8 sequences before calling std::fputs(..., stderr), conforming to WebKit logToStderr behavior.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that _ZN3WTF14dataLogFStringEPKc forwards to _ZN3WTF8dataLogFEPKcz with "%s", preventing format string vulnerabilities from '%' inside caller strings.
    • core/libs/prx/libSceNKWebKit/tests/Wtf.cpp: verified unit test coverage across empty accumulator initialization, off/on/accumulating channel filtering, newline termination handling, and accumulator clearing upon reset.
  • Concerns:
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp:24-25: Source provenance comments ('// Derived from Source/WTF/wtf/Assertions.cpp@80f77e94c63ee7202eec3d4b5b1a021dd89011ba' and '// Derived from Source/WTF/wtf/DataLog.cpp@80f77e94c63ee7202eec3d4b5b1a021dd89011ba') violate AGENTS.md rule: 'No comments in code, except #endif and namespace ends.' Upstream source references belong in the pull request description and docs/dev/debt/libSceNKWebKit.md, not in C++ source files.
  • Note: the AI-assisted checkbox can stay.

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5900403742 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19828#pullrequestreview-5900403742). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-14T01:26:15Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `ccd0689b64`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_wtf_tests` built cleanly. - **CTest** (`nkwebkit_wtf`): ``` 1/1 Test #3933: nkwebkit_wtf ..................... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that WTFLog checks !ch and ch->state == 0 before evaluating channel state, correctly handling LogChannelStateOn (1) versus accumulating channels (state 2). - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified thread safety and lock scoping across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv, confirming AccumulatorLock() protects all mutations of Accumulator() and that swap avoids holding the mutex during StringImpl::create. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified bounds check in AccumulateAndLog ensuring text.size() > INT32_MAX - accumulator.size() guards against integer overflow prior to accumulator concatenation. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that AccumulateAndLog accurately transcodes 8-bit Latin-1 code units to 2-byte UTF-8 sequences before calling std::fputs(..., stderr), conforming to WebKit logToStderr behavior. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that _ZN3WTF14dataLogFStringEPKc forwards to _ZN3WTF8dataLogFEPKcz with "%s", preventing format string vulnerabilities from '%' inside caller strings. - core/libs/prx/libSceNKWebKit/tests/Wtf.cpp: verified unit test coverage across empty accumulator initialization, off/on/accumulating channel filtering, newline termination handling, and accumulator clearing upon reset. - **Concerns**: - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp:24-25: Source provenance comments ('// Derived from Source/WTF/wtf/Assertions.cpp@80f77e94c63ee7202eec3d4b5b1a021dd89011ba' and '// Derived from Source/WTF/wtf/DataLog.cpp@80f77e94c63ee7202eec3d4b5b1a021dd89011ba') violate AGENTS.md rule: 'No comments in code, except #endif and namespace ends.' Upstream source references belong in the pull request description and docs/dev/debt/libSceNKWebKit.md, not in C++ source files. - Note: the AI-assisted checkbox can stay. Requesting changes for the points above.
PrivacyOnion commented 2026-11-15 19:17:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T19:17:11Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against ccd0689b64:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_wtf_tests built cleanly.
  • CTest (nkwebkit_wtf):
    1/1 Test #3933: nkwebkit_wtf .....................   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that WTFLog checks !ch and ch->state == 0 before evaluating channel state, correctly handling LogChannelStateOn (1) versus accumulating channels (state 2).
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified thread safety and lock scoping across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv, confirming AccumulatorLock() protects all mutations of Accumulator() and that swap avoids holding the mutex during StringImpl::create.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified bounds check in AccumulateAndLog ensuring text.size() > INT32_MAX - accumulator.size() guards against integer overflow prior to accumulator concatenation.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that AccumulateAndLog accurately transcodes 8-bit Latin-1 code units to 2-byte UTF-8 sequences before calling std::fputs(..., stderr), conforming to WebKit logToStderr behavior.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that _ZN3WTF14dataLogFStringEPKc forwards to _ZN3WTF8dataLogFEPKcz with "%s", preventing format string vulnerabilities from '%' inside caller strings.
    • core/libs/prx/libSceNKWebKit/tests/Wtf.cpp: verified unit test coverage across empty accumulator initialization, off/on/accumulating channel filtering, newline termination handling, and accumulator clearing upon reset.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912392724 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19828#pullrequestreview-5912392724). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T19:17:11Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `ccd0689b64`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_wtf_tests` built cleanly. - **CTest** (`nkwebkit_wtf`): ``` 1/1 Test #3933: nkwebkit_wtf ..................... Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that WTFLog checks !ch and ch->state == 0 before evaluating channel state, correctly handling LogChannelStateOn (1) versus accumulating channels (state 2). - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified thread safety and lock scoping across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv, confirming AccumulatorLock() protects all mutations of Accumulator() and that swap avoids holding the mutex during StringImpl::create. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified bounds check in AccumulateAndLog ensuring text.size() > INT32_MAX - accumulator.size() guards against integer overflow prior to accumulator concatenation. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that AccumulateAndLog accurately transcodes 8-bit Latin-1 code units to 2-byte UTF-8 sequences before calling std::fputs(..., stderr), conforming to WebKit logToStderr behavior. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that _ZN3WTF14dataLogFStringEPKc forwards to _ZN3WTF8dataLogFEPKcz with "%s", preventing format string vulnerabilities from '%' inside caller strings. - core/libs/prx/libSceNKWebKit/tests/Wtf.cpp: verified unit test coverage across empty accumulator initialization, off/on/accumulating channel filtering, newline termination handling, and accumulator clearing upon reset. Looks Good To Me
PrivacyOnion commented 2026-11-15 23:57:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T23:57:14Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 66b9997f23:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_wtf_tests built cleanly.
  • CTest (nkwebkit_wtf):
    1/1 Test #4271: nkwebkit_wtf .....................   Passed    0.07 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that WTFLog checks !ch and ch->state == 0 before branching on ch->state != LogChannelStateOn (1), routing state 2 (OnWithAccumulation) through FormatText and AccumulateAndLog.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified thread safety across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv, holding AccumulatorLock() around all accesses to Accumulator() and swapping out the buffer before calling _ZN3WTF10StringImpl6createEPKhj.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that AccumulateAndLog checks text.size() > static_caststd::size_t(std::numeric_limitsstd::int32_t::max()) - accumulator.size() before appending, preventing signed 32-bit length overflow when constructing WTF::StringImpl.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that AccumulateAndLog appends a trailing newline when missing and transcodes 8-bit Latin-1 characters (>= 0x80) into 2-byte UTF-8 sequences before writing to stderr.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that _ZN3WTF14dataLogFStringEPKc delegates via _ZN3WTF8dataLogFEPKcz("%s", str), avoiding format-string injection when logging arbitrary strings.
    • core/libs/prx/libSceNKWebKit/Export.cpp, include/InventoryExports.hpp, include/WtfExports.hpp, and docs/dev/debt/libSceNKWebKit.md: verified stub removal, ABI declarations, and technical debt updates.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5913619050 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19828#pullrequestreview-5913619050). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-15T23:57:14Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `66b9997f23`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_wtf_tests` built cleanly. - **CTest** (`nkwebkit_wtf`): ``` 1/1 Test #4271: nkwebkit_wtf ..................... Passed 0.07 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that WTFLog checks !ch and ch->state == 0 before branching on ch->state != LogChannelStateOn (1), routing state 2 (OnWithAccumulation) through FormatText and AccumulateAndLog. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified thread safety across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv, holding AccumulatorLock() around all accesses to Accumulator() and swapping out the buffer before calling _ZN3WTF10StringImpl6createEPKhj. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that AccumulateAndLog checks text.size() > static_cast<std::size_t>(std::numeric_limits<std::int32_t>::max()) - accumulator.size() before appending, preventing signed 32-bit length overflow when constructing WTF::StringImpl. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that AccumulateAndLog appends a trailing newline when missing and transcodes 8-bit Latin-1 characters (>= 0x80) into 2-byte UTF-8 sequences before writing to stderr. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: verified that _ZN3WTF14dataLogFStringEPKc delegates via _ZN3WTF8dataLogFEPKcz("%s", str), avoiding format-string injection when logging arbitrary strings. - core/libs/prx/libSceNKWebKit/Export.cpp, include/InventoryExports.hpp, include/WtfExports.hpp, and docs/dev/debt/libSceNKWebKit.md: verified stub removal, ABI declarations, and technical debt updates. Looks Good To Me
PrivacyOnion commented 2026-11-16 22:21:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-16T22:21:10Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against e9f4cb7580:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_wtf_tests built cleanly.
  • CTest (nkwebkit_wtf):
    1/1 Test #4404: nkwebkit_wtf .....................   Passed    0.08 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified that WTFLog in core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp correctly validates ch and ch->state before dispatching state 2 (OnWithAccumulation) to FormatText and AccumulateAndLog while preserving states 0 and 1.
    • Verified thread safety and mutex locking across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv using AccumulatorLock(), with swap avoiding contention during WTF::String creation.
    • Verified integer overflow protection in AccumulateAndLog against std::numeric_limitsstd::int32_t::max() to safeguard 32-bit StringImpl length bounds.
    • Verified dataLogFString delegating to dataLogF via format string '%s' to prevent format string vulnerabilities.
    • Verified that stub removals in Export.cpp, declarations in WtfExports.hpp/InventoryExports.hpp, and debt updates in docs/dev/debt/libSceNKWebKit.md conform to repository rules.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5928842987 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19828#pullrequestreview-5928842987). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-16T22:21:10Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `e9f4cb7580`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_wtf_tests` built cleanly. - **CTest** (`nkwebkit_wtf`): ``` 1/1 Test #4404: nkwebkit_wtf ..................... Passed 0.08 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified that WTFLog in core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp correctly validates ch and ch->state before dispatching state 2 (OnWithAccumulation) to FormatText and AccumulateAndLog while preserving states 0 and 1. - Verified thread safety and mutex locking across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv using AccumulatorLock(), with swap avoiding contention during WTF::String creation. - Verified integer overflow protection in AccumulateAndLog against std::numeric_limits<std::int32_t>::max() to safeguard 32-bit StringImpl length bounds. - Verified dataLogFString delegating to dataLogF via format string '%s' to prevent format string vulnerabilities. - Verified that stub removals in Export.cpp, declarations in WtfExports.hpp/InventoryExports.hpp, and debt updates in docs/dev/debt/libSceNKWebKit.md conform to repository rules. Looks Good To Me
PrivacyOnion commented 2026-11-17 01:28:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T01:28:50Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 742090164c:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_wtf_tests built cleanly.
  • CTest (nkwebkit_wtf):
    1/1 Test #4414: nkwebkit_wtf .....................   Passed    0.07 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/include/WtfExports.hpp, core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: Verified WTFLog properly checks channel nullity/state, handles LogChannelStateOn vs accumulating state (2), and forwards formatted messages via FormatText.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: Verified thread-safety of AccumulatorLock across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv, with std::string::swap preventing lock contention during StringImpl creation.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: Verified bounds checking and integer overflow prevention against std::numeric_limitsstd::int32_t::max() before accumulator resizing.
    • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: Verified _ZN3WTF14dataLogFStringEPKc safely forwards to _ZN3WTF8dataLogFEPKcz using '%s' format string, preventing format string injection.
    • core/libs/prx/libSceNKWebKit/tests/Wtf.cpp: Verified unit tests thoroughly exercise state transitions (off, on, accumulating), trailing newline insertion, non-ASCII logging, buffer clearing, and empty string behaviors.
    • AGENTS.md & Conventions: Confirmed comments match upstream attribution exceptions accepted by maintainer, debt entries updated in libSceNKWebKit.md, and no spurious files created.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5931100504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19828#pullrequestreview-5931100504). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-17T01:28:50Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `742090164c`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_wtf_tests` built cleanly. - **CTest** (`nkwebkit_wtf`): ``` 1/1 Test #4414: nkwebkit_wtf ..................... Passed 0.07 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WtfExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: Verified WTFLog properly checks channel nullity/state, handles LogChannelStateOn vs accumulating state (2), and forwards formatted messages via FormatText. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: Verified thread-safety of AccumulatorLock across AccumulateAndLog, _ZN3WTF20resetAccumulatedLogsEv, and _ZN3WTF26getAndResetAccumulatedLogsEv, with std::string::swap preventing lock contention during StringImpl creation. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: Verified bounds checking and integer overflow prevention against std::numeric_limits<std::int32_t>::max() before accumulator resizing. - core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp: Verified _ZN3WTF14dataLogFStringEPKc safely forwards to _ZN3WTF8dataLogFEPKcz using '%s' format string, preventing format string injection. - core/libs/prx/libSceNKWebKit/tests/Wtf.cpp: Verified unit tests thoroughly exercise state transitions (off, on, accumulating), trailing newline insertion, non-ASCII logging, buffer clearing, and empty string behaviors. - AGENTS.md & Conventions: Confirmed comments match upstream attribution exceptions accepted by maintainer, debt entries updated in libSceNKWebKit.md, and no spurious files created. Looks Good To Me
MarcZX10 commented 2026-11-17 02:40:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T02:40:11Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

  • Head: 742090164c58ca9268dc22d9964deadd4050f0a0, base main. No merged-preview check.
  • No build and no tests. The review used the diff from the review folder and the pinned repository reader, which searched and read files at the head.
  • Reader calls, by kind:
repo_read.py search <name> core/libs/prx/libSceNKWebKit
repo_read.py cat core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp <start> <end>

Results

Check Result Note
Build and tests at head not run No builds in this review
New exports defined once passed Stubs removed from Export.cpp
Empty result is non-null, 8-bit passed EmptyImpl flags include the 8-bit bit
WTFLogWithLevel not accumulating passed Matches the debt entry
Author-reported test runs not run Named in the description for other commits, not this head

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp:140-148 — AccumulateAndLog turns every byte of 0x80 or more into two UTF-8 bytes before fputs. Text that is already UTF-8 reaches stderr doubled: é (C3 A9) prints as é. The accumulator at lines 131-136 keeps the raw bytes, and the On path at lines 329-340 writes bytes unchanged. Either write text as it is to stderr, or say in the debt entry why the stderr copy is Latin-1.
  • core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp:133-134 — past the 2^31 cap the exported WTFLog throws std::length_error, so a logging call throws through C linkage. The accumulator is only cleared by getAndResetAccumulatedLogs, so it grows to the cap if nothing reads it. Decide what happens at the cap (drop new text, or keep the newest) and avoid throwing from a log call.

Sources

Not verified

  • Compilation on Linux or Windows at this head, and the test run. The Windows call LibcDetail::FormatWindows matches its declaration at WindowsFormatting.hpp:566, but the Windows path was not run.
  • Console behaviour, and the debt entry's claim that dataFile() is stdout on the PlayStation.
  • tools/progress.py counts (3000 to 3003). That file is not in the diff, and I did not recompute the counts.
  • The // Derived from lines. CONVENTIONS.md allows licence and copyright notices for adapted upstream code. AGENTS.md has no "Derived" text, so the exact form was not confirmed.
  • The upstream WebKit permalinks in the description were not fetched.
  • Files read: all six reviewed files were read through their diff hunks. Export.cpp, InventoryExports.hpp and docs/dev/debt/libSceNKWebKit.md are too large for the review folder, so only their hunks were read. WtfExports.hpp, WtfAssert.cpp and tests/Wtf.cpp were read through the diff and reader ranges, not in full. No file was excluded by rule.

To get this to a good state

Nothing is required.

Optional: the two non-blocking points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5931849927 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19828#pullrequestreview-5931849927). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T02:40:11Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran - Head: `742090164c58ca9268dc22d9964deadd4050f0a0`, base `main`. No merged-preview check. - No build and no tests. The review used the diff from the review folder and the pinned repository reader, which searched and read files at the head. - Reader calls, by kind: ``` repo_read.py search <name> core/libs/prx/libSceNKWebKit repo_read.py cat core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp <start> <end> ``` ## Results | Check | Result | Note | | --- | --- | --- | | Build and tests at head | not run | No builds in this review | | New exports defined once | passed | Stubs removed from `Export.cpp` | | Empty result is non-null, 8-bit | passed | `EmptyImpl` flags include the 8-bit bit | | `WTFLogWithLevel` not accumulating | passed | Matches the debt entry | | Author-reported test runs | not run | Named in the description for other commits, not this head | ## Findings **Blocking** None. **Non-blocking** - `core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp:140-148` — `AccumulateAndLog` turns every byte of 0x80 or more into two UTF-8 bytes before `fputs`. Text that is already UTF-8 reaches stderr doubled: `é` (C3 A9) prints as `é`. The accumulator at lines 131-136 keeps the raw bytes, and the On path at lines 329-340 writes bytes unchanged. Either write `text` as it is to stderr, or say in the debt entry why the stderr copy is Latin-1. - `core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp:133-134` — past the 2^31 cap the exported `WTFLog` throws `std::length_error`, so a logging call throws through C linkage. The accumulator is only cleared by `getAndResetAccumulatedLogs`, so it grows to the cap if nothing reads it. Decide what happens at the cap (drop new text, or keep the newest) and avoid throwing from a log call. ## Sources - [Accumulating transcode and stderr write](https://github.com/boykopovar/AnyPS5/blob/742090164c58ca9268dc22d9964deadd4050f0a0/core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp#L131-L148) - [On path of `WTFLog`](https://github.com/boykopovar/AnyPS5/blob/742090164c58ca9268dc22d9964deadd4050f0a0/core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp#L314-L340) - [`WTFLogWithLevel`](https://github.com/boykopovar/AnyPS5/blob/742090164c58ca9268dc22d9964deadd4050f0a0/core/libs/prx/libSceNKWebKit/src/WtfAssert.cpp#L365-L384) - [`EmptyImpl` and `CopyImpl`](https://github.com/boykopovar/AnyPS5/blob/742090164c58ca9268dc22d9964deadd4050f0a0/core/libs/prx/libSceNKWebKit/src/WtfString.cpp#L307-L342) - [Comment rule](https://github.com/boykopovar/AnyPS5/blob/742090164c58ca9268dc22d9964deadd4050f0a0/docs/dev/CONVENTIONS.md#L13) ## Not verified - Compilation on Linux or Windows at this head, and the test run. The Windows call `LibcDetail::FormatWindows` matches its declaration at `WindowsFormatting.hpp:566`, but the Windows path was not run. - Console behaviour, and the debt entry's claim that `dataFile()` is stdout on the PlayStation. - `tools/progress.py` counts (3000 to 3003). That file is not in the diff, and I did not recompute the counts. - The `// Derived from` lines. `CONVENTIONS.md` allows licence and copyright notices for adapted upstream code. `AGENTS.md` has no "Derived" text, so the exact form was not confirmed. - The upstream WebKit permalinks in the description were not fetched. - Files read: all six reviewed files were read through their diff hunks. `Export.cpp`, `InventoryExports.hpp` and `docs/dev/debt/libSceNKWebKit.md` are too large for the review folder, so only their hunks were read. `WtfExports.hpp`, `WtfAssert.cpp` and `tests/Wtf.cpp` were read through the diff and reader ranges, not in full. No file was excluded by rule. ## To get this to a good state Nothing is required. Optional: the two non-blocking points above.
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!19828
No description provided.