libc: reallocf is absent, first stop of PSXS5 and SwanStationPS5 on main; fix branch ready #3501
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 screamm on 2026-10-11T11:57:17Z.
libc (libSceLibcInternal) does not export
reallocf(NIDYMZO9ChZb0E). On currentmain0f863c10PSXS5 (PPSA97510) and SwanStationPS5 (PPSA98510) stop on it as their first stop (fresh Windows relink,--windows --registry unused-filter=0):Fix branch ready:
screamm:feat/libc-reallocf(92865bd6, one commit onmain0f863c10). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. The closed #1767 was the earlier attempt, closed for lack of a title; this is a rewrite on currentmain.reallocf(inFileAndHeap.cpp, next torealloc) calls the same heap path asrealloc; when the application's allocator returns null, or the default heap rejects the size as too large (the mappingposix_memalignalready uses), it frees the original block through the guest's own allocator, sets errno 12 and returns null, as FreeBSD 11lib/libc/stdlib/reallocf.cdoes; size 0 and a null pointer are left torealloc's existing behaviour; the other heap failures (exhausted arena, unknown or pinned pointer, finalized heap) keep throwing exactly asreallocdoes. TechnicalDebt records the FreeBSD provenance.application_heap_defaultandapplication_heap_replacementgain null-pointer-as-malloc, grow and shrink keeping data, size 0 freeing once, and the failure path (oversized request on the default heap; the fail flag on the fake guest allocator) returning null with errno 12 and freeing exactly once; removing the free makes both fail.Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs: the five heap tests 3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"532/534, the failures beingwindows_exceptions(#3411) and oneagc_driverheap-corruption exit that also occurs on unchangedmainhere under load and passed 3/3 alone with this change; withmain'sFileAndHeap.cppfour of the five tests fail;tools/check_conventions.py --base mainandgit diff --checkpass. Not run on Linux, no title run.Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T12:23:19Z.
Thank you @screamm for the clear diagnosis and test vectors for
reallocfon PSXS5 (PPSA97510) and SwanStationPS5 (PPSA98510).I have carried this off current
maininto #3522 (feat(libc): implement reallocf):reallocf_nid_postfix(NIDYMZO9ChZb0E) incore/libs/prx/libc/src/FileAndHeap.cppfollowing FreeBSD 11lib/libc/stdlib/reallocf.c.ApplicationHeapFree_nid_no_patch, setserrno = 12(ENOMEM), and returnsnullptr.ApplicationHeap.cppfor null pointer, grow, shrink, size 0, and failure on both default and replacement allocators.PR #3522 is open and passed PR intake! Calling on @adriadam10 and @oneandonlydean for review.
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T13:08:34Z.
Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.92865bd65onto currentmain: applies cleanly, no conflicts.tools/check_conventions.py --base origin/mainandgit diff --checkpass.The rebased branch is available at
blawesom:verify/3501for anyone carrying — the commit is otherwise unchanged.