fix(libkernel): accept MSG_NOSIGNAL in send and sendto #1279
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1279"
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 TheAggie on 2026-10-07T21:42:05Z.
What
send,sendtoandsendmsg(which forwards tosendto) failed every call with a nonzeroflagswithEOPNOTSUPP. FreeBSD code commonly passesMSG_NOSIGNAL(0x20000) to avoidSIGPIPEon a closed connection, so such callers could not send at all.MSG_NOSIGNALis accepted. Windows sockets never raiseSIGPIPE, so nothing is passed there; on Linux it maps to the nativeMSG_NOSIGNAL.EOPNOTSUPP, as before.guest_tcp:sendwithMSG_OOB(0x1) still fails withEOPNOTSUPP;sendwithMSG_NOSIGNALsucceeds and the data arrives.guest_udp:sendtowithMSG_NOSIGNALsucceeds. Both tests fail without the change.Tested
Windows 11 Pro (26200), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, NVIDIA GeForce RTX 5070 Ti.
guest_tcp,guest_udp,guest_sce_net,guest_addressespass; all 403 registered tests pass on currentmainwith this,polland #1265 applied (run from the generatedCTestTestfile.cmakecommands, as antivirus blocksctest.exehere).MSG_NOSIGNAL. Without this, every connection was closed without an answer (curl: empty reply). With it, pluspolland the same change as #1088, the server answeredGET /(HTTP 200) and received a 28.8 MB WAD throughPUT /upload/...; the saved file matches the source's SHA-256.Not tested on Linux.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-08T07:28:18Z.
Linux run, since the description says it wasn't tested there (Ubuntu 24.04, GCC 14.2, this commit applied to current
main6b573862, which it applies to cleanly).The PR's own tests:
guest_tcpandguest_udppass with the change and fail withUdp.cppfrommain.The Linux-specific part is what
MSG_NOSIGNALis for: sending on a connection the peer has closed. Nothing in the tree ignoresSIGPIPE, so on Linux the native flag is what keeps the process alive. I added that case toguest_tcp: closeaccepted, then send fromclientwith0x20000until it fails. That turned up one gap. The Linux branch ofNativeErrorhas noEPIPEcase, so the failure is reported as 5 (EIO) instead of FreeBSD'sEPIPE(32), which is what callers that passMSG_NOSIGNALusually check for.guest_tcpwith the case aboveEPIPEmappingEPIPEmapping,NativeSendFlagsreturning 0 on LinuxSIGPIPEThe last row shows the
MSG_NOSIGNALmapping is needed on Linux. With the mapping, the 8 socket-related tests (-R 'tcp|udp|net|socket|address|poll|epoll') pass. I ran the case without the#ifndef. I guarded it because Winsock reports a reset or aborted connection there, notEPIPE; I haven't checked which one on Windows.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T10:48:21Z.
Checked: build + full ctest (439/439) on current main,
guest_tcp/guest_udpfail with theUdp.cppchange reverted, Linux and Windows CI green.MSG_NOSIGNAL= 0x20000 matches FreeBSD; mapping to the native flag on Linux is needed (without it the process dies with SIGPIPE, as hikazey showed).Added as our own commit, taken from hikazey's comment (Co-authored-by):
NativeError(Linux):EPIPE→ 32. Sending to a closed peer returned 5 (EIO) instead of EPIPE.guest_tcp: send withMSG_NOSIGNALafter the peer closed must fail with 32 (#ifndef _WIN32; not checked what Winsock reports there).Merging once CI is green on the new head.
Imported from boykopovar/AnyPS5. Originally posted by hikazey on 2026-10-09T17:00:28Z.
.hikaze for dev role in Discord