fix(libSceNet): reject the flags and names the module rejects #9727
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9727"
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 KernelPanicNT on 2026-10-22T10:05:06Z.
What
Four libSceNet calls now fail with
EINVAL(0x80410116, errno 22) for the argument values the PS5libSceNetmodule rejects. Until now they ignored their flags, andsceNetEpollCreateits name:sceNetEpollCreate(name, flags): a null name or non-zero flags.sceNetGetMacAddress(addr, flags): non-zero flags, as a null address already did. The address is not written.sceNetResolverCreate(name, memid, flags): non-zero flags.sceNetResolverStartNtoa(rid, hostname, addr, timeout, retry, flags): a negative timeout, a negative retry count, or a flag bit outside0x10001(flags & 0xfffefffe). This is checked before anything else, so it comes beforeEBADFfor an unknown resolver and before a pendingsceNetResolverAbortis reported.Source of the behaviour.
sceNetEpollCreate"requires a name and zero flags (+0x809f-+0x80b8); anything else is EINVAL" (L448-L449).sceNetGetMacAddress: "The module first refuses a null addr or non-zero flags with EINVAL (+0x542c-+0x5438)" (L531-L541).sceNetResolverCreate: "Non-zero flags are EINVAL (+0xbae0)" (L564-L578).sceNetResolverStartNtoa: "The module refuses a negative timeout or retry and flags & 0xfffefffe with EINVAL (+0xbb11-+0xbb2c)", ahead of its resolver id check (L579-L594).What is kept as it is, and why.
sceNetResolverStartNtoastill ignores bits0x1and0x10000, and the timeout and retry count: every lookup runs once, synchronously, through the host resolver, as onmain. What these bits do on a console is not known (shadPS4 names them async and IP address literals disabled), and making them throw would break callers that pass them today. The new debt entry records this.sceNetResolverCreatealso refuses a null name, but its module citation covers only the flags, so a null name is still accepted.Changes:
Export.cpp: the checks above at the top of the four functions.guest_sce_net, newCheckRejectedArguments: each rejected value fails withEINVALand setssceNetErrnoLocto 22; a rejectedsceNetGetMacAddressleaves the address untouched; on a resolver with a pending abort the rejectedsceNetResolverStartNtoacalls returnEINVALand the next valid call still returns the abort'sEINTR; on a destroyed resolver the rejected values returnEINVAL, and flags 0,0x1,0x10000and0x10001reach theEBADFid check.docs/dev/debt/libSceNet.md: a newsceNetResolverStartNtoaentry for the two ignored flag bits, the timeout and the retry count.Unblocks: none. No title is known to pass these values; this corrects the result on those paths.
Tested
Linux (GitHub Codespace, 4 cores, AMD EPYC 7763, native build of this branch
b7372d895, rebased onmaind969e4bd6):guest_sce_net_tests: 5/5 runs pass.ctest -R "net_epoll_lifetime|guest_sce_net"(guest_sce_netand the eightnet_epoll_lifetime_*cases, which create epolls with a name and flags 0): 5/5 runs pass, 9/9 tests each.core/libs/prx/libSceNet/Export.cppfrommain,guest_sce_net_testsaborts (exit 134,SIGABRTinCheckRejectedArguments(); itsRequireaborts without a message):1/9 Test #1292: guest_sce_net ....................Subprocess aborted***Exception, and the eightnet_epoll_lifetime_*cases still pass. 5/5 pass again after restoring it.Windows: @ycbuzi ran the previous head
5e48663b5merged ontomain6a6a35fdf5(Windows 11, MinGW-w64 GCC 15.2.0, Release):guest_sce_netpasses, and aborts withExport.cppfrommain.Not tested: macOS, a console, a title run.
Checks:
python3 tools/check_conventions.py --base origin/mainpasses with no findings.tools/progress.py: unchanged, 4835/11180 (43.25%) on base and head; no export is added or removed.git diff --checkagainstmain: clean.Duplicate and overlap check
Searches of open and closed pull requests for
sceNetEpollCreate,sceNetResolverCreate,sceNetGetMacAddress,sceNetResolverStartNtoa, "libSceNet EINVAL" and "libSceNet flags" find no other change to these checks. None of the open libSceNet pull requests changes the four functions in its diff; #9636 (deterministic resolver failures) edits othersceNetResolverStartNtoaassertions inGuestSceNet.cpp, and #9493 adds ansceNetEpollCreatecall with flags 0 in a test.python3 tools/pr_overlap.py --branch fix/net-reject-unsupported-flagsreports no conflict. It could not compare #5836, #6044, #6879, #7201 and #8398, which conflict withmainin the shared files. Checked by hand: none of them changes these four functions or the new test (#5836 is peer socket retries, #6879 adds one line toExport.cppfor the browser build, #7201 is the macOS port, #8398 is NetCtl NpToolkit callbacks), and #6044 movesGuestSceNet.cpptocore/libs/tests/networking/; whichever lands second keeps both changes.Checklist
main(d969e4bd6); 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 MarcZX10 on 2026-10-22T11:58:41Z.
Review: DISMISSED
The cited module evidence and focused regression coverage are substantive. Separately, the branch is 13 commits behind current
mainand the test report is against7e2ba73e4. Please refresh the branch and rerunguest_sce_netand the overlap check on the resulting head before merge. The queue comment is not a reason to hold this PR; it is fine to keep submitting PRs and they will be handled in due course. Product Linux/Windows CI jobs are skipped on the current PR.I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.