Skip to content

fix(libSceNet): guard recvmsg guest outputs - #5930

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-net-recvmsg-host-write
Oct 18, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
Ondra97:codex/fix-net-recvmsg-host-write

Conversation

@Ondra97

@Ondra97 Ondra97 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

What

sceNetRecvmsg copied 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 returning EFAULT.

Keep the existing GuestArena::HostWrite guards 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 sceNetRecvmsg over 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.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source; none added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes, Codex

Full platform runtime CI requires a write-access collaborator to dispatch it under repository policy.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 5836 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/prx/libSceNet/Export.cpp
PR 6044 core/libs/prx/libSceNet/CMakeLists.txt
core/libs/tests/GuestSocketHostWrite.cpp
PR 7201 core/libs/prx/libSceNet/Export.cpp

@adriadam10 adriadam10 self-assigned this Oct 16, 2026
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the diff: the HostWrite guards on the message and each non-empty iovec are opened before the queued data is consumed, after message_length has validated null/iov_length/null bases, and a refused later vector releases the earlier guards. The new sceNetRecvmsg cases 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.

@adriadam10

Copy link
Copy Markdown
Collaborator

Re-checked against current main: the HostWrite guards on the message and each non-empty iovec are opened before the queued data is consumed, after message_length has validated null/iov_length/null bases, and a refused later vector releases the earlier guards. The new sceNetRecvmsg cases 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.

@adriadam10

Copy link
Copy Markdown
Collaborator

Re-checked against current main (after #5928): the HostWrite guards on the message and each non-empty iovec are opened before the queued data is consumed, after message_length has validated the vectors, and a refused later vector releases the earlier guards. The new sceNetRecvmsg cases 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.

@adriadam10
adriadam10 merged commit a01f668 into boykopovar:main Oct 18, 2026
9 checks passed
@Ondra97
Ondra97 deleted the codex/fix-net-recvmsg-host-write branch October 19, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants