Skip to content

feat(libressl3): retain SSL_CTX references - #12578

Closed
PrivacyOnion wants to merge 1 commit into
boykopovar:mainfrom
PrivacyOnion:feat/libressl3-ssl-ctx-up-ref
Closed

PrivacyOnion wants to merge 1 commit into
boykopovar:mainfrom
PrivacyOnion:feat/libressl3-ssl-ctx-up-ref

Conversation

@PrivacyOnion

@PrivacyOnion PrivacyOnion commented Oct 28, 2026 •

Copy link
Copy Markdown

What

Implement SSL_CTX_up_ref in libSceLibreSsl3 by atomically incrementing the reference counter at offset 40 of LibreSsl3SslCtx, following the LP64 struct ssl_ctx_st layout in LibreSSL 4.0.0 (ssl_lib.c#L2244-L2248). Null pointers and counter overflow throw std::invalid_argument and std::overflow_error without mutation.

Tested

Windows 11, verified sequential and concurrent retain semantics, boundary return values and layout integrity with guest_libressl3_key_reference.

Ran locally on 00b24c75b4:

$ ctest --test-dir build -R '^guest_libressl3_key_reference$' --output-on-failure
    Start 2034: guest_libressl3_key_reference
1/1 Test #2034: guest_libressl3_key_reference ....   Passed    0.01 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.14 sec

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

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Progress report (f7f03da → ced92ec)

📈 System libraries: 43.42% (+0.0063%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceLibreSsl3 SSL_CTX_up_ref_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libSceLibreSsl3 5/270 (1.85%) 6/270 (2.22%) +0.37%

@MarcZX10 MarcZX10 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.

A coordination note for this PR's landing order: I checked the exact current heads, and merge previews with #12580 and #12582 conflict in Key.cpp, GuestLibreSsl3KeyReference.cpp, and docs/dev/debt/libSceLibreSsl3.md. If this PR is intended to land first, please coordinate with the same author so the later PRs declare their dependencies and are restacked. I have not found a functional blocker in this diff; its Windows check is still running.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

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 9535 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 9536 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 9571 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 9970 core/libs/prx/libSceLibreSsl3/Export.cpp
docs/dev/debt/libSceLibreSsl3.md
PR 10395 core/libs/prx/libSceLibreSsl3/include/Api.hpp
core/libs/prx/libSceLibreSsl3/include/Key.hpp
core/libs/prx/libSceLibreSsl3/src/Key.cpp
core/libs/tests/GuestLibreSsl3KeyReference.cpp
docs/dev/debt/libSceLibreSsl3.md
PR 10452 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10461 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10490 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10491 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10493 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10557 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10631 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 10960 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 11146 core/libs/prx/libSceLibreSsl3/include/Api.hpp
core/libs/prx/libSceLibreSsl3/include/Key.hpp
core/libs/prx/libSceLibreSsl3/src/Key.cpp
core/libs/tests/GuestLibreSsl3KeyReference.cpp
docs/dev/debt/libSceLibreSsl3.md
PR 12315 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 12928 core/libs/prx/libSceLibreSsl3/Export.cpp
core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 13659 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 13662 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 13663 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md
PR 13831 core/libs/prx/libSceLibreSsl3/include/Api.hpp
docs/dev/debt/libSceLibreSsl3.md

@MarcZX10 MarcZX10 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.

Review note — coordinate the landing order

I found no functional issue in this PR’s focused change. The merge previews show a sequencing issue across the three open LibreSSL reference-count PRs: each pair conflicts in shared source, regression-test, and debt files. The PR currently declares no dependencies, so the intended application order is unclear.

What I ran

  • Compared current PR heads #12578 00b24c75b4be4b3ee7ed97013e4ea4a7a21b3afe, #12580 e5f35a2407c01477085fc0d9aa78ddbba669fda7, and #12582 dd47c78d6d72d3d88b2d21ccac72ffd8adb193c3.
  • Generated pairwise merge previews against current main 319621ba2e578bd053b0baba2877fe70520e0737.
  • Refreshed the hosted checks.

Results

Check Result
#12578 + #12580 merge preview conflict in Key.cpp, GuestLibreSsl3KeyReference.cpp, and libSceLibreSsl3.md
#12578 + #12582 merge preview conflict in the same three files
#12580 + #12582 merge preview conflict in the same three files
#12578 checks conventions, intake, labels, report, and Windows pass; Linux/product jobs skipped

Findings

Blocking

None in the change reviewed here. The pairwise conflicts require a recorded landing order before the stack can be applied without resolving shared hunks.

Non-blocking

This PR can be first if that is the agreed order. Please record the intended successor dependencies in the PR checklists or restack the later changes on top of this one after it lands. The conflicting files are:

  • core/libs/prx/libSceLibreSsl3/src/Key.cpp
  • core/libs/tests/GuestLibreSsl3KeyReference.cpp
  • docs/dev/debt/libSceLibreSsl3.md

Sources

Not verified

I did not independently rerun the focused tests. Hosted Linux/product checks were skipped; Windows and policy checks passed.

To get this to a good state

Confirm that #12578 is intended to land first and record the dependencies on #12580 and #12582, or propose another explicit order and restack the conflicting PRs accordingly.

@PrivacyOnion

Copy link
Copy Markdown
Author

#12578 lands first; #12580 is restacked on it and #12582 on #12580, each declares its dependency.

@EagleBearerYS

Copy link
Copy Markdown
Contributor

@PrivacyOnion a heads-up: we'd like to open a draft stacked on this PR shortly, with "Depends on: #12578", merging after yours. It implements six more libSceLibreSsl3 exports from LibreSSL 4.0.0: BIO_up_ref, SSL_up_ref, SSL_SESSION_up_ref, SSL_get_client_random, SSL_CTX_set_min_proto_version and SSL_CTX_set_max_proto_version.

The branch is feat/libressl3-sourced-b267-1-on-12578 on our fork (12dbb93). It keeps your commit as it is and builds on your LibreSsl3SslCtx:

@EagleBearerYS

Copy link
Copy Markdown
Contributor

@PrivacyOnion a correction to my note above. Lindamea1's #12754, which is also stacked on this PR, already covers five of those six exports, so we won't open them. BIO_up_ref is the one it doesn't have; we'll open it as a small PR stacked on #12754.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 30, 2026
@PrivacyOnion
PrivacyOnion force-pushed the feat/libressl3-ssl-ctx-up-ref branch from 00b24c7 to ced92ec Compare October 30, 2026 07:08
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants