Repository navigation
feat(libSceLibreSsl): select advertised application protocols - #9785
oneandonlydean merged 9 commits into
Conversation
|
@Felipebmaitan This PR only implements Proposed merge order for that documentation: #9785 first, then #9535 -> #9536 -> #9571, retaining the protocol entry when those branches are rebased. There is no code/build dependency. If your stack lands first, I will rebase this PR and place its entry alongside the merged sections instead. Please let me know if you prefer a different order. |
|
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.
|
|
Additional maintenance validation: this head was combined locally with the other pending FreeType/library contributions on main |
MarcZX10
left a comment
There was a problem hiding this comment.
The exact protocol-selection function passes the PR’s own GuestLibreSslProtocol.cpp harness locally: 7,056 generated list pairs plus the boundary and malformed-input cases. I compiled the exact PR source and harness into a temporary shared object with a throwing stub for NotImplemented_nid_no_patch; this validates the selection algorithm, but not the packaged-library/NID path or the full build. check_conventions.py and git diff --check against current main pass. The PR reports a full Windows build and 3/3 packaged tests; upstream PR checks currently run policy checks only and skip product builds.
The branch is eight commits behind live main (8499ea52e571b0edfc1feecfd3f6b9944012b359). CONTRIBUTING.md requires branches to be based on and kept up to date with main. Please update the branch and rerun the reported full build and packaged-library/NID tests on the resulting head.
MarcZX10
left a comment
There was a problem hiding this comment.
I rechecked exact head 19230580171979188d3d86b3229ddbd3d708526c against current main (11f976b27c16ed91633f00039dba5dfd97dd7cc1). Conventions and diff-check pass; the merge tree is clean. The reported Windows build and protocol/packaged-library 3/3 results are contributor-run, while hosted product builds are skipped. I previously ran the exact source/harness algorithm locally (7,056 generated protocol-list pairs and malformed/boundary cases), but that does not validate the packaged NID path. The author’s overlap note proposes the documentation order for #9535/#9536/#9571 and no code overlap. This branch is 21 commits behind current main; please rebase and rerun the focused packaged-library/NID tests on the new head before merge.
|
@MarcZX10 Synced the existing branch with current main Fresh validation on Windows 11 / supported WinLibs GCC 15.2.0 r7 / bundled dependencies / Ninja Release: full default build passed; 3/3 focused tests passed, zero skips. Both the normal export and the actual packaged-library NID run each exercise 7,056 generated pairs plus malformed/boundary cases; Strict main-sync, conventions, whitespace and test registration pass. Live main was rechecked immediately before pushing; Tested now records this exact submitted head. The #9535/#9536/#9571 documentation order remains a proposal awaiting author confirmation, not an agreed dependency. No hosted product-build result is claimed. Ready for re-review of the current-main/build request. |
|
Linux run (the description lists Linux as not tested). Docker on Windows: Ubuntu 26.04, GCC 15, glibc 2.43, WSL2 kernel 6.6, Release,
AI-assisted: yes |
There was a problem hiding this comment.
macOS test: guest_libressl_protocol_nid loads the unpatched libc
Apple M2 Max, macOS 27.2, Apple clang (Xcode 27), x86-64 Release build under Rosetta 2, BUILD_TESTING=ON, full default build. Head 1ec05748ff. main does not build on macOS, so the platform is #8658 (feat/macos-port) @ fa063d8b07 with this PR's diff applied (clean apply).
guest_libressl_protocol passes. guest_libressl_protocol_nid aborts:
dlopen(.../build/core/libs/libs/libSceLibreSsl.prx, 0x0006): Symbol not found: _H480xkq8iKk
Referenced from: <...> .../build/core/libs/libs/libkernel.prx
Expected in: <...> .../build/core/libs/libs/unpatched/libc.prx
LibreSSL protocol check failed at line 152
guest_libressl_protocol_tests links libc on every platform, so the process starts with unpatched/libc.prx loaded. Both libc builds have the install name @rpath/libc.prx, so when the patched libkernel.prx asks for @rpath/libc.prx, dyld reuses the unpatched image that is already loaded, and it has no NID exports.
guest_jxr_lookup_tests in #9954 avoids this by linking libc only on Windows. Doing the same in ProtocolSelection.cmake fixes it here:
target_link_libraries(guest_libressl_protocol_tests PRIVATE ${CMAKE_DL_LIBS})
if(WIN32)
target_link_libraries(guest_libressl_protocol_tests PRIVATE libc)
endif()With that change both tests pass 3/3 (--repeat until-fail:3). I did not run Linux here, but the same pattern failed on Linux in #9646 (patched tests could not resolve NIDs until libc was linked only on Windows), so this is likely not macOS-only.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Sync current main and keep the unpatched libc test dependency Windows-only.
|
Fixed the loader setup and refreshed main in The test links libc only on Windows; Windows NID mode selects packaged dependencies before startup, while normal mode selects raw dependencies. This prevents preloading the wrong libc. Full default Windows build and 3/3 focused CTests pass; local Ubuntu 24.04.1/WSL2, GCC 13.3/glibc 2.39 complete libs build and all 3 tests each pass three times, including the actual NID and 368-library loader. The 7,056-pair behavioral harness is unchanged. @Dom3005's Linux failure and @jotitadev's macOS report identified the dependency collision. The body credits the pinned macOS workaround results; a fresh macOS run on this head remains outstanding. Please rerun both modes on the #8658 stack when available. The Linux results above are local; no fresh macOS result is claimed. |
The branch was refreshed to 32db446 and the full build plus the packaged-library and NID tests pass on that head on Windows and Linux.
|
@santhoshkumar-dev I found that the new six-argument SSL_select_next_proto export has no declaration in this head's public library headers. Current main still has the old no-argument stub declaration. Please refresh onto current main, put your existing author-sourced signature in the canonical public header, and include it from the implementation and tests. I am not requesting native evidence for replacing that placeholder. Please rerun public_headers, the public-header compile tests and both protocol tests on the refreshed head. |
|
@santhoshkumar-dev firmware 13.42 data for the debt entry's open points (ABI, valid and invalid input). The decrypted
So the module doesn't validate the encodings. A zero-length entry can be negotiated, and an empty supported list is read anyway.
|
|
@oneandonlydean Replace the obsolete no-argument public placeholder with the existing six-argument author-sourced signature, and include that canonical header from the implementation and tests. Remove assertions that unsupported encodings or null outputs must throw. Retain valid-list behavior and the production guards. Updated head: @BunnyFl Thanks for the firmware report. The body and functional-debt entry now attribute your host-PC firmware execution, record the valid-list agreement and list the unsupported invalid-list differences. Null-output behavior remains unmeasured; no console or local firmware execution is claimed. The earlier macOS workaround result remains attributed to @jotitadev; this refreshed head still needs an independent macOS rerun. |
|
Refreshed this branch onto main Local Windows/WinLibs GCC 15.2 and Ubuntu/WSL2/GCC 13.3 complete libs builds pass. Each platform passes 68/68 selected CTests, zero skips: public_headers, all 64 header compile batches and 3 runtime cases. Conventions and whitespace pass; the six maintained branches also merge cleanly in all 15 pairings. The older macOS report remains attributed to @jotitadev on the now-closed #8658 port stack. A fresh current-stack macOS rerun remains outstanding; no new macOS result is claimed. |
… module SSL_select_next_proto validated both lists and threw for an empty list, a zero-length entry or a truncated entry. The firmware 13.42 report on PR #9785 shows the module runs LibreSSL 3.4.1's loop with no validation: a zero-length entry is negotiated, no overlap returns the first supported entry with its unchecked length byte, even for an empty supported list, and an empty peer list has no overlap. Follow that loop, and throw only for the null pointers the module would read. The test places each reported list before a guard page and checks the six reported cases. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
What
Implement
SSL_select_next_proto(CpIzEs1Q1Ug) for valid wire-format protocol lists. The first peer-preferred match returns a borrowed pointer into the peer list and status 1; no overlap returns the first supported protocol and status 2. Names are byte strings and may contain zero or high-bit bytes.The six-argument signature and valid-input contract follow LibreSSL 3.4.1 ssl.h and ssl_lib.c, with no new dependency.
BunnyFl's independent firmware 13.42 report executed the decrypted
libSceLibreSsl.sprxon a host PC, not console hardware. It reports matching six-argument valid-list status, selected-list offset and length across 200,000 random pairs repeated three times plus 500,000 pairs with a second seed. Its invalid-list observations differ from the current guards: zero-length names can be selected, fallback lengths are unchecked, and an empty supported list is read. Those paths remain unsupported and are recorded as functional debt. Null outputs were not measured. This is attributed evidence, not a local firmware run.Tested
Submitted and tested head
809350e09cfbe0cfc6156a15b842e9c89012f59a, including upstream main48c160c58b589157ebd94ebd53736a182f8303bf.Windows 11 x64 / WinLibs GCC 15.2.0 r7 and local Ubuntu 24.04.1 x86-64 under WSL2 / GCC 13.3.0 / glibc 2.39: Ninja Release, bundled dependencies,
BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=OFF. On each platform the completelibstarget and selected test executables build, and 68/68 CTests pass, zero skips: the public-header audit, all 64 public-header compilation batches and 3 focused runtime tests. The new upstream JPEG XR and updated SPIR-V dependencies use their pinned submodule commits. Both normal-symbol and actual packaged-NID modes exercise the 7,056 generated protocol-list pairs and valid-list boundaries, alongside the packaged-library loader.Final upstream recheck:
88795ed44801fa719eb2df990cbe1f11a1f9bd81merges cleanly; no FreeType/LibreSSL production, shared-header, test-registration or debt changes appeared after the tested base. Results remain pinned to the exact submitted head and its stated base.Conventions, whitespace and all 15 pairwise merge checks across the six maintained PRs pass. Open/closed/merged history was rechecked; no replacement implementation was found.
The earlier macOS report by @jotitadev used Apple M2 Max, macOS 27.2, Xcode 27 and x86-64 under Rosetta on #8658 at
fa063d8b07plus the original diff and conditional libc-link fix. That host-support PR was closed for splitting. It remains attributed historical evidence; no fresh macOS runtime host is available here, so validation on the current macOS stack remains outstanding. No title or physical-console execution is claimed.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)