Skip to content

feat(libSceLibreSsl3): implement custom BIO methods and field accessors - #14890

Closed
Noxy-HNR wants to merge 14 commits into
boykopovar:mainfrom
Noxy-HNR:codex/libressl3-bio-methods
Closed

Noxy-HNR wants to merge 14 commits into
boykopovar:mainfrom
Noxy-HNR:codex/libressl3-bio-methods

Conversation

@Noxy-HNR

@Noxy-HNR Noxy-HNR commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What

Implement 14 newly named LibreSSL3 BIO exports: method allocation/free, write/read/control/create/destroy callback installation, and data/init/shutdown/flag accessors.

The 80-byte method and 112-byte BIO layouts follow LibreSSL 4.0.0 bio_local.h, with behavior from bio_meth.c and bio_lib.c. Methods use the application heap and borrow their names. Callback pointers retain the guest System V ABI, and control arguments/results use 64-bit guest long on Windows. Null objects that upstream dereferences throw.

This supplies the method/field API, without implementing BIO construction, chaining or network I/O. BunnyFl's firmware 13.42 disassembly review confirms the method size/allocation and the field offsets these 14 exports touch. Other firmware and complete construction, chaining and I/O remain unverified; older libSceLibreSsl BIO objects require a bridge before use with these layouts. These limits are recorded in the library's debt file; no title unblock is claimed.

Tested

Current-head verification (6aa57fb3d42b700347cfda91768bbd45ab536e82): merged upstream main 9b0fdbfb24, preserving maintainer merge 6e2564e106. Only the debt inventory needed manual resolution: 131 remaining stubs (121 named, 10 unknown); BIO implementation, layout header and tests are unchanged. Windows x86-64, WinLibs GCC 15.2.0/Ninja, Release, full configuration (BUILD_TESTING=ON, relinker-only OFF): focused guest_libressl3_bio_tests target built with -j 18; guest_libressl3_bio passed three runs. Conventions and whitespace checks pass. Independent different-model static and validation-log review found no substantive issues. Fresh automatic Build run is queued for this exact head; no hosted pass is claimed. Full-build dispatch was attempted and rejected with HTTP 403 (admin rights required), so maintainer dispatch is pending. No full suite, Linux, console or title run was performed for this head.

Historical local verification (cefbec3c32): merged main ad8e79fd81 without force-pushing. Only the debt document required manual resolution; the BIO implementation, layout header and regression test are unchanged. The remaining-export inventory matches 146 rows (136 named and 10 unknown), retaining main's three session-metadata removals. Windows 11 x86-64, WinLibs GCC 15.2.0/Ninja, Release, -j 18: BIO, ASN.1, ASN.1 string, key reference, stack, time and session-metadata CTests all passed in each of three runs. Current conventions and whitespace checks pass. New hosted checks are running.

Historical local verification (d7ba0ad6e3): merged main 6beaeef052 without force-pushing; the only manual conflict resolution was the debt inventory. The BIO implementation, layout header and regression test are unchanged. Windows 11 x86-64, WinLibs GCC 15.2.0/Ninja, Release, -j 18: rebuilt the real module and six related targets; BIO, ASN.1, ASN.1 string, key reference, stack and time CTests all passed in each of three runs. Conventions and whitespace checks pass. Current-head hosted checks are pending.

Historical hosted verification (a94dbfe749): the Windows changed-test job passed; guest_libressl3_bio, ASN.1, stack and time tests passed. The job reports zero failures among 3,337 selected CTest entries, including skipped entries. Its log identifies this exact PR head. This is not a fresh full Linux run; earlier local and Linux results below retain their stated commits and scope.

Latest rebase verification on November 2 (ba5711574d, based on main at f6232fcfda): resolved the debt conflict while retaining main's new time entry and the attributed firmware 13.42 evidence. The BIO implementation, layout header and test source are byte-for-byte unchanged from 4300582b7f. Windows 11 x86-64, WinLibs GCC 15.2.0, Release: rebuilt BIO, ASN.1, allocator, stack, time and filesystem targets; 7/7 focused tests passed (guest_libressl3_bio, guest_libressl3_asn1, guest_libressl_asn1, guest_libressl_asn1_allocator, guest_libressl3_stack, guest_libressl3_time, guest_filesystem). The public-header audit passes for 405 libraries / 27,952 exports; current conventions, whitespace and the current-main merge preview pass. The automatic Windows job subsequently passed on this head: 2,074 tests executed and passed, 959 skipped, zero failures across 3,033 selected CTest entries. BIO, both ASN.1 decoders, the allocator case, stack, time and filesystem all ran and passed. This is a changed-test workflow, not the separate full build requested in the follow-up. At that historical run, #14889 and #12945 were open. #12945 has since merged; #14889 remains the declared integration prerequisite.

Prior verification on November 2: Windows 11 x86-64, WinLibs MinGW GCC 15.2.0, Release. Rebuilt the BIO, ASN.1, stack and filesystem targets on 4300582b7f: 4/4 passed. The same four tests pass on a clean local merge with main at b28bb77217 (tree 274bbd6f9973a8202acbd8aeb6887b7bad85d294). Clean main's filesystem test also passes.

The earlier hosted Windows job failed only guest_filesystem among 2,936 selected tests (exit 0xc0000409); BIO passed. After the PR was closed and reopened, the fresh Windows job passed at the previous head, 4300582b7f. The original failure was not reproduced or attributed to a specific cause. BunnyFl's re-approval applies to that previous head and reports passing BIO, public-header and filesystem checks. The rebased head still needs fresh hosted verification; the current local results are above.

Original verification:

Windows 11 x86-64, WinLibs MinGW GCC 15.2.0, Release, on an independent branch from upstream 0580e5c951 with BUILD_TESTING=ON. The ASN.1 value contribution was absent from this build.

  • Built guest_libressl3_bio_tests, guest_libressl3_asn1_tests and guest_libressl3_stack_tests through CMake.

  • ctest --test-dir <build> -R '^guest_libressl3_(bio|stack|asn1)$' --output-on-failure: 3/3 passed.

  • The new runtime test installs and calls guest write/read/control/create/destroy callbacks, transfers binary data, and checks a control value/result wider than 32 bits. It checks zero initialization, null callback replacement, borrowed names, allocation failure, exact field writes with surrounding guards, signed int values/flag masks and null-object exceptions. Method free does not invoke callbacks.

  • python core/libs/tests/test_public_headers.py --audit-only: 399 libraries / 26,743 exports passed.

  • python tools/check_conventions.py --base origin/main and git diff --check: passed.

  • nid_patcher successfully patched a copy of the resulting PRX with the libc export-preservation option.

Historical head ba5711574d is rebased onto f6232fcfda and merges cleanly with that main. The conflict resolution changes debt text only; no BIO implementation, layout or test behavior changed. The older results below retain their measured bases; hosted results are not being carried forward as validation of the new head.

No Linux, console or retail-title runtime test was performed. The full project build/test suite was not run.

tools/pr_overlap.py --repo boykopovar/AnyPS5 --base main --branch HEAD was rerun against 1,778 open PRs. It returned exit 2 because several other heads conflict with main, so this is not an automatic overlap pass. Shared declarations, build registrations and debt diffs were inspected manually for #10461, #10631, #10960, #11146, #12754, #13486, #14212, #14483, #14499, #14612, #14992, #15031, #15045 and #15119, along with the adjacent-edit findings. No other implementation of these 14 exports was found; the report also compares this local rebase against this PR's own previous head. Other PRs still touch shared debt/build/declaration files, so integration may require another rebase as those land. Companion #14889 implements a separate ASN.1 API. The two new heads still conflict in AdditionalExports.cpp and Api.hpp, so #14889 remains first and this BIO PR must be rebased afterward. There is no runtime dependency between those features.

#12945 (BIO_up_ref) is now merged into main and included here. This branch reuses the single 112-byte LibreSsl3Bio declaration in include/Key.hpp; include/Bio.hpp includes it and only defines the method/callback types and field assertions. The duplicate-layout integration work is complete, and the refreshed key-reference and BIO tests pass. #14889 remains the declared integration-order prerequisite.

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: feat(libSceLibreSsl3): implement ASN.1 value mutation and octet lifetime #14889

  • Fixes: none

  • Unblocks: none

  • GPUs tested: n/a

  • AI-assisted: yes

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Progress report (6c1efc7 → 92efe81)

📈 System libraries: 31.61% (+0.04%, +14 implemented functions)

✅ 14 implemented
Library Name
libSceLibreSsl3 BIO_clear_flags_nid_postfix
libSceLibreSsl3 BIO_get_data_nid_postfix
libSceLibreSsl3 BIO_get_shutdown_nid_postfix
libSceLibreSsl3 BIO_meth_free_nid_postfix
libSceLibreSsl3 BIO_meth_new_nid_postfix
libSceLibreSsl3 BIO_meth_set_create_nid_postfix
libSceLibreSsl3 BIO_meth_set_ctrl_nid_postfix
libSceLibreSsl3 BIO_meth_set_destroy_nid_postfix
libSceLibreSsl3 BIO_meth_set_read_nid_postfix
libSceLibreSsl3 BIO_meth_set_write_nid_postfix
libSceLibreSsl3 BIO_set_data_nid_postfix
libSceLibreSsl3 BIO_set_flags_nid_postfix
libSceLibreSsl3 BIO_set_init_nid_postfix
libSceLibreSsl3 BIO_set_shutdown_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl3 86/284 (30.28%) 100/284 (35.21%) +4.93%

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 16529 BIO_clear_flags
BIO_get_data
BIO_get_shutdown
BIO_meth_free
BIO_meth_new
BIO_meth_set_create
BIO_meth_set_ctrl
BIO_meth_set_destroy
BIO_meth_set_read
BIO_meth_set_write
BIO_set_data
BIO_set_flags
BIO_set_init
BIO_set_shutdown
core/libs/prx/libSceLibreSsl3/tests/Bio.cpp

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 12315 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 14212 docs/dev/debt/libSceLibreSsl3.md
PR 14465 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15163 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15514 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15544 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15591 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 15831 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16529 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
core/libs/prx/libSceLibreSsl3/tests/Bio.cpp
docs/dev/debt/libSceLibreSsl3.md
PR 16535 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16539 core/libs/prx/libSceLibreSsl3/include/Api.hpp
PR 16543 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16586 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16589 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16654 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16655 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
docs/dev/debt/libSceLibreSsl3.md
PR 16659 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16689 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16690 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16708 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16742 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16819 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16848 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16918 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16926 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16977 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16979 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16980 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16981 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 16996 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17067 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17068 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17124 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17138 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17142 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17147 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17148 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17235 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17236 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17237 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17239 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17240 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17241 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17242 core/libs/prx/libSceLibreSsl3/CMakeLists.txt
docs/dev/debt/libSceLibreSsl3.md
PR 17243 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17246 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17249 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17250 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17299 docs/dev/debt/libSceLibreSsl3.md
PR 17303 docs/dev/debt/libSceLibreSsl3.md
PR 17528 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17544 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17621 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17622 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 17626 core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp
core/libs/prx/libSceLibreSsl3/CMakeLists.txt
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md

@BunnyFl BunnyFl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right, and the layouts match the PS5 module, not only LibreSSL 4.0.0.

Firmware 13.42's system/common/lib/libSceLibreSsl3.sprx (sha256 ee2c529c87fe21b7ef1e5f13d10c47ee90944f52a1f848fe0995e031817c2c3a), disassembly only:

Export 13.42 This PR
BIO_meth_new (0x59d60) calloc(1, 0x50) 80-byte method, calloc_nid_postfix(1, …)
BIO_meth_free (0x59d90) tail call to free free_nid_postfix
BIO_meth_set_write/read/ctrl/create/destroy store at +0x10/+0x18/+0x30/+0x38/+0x40, return 1 write/read/control/create/destroy at the same offsets, return 1
BIO_set_init (0x5c410) mov [rdi+0x20], esi initialized at 0x20
BIO_get_shutdown/set_shutdown [rdi+0x24] shutdown at 0x24
BIO_set_flags/clear_flags or [rdi+0x28], esi / and [rdi+0x28], ~esi flags at 0x28
BIO_get_data/set_data (0x5c3e0/0x5c3f0) [rdi+0x38] data at 0x38

None of the 13.42 accessors checks for null, so throwing on a null object is the documented divergence from a fault, as the entry says.

Tested on Windows 11, WinLibs GCC 15.2.0, Release, with head 10cc291ea8 merged onto main: guest_libressl3_bio, public_headers and check_conventions.py --base upstream/main pass.

Non-blocking: the debt entry says the console layout is unverified. The table above settles the offsets these 14 exports touch for 13.42, so that part could be narrowed to what's still open (construction, chaining, I/O, and the bridge from the older libSceLibreSsl BIOs).

@Noxy-HNR

Noxy-HNR commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@BunnyFl thanks for checking this against 13.42, that's really useful. I've narrowed the debt entry in 4300582b7f. It now cites your disassembly for the method size, allocation and every offset these 14 exports touch, and it leaves open only other firmware and BIO construction, chaining and I/O (plus the bridge to the older libSceLibreSsl BIOs). The code is unchanged and the conventions checks pass.

@Noxy-HNR

Noxy-HNR commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@EagleBearerYS I rechecked #12945 against this branch. The textual merge preview is clean, but both branches define LibreSsl3Bio: yours in include/Key.hpp and this one in include/Bio.hpp. Their shared offsets agree, but retaining both definitions would break consumers that include both headers.

I've added Depends on: #12945 alongside #14889, so this PR defers to yours. Once the prerequisites land, this branch will reuse the shared BIO declaration and rerun the BIO and related tests. Please let me know if that order conflicts with your plans.

The description also now reflects BunnyFl's firmware 13.42 disassembly review and the debt update in 4300582b7f.

@EagleBearerYS

Copy link
Copy Markdown
Contributor

@Noxy-HNR thanks for checking, and that order works for us. #12945's LibreSsl3Bio in include/Key.hpp is 112 bytes, and the offsets your Bio.hpp asserts match it: initialized at 32, shutdown at 36, flags at 40, data at 56 and the last field at 104 (exData there, extraData in yours). We don't plan to change that layout.

@Noxy-HNR

Noxy-HNR commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

@oneandonlydean @BunnyFl the latest Windows job failed in guest_filesystem with exit code 0xc0000409. That is the only failure among its 2,936 selected tests; guest_libressl3_bio passed in the same run.

I checked this locally on Windows 11, WinLibs GCC 15.2.0, Release:

  • Clean main at b28bb77217: guest_filesystem passes.
  • PR head 4300582b7f: BIO, ASN.1, stack and filesystem tests pass, 4/4.
  • A clean local merge of those two exact heads (tree 274bbd6f9973a8202acbd8aeb6887b7bad85d294): the same four tests pass, 4/4. The filesystem test, its temporary-file helper, libc and libkernel have no changes relative to main in that combined tree.

I have not reproduced the hosted filesystem failure, so I am leaving it recorded as unresolved rather than attributing a cause. My attempt to rerun the failed job was denied for lack of repository rights. Could a maintainer rerun the failed Windows job, or investigate it on the runner if it repeats?

@BunnyFl BunnyFl left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited 2026-11-05: corrected. The first version of this review said guest_filesystem had passed 25 repeated runs alone and 15 in parallel on main; those runs left no log, so that line is removed and the repeats were redone below. It also misdescribed the hosted log (more output follows the junctions, quoted below), and it called the hosted abort "runner-side or flaky" without having tested any cause. I don't know what caused it.

Re-approving at 4300582b7f. From 10cc291ea8 (my first review) to 4300582b7f, git diff --stat shows one changed line, in docs/dev/debt/libSceLibreSsl3.md. Its new wording matches what the 13.42 disassembly showed: method size 0x50 through calloc, and the offsets of the five setters and seven accessors.

Run on 2026-11-02, Windows 11, WinLibs GCC 15.2.0, head 4300582b7f merged onto main a4eca2a056: guest_libressl3_bio, public_headers and guest_filesystem passed, one run each.

Rerun on 2026-11-05 at the current head ba5711574d merged onto main 6a337633c6, Windows 11 Pro 10.0.26300, WinLibs GCC, Release, with guest_libressl3_bio_tests and guest_filesystem_tests rebuilt before each run:

  • guest_libressl3_bio, public_headers and guest_filesystem pass, one run each.
  • guest_filesystem with ctest --repeat until-fail:25: 25 of 25 pass on the merge, and 25 of 25 on main 6a337633c6.

The hosted abort (job 125404179173 of run 41482291203, head 4300582b7f): guest_filesystem exits with 0xc0000409. These are the log's last lines before the abort:

Junction created for anyps5-filesystem-test-2211850804800\junction-full <<===>> anyps5-filesystem-test-2211850804800\junction-full-target
[src/Open.cpp:345 sceKernelOpen] path=anyps5-filesystem-test-2211850804800\present.txt flags=0x0 nativeFlags=0x8000 mode=00
... (24 more sceKernelOpen lines on present.txt, missing.txt and the test directory)
[src/Open.cpp:345 sceKernelOpen] path=/ flags=0x20000 nativeFlags=0x8000 mode=00
[src/Open.cpp:345 sceKernelOpen] path=. flags=0x20000 nativeFlags=0x8000 mode=00
FATAL: abort() (SIGABRT) on thread 3628

I haven't reproduced it on this machine in the runs above.

AI-assisted: yes (Claude Code)

@Noxy-HNR Noxy-HNR closed this Nov 2, 2026
@Noxy-HNR Noxy-HNR reopened this Nov 2, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
@Noxy-HNR
Noxy-HNR force-pushed the codex/libressl3-bio-methods branch from 4300582 to ba57115 Compare November 3, 2026 05:05
@Noxy-HNR

Noxy-HNR commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main at f6232fcfda; the new head is ba5711574d. This resolves the debt conflict and preserves the firmware 13.42 evidence. The BIO implementation, layout header and test source are unchanged from the previously approved 4300582b7f.

Windows 11, WinLibs GCC 15.2.0, Release: rebuilt the relevant targets and passed 7/7 tests (BIO, both ASN.1 decoders, the allocator case, stack, time and filesystem). The public-header audit passes for 405 libraries / 27,952 exports. Current conventions, whitespace and the current-main merge preview pass. The description also now records the successful hosted rerun at the previous head, rather than calling it pending.

Could a maintainer review the rebase and start a fresh full Build run on main with pr=14890? Please run it separately from #14889: those two heads still conflict in the shared export/declaration files.

The agreed order after #14889 and #12945 remains unchanged. I rechecked #12945 at e44bf06eab: its Key.hpp and this branch's Bio.hpp still define the same BIO type. Once those prerequisites land, this PR needs another rebase, one shared type declaration, and the focused tests rerun. No other authors' changes have been merged into this branch.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 3, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 6, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 6, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 6, 2026
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 6, 2026
# Conflicts:
#	docs/dev/debt/libSceLibreSsl3.md
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 6, 2026
# Conflicts:
#	docs/dev/debt/libSceLibreSsl3.md
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 7, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @Noxy-HNR, thanks for merging main. We merged the latest main on top (merge commit 6e2564e) after #15303 landed. The conflicts were all in stub blocks: your BIO implementations in src/Bio.cpp stay as they are, and the stubs main had implemented (tls_config_error and the tls_close/tls_client/tls_server table rows) or moved (tls_config_set_cert_mem) follow main. In docs/dev/debt/libSceLibreSsl3.md the additional exports line now reads 132 still-unimplemented callable exports (122 named, 10 known only by NID), recounted on the merged tree, since both sides removed different stubs. Nothing else in your changes was touched. Thanks!

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @Noxy-HNR, thanks for this. Pull request #14889 landed on main, so we merged current main into your branch again (merge commit 9baeb82); you don't need to do anything. The conflicts were adjacent stub entries: the stubs both sides had implemented (BIO_set_shutdown, ASN1_STRING_set) are dropped, and your BIO implementations stay as they are. In docs/dev/debt/libSceLibreSsl3.md the additional exports line now reads 127 still-unimplemented callable exports (117 named, 10 known only by NID), recounted on the merged tree and matching the stub table. Nothing else in your changes was touched; the LibreSsl3 tests pass on the merged tree.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @Noxy-HNR,

Main moved again (#15449 changed the same LibreSsl3 debt count), so we merged current main into your branch once more (92efe81). The count is recounted from the merged code: 126 = 116 named + 10 NID-only. Your code is otherwise unchanged; the 36 LibreSsl3 tests pass locally, and Windows CI is running again on the new head. Thanks for your patience.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 7, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi @Noxy-HNR, thanks for the BIO_meth_* work. One change before this can merge: could you drop the seven BIO field accessors (BIO_get_data, BIO_set_data, BIO_set_init, BIO_get_shutdown, BIO_set_shutdown, BIO_set_flags and BIO_clear_flags) and keep the BIO_meth_* functions?

The accessors read and write the fields at the LibreSSL 4.0.0 offsets from your LibreSsl3Bio (initialized 32, shutdown 36, flags 40, data 56). A BIO that reaches them is not built with that layout: BIO_new in libSceLibreSsl3 is only a forward to libSceLibreSsl's BIO_new (core/libs/prx/libSceLibreSsl3/ParentExports.cpp lines 189-190), so the object is libSceLibreSsl's Bio, where the same fields sit 8 bytes earlier (initialized 24, shutdown 28, flags 32, data 48; core/libs/prx/libSceLibreSsl/include/Bio.hpp). With your offsets BIO_set_init would write that object's flags field and BIO_get_data and BIO_set_data would read and write its next pointer, with no error.

Pull request #15760 implements the same seven accessors on libSceLibreSsl's layout, so nothing is lost by removing them here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants