Repository navigation
fix(libSceLibreSsl3): copy the EVP_MD_block_size digest field safely - #24394
oneandonlydean merged 1 commit into
Conversation
EVP_MD_block_size read the block size straight from the guest digest. Copy the field in through GuestCopyIn while preserving errno, at the offset of the libSceLibreSsl3 or the parent digest layout, as the parent EVP_MD_size does. An unreadable digest is rejected through NotImplemented instead of being dereferenced. Results for valid digests are unchanged.
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 9340d5e2e4:
- Conventions:
tools/check_conventions.pypassed. - Build:
guest_icu_locale_core_testsbuilt cleanly. - CTest (
guest_icu_locale_core):1/1 Test #3981: guest_icu_locale_core ............ Passed 0.08 sec 100% tests passed, 0 tests failed out of 1 - Negative control: with
core/libs/prx/libSceIcu/LocaleCore.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/1 Test #3981: guest_icu_locale_core ............***Exception: SegFault 0.46 sec 0% tests passed, 1 tests failed out of 1 - Code reading:
- Verified pointer safety and GuestCopyIn/GuestCopyOut usage in LocaleCore.cpp (ReadText, ReadStatus, WriteStatus, WriteResult) ensuring guest pointers cannot crash host or bypass protection
- Verified uloc_getKeywordValue behavior and error status propagation with kIllegalArgument when locale/keyword are null or invalid
- Verified uloc_getParent truncation and null termination semantics with u_terminateChars_nid_postfix and host staging buffer
- Verified LP64 vs LLP64 portability and Windows/Linux guard page handling in GuestIcuLocaleCore.cpp
- Verified strict AGENTS.md compliance regarding comments, debt tracking, and conventions mechanical gate pass
Looks Good To Me
9340d5e to
4f61e97
Compare
|
A batch push at 16:38 UTC+1 put the wrong commit on this branch (9340d5e, the uloc change that is #24439). I restored the branch to the commit this PR is about: 4f61e97, AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head 4f61e976d90dddd4c964ff9def2eeb4a4079ef03. I read the prepared description, commit summary, manifest, diff, and both changed files; I also inspected the digest layouts, parent size export, and guest copy implementation. No commands or tests were run.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | Both changed files read |
| Tests | not run | Reported results are from the author |
| Negative control | not run | Author reports mutation check passed |
Negative control
I did not run a negative control. The description reports that the test segfaults when the implementation is reset to origin/main while keeping the new assertion.
Findings
Blocking
None.
Non-blocking
None.
Sources
- AdditionalExports.cpp, changed copy and error handling
- GuestLibreSsl3Digest.cpp, regression assertion
Not verified
I did not run the reported ctest, conventions check, guest pointer audit, build, or mutation check. Those results in the description are author-reported. No files were excluded from the review bundle; both files listed as reviewed in the manifest were read.
To get this to a good state
Nothing is required. The reported checks and mutation result are optional context; no additional action is required for this review.
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
|
On Windows, head Existing runs:
What this run adds. The first run of this PR's own diff by itself, with a negative control and mutations. It is on Code.
Negative control and mutation. These ran on the merge. The mutations were applied to
Tests.
Host:
AI-assisted: yes |
ligmaSec
left a comment
There was a problem hiding this comment.
Built the changed digest unit and ran the branch's GuestLibreSsl3Digest fixture against the existing Linux runtime. It passed. The change reads the block-size field through the checked copy while preserving the existing result for readable digest objects.
AI-assisted: yes.
|
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.
|
What
EVP_MD_block_sizeincore/libs/prx/libSceLibreSsl3/AdditionalExports.cppreadblockSizestraight from the digest the caller passed. An unmapped digest pointer crashed the process.It now picks the field offset as before: the libSceLibreSsl3
DigestMethodlayout forEVP_sha1/EVP_sha224, and the parentEVP_MDlayout for everything else. It then copies the 32-bit field in throughGuestCopyIn_nid_no_patch.errnois saved and restored around the copy. An unreadable digest throws throughNotImplementedAt_nid_no_patch. This is the same treatment the parentEVP_MD_sizereceived in the merged EVP digest fix (5e108f0); libSceLibreSsl3'sEVP_MD_sizeforwards to that parent export. A null digest still returns -1.The digest is a guest pointer argument. Only
EVP_sha1andEVP_sha224are matched by address, as before. Any other pointer, including one a game builds or corrupts, is read as anEVP_MD, so it goes through the checked copy.For valid digests the result is unchanged: the existing checks for MD5, SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 in
GuestLibreSsl3Digest.cppstill pass. No debt entry describes the old unchecked read, so there is no debt fragment.Overlap
python3 tools/pr_overlap.py --names EVP_MD_block_size→ main: implemented, open: none.python3 tools/pr_overlap.py --branch fix/libressl3-md-block-size-guest-pointers(re-run on 2026-11-20 againstmain0a025bd) failed closed. It could not compareAdditionalExports.cppwith feat(libSceLibreSsl3): implement SSL_set_quic_transport_params #16981, feat(libSceLibreSsl3): implement EC_POINT_dup #17621, feat(libSceLibreSsl3): implement EC_POINT_get/set_affine_coordinates_GFp #17622 and feat(libSceLibreSsl3): implement ECDSA_do_sign #17626, which conflict with main. Checked by hand: they implementSSL_set_quic_transport_params,EC_POINT_dup,EC_POINT_get/set_affine_coordinates_GFpandECDSA_do_sign, and none of their diffs adds or removes a line that mentionsEVP_MD_block_size.Tested
Arch Linux, GCC, Release, re-run on 2026-11-20 after rebasing onto
main0a025bd.guest_libressl3_digest(core/libs/tests/GuestLibreSsl3Digest.cpp) now also passes the unmapped address0x10toEVP_MD_block_sizeand checks that it throws and keepserrno.Mutation check: with
AdditionalExports.cppreset toorigin/mainand the new check kept,guest_libressl3_digestsegfaults.ctest --test-dir build -R 'libressl3|public_headers'passed 159/159 (94 libSceLibreSsl3 tests, 65public_headers*).tools/check_conventions.py --base origin/mainpasses.tools/guest_pointer_audit.py libSceLibreSsl3no longer listsEVP_MD_block_size.tools/progress.py --module libSceLibreSsl3gives 550/667 on bothmainand this branch.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)