Skip to content

fix(libkernel): keep the TCP flag and IP receive options a PS5 accepts - #10350

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

oneandonlydean merged 7 commits into
boykopovar:mainfrom
orezraey:fix/libkernel-socket-receive-flags-measured-ps5

Conversation

@orezraey

@orezraey orezraey commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

Six more socket options measured on a retail PS5 (firmware 13.60) through libkernel_sys.sprx from a payload process. The source and console log are in this gist (pinet6). This branch is on top of #10331 (and so the socket option stack below it), which edit the same option code and debt entries.

On the console:

  • TCP_NOPUSH (4) and TCP_NOOPT (8) start at 0, read back as 0x1000 and 0x8 after any non-zero value, and as 0 after 0, as FreeBSD's TF_NOPUSH and TF_NOOPT bits;
  • TCP option 0x80, FreeBSD's TCP_KEEPINIT, behaves as a flag: 0 at first, 0x10000 after 5 or -1, 0 after 0;
  • IP_RECVDSTADDR (7) and IP_RECVIF (20) start at 0 and read back as 1 after a non-zero value; IP_RECVTTL (65) reads 0.

AnyPS5 failed all six with ENOPROTOOPT. They are now kept per socket and read back as above, and an accepted socket takes TCP_NOPUSH from its listener as FreeBSD 11.4's syncache_socket does. None of them changes traffic: TCP_NOPUSH does not hold back sends and the IP options add no control message to recvmsg, which a new debt entry records along with the unmeasured IP_RECVTTL set path.

Tested

Windows 11, MinGW (winlibs).

Checklist

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the incremental change at dd27146, with #10331's stacked dependency separated from this diff. The added TCP flag state reproduces the reported readback values, and only TCP_NOPUSH is inherited by accepted sockets as claimed. The IPv4 receive-option bits are kept separately from TTL/TOS and are independently tested; the PR explicitly records that IP_RECVTTL's set behavior and delivery of ancillary data remain unimplemented/unverified. The reported retail PS5 measurements and focused guest tests cover the newly added cases. Hosted eligibility, conventions, intake, labels and report checks pass; product jobs are skipped by path policy. I did not run the socket tests locally. No blocking issue found in this incremental diff.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@orezraey Could you refresh this child onto the settled #10331 prerequisite? It currently embeds 062dc00, while #10331’s reviewed head is 4dc6530. GuestSocketOptions.cpp:364/:373 still conditionally omits multicast assertions when setup fails. Preserve the parent’s strict guest_socket_options_multicast fixture and rerun it with guest_socket_options, guest_socket_stream_options and guest_underscore_entries on Linux and Windows, with actual passes. Resolve unsupported-form throw assertions in the parent rather than copying them here; retain TCP_NOPUSH-only inheritance and independent IP bits.

…nel-socket-receive-flags-measured-ps5

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

Copy link
Copy Markdown
Contributor Author

Refreshed onto #10331: 9402457 merges its current head f6d9973 (which follows 4dc6530 and drops the non-zero-address ip_mreqn loop), so this branch now carries the parent's strict, separately registered guest_socket_options_multicast fixture unchanged and copies no throw assertions. Against the parent, GuestSocketOptions.cpp only adds the receive-option loop for IP options 7, 20 and 65; the TCP_NOPUSH-only inheritance and the independent IP bits stay as they were. guest_socket_options, guest_socket_options_multicast, guest_socket_stream_options and guest_underscore_entries pass three runs in a row at 9402457 on Windows 11 (MinGW GCC 15.2) and on Linux (WSL2, kernel 6.18, GCC 16.2.1, Release).

@github-actions github-actions Bot added the build label Oct 24, 2026
@orezraey

Copy link
Copy Markdown
Contributor Author

@xXPBSXx: #8448 changes the same lines as this PR in core/libs/prx/libkernel/Socket/src/Udp.cpp (git merge-tree of both heads over current main conflicts there). I propose it lands first; I will then merge main into this branch, keeping both sides' behaviour, and rerun its tests. Depends on now lists it (merge order only).

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 24, 2026
orezraey and others added 2 commits October 24, 2026 14:20
…nel-socket-receive-flags-measured-ps5

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

Copy link
Copy Markdown
Collaborator

@orezraey The child now includes current #10331 d9d84b5, and its strict, separately registered multicast fixture is preserved, including the INADDR_ANY drop case. The own TCP/IP flag behavior and TCP tests remain unchanged. The final main merge is only through 137a8fa, before #10330 landed, so this head still conflicts with current main in libkernel.md. Once #10331 is settled, please refresh current main and retain the landed SOL_SOCKET debt together with this PR’s updated option counts, TCP/IP receive gap and multicast entry. Keep the strict fixture; we will run full CI on the resulting head.

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

Copy link
Copy Markdown
Contributor Author

@oneandonlydean Merged current main (after #10330) in fddc34a, still over #10331 at d9d84b5. libkernel.md keeps the landed SOL_SOCKET entry next to this PR's updated option counts (eight IPPROTO_TCP, ten IPPROTO_IP), the TCP_NOPUSH/IP_RECV* receive entry and the multicast entry; the strict guest_socket_options_multicast fixture is untouched. guest_socket_options, guest_socket_options_multicast and guest_socket_stream_options pass three runs in a row at that head on Windows (WinLibs GCC 15.2) and Linux (WSL2, GCC 16.2).

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 24, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@orezraey thanks, the delta review passed on fddc34a. #10331 has now merged, and GitHub shows this PR as conflicting with main again, so CI would skip it. Could you merge main once more? We'll run the full CI on that head.

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

Copy link
Copy Markdown
Contributor Author

Merged main (50757b0, with #10331) in 60e4b0b. The merge was clean, so this PR's diff against main is the same six files as before. All 28 guest_socket* tests pass three runs in a row on Windows, the 14 that run on Linux pass three runs in a row on WSL, and check_conventions passes.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@oneandonlydean
oneandonlydean merged commit 761cb46 into boykopovar:main Oct 24, 2026
11 of 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.

3 participants