fix(libkernel): fail read and write with a null buffer on a kqueue with EOPNOTSUPP, as FreeBSD 11.4 does #24486
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24486"
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 brajankw on 2026-11-20T17:25:32Z.
What
read,_read,writeand_writeon a kqueue failed withEFAULTwhen the buffer was null and the length was not 0. FreeBSD 11.4'skqueueopsreads and writes throughinvfo_rdwr, which fails withEOPNOTSUPPwithout touching the buffer, so a null buffer gets the sameEOPNOTSUPPas any other. A zero-length read still returns 0 first.KqueueDescriptorOperationsinGuestKqueue.cpp, through all four exports.Tested
Linux (Debian 13, GCC 14.2.0, Release). Head
aac46a0afc, the single commit onmainc8f72e905c.main84e16538d4,guest_kqueueaborts at the new null-buffer checks.aac46a0afc,ctestoverguest_kernel_sys_ksem,guest_kqueue,guest_kernel_sys,guest_filesystem,guest_file_vector,guest_kernel_sys_aio,guest_equeue_events,guest_kernel_fcntl,guest_kernel_ioctl_fionreadandguest_kernel_ioctl_device_type: all 10 pass.ctest(6393 tests,-j 12) on this branch and my other eleven branches of this round, merged ontomain84e16538d4: 6378 passed. The 15 failures also fail onmainin this environment:.gitdirectory, network access or a passwd entry for the user:conventions_git_errors,test_script_registration,web_library_assets,title_run,title_run_identity,guest_kernel_sys_login,guest_net_ctl,guest_getloginandguest_getlogin_no_session;agc_driverGPU cases fail the same way onmain:prepared_shaderswith itsindirect,uncachedanddebugforms, andstorage_file_write;agc_driver_image_table_packed_guardsis unstable onmainas well (2 of 10 runs passed on its own onmain3f4693be43).python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch fix/libkernel-kqueue-null-buffer-eopnotsupp: could not compare #6936, #7121, #7447, #9293, #9297, #9302, #12682, #12688, #12700, #12965 and #15037, which conflict withmaininStdio.cpp; #12682, #12688, #12700 and #12965 move the callers ofTransferArgumentErrorbut do not change it, and none of the others touches it.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 MarcZX10 on 2026-11-21T05:43:04Z.
Review: APPROVED
Reviewed — looks good
The reviewed head is
aac46a0afce8eae449069c91c9f7284ed2eb50c2; the inspected change correctly bypasses null-buffer validation for kqueue descriptors before the read/write calls, allowing the kqueue operation to produce its unsupported-operation error. Nothing blocks this; the points below are optional.What I ran
No commands or tests were run in this review. I read the prepared description, commits, manifest and diff, plus the changed code and its directly relevant callers at the pinned head.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests or builds were run. I did not verify the author-reported test results or behavior on Windows, macOS, or a physical console. Files read:
core/libs/prx/libkernel/File/src/Stdio.cpp(relevant argument validation and read/write callers),core/libs/tests/GuestKqueue.cpp(kqueue descriptor operation tests), andreview/description.md,review/commits.md,review/manifest.json, andreview/diff.patch. Excluded files: none; the manifest lists only the two changed files, and both were read at the relevant ranges.To get this to a good state
Nothing is required.