fix(libSceNet): guard recvmsg guest outputs #5930
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5930"
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 Ondra97 on 2026-10-14T16:15:15Z.
What
sceNetRecvmsgcopied received bytes into guest vectors and updated the message header without the host-write guards used by the other socket receive functions. On Windows, tracked mappings of shared direct memory can be armed read-only. The scatter copy and header update can then fault, and a logically read-only output faults instead of returningEFAULT.Keep the existing
GuestArena::HostWriteguards for the message and each nonempty vector through receive and scatter delivery. Refuse a read-only output before consuming the queued data. If a later vector is refused, earlier guards are released automatically.Extend the existing watched-socket fixture for
sceNetRecvmsgover UDP and TCP, using three vectors including an empty one. It checks boundaries, short receives, peek, unchanged errno, error cleanup, read-only vectors and headers, and collection during a blocking receive.Tested
Windows 11 Pro 10.0.26300, supported WinLibs GCC 15.2.0, Release, based on main
e34c47921.guest_sce_net.Checklist
main; no other open PR implements the same functionsFull platform runtime CI requires a write-access collaborator to dispatch it under repository policy.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:11:50Z.
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.
core/libs/prx/libSceNet/CMakeLists.txtcore/libs/prx/libSceNet/Export.cppcore/libs/prx/libSceNet/CMakeLists.txtcore/libs/tests/GuestSocketHostWrite.cppcore/libs/prx/libSceNet/Export.cppImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T18:50:10Z.
Checked the diff: the
HostWriteguards on the message and each non-empty iovec are opened before the queued data is consumed, aftermessage_lengthhas validated null/iov_length/null bases, and a refused later vector releases the earlier guards. The newsceNetRecvmsgcases extend the existing watched-socket fixture. Linux build and the scoped ctest (libs + libSceNet, 37 tests) are green; the new cases are Windows-only, so they will run in the Windows job. Merging once that is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T20:29:37Z.
Re-checked against current
main: theHostWriteguards on the message and each non-empty iovec are opened before the queued data is consumed, aftermessage_lengthhas validated null/iov_length/null bases, and a refused later vector releases the earlier guards. The newsceNetRecvmsgcases extend the existing watched-socket fixture. Linux build and the scoped ctest (libs + libSceNet, 39 tests) are green; the new cases are Windows-only, so they will run in the Windows job. Merging once that is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T23:28:51Z.
Re-checked against current
main(after #5928): theHostWriteguards on the message and each non-empty iovec are opened before the queued data is consumed, aftermessage_lengthhas validated the vectors, and a refused later vector releases the earlier guards. The newsceNetRecvmsgcases extend the existing watched-socket fixture. Linux build and ctest are green for libSceNet (guest_sce_net); the new cases are Windows-only, so they will run in the Windows job. Merging once that is green.