fix(libkernel): fail EVFILT_READ and EVFILT_WRITE on the random device with ENODEV, as FreeBSD 11.4 does #24482
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24482"
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:22:59Z.
What
kevent,sceKernelAddReadEventandsceKernelAddWriteEventthrew for read and write events on/dev/randomand/dev/urandom. FreeBSD 11.4 attaches these filters through the file'sfo_kqfilter: devfs passes it to the device'sd_kqfilter, whichrandom_cdevswleaves unset andprep_cdevswfills withenodev.EVFILT_READandEVFILT_WRITEfail withENODEV.kqueue_registerclearsfflagsbefore the attach, so the error event hasfflags0 andENODEVindata.sceKernelAddReadEventandsceKernelAddWriteEventanswerENODEVin their export wrappers, afterEBADFfor a bad queue, askern_keventfetches the kqueue before the attach.AddDescriptorEvent, which #10645 rewrites, is not touched; this merges with #10645 without overlap.EVFILT_PROCDESCthere still throws, as #7653 limited it to measured kinds, andEVFILT_VNODEandsceKernelAddFileEventstill watch the host device, where FreeBSD fails withENODEVas well.RandomDeviceReadWriteinGuestKqueue.cpp, for both devices, throughkeventwith and without an event list,EV_DELETEafterwards, the two equeue calls, and a random device on descriptor 0.Tested
Linux (Debian 13, GCC 14.2.0, Release). Head
0c7dd7b9cb, the single commit onmainc8f72e905c.main84e16538d4,guest_kqueueaborts withkevent: EVFILT_READ on a descriptor that is neither a socket nor the read end of a pipe not implemented.0c7dd7b9cb,ctestoverguest_kqueue,guest_equeue_events,guest_randomandguest_kernel_sys_ksem: all 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-kevent-random-device-enodev: could not compare #7121 (Kqueue.cpp,GuestKqueue.cpp) and #9293, #9297 and #9302 (Equeue.cpp), which conflict withmain; none of their diffs touchesAddDescriptorKnoteor the two equeue wrappers.git merge-treewith #10645's head is clean.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 PrivacyOnion on 2026-11-20T18:30:38Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
0c7dd7b9cb:tools/check_conventions.pypassed.guest_kqueue_testsbuilt cleanly.guest_kqueue,guest_kqueue_cleared_race):core/libs/prx/libkernel/Equeue/Equeue.cpp,core/libs/prx/libkernel/Equeue/src/Kqueue.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me