fix(libkernel): fail EVFILT_READ and EVFILT_WRITE on a ksem id with EINVAL, as FreeBSD 11.4 does #24490
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24490"
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:29:05Z.
What
keventthrew for read and write events on a ksem id, a host null device descriptor here. FreeBSD 11.4 attaches these filters through the file'sfo_kqfilter, andksem_opsusesinvfo_kqfilter, which fails withEINVAL.EVFILT_READandEVFILT_WRITEfail withEINVAL;kqueue_registerclearsfflagsbefore the attach, so the error event hasfflags0 andEINVALindata.sceKernelAddReadEventandsceKernelAddWriteEventstill throw on a ksem id, andEVFILT_VNODEandsceKernelAddFileEventwatch the host null device; the new debt entry records both.IsKsemDescriptor, which this uses, is replaced byDuplicateKsemDescriptorin open #22191. The two merge without a textual conflict, but whichever lands second needs a rebase that keeps a ksem predicate, or the build breaks. I will rebase this as soon as #22191 lands.KsemReadWriteinGuestKqueue.cpp, including a ksem id on descriptor 0.Tested
Linux (Debian 13, GCC 14.2.0, Release). Head
4386105ec3, 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.4386105ec3,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 before review, which then moved the check ahead of the standard-input shortcut and added the descriptor-0 case, 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-ksem-einval: it flagged #7088 for an earlier placement of the check; with the check first inAddDescriptorKnote,git merge-treewith #7088's head is clean. It could not compare #7121, which conflicts withmainand does not touchAddDescriptorKnote.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T17:47:56Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
4386105ec3:tools/check_conventions.pypassed.guest_kqueue_testsbuilt cleanly.guest_kqueue,guest_kqueue_cleared_race):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
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T05:53:51Z.
Review: APPROVED
Reviewed — looks good
The change at head
4386105ec3f8ae5c55fbc35052ece935bc51c9ddrejects ksem descriptors before the standard-input shortcut and reports the expectedEINVALevent; no blocking defects were found in the reviewed files.What I ran
No commands were run. I read the prepared diff and the changed files at the pinned head.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run tests or build the change. The reported test and platform results in the PR description are author-supplied. The reader listed all three changed files as included and reviewed; no changed files were excluded.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T13:33:43Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
aef78456354d3a7b23e4aef392546c0fd3e760b8using the prepared diff andrepo_read.pyat that head. No tests or build commands were run during this review; test results in the PR description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No test/build rerun, Windows or macOS run, physical-console behavior, or FreeBSD source behavior was independently verified. Read:
core/libs/prx/libkernel/Equeue/src/Kqueue.cpp,core/libs/tests/GuestKqueue.cpp, anddocs/dev/debt/changes/fix-libkernel-kevent-ksem-einval.md. Excluded changed files: none. The referenced FreeBSD source and other PR interactions were not inspected.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T14:08:57Z.
Review: APPROVED
I read the diff at
aef7845635. Windows 11 with GCC 15.2 and Linux (Ubuntu 24.04 in WSL2, GCC 13.3), merged intomainat6c6b29320fetogether with other open PRs (so not an isolated build).guest_kqueueandguest_kqueue_cleared_race: pass on both.guest_kqueuestops with "kevent: EVFILT_READ on a descriptor that is neither a socket nor the read end of a pipe not implemented". On Linux, with the changed sources of the tested CPU PRs put back tomain's,guest_kqueuefails too.Not checked: a console.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T14:18:17Z.
Review: COMMENTED
Built the changed Kqueue unit with the branch's
GuestKqueuefixture against the existing Linux runtime. The fixture passed, includingEINVALfor read and write filters on a semaphore. I checked that the semaphore test still runs when the semaphore occupies descriptor zero.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.