Commit Graph
10 Commits
Author SHA1 Message Date
orezraeyandClaude Opus 5.5 373027da36 fix(libc): reject strerror_r buffers under 23 bytes and cut longer texts
The libc.prx that PPSA31872 ships returns ERANGE for a buffer shorter than
23 bytes and otherwise strncpy's length - 1 bytes and terminates the last
one. This matches the firmware 13.60 log, where error 0 with a 16-byte
buffer returned 34 although "No error" fits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:59:49 -03:00
orezraeyandClaude Opus 5.5 b4530f1cce fix(libc): give strerror_r and perror the strerror texts as measured on a PS5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 17:59:49 -03:00
boykopovar f38d29fd08 refactor(sdk): add canonical headers for remaining libraries 2026-10-24 23:17:42 +03:00
ntamas94andClaude Opus 5.5 8305168f39 fix(libc): answer strerror as the titles' libc.prx does
The libc.prx that PS4 titles ship (measured for CUSA04865 and CUSA12435 on a
PS4 Pro, firmware 10.71) names 0 "No error", 1 to 94 with the FreeBSD texts
(30 is "Read-only filesystem"), answers every other number, 95 and 96
included, with "error_code=0x%08x", and leaves errno alone. AnyPS5 returned
"No error: 0", named 95 and 96, answered "Unknown error: %d" and set errno
to 22. strerror_r and perror keep their wording; only the shared EROFS text
changes for them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-23 19:19:40 +02:00
Adrià 097a6288f1 Merge pull request #3130 from fma-rc/fix/strerror-r-unknown-short
fix(libc): keep EINVAL from strerror_r for an unknown error with a short buffer
2026-10-11 10:44:49 +02:00
fma-rc d90dff97a8 fix(libc): keep EINVAL from strerror_r for an unknown error with a short buffer 2026-10-11 00:50:49 +02:00
Hussein Kadhim 57da6e662e test(libc): check the exact unknown-error texts
(cherry picked from commit bbd7e79cda)
2026-10-10 20:28:58 +00:00
Hussein Kadhim 5830d8e446 fix(libc): use FreeBSD errlst message texts for strerror and strerror_r
Twenty-five of the ninety-seven errno messages differed from FreeBSD releng/11.4 lib/libc/gen/errlst.c (for example errno 0, 30, 47, 62, 70 and 84).

(cherry picked from commit ce14c9ad7d)
2026-10-10 20:28:58 +00:00
LuisBiceps 9850628e1b test(libc): reset errno after the worker thread in guest_errors
guest_errors sets errno to 13 and checks at the end that the strerror_r
calls left it alone, but a std::thread is created and joined in between.
Guest errno is the host's errno. Since glibc 2.42, pthread_create first
tries madvise(MADV_GUARD_INSTALL) for the new thread's stack guard.
Kernels before 6.13, including WSL2's 6.6, reject it with EINVAL, and
glibc falls back to mprotect with errno left at EINVAL. POSIX leaves
errno unspecified after a successful call, so the test aborts on Ubuntu
26.04 (glibc 2.43) under WSL2 without anything being wrong.

Check errno right after the strerror calls, and set it to 13 again after
the join, so every errno check covers only strerror and strerror_r.
2026-10-09 01:21:00 +08:00
SamG-Coder 97e6ce992b feat(libc): implement guest errno message APIs 2026-09-25 06:17:18 +10:00