Skip to content

fix(libkernel): keep socket buffer sizes and SO_NBIO as measured on a PS5 - #10302

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
orezraey:fix/libkernel-socket-buffers-measured-ps5
Oct 24, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
orezraey:fix/libkernel-socket-buffers-measured-ps5

Conversation

@orezraey

@orezraey orezraey commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

getsockopt and setsockopt measured on a retail PS5 (firmware 13.60) through libkernel_sys.sprx from a payload process. The sources and console logs are in this gist (pinet to pinet3; the address cases of pinet went to #10299). The debt entry had these answers from the FreeBSD 11.4 source, or from the host.

The console:

  • starts a socket with SO_SNDBUF/SO_RCVBUF of 32768/65536 (TCP, IPv4 and IPv6), 9216/42080 (UDP), 8192/8192 (AF_UNIX stream and seqpacket) and 2048/4096 (AF_UNIX datagram), and SO_SNDLOWAT/SO_RCVLOWAT of 2048/1;
  • keeps the size asked for up to 524288 bytes, reads back 524288 for anything larger up to 5592405, fails above that with ENOBUFS (55) and below 1 with EINVAL;
  • limits a low-water mark to its buffer, and lowers it when the buffer shrinks under it;
  • reads SO_NBIO back as 0x100 (SS_NBIO), not 1;
  • fails a null setsockopt value with a length with EFAULT before it looks at the descriptor or the option, and answers a null getsockopt value with success and length 0.

AnyPS5 read the host's buffer sizes, failed the low-water marks with ENOPROTOOPT, read SO_NBIO as 1, and answered both null values with EINVAL. The four sizes are now kept per socket, set on the host as well, and copied to an accepted socket as FreeBSD's sonewconn does. The 6000-character getsockopt, setsockopt debt entry is split by option, keeps only what still differs or was not measured, and now lists the options the console accepts that fail here (SO_REUSEPORT, SO_DEBUG, SO_TIMESTAMP, IP_TTL, IP_TOS, TCP_MAXSEG, TCP_KEEPIDLE).

Tested

Windows 11, MinGW (winlibs).

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
  • GPUs tested: n/a
  • AI-assisted: yes

… PS5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 7511 core/libs/prx/libkernel/Socket/src/Udp.cpp L1124, L1144, L1147-1150
docs/dev/debt/libkernel.md L217
PR 8448 docs/dev/debt/libkernel.md L217
PR 8921 docs/dev/debt/libkernel.md L217-218

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 4630 docs/dev/debt/libkernel.md
PR 5021 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 6044 core/libs/tests/GuestSocketOptions.cpp
PR 6149 docs/dev/debt/libkernel.md
PR 6740 docs/dev/debt/libkernel.md
PR 6830 docs/dev/debt/libkernel.md
PR 6936 docs/dev/debt/libkernel.md
PR 7049 docs/dev/debt/libkernel.md
PR 7088 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7121 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7201 core/libs/prx/libkernel/Socket/src/SocketOptions.cpp
core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 7509 docs/dev/debt/libkernel.md
PR 7565 docs/dev/debt/libkernel.md
PR 7653 docs/dev/debt/libkernel.md
PR 8010 docs/dev/debt/libkernel.md
PR 8520 docs/dev/debt/libkernel.md
PR 8553 docs/dev/debt/libkernel.md
PR 9074 docs/dev/debt/libkernel.md
PR 9133 docs/dev/debt/libkernel.md
PR 9156 docs/dev/debt/libkernel.md
PR 9160 docs/dev/debt/libkernel.md
PR 9169 core/libs/prx/libkernel/Socket/src/Udp.cpp
PR 9199 docs/dev/debt/libkernel.md
PR 9284 docs/dev/debt/libkernel.md
PR 9293 docs/dev/debt/libkernel.md
PR 9297 docs/dev/debt/libkernel.md
PR 9302 docs/dev/debt/libkernel.md
PR 9557 docs/dev/debt/libkernel.md
PR 9561 docs/dev/debt/libkernel.md
PR 9566 docs/dev/debt/libkernel.md
PR 9575 docs/dev/debt/libkernel.md
PR 9578 core/libs/prx/libkernel/Socket/src/Udp.cpp
docs/dev/debt/libkernel.md
PR 9669 docs/dev/debt/libkernel.md
PR 9693 docs/dev/debt/libkernel.md

…e inherited sizes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@oneandonlydean
oneandonlydean merged commit 6fc058f into boykopovar:main Oct 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants