fix(libkernel): store setrlimit RLIMIT_CORE soft limit, ignore raised DATA/STACK hard limits #11862
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11862"
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 ionut27001 on 2026-10-27T10:01:25Z.
What
setrlimitkept no state forRLIMIT_CORE, so any change threw. It now stores theRLIMIT_COREsoft limit when the hard limit is unchanged andgetrlimitreports it. AnyPS5 never writes a core file, so any core size limit is honoured as is. Raising the hard limit ofRLIMIT_DATAorRLIMIT_STACKwith the soft limit unchanged returns 0 and leaves both limits as they were, as a payload process on a PS5 (firmware 12.70) does; a request that also changes the soft limit still throws. Other resources behave as onmain, and the debt entry lists what throws.Evidence, probe
p87_libkernel(a payload process on a PS5; title processes are unverified; firmware 12.70 frommeta fw=0x12700001on line 2),result.log:RLIMIT_DATAreads 34359738368 for both limits; raising the hard limit to +1, x2, +2^32 andRLIM_INFINITYwith the soft limit unchanged returns 0 with errno 0 each time, andgetrlimitreads the old limits after eachRLIMIT_STACK(2097152)RLIMIT_COREsoft limit to 0, then to 4096 (a raise from 0), then back to infinity returns 0 with errno 0, andgetrlimitreads each value back with the hard limit infinityEarlier probe
p83_libkernel(same firmware),result.log:getrlimitof resources 0 to 14,RLIMIT_DATA34359738368,RLIMIT_STACK2097152,RLIMIT_NPROC1604,RLIMIT_NOFILE13952, the others infinitysetrlimitto the values just read returns 0 for resources 0 to 14setrlimit(RLIMIT_NOFILE)to {13952, 13952} and then to {13952, 13953} both return 0 andgetrlimitreads 12555 for both limits; the probe does not read between the two calls (unchanged here, listed in the debt entry)Not claimed: the console result for a request that changes the soft limit of
RLIMIT_DATAorRLIMIT_STACKtogether with a raised hard limit (still throws here), the limits after lowering a hard limit (p83 line 361 shows only the return value 0 forRLIMIT_CORE{2, 1}, which FreeBSD normalises to {1, 1}), and soft limit changes of the other resources, which still throw.Tested
Windows 11, WinLibs GCC 15.2.0 (Release, Ninja), commit
bfbe4043c9on main75f3702aed:ctest -R ^guest_setrlimit$passed twice.Process.cpprestored from main and rebuilt, the same test aborts (setrlimit: changing the limit of resource 4 is not supported).RLIMIT_DATAhard-raise check runs only when the hostRLIMIT_DATAhard limit is finite; on Windows it is infinite unless the process runs in a memory-limited job, so this run most likely exercised only theRLIMIT_STACKraise.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T10:30:23Z.
Review: DISMISSED
I reviewed the current head
b6419c703092ac0b87347a541e7cd243e4e80932. Two behavior gaps block approval:storesSoftLimitreturns success and records new limits forRLIMIT_FSIZE,RLIMIT_CORE,RLIMIT_SBSIZE,RLIMIT_NPTS,RLIMIT_SWAP,RLIMIT_KQUEUESandRLIMIT_UMTXP, but those values are not enforced. The PR's own new debt entry confirms there is noEFBIG/SIGXFSZat the file-size limit and no enforcement for the other resources. A caller receives success for a limit that has no effect, which is a silent stub under this repository's contribution rules. Please implement the affected behavior or keep unsupported changes on the explicit unsupported path rather than reporting them as applied.RLIMIT_DATAandRLIMIT_STACKraises the maximum by one. The conditionrequested.rlim_max > current.rlim_maxaccepts any larger value as a successful no-op. Please keep unmeasured larger raises unsupported until their behavior is established, rather than generalizing beyond the evidence.The overlap check also lists open #11236 on
docs/dev/debt/libkernel.md. CONTRIBUTING requires the authors to agree on order and declare it withDepends on; please coordinate and update the dependency field. The existing inline review comment already covers the proposed unsupported-STACK test assertions; I am not duplicating that request here.