fix(libkernel): fail fsync, fstatfs, fchflags, futimes and flock on a ksem id as FreeBSD 11.4 does #24488
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24488"
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:28:53Z.
What
These calls reached the host null device behind a ksem id:
fstatfsreturned host data,fchflagsthrew, andfutimestried to set the null device's times. FreeBSD 11.4 takes the vnode forfsync,fdatasync,fstatfs,fchflagsandfutimesthroughgetvnode, which fails withEINVALfor a file that is not a vnode, andsys_flockfails withEOPNOTSUPPfor one, before it checks the operation.futimes, which #24483 fixes for a kqueue.futimesstill copies its times in first, askern_futimesrunsgetutimesbeforegetvnode, soEFAULTkeeps its place.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.VnodeCallsinGuestKernelSysKsem.cpp, includingflockwith operation 0.Tested
Linux (Debian 13, GCC 14.2.0, Release). Head
ad4b485923, on #24487's headf78c18f92a, which has since merged, somainnow contains it and this PR shows only its own commit. The runs after the first two bullets are from earlier heads.ad4b485923:ctest -R '^guest_(kernel_sys_ksem|kqueue|kqueue_cleared_race)$': 3/3 passed.7aba775579, merged with my eight other updated branches ontomainbd9a6c00a6:ctestover the 23 tests these branches touch (guest_kernel_ioctl_fionread,guest_kernel_ioctl_device_type,guest_kernel_fcntl*,guest_kernel_app_archive_*,guest_kernel_sys_ksem,guest_kqueue,guest_equeue_events,guest_socket_events,guest_system_configuration,guest_socket_pair,guest_recvmsg_memory,guest_kernel_sys_cpuset,np_uds_events,guest_np_uds_*andguest_np_trophy_*): all pass.main84e16538d4,guest_kernel_sys_ksemfails at the newfstatfscheck.85bc501067,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-ksem-vnode-calls: #22191 adds a call in the same place ofGuestKernelSysKsem.cpp'smain(line 300), so whichever lands second needs a rebase; could not compare #6936, #7121, #7447, #9293, #9297, #9302, #12682, #12688, #12700, #12965 and #15037, which conflict withmain; none of them touches these checks.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-20T17:55:57Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
85bc501067:tools/check_conventions.pypassed.guest_kernel_sys_ksem_tests,guest_kqueue_testsbuilt cleanly.guest_kernel_sys_ksem,guest_kqueue,guest_kqueue_cleared_race):core/libs/prx/libkernel/File/src/Open.cpp,core/libs/prx/libkernel/File/src/Stdio.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:39:12Z.
Review: APPROVED
Reviewed — looks good
Nothing in the changed code blocks merging; the targeted review found no verified defects.
What I ran
Reviewed head
85bc5010674a842c1db7ae8f3cb6c1428fbf3ff5using the prepared diff and pinned reader. No commands or tests were run by me; test results in the PR description are author-reported.Read
core/libs/prx/libkernel/File/src/Open.cpp,core/libs/prx/libkernel/File/src/Stdio.cpp,core/libs/tests/GuestKernelSysKsem.cpp,core/libs/tests/GuestKqueue.cpp(changed files; included in the review folder), and the targeted context incore/libs/prx/libkernel/Semaphore/include/Ksem.hppandcore/libs/prx/libkernel/Semaphore/src/Ksem.cpp.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run tests, build the change, or verify behavior on Windows, macOS, or a console. The author reports Linux Debian 13/GCC 14.2 Release testing and a passing set of ten targeted CTest cases. All changed files were included and read;
files.jsonexclusions were not provided in the prepared materials, so excluded-file status is not verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T09:27:58Z.
Review: COMMENTED
Reviewed — no blocking findings
The changed code consistently routes ksem descriptors through the intended error paths; I did not independently run the reported checks.
What I ran
Reviewed head
7aba775579e5bcbc3976ddafbdf7bef221368900using the pinned reader. No tests or other commands were run.Results
Negative control
Not run independently; the description reports a negative control on an earlier main revision.
Findings
Blocking
None.
Non-blocking
None.
Sources
core/libs/prx/libkernel/File/src/Open.cppandcore/libs/prx/libkernel/File/src/Stdio.cppat head7aba775579e5bcbc3976ddafbdf7bef221368900.core/libs/tests/GuestKernelSysKsem.cppat head7aba775579e5bcbc3976ddafbdf7bef221368900.Not verified
No checks were run independently. The description reports test results, but they were not confirmed in this review. All changed files listed in the manifest were included and inspected; no changed files were excluded.
To get this to a good state
Nothing is required. Optional: confirm the reported checks on the current head in CI.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T11:37:38Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes add ksem-specific descriptor errors and regression coverage; no verified blocking defect was found in the inspected code.
What I ran
ad4b4859235f4d57376fac71b9ba581cb204c5d2using the prepared diff andrepo_read.py.description.md; these were not independently verified.Open.cpp,Stdio.cpp, andGuestKernelSysKsem.cpp, plus the ksem descriptor predicate implementation.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
files.json; that document was unavailable through the reader.To get this to a good state
Nothing is required.