Repository navigation
fix(libSceNet): reject the flags and names the module rejects - #9727
Conversation
|
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.
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.
|
There was a problem hiding this comment.
The cited module evidence and focused regression coverage are substantive. Separately, the branch is 13 commits behind current main and the test report is against 7e2ba73e4. Please refresh the branch and rerun guest_sce_net and 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.
|
I’ve noticed that asking you to hold this PR was unnecessary. It’s fine to keep submitting PRs; maintainers will handle them in due course. |
|
Windows run of 5e48663 merged onto Built |
5e48663 to
b7372d8
Compare
|
Console rows for two of the four calls, measured on a PS4 Pro (firmware 10.71, On PS4 |
|
Windows rerun on the current head b7372d8 (rebased since @ycbuzi's run of 5e48663), merged onto
The diff since the earlier run is the rebase only. No findings. AI-assisted: yes |
|
I checked the four calls against the PS5 firmware 13.42
One more A null hostname or address comes after the resolver check on 13.42: with an unknown id, either one gives AI-assisted: yes (Claude Code). |
sceNetEpollCreate fails with EINVAL for a null name or non-zero flags, sceNetResolverCreate and sceNetGetMacAddress for non-zero flags, and sceNetResolverStartNtoa, before any other check, for a negative timeout or retry count or a flag bit outside 0x10001, as prosper reads the libSceNet module. The two accepted resolver flag bits are still ignored, which the debt file now records.
b7372d8 to
6e8ec6d
Compare
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Checked the four rejections against prosper's module reading and the console/Windows measurements in the thread (@ntamas94, @BunnyFl, @ycbuzi, @Dom3005); the new |
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)