fix(libkernel): name the failing vnode watch in the kqueue notification error #5493
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5493"
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 Roojool on 2026-10-13T21:03:28Z.
What
EVFILT_VNODEwatch errors now name the failing watcher, the path that was passed toFindFirstChangeNotification, andGetLastError, instead of the anonymousEVFILT_VNODE: FindFirstChangeNotification failed, error=5that the Windows CI job printed.In the windows job of run 38451769652 (attempt 1, job 115484249079),
guest_kqueueaborted with exactly that string and exit code0xC0000409; attempt 2 of the same run passed, so the trigger is transient — which is precisely why the error needs to carry its context. This is the context #5435's review asked for: which notification handle and path was denied.The messages now read, for example:
WatchParent,WatchContents(entries/subdirectories) each label themselves; bothWatchParentcall sites (initial attach and re-registration) are labelledparent, so the message discriminates where the failure came from. Only the parent watch fails this way in practice — the watched directory itself is opened withFILE_LIST_DIRECTORYfirst, so a denial there surfaces earlier (modulo a rename or ACL change racing the two calls).Behaviour is unchanged: the call still throws. FreeBSD's
vfs_kqfiltererrno set is{EBADF, EINVAL, ENOMEM}and consults no directory permission, soERROR_ACCESS_DENIEDhas no counterpart to map to — inventing one is not grounded, and the throw stands per CONTRIBUTING.Overlap: #5393 touches the same files with a behaviour change for a measured delete-pending re-registration path. This PR is complementary and diagnosability-only — its named-watcher message discriminates the two hypotheses on the next recurrence (which call site and path failed), which raises the information value of #5393's own validation. Happy to rebase onto #5393 if it merges first.
Tested
main: denyFILE_LIST_DIRECTORYon the watched directory's parent, runguest_kqueue→ the sameerror=5throw → abort0xC0000409(receipts/G14-reproduction.txt). With this change the same run names theparentwatch and the denied path before aborting.DeniedParentWatchcase inguest_kqueue: DACL-denied parent → the thrown message containsparent,error=5and the absolute parent path (case-insensitively against the NT-normalized form); the DACL is restored before any assertion, so a failure does not strand a denied directory; afterwards the same watch is re-added and still deliversNOTE_WRITE. On unmodifiedmainthis test fails withthe vnode watch error lacks "parent"(receipts/G14-base-fail-windows.txt).guest_kqueue5/5 plus 10 file/directory/descriptor neighbours 11/11.guest_kqueue+ 11 neighbours 12/12 (the changed code is inside#ifdef _WIN32; this proves build and no regression).python tools/check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-13T21:03:35Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T22:07:25Z.
Review: COMMENTED
I checked this against the intermittent #5435 failure. The error now distinguishes
parent,entriesandsubdirectories, and includes the path passed to the Windows API plusGetLastError; the denied-parent test restores the DACL before its assertions and verifies the watch works afterward. Keeping the unsupported host-permission case as a throw is consistent with the lack of a grounded FreeBSD errno mapping. Applicable CI checks pass; the full path-filtered build jobs are skipped, with the Windows run documented in the PR. No further issue from me.Imported from boykopovar/AnyPS5. Originally posted by Roojool on 2026-10-14T05:05:49Z.
#5435 was closed with the fix in #5393 (merged). This PR keeps its scope — diagnosability only — and is now rebased on top of #5393, so both changes coexist: the watch no longer fails for the delete-pending path #5393 fixed, and if the transient Windows failure recurs, the error now names which of the parent/entries/subdirectories watches, on which path, was denied — the log-line context the close note asks for. Both test cases (delete-watched-file and denied-parent-watch) are kept.
Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-14T05:05:55Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T13:47:50Z.
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.mdL110-111docs/dev/debt/libkernel.mdL110-111Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T20:48:56Z.
Checked the diff, rebased onto current main and ran build +
guest_kqueueon Linux (the changed code is_WIN32-only; Windows is covered by the full Build before merge).Added two small commits' worth of fixes on top of your branch:
docs/dev/debt/libkernel.md: thesem_timedwaitentry had been joined onto the end of the EVFILT_VNODE line (...neither confirmed on a title- [sem_timedwait]...); split back into its own bullet.core/libs/tests/GuestKqueue.cpp: include<algorithm>and<cctype>forstd::transform/std::tolower.Merging once the Windows build is green.
Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-14T20:49:01Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-15T04:04:03Z.
The new
DeniedParentWatchcase aborts deterministically on a Windows box where the test process runs elevated.maina077a88df(also with #6060 or #6168 merged, same result), Windows 11 10.0.26200, MinGW-w64 GCC 15.2.0 r7, Release; 4 of 4 runs:The quoted error text is empty, so the watch on the DACL-denied parent succeeded and nothing was thrown. The process is an OpenSSH session of a local administrator:
whoami /groupsshowsBUILTIN\Administratorsenabled andMandatory Label\High Mandatory Level, andwhoami /privshowsSeBackupPrivilege,SeRestorePrivilege,SeSecurityPrivilegeandSeTakeOwnershipPrivilegeenabled. With backup privilege held,FILE_LIST_DIRECTORYis granted regardless of the deny ACE, soFindFirstChangeNotificationon the parent does not fail.guest_kqueuepassed 5 of 5 on this box atmainfa539dd9b, before this change.A skip (exit 77) when the deny cannot take effect, for example when the process holds
SeBackupPrivilegeor the parent can still be listed after the DACL is applied, would keep the case meaningful on unprivileged runners without failing elevated ones.Tested with AI assistance (Claude Code).