fix(libSceNet): report copied socket address lengths #4613
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4613"
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 EagleBearerYS on 2026-10-12T16:45:33Z.
What
sceNetAccept,sceNetGetsockname,sceNetGetpeername,sceNetRecvfromandsceNetRecvmsgstored the full address length (16 or 28) even when the caller's buffer was shorter and only part of the address was copied. FreeBSD 11.4 stores the copied length, the smaller of the two: accept, recvfrom and recvmsg, getsockname and getpeername insys/kern/uipc_syscalls.c. libkernel's socket calls do the same since #4295.mainlengthsceNetGetsocknamesceNetRecvfromsceNetAcceptsceNetGetpeernameTested
Windows 11 (10.0.26300), WinLibs MinGW-w64 GCC 15.2.0 r7 (UCRT), Release,
-DBUILD_TESTING=ON, onmainat2a5eca11:main'sExport.cpp, the newCheckDatagramAddressLengthsandCheckStreamAddressLengthsinguest_sce_netabort (exit0xc0000409);guest_sce_netpasses onmainitself, IPv6 checks included, so the abort is the new checks. With the change they pass, 20 runs in a row. The IPv6 half runs here (28-byte addresses).core/libs/prx/libc/CMakeLists.txtandcore/libs/prx/libkernel/CMakeLists.txtthat build on Windows pass, and so do the network tests (guest_datagram_recv,guest_datagram_recvfrom,guest_datagram_sceNetRecv,guest_datagram_sceNetRecvfrom,guest_udp,guest_resolver,guest_posix_filesystem).Linux (Ubuntu 24.04, GCC 13.3, Release), base
33ae282e: the newCheckDatagramAddressLengthsandCheckStreamAddressLengthsinguest_sce_netabort onmain(getsockname with capacity 0 reports 16) and pass with the change, 20/20; the IPv6 half was skipped there for want of an IPv6 loopback. The libSceNet, libc and libkernel tests are unchanged. Again on WSL2 (Ubuntu 24.04, GCC 13.3.0, Release with CI's configure flags), merged intomainatc952c2b0e, now with the IPv6 half: they abort withmain'sExport.cppand pass with the change, 20 runs in a row.tools/check_conventions.py --base origin/mainpasses.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)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:44:28Z.
Checked the diff against FreeBSD's
uipc_syscalls.c(accept, getsockname, getpeername, recvfrom and recvmsg all report the copied length). Ran the libSceNet/libs tests on Linux (green);guest_sce_netfails withExport.cppreverted and passes with the change. Merging once the full Build is green.