Repository navigation
fix(libSceHttp): copy URIs as measured on a PS5 - #9073
Conversation
A payload on a PS5 (firmware 13.60) shows sceHttpUriCopy clears the whole output and all prepare bytes of the pool before it reads the source, so a source that is the output or lies in the pool copies as empty. Read the source after clearing, clear the output with its padding, and test the measured layout, failures and aliasing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
|
|
Independent Windows run of this PR (data only). Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against PR head tested: Results (3 runs each):
GPU: the run output has no Not run: other platforms, the other tests in the same family, the full repository CTest, and any title or console run. AI-assisted (Claude Code). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
My draft #9834 uses |
|
I moved the TLS test into |
|
I see no exact hunk overlap now. |
What
sceHttpUriCopywas written from a reading of the libSceHttp.sprx disassembly, and its debt entry said it was not measured on a console. In a payload process on a PS5 (firmware 13.60) every ordinary input already matched:preparebytes cleared;requireon success, and left alone on a short pool;The one difference is the order of operations. The console clears the whole output element and all
preparepool bytes before it reads the source, so a source that is the output itself, or that lies inside the pool, is read after it was cleared:mainbefore this PRout == srcrequire5: all five strings empty, port 0require5: all five strings empty, port 0require0x12, while sizing only counts the real string: 0x1c)preparepast a guard page)This PR clears
outand the pool first, then reads the source pointers and the port, computes the size and copies. A short pool returnsERROR_OUT_OF_MEMORYwith both already cleared, as before.Not measured: whether the console writes the strings before it checks the size. A short pool always ends up cleared, so the order can't be seen. The debt entry says so.
Tests:
guest_httpchecks, inside the existingsceHttpUriCopyblock:require, the padding and the reserved bytes;out == src, and a source element or a source string inside the pool.The new checks fail on
mainand pass here.Debt: the
sceHttpUriCopyentry indocs/dev/debt/libSceHttp.mdnow describes the measured behaviour and the one unmeasured point.How the console was measured
sceHttpInitwas not needed and not called.libSceHttp.sprxwas loaded withdlopen, andsceHttpUriCopyandsceHttpUriParsewere taken from it withdlsym.sceHttpUriParseand from hand-built elements.~, outputs with 0x5a, andrequireis preset to 0xabcd; every output pointer is logged as an offset into the pool.uricopy2anduricopy3put the pool before a guard page to see the clearing, and alias the source with the output and the pool.Console output (excerpt, copied unchanged)
Tested
Windows 11, WinLibs GCC 15.2.0, Release:
guest_http,guest_http_response_headerandguest_http2pass. Not tested on Linux or with a title.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)