fix(libSceNet): accept MSG_NOSIGNAL in send, sendto and sendmsg #11037

Merged
Bram910 merged 2 commits from upstream-pr/11037 into main 2026-10-26 21:59:37 +00:00
Bram910 commented 2026-10-25 14:42:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Bram910 on 2026-10-25T14:42:49Z.


What

Accept MSG_NOSIGNAL (0x20000) in sceNetSend, sceNetSendto and sceNetSendmsg. They accepted only MSG_DONTWAIT and failed every other flag with EOPNOTSUPP. Titles built with the PS5 Payload SDK pass FreeBSD's MSG_NOSIGNAL (its include/freebsd/sys/socket.h defines it as 0x20000). For example, ProsperoTV (PPSA99003) sends every phone-remote reply with it. Under AnyPS5 the reply send failed, ProsperoTV closed the connection, and the phone or browser got an empty response (ERR_EMPTY_RESPONSE), so the phone remote could not be used.

The flag changes nothing on the host. Every host send already passes MSG_NOSIGNAL on Linux (NATIVE_SEND_FLAGS), and Windows raises no SIGPIPE. A send on a stream whose write side is shut down still fails with EPIPE, and other unsupported flags still fail with EOPNOTSUPP. sceNetSendmsg forwards to sceNetSendto, so the two changed checks cover all three calls.

libkernel's send and sendto already accept this flag (#1279, merged). The same libSceNet change was proposed twice before (#2406, #2835); both were closed by the intake bot while intake was paused, not after review.

A new CheckNoSignal in GuestSceNet.cpp covers a loopback TCP connection. It sends with MSG_NOSIGNAL through sceNetSend, sceNetSendto (also with MSG_DONTWAIT) and sceNetSendmsg, and checks that the bytes arrive. It also checks that MSG_NOSIGNAL | MSG_PEEK still fails with EOPNOTSUPP, and that MSG_NOSIGNAL sends after shutdown(SHUT_WR) fail with EPIPE. The debt entry records that the flag value follows FreeBSD and is not measured on a console.

Tested

  • Base main 3a2c51afd2ee6a824cd3a294912c65e6bbf2b768; head 32744645c48be917ebf1517211209b9522a2e703.
  • Homebrew, end to end: ProsperoTV 01.000.090 (PPSA99003, GPL-3.0 release PPSA99003.zip, SHA-256 checked against the release's SHA256SUMS), converted with relinker --windows. On unchanged main, GET http://127.0.0.1:8888/ gets an empty reply. With this change it returns HTTP 200, the 18,900-byte remote page. ProsperoRadio (PPSA99001) and ProsperoLight (PPSA99002) start and render as before.
  • Red/green, Windows 11 x64, Ryzen 9 7950X, RTX 3080, WinLibs GCC 15.2.0 r7, Release: guest_sce_net passes 3/3 with the change. With only the Export.cpp change reverted, it aborts at the first MSG_NOSIGNAL send. On the rebased head it passes 5/5 consecutive runs, and the 75 related network tests (guest_sce_net, net_dontwait*, guest_datagram*, guest_socket_host_write*, guest_refused_connect, guest_net_buffer_validation, TCP/UDP, SSL and HTTP) pass.
  • Full Windows suite on the rebased head: of 2,356 tests, 2,347 pass, 6 are platform skips and 3 fail. The 3 failures are unrelated to this change:
    • agc_host_import_cut_lifetime (#10746, fixed by #10785) and agc_driver_depth_plane_partial_store (#10664, fixed by #10696) are known main failures.
    • pad_sdl aborts because a physical DualSense on this machine takes controller slot 0 ahead of the test's virtual controller; the test does not link libSceNet.
  • Red/green, Ubuntu 22.04 under WSL, GCC 13.4, Release: guest_sce_net passes 3/3 with the change and aborts with only the fix reverted. On the rebased head it passes 5/5 consecutive runs, and the 40 related network tests pass. WSL has only a software Vulkan device, so the full Linux suite was not used for this change.
  • python tools/check_conventions.py --base origin/main --head HEAD and git diff --check origin/main...HEAD pass.
  • Overlap: tools/pr_overlap.py needs gh, which this machine does not have. Instead, every open PR's head was fetched and diffed against main; none accepts MSG_NOSIGNAL in libSceNet. #10949 and #10881 touch the same files and merge cleanly with this branch. #5836, #7201 and #9733 also touch them but already conflict with main on their own.

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: PPSA99003 (ProsperoTV homebrew) phone remote; no bring-up discussion
  • GPUs tested: n/a
  • AI-assisted: yes, Claude

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5005713453 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11037). Originally posted by [Bram910](https://github.com/Bram910) on 2026-10-25T14:42:49Z. --- ### What Accept `MSG_NOSIGNAL` (`0x20000`) in `sceNetSend`, `sceNetSendto` and `sceNetSendmsg`. They accepted only `MSG_DONTWAIT` and failed every other flag with `EOPNOTSUPP`. Titles built with the PS5 Payload SDK pass FreeBSD's `MSG_NOSIGNAL` (its `include/freebsd/sys/socket.h` defines it as `0x20000`). For example, ProsperoTV (PPSA99003) sends every phone-remote reply with it. Under AnyPS5 the reply send failed, ProsperoTV closed the connection, and the phone or browser got an empty response (`ERR_EMPTY_RESPONSE`), so the phone remote could not be used. The flag changes nothing on the host. Every host send already passes `MSG_NOSIGNAL` on Linux (`NATIVE_SEND_FLAGS`), and Windows raises no `SIGPIPE`. A send on a stream whose write side is shut down still fails with `EPIPE`, and other unsupported flags still fail with `EOPNOTSUPP`. `sceNetSendmsg` forwards to `sceNetSendto`, so the two changed checks cover all three calls. libkernel's `send` and `sendto` already accept this flag (#1279, merged). The same libSceNet change was proposed twice before (#2406, #2835); both were closed by the intake bot while intake was paused, not after review. A new `CheckNoSignal` in `GuestSceNet.cpp` covers a loopback TCP connection. It sends with `MSG_NOSIGNAL` through `sceNetSend`, `sceNetSendto` (also with `MSG_DONTWAIT`) and `sceNetSendmsg`, and checks that the bytes arrive. It also checks that `MSG_NOSIGNAL | MSG_PEEK` still fails with `EOPNOTSUPP`, and that `MSG_NOSIGNAL` sends after `shutdown(SHUT_WR)` fail with `EPIPE`. The debt entry records that the flag value follows FreeBSD and is not measured on a console. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Base `main` `3a2c51afd2ee6a824cd3a294912c65e6bbf2b768`; head `32744645c48be917ebf1517211209b9522a2e703`. - Homebrew, end to end: ProsperoTV 01.000.090 (PPSA99003, GPL-3.0 release `PPSA99003.zip`, SHA-256 checked against the release's `SHA256SUMS`), converted with `relinker --windows`. On unchanged main, `GET http://127.0.0.1:8888/` gets an empty reply. With this change it returns `HTTP 200`, the 18,900-byte remote page. ProsperoRadio (PPSA99001) and ProsperoLight (PPSA99002) start and render as before. - Red/green, Windows 11 x64, Ryzen 9 7950X, RTX 3080, WinLibs GCC 15.2.0 r7, Release: `guest_sce_net` passes 3/3 with the change. With only the `Export.cpp` change reverted, it aborts at the first `MSG_NOSIGNAL` send. On the rebased head it passes 5/5 consecutive runs, and the 75 related network tests (`guest_sce_net`, `net_dontwait*`, `guest_datagram*`, `guest_socket_host_write*`, `guest_refused_connect`, `guest_net_buffer_validation`, TCP/UDP, SSL and HTTP) pass. - Full Windows suite on the rebased head: of 2,356 tests, 2,347 pass, 6 are platform skips and 3 fail. The 3 failures are unrelated to this change: - `agc_host_import_cut_lifetime` (#10746, fixed by #10785) and `agc_driver_depth_plane_partial_store` (#10664, fixed by #10696) are known `main` failures. - `pad_sdl` aborts because a physical DualSense on this machine takes controller slot 0 ahead of the test's virtual controller; the test does not link libSceNet. - Red/green, Ubuntu 22.04 under WSL, GCC 13.4, Release: `guest_sce_net` passes 3/3 with the change and aborts with only the fix reverted. On the rebased head it passes 5/5 consecutive runs, and the 40 related network tests pass. WSL has only a software Vulkan device, so the full Linux suite was not used for this change. - `python tools/check_conventions.py --base origin/main --head HEAD` and `git diff --check origin/main...HEAD` pass. - Overlap: `tools/pr_overlap.py` needs `gh`, which this machine does not have. Instead, every open PR's head was fetched and diffed against `main`; none accepts `MSG_NOSIGNAL` in libSceNet. #10949 and #10881 touch the same files and merge cleanly with this branch. #5836, #7201 and #9733 also touch them but already conflict with `main` on their own. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: PPSA99003 (ProsperoTV homebrew) phone remote; no bring-up discussion <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes, Claude <!-- yes / no --> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-25 15:01:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T15:01:52Z.

Review: APPROVED


Reviewed exact head 32744645c48be917ebf1517211209b9522a2e703. The change admits the FreeBSD MSG_NOSIGNAL bit for the three send APIs while preserving rejection of other unsupported flags; sendmsg forwards through the validated sendto path. FreeBSD 11.4 defines the flag as 0x20000 and suppresses SIGPIPE on EPIPE when it is set (sys/sys/socket.h and sys/kern/uipc_syscalls.c). The changed source and regression test compile with GCC 12.2; exact-head diff and conventions checks pass. The PR reports Windows and WSL red/green tests and homebrew reproduction; I did not independently reproduce those runtime results. Hosted product jobs are skipped by path policy.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5643777116 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11037#pullrequestreview-5643777116). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T15:01:52Z. **Review:** APPROVED --- Reviewed exact head `32744645c48be917ebf1517211209b9522a2e703`. The change admits the FreeBSD `MSG_NOSIGNAL` bit for the three send APIs while preserving rejection of other unsupported flags; `sendmsg` forwards through the validated `sendto` path. FreeBSD 11.4 defines the flag as `0x20000` and suppresses SIGPIPE on EPIPE when it is set (sys/sys/socket.h and sys/kern/uipc_syscalls.c). The changed source and regression test compile with GCC 12.2; exact-head diff and conventions checks pass. The PR reports Windows and WSL red/green tests and homebrew reproduction; I did not independently reproduce those runtime results. Hosted product jobs are skipped by path policy.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!11037
No description provided.