fix(libkernel): return ENOTTY for malformed ioctl requests #5569
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5569"
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 MarcZX10 on 2026-10-14T00:08:21Z.
What
Fixes #5564. Validate the encoded
ioctlrequest before reading its argument or looking up the descriptor, returningENOTTYfor malformed requests on files, pipes, directories, sockets, and invalid descriptors. The malformed cases follow FreeBSD'ssys_ioctl: no direction bit, an output request with zero length, or a void request whose length is notsizeof(int). Input-only requests with zero length are left to the existing path because FreeBSD behavior depends on compatibility options and the console configuration is unknown.Hussein Kadhim's implementation commit is carried with his original author attribution preserved. The existing behavior for well-formed requests is unchanged. The issue's overlap scan noted only a shared
docs/dev/debt/libkernel.mdline with #5451, #5020 and #5053; there is no implementation dependency, and a later debt-line merge may need a small rebase.Tested
Linux, GCC 12.2, Ninja Release,
BUILD_TESTING=ON, currentmaind1670009fbfdfe57f8f26ee09ced77fe6b18c2ca:guest_kernel_fcntl_tests,guest_udp_tests, andguest_sendfile_tests.guest_kernel_fcntlandguest_sendfilepassed three consecutive CTest runs each (6/6).guest_kernel_fcntlchecks retained but the three implementation files restored from currentmain,guest_kernel_fcntlaborts as expected; with the fix restored, it passes 3/3.guest_udppassed once and then aborted on a repeated run. The same intermittent abort reproduced withUdp.cpprestored from currentmain, so I am not claiming that test passed reliably in this environment.tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main...HEADpassed.Checklist
main; no other open PR implements the same behaviorNotImplemented_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 github-actions[bot] on 2026-10-14T00:22:37Z.
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)docs/dev/debt/libkernel.mdL161-162docs/dev/debt/libkernel.mdL162core/libs/tests/GuestKernelFcntl.cppL65docs/dev/debt/libkernel.mdL162Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T01:08:11Z.
Closing: no title is known to reach this. With the queue at 750 open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed