fix(libSceHttp2): validate SSL setter handles #3535
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3535"
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 sktharunbalaji13-cmd on 2026-10-11T12:38:32Z.
What
sceHttp2SetMinSslVersion,sceHttp2SslEnableOptionandsceHttp2SslDisableOptiondiscarded theiridand returned success for any value. They now validateidagainst a live-handle registry and returnSCE_HTTP2_ERROR_INVALID_ID(0x817B1100) for a handle that was never allocated, was deleted, or belonged to a terminated context, following the prosper reference. Networking is still not implemented, so the TLS value remains ignored; only the handle is validated.The context-only
g_poolsmap is replaced by one typed registry.sceHttp2Init,sceHttp2CreateTemplate,sceHttp2CreateRequestWithURLandsceHttp2CreateCookieBoxregister their handles (kind, owner, and pool size for contexts).sceHttp2Term,sceHttp2DeleteTemplateandsceHttp2DeleteRequestinvalidate them and release descendants transitively (a template owns its requests; a context owns its templates and cookie boxes).sceHttp2GetMemoryPoolStatsreads the pool size from the registry and keeps the console'sERROR_NULL_POINTERreturn and zeroed output for an unknown context. The setters accept any live handle kind, because no per-kind restriction is measured; ids stay monotonic and are never reused.docs/dev/TechnicalDebt.md(libSceHttp2 entry) is updated to record the validation and to mark what remains unverified: whether the console restricts the handle kind these setters accept, and how it treats an id from a previous init/term cycle.Tested
Windows, MinGW-w64 GCC 15.2.0, Ninja, Release (
-DBUILD_TESTING=ON):cmake --build build --target guest_http2_tests— built.ctest --test-dir build -R guest_http2 --output-on-failure— passed (1/1).The regression coverage in
core/libs/tests/GuestHttp2.cppadds: all three setters reject0,-1and a large never-allocated id; all three accept live context, template, request and cookie-box ids; a deleted request id is rejected (and the secondsceHttp2DeleteRequestreturns the invalid-id error); a deleted template and its outstanding request are rejected; a terminated context and all of its descendants are rejected; a fresh context after termination is accepted. Existing memory-pool, cookie, send-error and async assertions are unchanged.Not run on a PS5. Console behaviour (per-kind restrictions and previous-cycle ids) is unverified.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt — not applicable to this change.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by sktharunbalaji13-cmd on 2026-10-11T12:44:11Z.
Hi, I investigated the failing CI checks on PR #3535 (
fix(libSceHttp2): validate SSL setter handles).The macOS, Ubuntu, and Windows relinker jobs, along with the conventions job, are failing during
actions/checkoutcleanup—not during compilation or convention checking.The common error is:
At base commit
1e8fff68c8f6d3b67e38be584e15706a70c9d8bf,3rdparty/imguiexists as a gitlink (mode160000), but.gitmoduleshas no corresponding entry. My read-only investigation traces the addition to commitddf6b8c98(2026-10-11T11:08:03Z), an unrelated NpTrophy2 test commit. The same checkout failure also affects the base commit's own Build workflow (run38138220808:linux,windowsand all threerelinkerjobs fail).The checkout step itself is not the cause: the relinker jobs use
submodules: false, yetactions/checkoutstill runsgit submodule foreach --recursiveto strip credentials, and that errors when a gitlink has no.gitmodulesURL.PR #3535 does not touch the submodule or
.gitmodules. Could a maintainer check whether the3rdparty/imguigitlink was accidental (most likely, given it rode along in an unrelated commit) and should be removed, or whether its missing submodule URL should be restored in.gitmodules? Oncemainis repaired, the affected workflows can be rerun.The local Windows
guest_http2_testsbuild andctest -R guest_http2passed. The CI relinker builds and conventions checker have not yet run successfully, so I am not claiming those checks passed.Thanks!
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T12:51:06Z.
I reviewed the handle lifecycle changes. One follow-up gap:
DeleteRequesterasesg_completions[req_id], butDeleteTemplateandTermrecursively erase descendant request handles throughReleaseOwnedHandleswithout clearing completion queues for those requests. A request that completed asynchronously before its template/context is deleted can therefore retain stale queue state, andWaitAsyncstill looks up that id without checking the live-handle registry. Could the cascade return/collect the removed request ids and erase their completion entries too? A regression could send an async request, delete its template or terminate the context, then verify the completion is no longer consumable and the request has no retained state.Imported from boykopovar/AnyPS5. Originally posted by sktharunbalaji13-cmd on 2026-10-11T14:53:06Z.
@MarcZX100 thanks for the review — I addressed the gap in
bf99430cc(follow-up on the same branch, not a new PR).ReleaseOwnedHandlesnow returns every transitively removed handle id, andsceHttp2DeleteTemplateandsceHttp2Termerase the completion queue of each removed request in addition to the handle itself.sceHttp2DeleteRequestuses the same helper, so the cascade no longer leaves stale queue state.To keep the state from coming back under a race, completion insertion now coordinates with deletion:
CompleteAsyncvalidates that the request is a live request while holding the handle lock and inserts the completion under it. A send that races a deletion therefore either returnsSCE_HTTP2_ERROR_INVALID_IDwithout queuing, or is erased by the deletion — so no completion is re-created after a deletion returns.sceHttp2WaitAsyncis deliberately unchanged: it consumes from the queue, which is what makes the erase (rather than a liveness check in the wait) the thing that makes a cascade-deleted request's completion unconsumable.Regression coverage in
core/libs/tests/GuestHttp2.cpp: a request is sent asynchronously, its completion is drained from the user event, thensceHttp2DeleteTemplate(and separatelysceHttp2Term) removes the request. The test asserts the completion can no longer be consumed, a late send returns the invalid-id error without queuing a new completion, and the removed handles report the invalid-id error. Existing request deletion, send-error, cookie, WebSocket and async assertions are unchanged.Two caveats worth being explicit about:
sceHttp2WaitAsyncrunning concurrently with a deletion can still consume a completion that was queued before the handle was removed, because the wait consumes under the completion lock only. Once the deletion returns, no completion for the deleted request remains and none can be re-created. That concurrent window is a known limitation, not something this change claims to close.Tested on Windows, MinGW-w64 GCC 15.2.0, Ninja, Release (
-DBUILD_TESTING=ON):cmake --build build --target guest_http2_testsbuilt, andctest --test-dir build -R guest_http2 --output-on-failurepassed (1/1). As a control, temporarily disabling the cascade erase makes the same test fail, and restoring it makes it pass. Not run on a PS5.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T18:36:17Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceHttp2/Export.cppL9-10, L20-21, L279-280core/libs/prx/libSceHttp2/Export.cppL33-35, L37-42Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:32:16Z.
Checked on Linux: build +
guest_http2pass, the test fails withExport.cppreverted, and the invalid-id returns (setters, Term/Delete*/Create*, async send/wait) match prosper'shle_http2.cpp. The cascade now also clears the completion queues MarcZX100 pointed out.Added one commit: the TechnicalDebt entry now also lists the other exports that return the invalid-id error for a stale or wrong-kind handle (prosper, not measured on a console). Merging once CI is green.