feat(libkernel): wake each listed address in _umtx_op UMTX_OP_NWAKE_PRIVATE #3845

Merged
13hourstilliland merged 1 commit from upstream-pr/3845 into main 2026-10-11 22:09:32 +00:00
13hourstilliland commented 2026-10-11 17:52:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 13hourstilliland on 2026-10-11T17:52:16Z.


What

_umtx_op threw for UMTX_OP_NWAKE_PRIVATE (21). It now follows FreeBSD 11.4's __umtx_op_nwake_private: the object is an array of val pointers, and every waiter on each address is woken (kern_umtx_wake(td, uaddrs[i], INT_MAX, 1)). The count is read as an int, as in struct _umtx_op_args, so a count of 0 or fewer reads nothing and returns 0. A null list fails with EFAULT, which is what copyin returns for it. Null entries inside the list wake nothing, matching WAKE_PRIVATE. Waiters share the existing address queue, so WAIT, WAIT_UINT and WAIT_UINT_PRIVATE waiters are all released.

The other unimplemented operations still throw. The _umtx_op TechnicalDebt entry now lists this operation and the unreadable-list gap (FreeBSD's copyin fails for any unmapped list, not only a null one).

Tested

Linux x86-64, GCC 14, Release, BUILD_TESTING=ON. guest_umtx_op passes with two new cases:

  • Three WAIT_UINT_PRIVATE waiters on one word and a WAIT waiter on another are released by one NWAKE_PRIVATE call whose list also holds a null entry. A waiter on an address not in the list stays blocked.
  • Counts of 0, a value whose low 32 bits are 0, and -1 read nothing. A null list with count 1 fails with EFAULT.

On main the new test throws on the first NWAKE_PRIVATE call. Each of these mutations makes it fail: waking one waiter per address instead of all, skipping the last entry, returning 0 for a null list, and treating the count as 64-bit. check_conventions.py (with this title and description) and check_test_registration.py pass. Not tested with a title.

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
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4821090636 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3845). Originally posted by [13hourstilliland](https://github.com/13hourstilliland) on 2026-10-11T17:52:16Z. --- ### What `_umtx_op` threw for `UMTX_OP_NWAKE_PRIVATE` (21). It now follows FreeBSD 11.4's [`__umtx_op_nwake_private`](https://github.com/freebsd/freebsd-src/blob/d106002967eff712894ab8b5337bbbff106ce5e0/sys/kern/kern_umtx.c#L3416-L3436): the object is an array of `val` pointers, and every waiter on each address is woken (`kern_umtx_wake(td, uaddrs[i], INT_MAX, 1)`). The count is read as an `int`, as in `struct _umtx_op_args`, so a count of 0 or fewer reads nothing and returns 0. A null list fails with `EFAULT`, which is what `copyin` returns for it. Null entries inside the list wake nothing, matching `WAKE_PRIVATE`. Waiters share the existing address queue, so `WAIT`, `WAIT_UINT` and `WAIT_UINT_PRIVATE` waiters are all released. The other unimplemented operations still throw. The `_umtx_op` TechnicalDebt entry now lists this operation and the unreadable-list gap (FreeBSD's `copyin` fails for any unmapped list, not only a null one). ### Tested Linux x86-64, GCC 14, Release, BUILD_TESTING=ON. `guest_umtx_op` passes with two new cases: - Three `WAIT_UINT_PRIVATE` waiters on one word and a `WAIT` waiter on another are released by one `NWAKE_PRIVATE` call whose list also holds a null entry. A waiter on an address not in the list stays blocked. - Counts of 0, a value whose low 32 bits are 0, and -1 read nothing. A null list with count 1 fails with `EFAULT`. On `main` the new test throws on the first `NWAKE_PRIVATE` call. Each of these mutations makes it fail: waking one waiter per address instead of all, skipping the last entry, returning 0 for a null list, and treating the count as 64-bit. `check_conventions.py` (with this title and description) and `check_test_registration.py` pass. Not tested with a title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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
adriadam10 commented 2026-10-11 22:09:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T22:09:02Z.


Checked against FreeBSD __umtx_op_nwake_private (int count, wake all waiters per listed address, EFAULT on an unreadable list); build + guest_umtx_op pass, and the new test fails without the change. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114393317 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3845#issuecomment-6114393317). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T22:09:02Z. --- Checked against FreeBSD `__umtx_op_nwake_private` (int count, wake all waiters per listed address, EFAULT on an unreadable list); build + `guest_umtx_op` pass, and the new test fails without the change. Merging.
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!3845
No description provided.