fix(libkernel_sys): check the readlink size before the path #8603
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8603"
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-20T18:05:20Z.
What
readlinkandreadlinkatreturnedEFAULTfor a NULL path andENOENTfor an empty one before they looked at the buffer size. FreeBSD 11.4kern_readlinkat(vfs_syscalls.c:2232) returnsEINVALfor a size aboveIOSIZE_MAXbefore it looks the path up. The size is now checked first in both functions; a NULL or empty path with a valid size behaves as before. Overlap: #5528 (readlink path length, open) conflicts inExport.cpp(git merge-tree: one conflict), #8312 and #8522 are clean; whichever lands second rebases.pr_overlapwas not run.Fixes #8602
Tested
Windows 10 (19045), WinLibs GCC 15.2.0 r7, Release, with this commit (
994fb42929) onmain892a4f1328; the run without the change was made on the same base:guest_kernel_sys: aborts with exit code 0xc0000409 ("Kernel sys check failed at line 304", guest errno 14) without the change toExport.cpp, passes with it, 3 of 3 runs.python tools/check_conventions.py --base upstream/mainandgit diff --checkpass.GuestNamedShmIoDescriptorReuse.cpp(it mentionsreadlink, is Linux-only and does not linklibkernel_sys); a console; a title run.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T18:27:36Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libkernel_sys/Export.cppL278, L287Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libkernel_sys/Export.cppcore/libs/tests/GuestKernelSys.cppcore/libs/prx/libkernel_sys/Export.cpp