fix(libSceNet): socket option calls report unknown options, levels and short buffers like a PS5 #18108
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18108"
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 kali113 on 2026-11-10T13:02:33Z.
What
sceNetGetsockoptandsceNetSetsockoptanswered argument errors differently from a PS5. Measured on a PS5 (firmware 13.590.001, payload process) by running one case list on the console and against this library, then diffing; about 400 of the differing cases come down to the rules below.EINVALEINVALEFAULT, before the descriptor is checkedEINVALEFAULT, length untouched0x80000000or moreEINVALEFAULT, before the descriptor is checkedEINVALEFAULTENOPROTOOPT, whatever the lengthEOPNOTSUPP(EINVALwhen short)ENOPROTOOPTEINVAL0x7fff,IPPROTO_IPon an IPv6 socket)EINVALEOPNOTSUPPIPPROTO_UDPon a datagram socketENOPROTOOPTEOPNOTSUPPPer-option results that do not follow the general rule are encoded as measured:
0x1000isEINVALboth ways,0x1009EOPNOTSUPPboth ways,0x1010EOPNOTSUPPon get andENOPROTOOPTon set,0x1014ENOPROTOOPTon get andEINVALon set;0x2,0x1007,0x1008,0x1016,0x1011to0x1013and0x1107can be read but not set;0x4000,0x8000and0x1202can be set but not read.Not changed, and recorded in the debt entry:
EOPNOTSUPP, as do allIPPROTO_IPoptions on an IPv4 socket.ENOPROTOOPTfor option numbers outside the scanned ranges (single bits up to0x20000,0x1001-0x1020,0x1100-0x1110,0x1200-0x1210) is extrapolated from those ranges.SO_NBIOand0x10000(the console returns flag bits).SO_RCVTIMEO/SO_SNDTIMEOstructure passed to set is still read without a checked copy.getsockoptstill accepts a length of0x80000000or more; the console returnsEINVALthere too (measured).Ipv6Only.cppkeeps asserting the old result for the libkernel half.Existing tests that asserted the old codes are updated to the measured ones. #5836 adds support for setting
0x20000in the same function; the two changes do not contradict each other, and whichever lands second needs a small rebase.Tested
Linux x86-64 container on an Apple Silicon host: the new
guest_net_sockopt_errorsplus everyguest_net*,guest_sce_net*,net_*,guest_inet*,guest_socket*andguest_http2*test, 90 of 90 pass. No other targets were run locally. Windows and macOS not run.Console side: PS5, firmware 13.590.001, payload process (ps5-payload-sdk v0.45), loopback sockets only. A payload may have privileges a title does not; nothing here depends on that. Probe sources and raw output are in the first comment.
Follow-up:
0258d2cfe2makesGuestWritablekeep the caller's errno, because its Linux mapping lookup could leave a host error in the guest's errno.5846fad360removes debt sentences about null pointers that the measured rules replace. Syntax-checked only; not run.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-10T13:02:44Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T04:46:19Z.
Review: COMMENTED
Reviewed — no blocking findings
The changed code and tests support the reported socket option behavior; I could not run checks in this review environment, so a formal approval is not justified.
What I ran
Reviewed head
2355a297891cb8ac3af0ffe9cfe3a75bae51780d. No commands or tests were run; the available tools provided read-only review access.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Tests were not run. Windows, macOS, and physical-console behavior were not independently verified; the platform and console results in the description are author-reported. The new sockopt error test was reviewed in the diff.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T17:03:17Z.
Review: COMMENTED
NET_SO_ERRORreads and clears the host socket's pending error beforestorechecks whether it can write the guest outputs. If the output buffer is unwritable, the guest getsEFAULTand a subsequent valid call can lose the pending error. Please check the output ranges before consuming the host error, or document and test the behavior if the console deliberately consumes it on failure.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.