fix(libSceHttp2): return the console codes for failed TLS handshakes #11922
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11922"
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 hugodearaujo on 2026-10-27T12:36:44Z.
What
sceHttp2SendRequestthrew (sceHttp2: TLS failed; console error mapping is unknown) wheneversceSslConnectfailed. A PS5 payload measured what the console returns against TLS servers it ran itself on the loopback address (a TLS 1.2 server with a self-signed certificate, and servers that close, reset, send a fatal alert or answer in plain text after the ClientHello), with version 2 (HTTP/1.1) and version 3 (HTTP/2) templates. The console returnssceSslConnect's failure unchanged, and the transport now does the same for the seven measured results:0x8095F00C0x8095F00BsceHttp2SslEnableOption(0x8)0x8095F00D0x8095F0100x8095170D0x804101360x80951D78sceSslConnecton a plain socket returned the same codes in the same cases, so these are libSceSsl's results passed through. Any othersceSslConnectfailure still throws. With libSceSsl as it is, the transport reaches five of these: libSceSsl reports a reset during the handshake as0x8095170Dand throws for a reply that is not TLS, so the last two rows need a libSceSsl change first (recorded in the debt entry).After a failed send the console answers the other calls the same way whatever the failure was, and so does the transport now:
sceHttp2GetStatusCodereturns 0 and stores 0,sceHttp2GetResponseContentLengthandsceHttp2ReadDatareturn0x817B1065and leave their outputs alone, and anothersceHttp2SendRequestreturns the same error. This also covers a refused connection, whose status call used to return0x8041013D.A fresh template does not check the certificate's expiry on the console: with default options a trusted but expired certificate was accepted and the request completed (status 200, body read), and only after
sceHttp2SslEnableOption(0x8)did the send return0x8095F00D. The template default here includes0x8, so that request fails with0x8095F00D; this PR leaves the default as it is.Lookup failures, timeouts and failures after the handshake still throw: they were measured too, but no title reaches them yet.
Console lines (system software 13.590.001, payload process):
Tested
main5454cd2e45:ctest -R guest_http2passes (7 tests), 3 runs in a row.GuestHttp2Transport.cppnow checks against loopback servers an untrusted certificate (0x8095F00C), a host name the certificate does not cover (0x8095F00B), an expired certificate aftersceHttp2SslEnableOption(0x8)(0x8095F00D), a server that closes after the ClientHello (0x8095170D) and one that answers it with a fatal alert (0x8095F010), and after each of these and after a refused connection, the status, content length, read and repeated send results.main9f748f4d8emerged in (0d054bf053):main's gzip inflation work conflicted inTransport.cpp(constants side by side), in the transport test'sModelist and next toFailure(gzip scenarios added there; this PR'sFailurekeeps no host name flag, since that case moved toHandshake), and in the debt file.ctest -R guest_http2: 7 of 7, three times in a row, gzip scenarios included; with onlymain'sTransport.cpp,guest_http2_transportstill aborts at the first handshake case.main'sTransport.cpp: the handshake cases abort withsceHttp2: TLS failed; console error mapping is unknown(the expired one included, run first to check) and the refused case fails its status check; with this change all pass.0x8095170Dand throws for a reply that is not TLS, where the console'ssceSslConnectreturned0x80410136and0x80951D78.Connect(), so the change covers it. The only textual conflict inTransport.cppis the placement after #11586's callback cleanup. Onmain+ #11611 + this change all 8 HTTP2 test groups pass; one #11611 case changes (an untrusted chain without a callback now returns0x8095F00C).main+ #11611 it aborts at 65 s on its first telemetry POST (sceHttp2: TLS failed; console error mapping is unknown), because the server's certificate cannot be verified without #11145. With this change added and no #11145 it ran the whole 600 s and reached the same license agreement screen as with #11145. The title logs its own exporter error for each failed send ([OTLP HTTP Client] Session state: request send failed.request failed, 16 times in 600 s) and retries about every 31 s. A logging build of the same change on an earliermainshowed each of those sends returning0x8095F00C.main04a9eb4fa2merged in (6dd4bcd43a), after #11586 landed:Transport.cppwas the placement after #11586's callback cleanup. The cleanup runs first, then the measured codes are returned.guest_http2_ssl_callbackschanges in one mode only. Mode 5, an untrusted chain with the callback cleared, now expects0x8095F00C, the code the console returned for that chain (L1-untrustedabove), instead of a throw.0x8095F0FD, which is not among the measured codes. Aborting, deleting or throwing from the callback (modes 6 to 8) also still throws.ctest -R guest_http2: 9 of 9.tools/check_conventions.pypasses. Not tested on Windows.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)Transport.cpp(the new line goes right after #11586's TLS callback cleanup) and in the transport test and debt files; proposed order: this PR first, then #11586 and #11611 rebase onto it. Alan Wake 2 also needs #11611 for its HTTP/1.1 requests.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T12:41:29Z.
Review: CHANGES_REQUESTED
The payload results are valuable, but the implementation does not yet return the measured console codes for two cases included in the PR’s table.
Connect()only passes through values inHandshakeFailures; the PR says LinuxsceSslConnectreports a peer reset as the close code0x8095170D(the console reports0x80410136) and throws for a non-TLS reply (the console reports0x80951D78). The current reset path therefore returns the wrong code, and the non-TLS path still throws fromsceHttp2SendRequest. The new transport tests cover close and fatal alert, but explicitly omit reset and non-TLS. Please normalize these observed host outcomes where they can be distinguished and add focused tests; otherwise narrow the claimed supported behavior and leave those measured cases documented as unresolved rather than implying passthrough reproduces them.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T09:51:52Z.
Review: CHANGES_REQUESTED
Thanks for the console measurements. Two points are still open, both raised above and not yet addressed:
docs/dev/debt/libSceHttp2.md(error paths entry) says the transport passes through a peer reset0x80410136and a non-TLS reply0x80951D78. With libSceSsl as it is,core/libs/prx/libSceSsl/Export.cpp:501maps a reset during the handshake to0x8095170Dand nothing produces0x80951D78(the non-TLS reply throws). Either fix the mapping in libSceSsl and add tests for both cases (the test body already says the host currently reports otherwise), or make the entry state what is returned today and keep the two codes inHandshakeFailuresonly if they can actually be reached.Depends onsays none, but the body reports a textual conflict inTransport.cppwith #11586. List it (and any other PR from the overlap report that you rebased across) inDepends onand say which merges first.The rest (status/length/read/resend after a failed send, the close and alert tests, the untrusted and wrong-name cases) matches the measurements and the tests fail without the change.
Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-29T12:47:58Z.
Review: APPROVED
Reviewed — approved
The change passes the measured
sceSslConnecthandshake failures throughsceHttp2SendRequestand makes the status, content length, read and repeated-send calls answer as the console did after a failed send; it merges cleanly, builds, its tests pass, and they fail without the production change.What I ran
35f95a1d4bc246bdd91238e9dc92983c1ee3ed5cmain:5454cd2e455994d992aca39335ce60507eeda1ebThe head already contains a merge of this
main, so the merged tree has the same content as the head.Results
maingit diff --checktools/check_conventions.pydebt-lengthondocs/dev/debt/libSceHttp2.md:32, see below)libSceHttp2--target libsctest -R guest_http2(7 tests:guest_http2,_cookies,_options,_transport,_early_response,_system_roots,_teardown)guest_http2_transporttakes about 5.6 sguest_http2_transportfails without theTransport.cppchangecheck_conventions.py
ctest on the merged tree (first run)
Negative control
I restored only
core/libs/prx/libSceHttp2/Transport.cppfrommainand kept the new test.guest_http2_transportaborts at the first new handshake case, the host name that the certificate does not cover:Output
After I restored the merged file and rebuilt, the test passes again. The run stops at the first failing case, so this control does not show the close, alert, untrusted and refused cases failing one by one. The PR description reports that they each fail on
main.Findings
Blocking
None.
Non-blocking
docs/dev/debt/libSceHttp2.md:32is 1205 characters, andcheck_conventions.pywarns about it (debt-length). Splitting the old entry into "error paths" and "connections" was a good step. The list of codes could still be shorter: point at the PR for the per-case table and keep only the gap, which is that the reset and non-TLS codes cannot be reached until libSceSsl changes.AfterFailedSend(core/libs/tests/GuestHttp2Transport.cpp:385) also runs for the refused connection (core/libs/tests/GuestHttp2Transport.cpp:514). For the read call it expects0x817B1065(line 393), but the console lines in the description have aread0result only forT1-untrusted. ForR1-refusedthey show onlystatus,lengthandsend-again. The implementation (core/libs/prx/libSceHttp2/Transport.cpp:596) returns the same code for every failure. That is probably right, but for the refused case it is an inference. Adding the payload'sR1read result to the PR, if it was captured, would back the "whatever the failure was" claim.0x8095F00Dis inHandshakeFailures(core/libs/prx/libSceHttp2/Transport.cpp:40), and libSceSsl produces it when verify option0x8is set (core/libs/prx/libSceSsl/Export.cpp:483). The new tests cover only0x8095F00B,0x8095F00C,0x8095170Dand0x8095F010. A loopback server with an expired certificate andsceHttp2SslEnableOption(0x8)would cover the fifth reachable code. A run without the option, expecting success, would cover the console'sE1result as well.Others have already raised the two unreachable codes (
0x80410136and0x80951D78) and theDepends onordering. The current debt text and description address both, so I do not repeat them.Not verified
57acad605e, is in the PR comments.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T19:58:30Z.
Review: APPROVED
Re-checked — approved
Since my last review, the PR shortened the error-paths debt entry (
c3cc464ce1), added an expired-certificate handshake test (1acaa7f8ea), documented the console'sread0result after a refused connection, and merged currentmain. All three of my earlier non-blocking points are resolved, and the new test fails without the matching production entry.What changed since my last review
c3cc464ce1: thelibSceHttp2 error pathsentry is shorter. It now lists what throws, then the two codes that can't be reached until libSceSsl changes, and points to this PR for the per-case results.1acaa7f8ea: addsMode::Expired, a loopback server that uses the existingExpiredServerPem/ExpiredServerKeyfixture (core/libs/tests/SslCertificateFixture.hpp:94), andHandshake(ssl, Mode::Expired, 0x8095f00d, 0x8)(core/libs/tests/GuestHttp2Transport.cpp:1022).Expiredis placed beforeEarlyFinalin the enum, soIsEarly()(mode >= Mode::EarlyFinal, line 155) still classifies modes correctly.main, the last one resolving conflicts with #11575 in the transport test and the debt file. The production diff (Transport.cpp) is unchanged from the reviewed commit apart from line offsets.R1-refused-v2 read0 rc=817b1065line and theE1/E2expired-certificate lines. It also notes that a fresh template on the console does not check expiry, while the template default here includes0x8. The PR leaves that default unchanged.What I ran
7b95725572632d715c7cab90fc8969fbdeff3838main:dd0548601bfeb18f337cbc2bdb67ff211c13ff263f085c42c946ec193eb39af13e8af076772c8295maingit diff --checkcheck_conventions.pydebt-lengthwarning is gonelibsand the selected targets)unwrap_selfalso fails onmain(known failure). Twomain_sync_renames_*tests that fail on the baseline pass here. They are unrelated to this PRctest -R guest_http2×3 (8 tests, includingguest_http2_redirectsfrommain)guest_http2_transporttakes about 7.7 sguest_http2_transportfailsguest_http2_transportfails at the expired scenariogit status --porcelainempty);guest_http2_transportpasses againNegative control outputs
Negative control 2 shows that the new expired case (mode 26) depends on its own entry in
HandshakeFailures, separately from the other cases. A side note on the list itself: my first attempt dropped the element but keptstd::array<int, 7>. That pads the array with a 0, so a successful handshake returned early and skipped the ALPN check (NoAlpnfailed). The PR's array is fully populated, so this does not affect it.Previous findings
docs/dev/debt/libSceHttp2.md:32): Resolved.check_conventions.pyno longer reportsdebt-length. The entry now states what throws first, then names the two unreachable codes (0x80410136,0x80951D78) with what the host returns instead.C|R1-refused-v2|read0|rc=817b1065, and the author reports the same result forR2-refused-v3.AfterFailedSend(core/libs/tests/GuestHttp2Transport.cpp:749) checking0x817B1065for the refused case (line 878) now matches a measured result.Handshake(ssl, Mode::Expired, 0x8095f00d, 0x8)atcore/libs/tests/GuestHttp2Transport.cpp:1022passes on the merged tree and fails without the0x8095f00dentry (negative control 2). The console's default-options case (E1, expiry not checked) is not tested. That is consistent with the PR leaving the template default as it is: the description records the difference, and changing the default belongs in its own PR.New findings
Blocking
None.
Non-blocking
None.
Not verified
57acad605e,0d054bf053) and on a local resolution of the latest conflict.0x80410136) and non-TLS (0x80951D78) cases. As the debt entry says, the host libSceSsl cannot produce them yet.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T23:29:48Z.
Review: APPROVED
adriadam10's two points look addressed at this head. The debt entry (
docs/dev/debt/libSceHttp2.md) no longer says the transport passes0x80410136and0x80951D78through. It says both are console results that can't be reached until libSceSsl changes, since the host libSceSsl returns0x8095170Dfor the reset and throws for the non-TLS reply. And theDepends online now names the textual conflicts with #11586 and #11611 inTransport.cpp. Whether that line should list them as dependencies rather than as a note is adriadam10's call.Tested on Windows 11, WinLibs GCC 15.2.0, with this head merged onto current
main: all nineguest_http2*tests pass, nothing skipped, includingguest_http2_transport. Withmain'sTransport.cpp,guest_http2_transportaborts (0xc0000409) and the other eight still pass.Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T21:47:37Z.
Review: APPROVED
Re-checked — approved
The only change since my last review is the merge of current
main(6dd4bcd43a) after #11586 landed. The measured-code passthrough now runs after #11586's TLS callback cleanup, and mode 5 ofguest_http2_ssl_callbacksnow expects0x8095F00Cwhere it used to expect a throw. The checks pass, the tests pass, and the negative control fails as it should.What changed since my last review
486a71ef91,7215512e1b,c3cc464ce1and1acaa7f8eaare unchanged. The new work is all in the merge commit6dd4bcd43a.Transport.cpp, theHandshakeFailurescheck (core/libs/prx/libSceHttp2/Transport.cpp:521) now comes after #11586'ssceSslSetVerifyCallback(ssl, nullptr, nullptr)cleanup (line 520). So the callback is cleared before an early return too.core/libs/tests/GuestHttp2Transport.cpp:611, mode 5 ofSslCallbacks(an untrusted chain with the callback cleared, line 603) now expects0x8095F00C. Modes 2, 3 and 6 to 8 still expect a throw.I checked that answer against libSceSsl. A refusing callback makes
sceSslConnectreturnErrorCallbackCheck=0x8095F0FD(core/libs/prx/libSceSsl/Export.cpp:59,:932). That code is not inHandshakeFailures, soConnect()still reachesRequire(result == 0, ...)and throws, as onmain. Mode 5 runs no callback, so libSceSsl's plain known-CA failure (ErrorUnknownCa,Export.cpp:487) is returned. That is the code the console returned for the same chain (SSL|L1-untrusted|sslconnect=8095f00c, author-reported). The changed expectation therefore follows a measurement and is not a weaker test.What I ran
6dd4bcd43a5cdc2f615876c7f953ca7f9b70b258main:04a9eb4fa2877eb6e40bf2c83adf972e40d89b244a6864571ad88f4d5f3f0aac0c61e71c8e121739maingit diff --checkcheck_conventions.pyunwrap_self_..._destination_directory_groupalso fails onmain(known failure)ctest -R guest_http2×3guest_http2_ssl_callbacks(about 2.3 s) andguest_http2_transport(about 7.6 s)guest_http2_transportandguest_http2_ssl_callbacksboth abortgit status --porcelainis emptyNegative control output
Previous findings
My last review (on
7b95725572) had no open findings, and nothing in this merge reopens them.New findings
Blocking
None.
Non-blocking
None.
Not verified
L1-untrusted, and the Alan Wake 2 result. I accepted them as author-reported and did not launch any title.0x80410136) and non-TLS (0x80951D78) cases. The host libSceSsl cannot produce them yet, as the debt entry says.