feat(libSceLibreSsl3): implement SSL_CTX_add0_chain_cert and SSL_CTX_clear_chain_certs #23029
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23029"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by heditrigui on 2026-11-18T16:54:33Z.
What
feat(libSceLibreSsl3): implement
SSL_CTX_add0_chain_certandSSL_CTX_clear_chain_certs.SSL_CTX_add0_chain_certappends anX509certificate to the context's extra chain certificates list (context->extraCerts) without incrementing the certificate's reference count, taking ownership per LibreSSL / OpenSSLadd0semantics.SSL_CTX_clear_chain_certsclears the certificate chain associated with the context, freeing the stack and decrementing certificate reference counts viask_pop_free, returning 1 on success (or 0 if context is null).core/libs/prx/libSceLibreSsl3/tests/SslCtxChainCerts.cppcovering null argument validation, chain addition, stack growth, reference count retention across clear operations, and allocation failure paths.docs/dev/debt/changes/feat-libressl3-ssl-ctx-chain-certs.md.Tested
git diff --check.tools/check_conventions.py --base main(0 errors).tools/debt_fold.py --check.tools/pr_overlap.py(0 collisions).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch).mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T16:59:37Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
49bbefeb57:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T17:15:21Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: release each certificate when clearing its final reference.
What I ran
Reviewed head
49bbefeb578c53a0686e01f5b4eb3bbb3d3b8c9busing the prepared diff andrepo_read.pysource reads. No test or build commands were run.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:14:ReleaseCertificateonly decrements the reference count. When the last reference is removed, it leaves the X509 object and its owned data allocated, so clearing the chain leaks certificates. Use the certificate release routine when the count reaches zero.Non-blocking
None.
Not verified
Tests, build, and console behavior were not run. Read the prepared description, commits, diff, manifest, and README; inspected all changed files, including the complete added source, test, and debt fragment. For
CMakeLists.txt, inspected the changed hunk; forExport.cpp, inspected the full file. No changed files were excluded.To get this to a good state
Release certificate resources when clearing the final reference, then run the relevant test and build checks.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T18:21:36Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
8ab6419b6c:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T19:40:12Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: release certificates through the library’s X509 reference-counting/free routine when clearing the chain.
What I ran
Reviewed head
8ab6419b6c21248e2648af94905c0465093412b9using the pinned readerrepo_read.py; no tests or build commands were run.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:14decrements the reference count itself and then callsfree_nid_postfixwhen it reaches zero. This only frees the outerLibreSsl3X509allocation; it skips the X509 destructor’s cleanup of owned certificate fields. Certificates whose final reference is released here can leak their internals. Use the library’s X509 free routine so final-reference cleanup follows the normal ownership path.Non-blocking
None.
Not verified
Build and test execution, console behavior, and behavior on platforms other than the reader’s source view were not verified. Files reviewed:
core/libs/prx/libSceLibreSsl3/CMakeLists.txt,core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp,core/libs/prx/libSceLibreSsl3/tests/SslCtxChainCerts.cpp, anddocs/dev/debt/changes/feat-libressl3-ssl-ctx-chain-certs.md. No changed files were excluded;files.jsonwas not available through the reader.To get this to a good state
Replace the custom final-reference release with the library’s X509 free routine, then run the focused chain certificate test and the relevant build checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T09:03:14Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
8c00487dd3:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T09:37:39Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
8c00487dd3b52fbf483b376d6a8d4eaac36f0215against basemain. I read the prepared description, commits, diff, manifest, all changed source and test lines, and targeted stack and X509 ownership context viarepo_read.py. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceLibreSsl3/tests/SslCtxChainCerts.cpp:119clears the chain, but the test only freescert2afterward. The certificates with a final reference of 1, includingcert1, are not released by the test allocator;TestAllocationTrackingtherefore appears unable to reach zero. Free those test allocations or track certificate releases separately so the allocation check verifies cleanup.Not verified
To get this to a good state
Nothing is required. Optionally, make the test release all certificate allocations so its allocation tracking assertion checks the intended cleanup.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T11:34:40Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
31237e2fd3:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsfailed to build.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T11:40:45Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: prevent the chain clear callback from decrementing an already-zero X509 reference count.
What I ran
Reviewed head
31237e2fd374622db002fd5a899a6a298c4bbd2dusing the prepared diff andrepo_read.pytargeted reads/searches. No build or tests were run.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:14:ReleaseCertificatedecrements the count unconditionally and frees the certificate when the prior count is0or1. For a zero count, this wraps the count to-1and frees the object; the X509 reference count must not be decremented below zero. Guard against nonpositive counts before decrementing and free only when decrementing from one.Non-blocking
None.
Not verified
Build and test execution, console behavior, and the excluded-file list were not verified. Read the prepared description, commits, manifest, diff, and full text for all five changed files:
core/libs/prx/libSceLibreSsl3/CMakeLists.txt,core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp,core/libs/prx/libSceLibreSsl3/tests/SslCtxChainCerts.cpp, anddocs/dev/debt/changes/feat-libressl3-ssl-ctx-chain-certs.md. No changed files were excluded according to the manifest.To get this to a good state
Prevent clearing a zero-reference certificate from underflowing its count or freeing it, and add a regression test for that case. Then run the focused test and relevant project checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T13:28:21Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
5763c85792:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.count.fetch_sub(1, std::memory_order_acq_rel)unconditionally decrementscertificate->references. Ifcertificate->references <= 0prior to release,fetch_subunderflows the count to negative (or further negative) while satisfying<= 1, invokingfree_nid_postfix(certificate)on a nonpositive reference count without guarding against nonpositive counts. Per maintainer and reviewer guidance, ReleaseCertificate must guard againstcount <= 0prior to decrementing and only free when decrementing from 1.context->extraCertsis initially null andsk_new_nid_postfix(nullptr)succeeds in creating a new stack, butsk_push_nid_postfix(stack, certificate)fails (e.g. out of memory on reallocation), the function returns 0 while leavingcontext->extraCertsassigned to the newly allocated empty stack. Becausecontext->extraCertsis left non-null, subsequent operations or context destruction leak or mismanage the orphaned empty stack without cleanup or rollback.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T13:39:25Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: free the certificate if insertion fails, or otherwise restore its ownership to the caller according to the API contract.
What I ran
5763c857926f0af4edfda874d99cf5f21c558568using the prepared review bundle andrepo_read.py.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:31: Ifsk_push_nid_postfixreturns 0, the function returns failure but does not release the certificate.sk_push_nid_postfixcan return 0 when growing the stack's element array fails; its failure leaves the stack unchanged. The API description says add0 transfers ownership, so this failure path leaks the transferred certificate. Release it on failure or define and implement an explicit ownership return contract.Non-blocking
None.
Sources
core/libs/prx/libSceLibreSsl3/src/Stack.cpp:120-127shows the allocation-failure return fromsk_push_nid_postfix.core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:31-32shows the failed insertion path.Not verified
core/libs/prx/libSceLibreSsl3/CMakeLists.txt,core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp,core/libs/prx/libSceLibreSsl3/tests/SslCtxChainCerts.cpp, anddocs/dev/debt/changes/feat-libressl3-ssl-ctx-chain-certs.md. No changed files were excluded by the manifest.To get this to a good state
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T15:54:20Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
b6f5f50aaa:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.<= 1, freeing certificate and driving references to negative values (e.g., -1). This directly violates the maintainer's explicit review requirement to guard against nonpositive counts before decrementing and return early when count is 0 or less.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T15:59:08Z.
Review: CHANGES_REQUESTED
Reviewed — comments
Changes are required before merge: the changed code invokes a stack cleanup API that is not declared in the included public header, so the implementation cannot compile as written.
What I ran
Reviewed head
b6f5f50aaad33e4cdf1a0b5ec2d1a44c7942d432. No build or tests were run. Read the prepared description, commit list, manifest, diff, and all six changed files; inspected the stack implementation and API declarations used by the change.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:44callssk_pop_free_nid_postfix, but the includedApi.hppdeclares onlysk_free_nid_postfix,sk_new_nid_postfix, andsk_push_nid_postfixfor stack operations (core/libs/prx/libSceLibreSsl3/include/Api.hpp:393-395). Repository search found no declaration forsk_pop_free_nid_postfix; the source also provides no local declaration. This leaves the call undeclared at compile time. Declare and implement the API or release each element and free the stack using available declared APIs.Non-blocking
None.
Not verified
No build, unit tests, console behavior, or author-reported checks were verified by this review.
files.jsonwas not available through the reader; the manifest lists six changed files and marks all included, and all six were read. The review bundle excluded no changed files according to the manifest entries read.To get this to a good state
Add a valid declaration and implementation for
sk_pop_free_nid_postfix, or change the cleanup to use available declared APIs. Then rerun the project build and the new chain-certificate test.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T08:17:20Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
127f311dfa:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T08:19:25Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: release certificates through their full destructor when the context drops the final reference.
What I ran
Inspected the prepared diff and targeted source at head
127f311dfad47a0ec9a828bbdeb4a0696e5f5cab; no build or tests were run.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:15frees theLibreSsl3X509allocation directly when its reference count reaches zero. The certificate struct contains separately allocatedcertInfo,sigAlg, andsignaturepointers, so clearing a chain with the final reference leaks those owned resources. Use the full X509 destruction path for the final release. The new tests use certificates with those pointers set to null, so they do not exercise this case.Non-blocking
None.
Not verified
Build and test execution were not performed. The description’s reported checks were not independently run. Read the changed CMake hunk,
Export.cpp,Api.hpp,SslCtxChainCerts.cpp,SslCtxChainCerts.cpptests, and the debt fragment. No files were excluded from the prepared manifest.To get this to a good state
Replace the final-reference raw free with full X509 destruction, then add coverage for releasing a certificate with owned sub-allocations. Re-run the relevant build and tests on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T08:54:54Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
e20bfab67a:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsfailed to build.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T08:58:19Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: make
SSL_CTX_add0_chain_certhandle stack insertion failures without throwing or leaving partial state.What I ran
Reviewed head
e20bfab67aad0ec2f3b072909c946acbc1bd2a8fagainst the prepared diff. No commands or tests were run.Results
Findings
Blocking
SSL_CTX_add0_chain_cert_nid_postfixtreatssk_push_nid_postfixas a non-throwing operation. That helper throws on invalid stack memory or a failed guest memory access; therefore such a failure can escape the API instead of returning 0, and on a newly allocated stack can leave the stack attached to the context. Catch and clean up appropriately so failure preserves the add0 contract. Evidence:core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:32.Non-blocking
None.
Not verified
No tests or build were run. All eight changed files listed as reviewed in the manifest were read:
core/libs/prx/libSceLibreSsl3/CMakeLists.txt,core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/include/X509.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp,core/libs/prx/libSceLibreSsl3/src/X509StoreLoadLocations.cpp,core/libs/prx/libSceLibreSsl3/tests/SslCtxChainCerts.cpp, anddocs/dev/debt/changes/feat-libressl3-ssl-ctx-chain-certs.md. No changed files were excluded by the manifest.To get this to a good state
Handle exceptions from stack insertion, restoring
context->extraCertsand freeing a newly created stack before returning 0. Add and run coverage for this failure path.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T09:11:57Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
bb5cb12d6f:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:15:32Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: prevent clearing an invalid stack count from indexing outside its element array.
What I ran
Reviewed head
bb5cb12d6f62757230d672f169966a60e700545f. No build or tests were run. Readdescription.md,commits.md,diff.patch,manifest.json, and every changed line in the eight changed files; consultedStack.cpp,Api.hpp, andX509StoreLoadLocations.cppfor stack and certificate cleanup behavior.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:51loops tostack->numwithout validating that the count is nonnegative or withinnumAlloc.sk_push_nid_postfixexplicitly rejects a negative count, and this PR's own test constructs a stack withnum = -1attests/SslCtxChainCerts.cpp:265, but does not clear it. If a context has such a stack,SSL_CTX_clear_chain_certsindexesstack->datawith a negative count and then frees the stack; malformed counts above allocated capacity similarly read beyond the array. Validate stack metadata before releasing elements, with a safe error path that avoids out-of-bounds access.Non-blocking
None.
Sources
Not verified
Build and test results, console behavior, and behavior on other operating systems were not verified. All eight changed files listed in the manifest were read; no changed files were excluded.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T10:25:48Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
76a220d0cc:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/include/X509.hpp,core/libs/prx/libSceLibreSsl3/src/X509StoreLoadLocations.cpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T10:37:22Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: update
extraCertsthrough the guest-memory validation and copy helpers so these entry points safely handle guest context pointers.What I ran
Reviewed head
76a220d0cc82b9a5a043fe81425cb55338493550. No commands or tests were run; I used the pinnedrepo_read.pyreader to inspect the prepared diff and source context.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:25— The functions directly dereference the caller-providedcontext,certificate, stack, and certificate fields. In this guest ABI, callers provide guest addresses; nearby SSL context code validates/copies guest memory before accessing fields, andsk_push_nid_postfixdoes so for its stack argument. A bad or unmapped context/certificate pointer can therefore fault the host process instead of returning a failure or following the project’s invalid-guest-pointer handling. Apply the guest-memory checks/copy-in/copy-out pattern to the context and certificate accesses (and the chain elements during clear) before modifying or releasing them.Non-blocking
None.
Not verified
core/libs/prx/libSceLibreSsl3/CMakeLists.txt,core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/include/X509.hpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp,core/libs/prx/libSceLibreSsl3/src/X509StoreLoadLocations.cpp,core/libs/prx/libSceLibreSsl3/tests/SslCtxChainCerts.cpp, anddocs/dev/debt/changes/feat-libressl3-ssl-ctx-chain-certs.md. No changed files were excluded by the manifest.To get this to a good state
Update the new entry points to validate and safely copy guest context, certificate, stack, and chain-element data before access or mutation. Then run the new chain-certificate test and relevant build checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T11:09:12Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
c96fe83c94:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/include/X509.hpp,core/libs/prx/libSceLibreSsl3/src/X509StoreLoadLocations.cpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:16:39Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: prevent certificate destruction when
referencesis zero or negative.What I ran
Reviewed head
c96fe83c940bea0f8aa5035915ef9b6e4dcf8f43using the prepared patch andrepo_read.pysource reads. No build or tests were run. The author reports checks in the PR description; those results were not independently run.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:25:fetch_sub(1) <= 1destroys the certificate for any initial reference count of zero or less. A zero count underflows and frees the certificate; a negative count is also decremented and freed. Guard against nonpositive counts before decrementing, and free only when a valid positive count reaches zero. Otherwise a malformed or already-released certificate in the context chain can cause premature destruction or a double free.Non-blocking
None.
Not verified
No tests, build, console behavior, or author-reported checks were run. The prepared bundle includes full text for all 8 changed files, and each changed file was read; no files were excluded according to the manifest.
To get this to a good state
Correct the reference-count handling in
ReleaseCertificateso nonpositive counts cannot be decremented or freed, then rerun the relevant tests and build on the new head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:38:15Z.
Review: COMMENTED
Reviewed — no blocking findings
The implementation appears sound in the inspected code, but tests and build checks were not run in this reader-only review environment.
What I ran
Reviewed head
0d69f5119e62104836ee9acacf6e2daaa412931f. Inspected the prepared diff and changed lines, plus the stack helpers and related type definitions at the pinned head. No commands or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
Reviewed
core/libs/prx/libSceLibreSsl3/CMakeLists.txt,Export.cpp,include/Api.hpp,include/X509.hpp,src/SslCtxChainCerts.cpp,src/X509StoreLoadLocations.cpp,tests/SslCtxChainCerts.cpp, anddocs/dev/debt/changes/feat-libressl3-ssl-ctx-chain-certs.md. No changed files were excluded.Not verified
Build and test results, console behavior, and the author's reported convention, debt-fold, and PR-overlap checks were not independently verified.
To get this to a good state
Nothing is required. Optional: run the new
guest_libressl3_ssl_ctx_chain_certstest and relevant build checks.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T11:44:38Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
0d69f5119e:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/include/X509.hpp,core/libs/prx/libSceLibreSsl3/src/X509StoreLoadLocations.cpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T11:01:01Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: clear the context pointer before releasing its certificates and stack so a release failure cannot leave a dangling pointer.
What I ran
Reviewed head
8c03e3ff7dfe3058af6b36d249e6324595d89ebbusing the prepared diff andrepo_read.pyfor targeted source reads. No build or tests were run.Results
Findings
Blocking
core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cpp:108releases each certificate before clearingcontext->extraCertsat lines 111–116. IfReleaseCertificatefails while validating a certificate pointer or reference field,NotImplementedAt_nid_no_patchmay unwind after earlier certificates were already freed; the context still points to the original stack containing freed entries. A later clear can then access freed memory or release those entries twice. Detach the stack from the context before releasing its entries, and define safe cleanup behavior for failures.Non-blocking
None.
Not verified
Build, tests, console behavior, and claims in the PR description about convention checks, debt folding, and overlap screening were not independently verified. The review bundle lists six changed files, all marked included; full source was read for
SslCtxChainCerts.cpp,X509StoreLoadLocations.cpp, the new tests, and the relevant CMake/header context. Other changed files were reviewed through the diff only. No files were excluded by the manifest.To get this to a good state
Detach the stack before certificate release, then rerun the chain-certificate tests and relevant build checks on the updated head.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T11:14:11Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
8c03e3ff7d:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/include/X509.hpp,core/libs/prx/libSceLibreSsl3/src/X509StoreLoadLocations.cpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T12:24:25Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the review found no verified blocking defect.
What I ran
Reviewed head
93092235245197352f5e7f4e62b1c183369d086fusing the prepared diff andrepo_read.py. No build or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build/test results and physical-console behavior were not verified. All eight changed files listed in the manifest were read; the manifest lists no exclusions.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-21T12:51:29Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
9309223524:tools/check_conventions.pypassed.guest_libressl3_ssl_ctx_chain_certs_testsbuilt cleanly.guest_libressl3_ssl_ctx_chain_certs):core/libs/prx/libSceLibreSsl3/Export.cpp,core/libs/prx/libSceLibreSsl3/include/Api.hpp,core/libs/prx/libSceLibreSsl3/include/X509.hpp,core/libs/prx/libSceLibreSsl3/src/X509StoreLoadLocations.cpp,core/libs/prx/libSceLibreSsl3/src/SslCtxChainCerts.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me