libkernel: a null buffer or negative offset hides EBADF and ESPIPE in read, write, pread and pwrite #8662
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 xXPBSXx on 2026-10-20T20:17:48Z.
Repro
read(-1, NULL, 1),write(-1, NULL, 1),sceKernelRead(-1, NULL, 1),pread(-1, buf, 1, -1),pread(pipe_read_end, buf, 1, -1).Expected (FreeBSD 11.4 sys/kern/sys_generic.c:288, :332-341): EBADF for a descriptor that is not open, ESPIPE for a descriptor that cannot seek, EINVAL for a negative offset on a seekable one; a null buffer is only noticed when the data is copied (EFAULT).
Actual: EFAULT for the null buffer, EINVAL for the negative offset, before the descriptor is looked at.
Test: core/libs/tests/GuestFilesystem.cpp. Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/transfer-descriptor-first-fb. AI-assisted (Claude Code).