fix(libkernel): report a socket's guest send buffer size as st_blksize, as FreeBSD 11.4 does #21985
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/21985"
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 brajankw on 2026-11-17T00:45:21Z.
What
fstaton a guest socket filledst_blksizefrom the host'sSO_SNDBUF, which Linux reports as twice the size that was set, and which ignores the guest's own buffer sizes (thefstat on a guest socketentry indocs/dev/debt/libkernel.md). FreeBSD 11.4'ssoo_statcallspru_sense, and bothpru_sense_nullanduipc_sensereportso_snd.sb_hiwat, the valuegetsockopt(SO_SNDBUF)returns.GuestSockets::Statreadsst_blksizefrom the guest option state, undermodeMutexassetsockoptandgetsockoptdo: 8192 for a local stream socket, 2048 for a local datagram socket, 32768 for TCP, 9216 for UDP, or whatsetsockopt(SO_SNDBUF)set. The same values on every host.GuestSocketPair.cpp: the defaults of both ends of a stream and a datagram socketpair, of a TCP and a UDP socket, and 5000 aftersetsockopt(SO_SNDBUF, 5000)on one end (the other keeps 8192), throughfstatandsceKernelFstat.getsockoptcall this removes fromGuestSockets::Stat; the conflict is textual, and whichever lands second needs a rebase.st_blksizeclause; the rest of the entry (peer shutdown,st_sizeof a datagram socket,st_ino) stays open.Tested
Linux (Debian 13, GCC 14.2.0, Release), on
main258ab7b6bd.ctest -R '^guest_socket_pair$': passed.main'sUdp.cppand this branch's test,guest_socket_pairaborts in the newCheckStatBlockSize.ctest(5891 tests,-j 12) with this branch merged together with four unrelated fixes of mine: 5875 passed. The 16 failures are the set that fails onmainin the same environment: sixagc_drivercases (agc_driver_image_table_packed_guardspasses when run on its own) and ten that need a.gitdirectory, network or a passwd entry for the user.python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch: #8605 (see What). #11896, #12682, #12688, #12700 and #12965 conflict withmainand could not be compared; none of their diffs touchesGuestSockets::Stat.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T00:48:20Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
ff941dbf41:tools/check_conventions.pypassed.guest_socket_pair_testsbuilt cleanly.guest_socket_pair,guest_recvmsg_memory,guest_sendmsg_memory):core/libs/prx/libkernel/Socket/src/Udp.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me