test(libkernel): deny the kqueue parent listing to the token user's SID #6173

Merged
PYTHONRETARDE merged 1 commit from upstream-pr/6173 into main 2026-10-17 11:33:09 +00:00
PYTHONRETARDE commented 2026-10-15 00:25:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PYTHONRETARDE on 2026-10-15T00:25:10Z.


What

guest_kqueue aborts on Windows when the user name equals the computer name:

the vnode watch error lacks "parent":

DeniedParentWatch denies FILE_LIST_DIRECTORY on the watched file's directory to the name GetUserNameW returns, passed as TRUSTEE_IS_NAME. On a machine named JABER with the local user jaber, LookupAccountNameW(nullptr, L"jaber") resolves to the computer's account domain (SidTypeDomain, S-1-5-21-…-948590136) instead of the user (S-1-5-21-…-948590136-1001). The deny entry then matches no one, FindFirstChangeNotificationW on the parent succeeds, no error is thrown and ThrownMessage returns an empty string.

The deny entry now names the SID of the process token's user (GetTokenInformation(TokenUser), TRUSTEE_IS_SID), so no name lookup is involved. Test-only change; the EVFILT_VNODE implementation is unchanged.

Tested

Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, main ab9a4768 + this commit. User jaber on computer JABER.

  • Before: guest_kqueue fails 3 of 3 (Exit code 0xc0000409, the message above).
  • After: guest_kqueue passes 5 of 5, so the parent watch is denied and the error carries parent, error=5 and the directory. guest_getlogin passes.
  • tools/check_conventions.py --base upstream/main passes.
  • Not tested on a machine where the two names differ, beyond CI.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4866365243 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6173). Originally posted by [PYTHONRETARDE](https://github.com/PYTHONRETARDE) on 2026-10-15T00:25:10Z. --- ### What `guest_kqueue` aborts on Windows when the user name equals the computer name: ``` the vnode watch error lacks "parent": ``` `DeniedParentWatch` denies `FILE_LIST_DIRECTORY` on the watched file's directory to the name `GetUserNameW` returns, passed as `TRUSTEE_IS_NAME`. On a machine named `JABER` with the local user `jaber`, `LookupAccountNameW(nullptr, L"jaber")` resolves to the computer's account domain (`SidTypeDomain`, `S-1-5-21-…-948590136`) instead of the user (`S-1-5-21-…-948590136-1001`). The deny entry then matches no one, `FindFirstChangeNotificationW` on the parent succeeds, no error is thrown and `ThrownMessage` returns an empty string. The deny entry now names the SID of the process token's user (`GetTokenInformation(TokenUser)`, `TRUSTEE_IS_SID`), so no name lookup is involved. Test-only change; the `EVFILT_VNODE` implementation is unchanged. ### Tested Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, `main` `ab9a4768` + this commit. User `jaber` on computer `JABER`. - Before: `guest_kqueue` fails 3 of 3 (`Exit code 0xc0000409`, the message above). - After: `guest_kqueue` passes 5 of 5, so the parent watch is denied and the error carries `parent`, `error=5` and the directory. `guest_getlogin` passes. - `tools/check_conventions.py --base upstream/main` passes. - Not tested on a machine where the two names differ, beyond CI. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-15 12:16:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:16:00Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestKqueue.cpp
PR 6343 core/libs/tests/GuestKqueue.cpp
PR 6510 core/libs/tests/GuestKqueue.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191819940 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6173#issuecomment-6191819940). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:16:00Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestKqueue.cpp` | | [PR 6343](https://www.github.com/boykopovar/AnyPS5/pull/6343) | `core/libs/tests/GuestKqueue.cpp` | | [PR 6510](https://www.github.com/boykopovar/AnyPS5/pull/6510) | `core/libs/tests/GuestKqueue.cpp` |
MarcZX10 commented 2026-10-15 22:25:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T22:25:21Z.


I reviewed the shared test-file change against the elevated-token report. #6173 fixes the ACL trustee identity; #6599 addresses the separate case where SeBackupPrivilege / SeRestorePrivilege let an elevated process bypass that ACL. The helper and call are confined to DeniedParentWatch, so the PRs do not depend on each other or overlap in changed lines.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6203537368 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6173#issuecomment-6203537368). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-15T22:25:21Z. --- I reviewed the shared test-file change against the elevated-token report. #6173 fixes the ACL trustee identity; #6599 addresses the separate case where SeBackupPrivilege / SeRestorePrivilege let an elevated process bypass that ACL. The helper and call are confined to DeniedParentWatch, so the PRs do not depend on each other or overlap in changed lines.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6173
No description provided.