Skip to content

fix(libSceNet): guard recvfrom sender outputs before receiving - #7186

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
simonbronk:codex/net-receive-address-guards-20261017
Oct 18, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
simonbronk:codex/net-receive-address-guards-20261017

Conversation

@simonbronk

Copy link
Copy Markdown
Contributor

What

sceNetRecvfrom opens the receive-data buffer for host writes but writes the sender address and its length without those guards. A logically read-only sender-address mapping on Windows causes an unhandled 0xc0000005 write in libSceNet.prx instead of EFAULT.

Guard the length output before the unbound-socket early return, and the datagram address before receiving. Bound the address guard by caller capacity and native family size (16 bytes for IPv4, 28 for IPv6). Zero-capacity addresses need no write permission; stream address bytes remain untouched. Refused outputs leave the queued datagram available.

The existing watched-socket fixture now covers read-only address and length outputs, unchanged metadata and packet recovery, zero address capacity, and an IPv4 output ending at a writable page followed by a read-only page despite a larger supplied capacity.

No affected title is confirmed: this is a synthetic native regression. #5930 concerns sceNetRecvmsg message/vector guards, not these sceNetRecvfrom sender outputs. The current open #5836 and #6926 do not add these guards. No new PR implementing them was found.

Tested

Windows x64, Intel Core i7-8700, supported WinLibs GCC 15.2.0 r7 UCRT, CMake 4.4.4, Release, BUILD_TESTING=ON, bundled dependencies.

Refreshed on 2026-10-17 to main 84b0d2f24863d1e88105ada295cc346f720c1a6a. Exact tested tree ba773e46de2fa81663009f4fca80f348201c3b64. The rebase preserves main's new unbound-socket wait; the length guard also covers that path's length write.

  • Rebuilt the actual network library, runtime dependencies and guest_socket_host_write_tests, guest_datagram_receive_tests, guest_sce_net_tests on this base.
  • Final related network CTests and ten repetitions of the extended UDP regression pass with no skips; raw output attached.
  • Negative control captured on the original base 82ddae75b6761757f3d3ba9c0723647469270f76: adding the read-only-address case without production changes causes 0xc0000005 at the sender-address write. The original fixture without that case passed there. This negative control was not repeated on the new base.
  • Conventions against the new base and git diff --check pass. pr_overlap.py could not run because gh is unavailable; overlap was checked through the GitHub connector and the relevant open PR diffs.
  • New protected-output cases are IPv4 UDP. Existing TCP/IPv6 normal-path controls pass. No protected IPv6-output test, full all-target build, full CTest sweep, Linux/macOS or title execution. No performance claim.

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 (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none (no affected title verified)
  • GPUs tested: n/a
  • AI-assisted: yes (OpenAI Codex)
    net-receive-address-evidence-20261017.zip

AI-assisted: OpenAI Codex.
Windows native checks: 17 related CTests and 10 regression repetitions pass.
No affected title verified.
@github-actions github-actions Bot added the prx label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 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/Export.cpp
PR 6044 core/libs/tests/GuestSocketHostWrite.cpp
PR 6447 core/libs/prx/libSceNet/Export.cpp
PR 7201 core/libs/prx/libSceNet/Export.cpp
PR 7332 core/libs/prx/libSceNet/Export.cpp

@oneandonlydean oneandonlydean self-assigned this Oct 18, 2026
@oneandonlydean
oneandonlydean merged commit ddf547f into boykopovar:main Oct 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants