fix(libkernel): return errors from pread instead of aborting #4719
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4719"
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 gjonn on 2026-10-12T19:44:24Z.
What
The POSIX
preadexport threw on a null buffer, a negative offset and any failed host read, which terminates the process. It now returns -1 and sets the guest errno exactly likepwriteandsceKernelPreadon main:EFAULTfor a null buffer with a non-zero length,EINVALfor a negative offset, and the mapped host error otherwise (EBADFfor an invalid or write-only descriptor).PPSA01317 stops on its first boot on Windows when a read from its save folder fails, at:
Tested
Windows 11, MinGW,
guest_file_vectoraddspread/pwritechecks for a null buffer, a negative offset, descriptor 9999 and a write-only descriptor.On main:
With the argument checks skipped, the invalid descriptor check on main stops at:
With this change:
guest_aioandguest_shm_openalso pass.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 nicolasfalesy on 2026-10-13T07:36:12Z.
Linux test (Arch, GCC 16.2.1, glibc, Release), this PR merged onto
main7e181fcc3together with #4725, #4719, #4585 and #4582 (no conflicts):guest_file_vectorpasses. With this PR's source change reverted (test kept), it fails on Linux, so the check guards the change on Linux too.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T15:15:48Z.
Rebased onto current
main(the partialEBADFhandling inpread_nid_postfixoverlapped this rewrite; kept this PR's version).guest_file_vectorfails without theStdio.cppchange and passes with it; scoped ctest (libs, libc, libkernel, 217 tests) is green on the rebase; merging once the full build is green.