feat(libSceLibreSsl): implement five custom UI method functions #9942

Closed
GabrielKLBr wants to merge 1 commit from upstream-pr/9942 into main
GabrielKLBr commented 2026-10-22 22:59:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by GabrielKLBr on 2026-10-22T22:59:50Z.


What

Implement five previously throwing exports in libSceLibreSsl:

Function NID
UI_create_method tq1e1kFa2s8
UI_destroy_method L6H3T7sBP5U
UI_method_set_opener 1OlYGRE3vcY
UI_method_get_opener FAKxcUW+Pqk
UI_method_set_writer uQ4HFlHUJy0

Implementation

Methods own a copied optional name and initially empty callback slots. Setters store, replace or clear guest System V callback pointers without invoking them; the opener getter returns the stored pointer. Null setters return -1 and a null opener query returns null. Destruction releases the name and method. A failed method allocation returns null. In LibreSSL 2.5.4, a failed name copy still returns the allocated, usable method with a null name; the implementation and allocation-failure tests preserve that behavior. Null destruction throws through NotImplemented_nid_no_patch rather than reproducing the reference's invalid dereference.

No new third-party dependency or additional exported symbol is introduced. Existing export names and NIDs stay unchanged. The 56-byte reference layout and callback offsets have compile-time checks.

Evidence

  • Names and NIDs: PS5 3.20 export inventory, independently checked against tools/nid_names.py's algorithm.
  • Behavior: LibreSSL 2.5.4 ui_lib.c, ui.h and ui_locl.h.
  • Version selection: another contributor's console observations report LibreSSL 2.5.4 in libSceLibreSsl on firmware 13.40. That is supporting evidence, not a hardware test performed for this contribution. These five UI APIs have not been measured on PS5 here.

Technical debt

docs/dev/debt/libSceLibreSsl.md records the unmeasured PS5 UI signatures/layout/behavior, the deliberate null-destruction throw, and the remaining allocator/consumer integration limitations. The wholly unknown export count changes from 377 to 372 after rebasing onto the merged digest implementation (#9025). Other UI exports retain their throwing behavior.

Selection and overlap

A source-tree scan enumerated libraries with at least five actual throwing exports. Investigated candidates included libkernel_sys, libScePosixForWebKit, libSceCesCs, libSceUlt, libSceNet, libSceHttp, libSceSsl, libSceAudioPropagation, libSceFontFt, libSceRudp, libSceUsbd and libSceVorbisDec. Existing implementations in open PRs, unresolved contracts, title-shipped wrapper restrictions and scope removed those candidates. secrets.choice was used on the qualified set, which contained only libSceLibreSsl; this was not a multi-library lottery.

The official authenticated overlap checker completed successfully against main at 24c6cc33f090296ab90dc154abdfb9ef548fc923, with no shared exports. It reports a textual test-registration conflict with #9355; neither change builds on the other. When either lands, preserve both test blocks while rebasing the other. Several older PRs already conflict with main, so their shared CMake/source/debt files cannot be compared automatically. I inspected the affected CMake additions for UI test target collisions and verified that all five UI functions remain throwing stubs in #9033, #9041, #9047, #9446, #9448, #9529, #9571, #9745 and #9870. The same functions were absent from the inspected patches of the 15 relevant LibreSSL PRs in the initial 1,290-PR inventory. No other contributor was messaged.

This branch incorporates #9025's existing digest code through main; the PR itself still implements exactly five UI exports in one library. The debt-count conflict from that merge was resolved by preserving its digest entry and subtracting five from 377. There is no pending implementation dependency. Shared includes/count lines can need textual rebases whichever independent LibreSSL PR lands first.

Tested

Linux Mint 22.3 x86-64, GCC/G++ 13.3.0, CMake 3.28.3, Ninja 1.11.1, Python 3.12.3, Release and BUILD_TESTING=ON.

  • Configure: PATH=/home/gabri/.local/share/anyps5-tools/usr/bin:$PATH cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON -DCMAKE_PREFIX_PATH=/home/gabri/.local/share/anyps5-tools/usr — passed.
  • CPATH=/home/gabri/.local/share/anyps5-tools/usr/include cmake --build build --parallel 8 — passed, exit 0.
  • CPATH=/home/gabri/.local/share/anyps5-tools/usr/include cmake --build build --target libs --parallel 8 — passed, exit 0.
  • ctest --test-dir build -R '^guest_libressl_ui' --output-on-failure — both new tests passed, 0.14 seconds total in the final focused run.
  • PATH=/home/gabri/.local/share/anyps5-tools/usr/bin:$PATH VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json CTEST_PARALLEL_LEVEL=4 ctest --test-dir build --output-on-failure — exit 0, 1,764 passed, 85 skipped, 0 failed out of 1,849; 88.03 seconds on final commit a12622b6e42b5a1359aba721e8106955d65917ee (base 24c6cc33f090296ab90dc154abdfb9ef548fc923). llvmpipe/LLVM 20.1.2, Mesa 25.2.8; unsupported feature/display tests skipped.
  • Initial host-GPU full run: 1,792 passed, 46 skipped, 9 failed, exit 8, 100.91 seconds. shader_cache_runtime_sources failed because my runner PATH omitted local Ninja; correcting PATH fixed it. Eight graphics tests failed on AMD Radeon RX 580 2048SP / RADV POLARIS10, Mesa 25.2.8, with numerical/sample-location differences or guest-memory import unavailable (/dev/udmabuf permission denied). No permissions were changed and these GPU failures are not claimed fixed.
  • PATH=/home/gabri/.local/share/anyps5-tools/usr/bin:$PATH VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json CTEST_PARALLEL_LEVEL=4 ctest --test-dir build --rerun-failed --output-on-failure — exit 0, 8 passed and 1 feature skip; 7.78 seconds.
  • python3 tools/check_conventions.py --base upstream/main — passed without findings. Legacy --base origin/main also passed.
  • PATH=/home/gabri/.local/share/anyps5-tools/usr/bin:$PATH python3 tools/check_compile.py --build build --jobs 2 --base upstream/main — 2 changed translation units compile.
  • git diff --check upstream/main...HEAD — clean; final working tree clean.
  • Standalone final-source AddressSanitizer/UndefinedBehaviorSanitizer/leak checks and linker-wrapped allocation-failure tests — passed. Initial object allocation failure returns null; name-only allocation failure preserves a usable unnamed object, as 2.5.4 does.
  • Five deliberately broken implementations — all detected by behavioral assertions.
  • Direct oracle using the unmodified five LibreSSL 2.5.4 functions — 1,000 callback operations, five name cases and null setter/getter behavior matched. Native null destruction was not invoked.
  • Baseline/changed dynamic exports — identical symbol sets; actual patched library behavior passed when loaded by all five NIDs.

These are local host tests. No PS5, title or homebrew was tested. Compiler/linker warnings observed were in unchanged kernel, graphics and glslang sources.

Local dependencies added: official Ubuntu ninja-build, gh, libxrandr-dev, libxext-dev, libxrender-dev, libpthread-stubs0-dev, unpacked to a user-owned prefix because system installation needs a password. Git was unchanged. Default submodules initialized recursively; no new repository dependency.

python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch feat/libressl-five-ui-functions --jobs 2 — passed, exit 0, using the existing authorized Git credential without exposing or storing it. Output and manual follow-up are summarized above. The initial unauthenticated CLI attempt failed; an anonymous public-API run completed, a later anonymous refresh hit the rate limit, and the final authenticated run completed normally.

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; the contributor remains responsible for every line
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4975270486 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9942). Originally posted by [GabrielKLBr](https://github.com/GabrielKLBr) on 2026-10-22T22:59:50Z. --- ### What Implement five previously throwing exports in `libSceLibreSsl`: | Function | NID | | --- | --- | | `UI_create_method` | `tq1e1kFa2s8` | | `UI_destroy_method` | `L6H3T7sBP5U` | | `UI_method_set_opener` | `1OlYGRE3vcY` | | `UI_method_get_opener` | `FAKxcUW+Pqk` | | `UI_method_set_writer` | `uQ4HFlHUJy0` | #### Implementation Methods own a copied optional name and initially empty callback slots. Setters store, replace or clear guest System V callback pointers without invoking them; the opener getter returns the stored pointer. Null setters return -1 and a null opener query returns null. Destruction releases the name and method. A failed method allocation returns null. In LibreSSL 2.5.4, a failed name copy still returns the allocated, usable method with a null name; the implementation and allocation-failure tests preserve that behavior. Null destruction throws through `NotImplemented_nid_no_patch` rather than reproducing the reference's invalid dereference. No new third-party dependency or additional exported symbol is introduced. Existing export names and NIDs stay unchanged. The 56-byte reference layout and callback offsets have compile-time checks. #### Evidence - Names and NIDs: [PS5 3.20 export inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceLibreSsl.c), independently checked against `tools/nid_names.py`'s algorithm. - Behavior: LibreSSL 2.5.4 [ui_lib.c](https://github.com/libressl/openbsd/blob/2e2c612066aa993717528a0249c15c51128d61cb/src/lib/libcrypto/ui/ui_lib.c), [ui.h](https://github.com/libressl/openbsd/blob/2e2c612066aa993717528a0249c15c51128d61cb/src/lib/libcrypto/ui/ui.h) and [ui_locl.h](https://github.com/libressl/openbsd/blob/2e2c612066aa993717528a0249c15c51128d61cb/src/lib/libcrypto/ui/ui_locl.h). - Version selection: another contributor's [console observations](https://github.com/boykopovar/AnyPS5/discussions/8981#discussioncomment-19111214) report LibreSSL 2.5.4 in libSceLibreSsl on firmware 13.40. That is supporting evidence, not a hardware test performed for this contribution. These five UI APIs have not been measured on PS5 here. #### Technical debt `docs/dev/debt/libSceLibreSsl.md` records the unmeasured PS5 UI signatures/layout/behavior, the deliberate null-destruction throw, and the remaining allocator/consumer integration limitations. The wholly unknown export count changes from 377 to 372 after rebasing onto the merged digest implementation (#9025). Other UI exports retain their throwing behavior. #### Selection and overlap A source-tree scan enumerated libraries with at least five actual throwing exports. Investigated candidates included libkernel_sys, libScePosixForWebKit, libSceCesCs, libSceUlt, libSceNet, libSceHttp, libSceSsl, libSceAudioPropagation, libSceFontFt, libSceRudp, libSceUsbd and libSceVorbisDec. Existing implementations in open PRs, unresolved contracts, title-shipped wrapper restrictions and scope removed those candidates. `secrets.choice` was used on the qualified set, which contained only libSceLibreSsl; this was not a multi-library lottery. The official authenticated overlap checker completed successfully against `main` at `24c6cc33f090296ab90dc154abdfb9ef548fc923`, with no shared exports. It reports a textual test-registration conflict with #9355; neither change builds on the other. When either lands, preserve both test blocks while rebasing the other. Several older PRs already conflict with main, so their shared CMake/source/debt files cannot be compared automatically. I inspected the affected CMake additions for UI test target collisions and verified that all five UI functions remain throwing stubs in #9033, #9041, #9047, #9446, #9448, #9529, #9571, #9745 and #9870. The same functions were absent from the inspected patches of the 15 relevant LibreSSL PRs in the initial 1,290-PR inventory. No other contributor was messaged. This branch incorporates #9025's existing digest code through main; the PR itself still implements exactly five UI exports in one library. The debt-count conflict from that merge was resolved by preserving its digest entry and subtracting five from 377. There is no pending implementation dependency. Shared includes/count lines can need textual rebases whichever independent LibreSSL PR lands first. ### 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. --> Linux Mint 22.3 x86-64, GCC/G++ 13.3.0, CMake 3.28.3, Ninja 1.11.1, Python 3.12.3, Release and `BUILD_TESTING=ON`. - Configure: `PATH=/home/gabri/.local/share/anyps5-tools/usr/bin:$PATH cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON -DCMAKE_PREFIX_PATH=/home/gabri/.local/share/anyps5-tools/usr` — passed. - `CPATH=/home/gabri/.local/share/anyps5-tools/usr/include cmake --build build --parallel 8` — passed, exit 0. - `CPATH=/home/gabri/.local/share/anyps5-tools/usr/include cmake --build build --target libs --parallel 8` — passed, exit 0. - `ctest --test-dir build -R '^guest_libressl_ui' --output-on-failure` — both new tests passed, 0.14 seconds total in the final focused run. - `PATH=/home/gabri/.local/share/anyps5-tools/usr/bin:$PATH VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json CTEST_PARALLEL_LEVEL=4 ctest --test-dir build --output-on-failure` — exit 0, 1,764 passed, 85 skipped, 0 failed out of 1,849; 88.03 seconds on final commit `a12622b6e42b5a1359aba721e8106955d65917ee` (base `24c6cc33f090296ab90dc154abdfb9ef548fc923`). llvmpipe/LLVM 20.1.2, Mesa 25.2.8; unsupported feature/display tests skipped. - Initial host-GPU full run: 1,792 passed, 46 skipped, 9 failed, exit 8, 100.91 seconds. `shader_cache_runtime_sources` failed because my runner PATH omitted local Ninja; correcting PATH fixed it. Eight graphics tests failed on AMD Radeon RX 580 2048SP / RADV POLARIS10, Mesa 25.2.8, with numerical/sample-location differences or guest-memory import unavailable (`/dev/udmabuf` permission denied). No permissions were changed and these GPU failures are not claimed fixed. - `PATH=/home/gabri/.local/share/anyps5-tools/usr/bin:$PATH VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json CTEST_PARALLEL_LEVEL=4 ctest --test-dir build --rerun-failed --output-on-failure` — exit 0, 8 passed and 1 feature skip; 7.78 seconds. - `python3 tools/check_conventions.py --base upstream/main` — passed without findings. Legacy `--base origin/main` also passed. - `PATH=/home/gabri/.local/share/anyps5-tools/usr/bin:$PATH python3 tools/check_compile.py --build build --jobs 2 --base upstream/main` — 2 changed translation units compile. - `git diff --check upstream/main...HEAD` — clean; final working tree clean. - Standalone final-source AddressSanitizer/UndefinedBehaviorSanitizer/leak checks and linker-wrapped allocation-failure tests — passed. Initial object allocation failure returns null; name-only allocation failure preserves a usable unnamed object, as 2.5.4 does. - Five deliberately broken implementations — all detected by behavioral assertions. - Direct oracle using the unmodified five LibreSSL 2.5.4 functions — 1,000 callback operations, five name cases and null setter/getter behavior matched. Native null destruction was not invoked. - Baseline/changed dynamic exports — identical symbol sets; actual patched library behavior passed when loaded by all five NIDs. These are local host tests. No PS5, title or homebrew was tested. Compiler/linker warnings observed were in unchanged kernel, graphics and glslang sources. Local dependencies added: official Ubuntu `ninja-build`, `gh`, `libxrandr-dev`, `libxext-dev`, `libxrender-dev`, `libpthread-stubs0-dev`, unpacked to a user-owned prefix because system installation needs a password. Git was unchanged. Default submodules initialized recursively; no new repository dependency. `python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch feat/libressl-five-ui-functions --jobs 2` — passed, exit 0, using the existing authorized Git credential without exposing or storing it. Output and manual follow-up are summarized above. The initial unauthenticated CLI attempt failed; an anonymous public-API run completed, a later anonymous refresh hit the rate limit, and the final authenticated run completed normally. ### 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 <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes; the contributor remains responsible for every line <!-- yes / no -->
MarcZX10 commented 2026-10-23 05:45:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:45:03Z.

Review: APPROVED


Reviewed exact head a12622b6e42b5a1359aba721e8106955d65917ee against current main 0db47b263d1019043f7d28fad4e7ee0a1ea5ec6a. Current-main git diff --check and conventions pass. The PR reports focused UI tests, allocation-failure and sanitizer checks, successful patched-NID loading, and a full lavapipe suite (1,764 pass, 85 skipped); I did not rerun the C++ suite locally. The PS5 UI ABI/behavior is explicitly recorded as unmeasured, and the implementation follows the pinned LibreSSL 2.5.4 reference while preserving the documented null-destroy difference. Current-main sync is clean; only core/libs/CMakeLists.txt changed on both sides, so preserve this UI test registration when resolving it. I found no overlapping implementation of these five exports in the current open PRs or a substantive defect in the reviewed code/evidence.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624397265 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9942#pullrequestreview-5624397265). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T05:45:03Z. **Review:** APPROVED --- Reviewed exact head `a12622b6e42b5a1359aba721e8106955d65917ee` against current main `0db47b263d1019043f7d28fad4e7ee0a1ea5ec6a`. Current-main `git diff --check` and conventions pass. The PR reports focused UI tests, allocation-failure and sanitizer checks, successful patched-NID loading, and a full lavapipe suite (1,764 pass, 85 skipped); I did not rerun the C++ suite locally. The PS5 UI ABI/behavior is explicitly recorded as unmeasured, and the implementation follows the pinned LibreSSL 2.5.4 reference while preserving the documented null-destroy difference. Current-main sync is clean; only `core/libs/CMakeLists.txt` changed on both sides, so preserve this UI test registration when resolving it. I found no overlapping implementation of these five exports in the current open PRs or a substantive defect in the reviewed code/evidence.

Pull request closed

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!9942
No description provided.