fix(libSceSsl): keep the bundled mbedtls symbols out of libSceSsl's exports on macOS #10530
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10530"
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 maximilianfv on 2026-10-24T08:40:36Z.
What
On Linux and MinGW,
--exclude-libs,ALLkeeps the statically linked Mbed TLS out of libSceSsl's dynamic exports. Apple's linker has no such option, so on macOSlibSceSsl.prxexports 930mbedtls_*and 155psa_*symbols (54 of its 1,139 exports are libSceSsl's own). A program that links its own Mbed TLS can then bind to libSceSsl's copy, which allocates from libSceSsl's context pool.guest_ssl_transport_kernelandguest_ssl_transport_netfail on macOS this way: their test TLS server links Mbed TLS itself. The analysis in #8658 (commit8a4bd1e4cd) traced this to the server'smbedtls_ssl_setupresolving to libSceSsl's copy and failing withMBEDTLS_ERR_SSL_ALLOC_FAILED.This builds the
mbedtls,mbedcrypto,mbedx509andp256mtargets with hidden C visibility on Apple. These targets are shared, so the change also reacheslibSceLibreSsl, which linksmbedcryptoand exported 27mbedtls_*symbols on macOS; it now exports none. The Linux and MinGW paths are unchanged.Prior art, credited:
a5c41edb82, authored 2026-10-18: the same change, line for line. This PR brings it to currentmainas a standalone fix, with Ycaro as co-author.8a4bd1e4cd, authored 2026-10-19: the same fix, done with-unexported_symbol,_mbedtls_*and_psa_*linker options rather than hidden visibility. None of the PRs split from #8658 so far includes it._nid_names; the existingguest_ssl_transport_*tests cover this change.pr_overlap.py(run serially): no overlapping PRs. It could not compare #6044 because #6044 conflicts withmain. #6044 changescore/libs/prx/libSceSsl/CMakeLists.txtonly in theBUILD_TESTINGblock, not the lines changed here.Tested
Apple M1 Pro, macOS 27.0.1, x86_64 build under Rosetta 2.
mainalone does not build on macOS, so I tested on mugurc's macOS series (ci/macos-series-2, 27e968974) merged withmainat1e20650e84, plus the macOS build parts of #10419, toggling only this change.nm -gU libSceSsl.prxmbedtls_, 155psa_)mbedtls_orpsa_nm -gU libSceLibreSsl.prxmbedtls_)mbedtls_ctest -R 'guest_ssl|guest_libressl|guest_http'(14 tests)guest_ssl_transport_kernelandguest_ssl_transport_netfail witha server certificate without a loaded CA passed the initial verify optionsThe five
guest_libressl*tests pass both ways. On the series alone (27e968974, without themainmerge), the same two transport tests failed without the change and all 9ssl|httptests passed with it.Not tested on Linux or Windows. Their CMake path is unchanged.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T11:09:39Z.
Review: APPROVED
Reviewed the exact two-line CMake change and the reported export/test comparison. It applies hidden C visibility to the four bundled Mbed TLS targets only on Apple; Linux/MinGW retain
--exclude-libs,ALLand other platforms are untouched. The earlier implementation is cited, but it is not in current upstreammain, and the PR provides a macOS-specific report showing the resulting export set and SSL transport regression coverage. The automatic build jobs for this PR are skipped; I am relying on the described macOS run, not treating it as hosted CI.Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-25T09:45:15Z.
Review: APPROVED
Tested head
f5dffcb12fon Apple M4 Pro, macOS 27.0.1, Apple clang 21, x86-64 under Rosetta 2. The tree ismain61fc572ceeplus the open macOS build PRs and the parts of mugurc's series that #7201 also carries. Only this change was toggled.nm -gU libSceSsl.prxlists 1,085mbedtls_*/psa_*symbols.guest_ssl_transport_kernelandguest_ssl_transport_netfail 2 runs out of 2, ata server certificate without a loaded CA passed the initial verify options.libSceSsl.prxexports 55 symbols and none of them ismbedtls_*orpsa_*.libSceLibreSsl.prxexports none either. Both transport tests pass 3 runs out of 3.ctest -R 'ssl|http|libressl|crypto|tls|x509'(63 tests): 61 pass without this change and all 63 with it. Only the two transport tests change.AI-assisted: yes