Repository navigation
fix(libSceNet): accept every sceNetMemoryAllocate flag as measured on a PS5 - #9076
Merged
oneandonlydean merged 2 commits intoOct 22, 2026
Merged
Conversation
… a PS5 A PS5 (firmware 13.60) allocates with any flag value, zero-fills only for flag 2 and returns 64-byte aligned blocks. Record the measured behaviour of sceNetGetIfName, sceNetGetRandom, sceNetGetSystemTime, sceNetMemoryFree and sceNetUsleep, which already match the console, and keep only their open gaps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
|
Contributor
|
Linux data point for
|
12 tasks done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 tasks done
12 tasks done
12 tasks done
oneandonlydean
pushed a commit
that referenced
this pull request
Oct 25, 2026
After sceNetInit, the console's sceNetUsleep prints "[LIBNET] usleep <count>" to standard output for a negative count before failing with EINVAL, as a payload measured on firmware 13.60 (#9076). AnyPS5 failed without printing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On
main,sceNetMemoryAllocatetakes anint32_tsize and throws for flag 4 (the pool reserve bypass), since AnyPS5 has no network pool. In a payload process on a PS5 (firmware 13.60):sceNetMemoryAllocatecasemainbefore this PRstd::runtime_errorINT64_MIN(flags 0 or 2)sceNetErrnoLocunchangedFlag 4 only lets an allocation dip into the pool's reserve. AnyPS5 allocates from the guest heap and enforces no pool or reserve, so a flag 4 allocation succeeds exactly as one without it does, which is what the console shows away from the reserve. The probe's sizes do not tell an
int32_tsize from anint64_tone (INT64_MINhas a zero low half), so this PR keepsmain'sint32_t.The same probe measured the other small utilities whose debt entries said "unverified on hardware". They already matched:
sceNetGetIfNamegives the 10 names for indexes 0 to 9 and an empty string with errno 22 past them, with a 32-bit index.sceNetGetRandomwrites exactly 4 bytes and fails with 22 for a null output.sceNetGetSystemTimegives microseconds equal tosceKernelGetProcessTimeand ignores a null output.sceNetMemoryFree(NULL)does nothing.sceNetUsleeptakes a signed 32-bit count and fails with 22 when it is negative.sceNetEtherNtostr's results and errors.On every failure the console returns
0x80410100 | errnoand setssceNetErrnoLoc, and a successful call leaves it unchanged; AnyPS5'sfail()already does this. Results were the same before and aftersceNetInit(which returned 0).Debt:
mainalready removed thesceNetGetIfNameandsceNetGetSystemTimeentries and rewrotesceNetGetRandom's. This PR:main'ssceNetMemoryAllocate and sceNetMemoryFreeentry with the measured cases, the0xddbytes a non-zero-filled block holds on the console, what happens when the pool runs out, and why flag 4 no longer throws;sceNetUsleep: the[LIBNET] usleep <n>line the console prints for a negative count, and what an interrupted sleep returns.Tests:
guest_sce_netchecks:sceNetGetRandom;sceNetGetRandom;sceNetUsleep(INT32_MIN).Related: open PR #8204 implements
sceNetEtherStrton, which this PR does not touch. The same probe measured it, and the console does not validate its input; see the log.How the console was measured
libSceNet.sprxwas loaded withdlopen, and every function was taken from it withdlsym.~or 0x5a, andsceNetErrnoLocis preset to 90 before each call.sceKernelGetProcessTime.Console output (excerpt, copied unchanged)
Tested
Windows 11, WinLibs GCC 15.2.0, Release:
guest_sce_netpasses, also after the merge ofmaininda0ed3b5c3. Not tested on Linux or with a title.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)