Skip to content

fix(process): prevent sibling wakes during targeted waits - #56

Merged
YUZHEthefool merged 3 commits into
mainfrom
fix/selective-wait-wakeup
Nov 1, 2026
Merged

YUZHEthefool merged 3 commits into
mainfrom
fix/selective-wait-wakeup

Conversation

@YUZHEthefool

@YUZHEthefool YUZHEthefool commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

A PID-targeted wait4/waitid briefly published waiting_child = Some(0) before narrowing the filter after its child scan. A sibling exiting in that window could wake the parent, and each retry reopened the window. Remote diagnostics reproduced two extra wakes while waiting for PID 55: sibling PID 54 woke it once at exit notification and again at the final switch-out handoff. This resolves the residual selective-wait issue recorded in #49.

Resolve the target's global PID before publishing Blocked, using the child's retained namespace identity, then scan again for reapable children. An exit during resolution is therefore observed by the scan or wakes the already-published wait. Signal/kill checks remain under the parent PCB lock, and an unresolved target stays runnable for stale/incomplete child-list recovery.

  • Share the unchanged PID-match wake operation between exit notification, group notification and the scheduler handoff.
  • Keep PID-targeted group waits selective while retaining their child-event counter check.
  • Add five hosted interleaving/cleanup tests. Repeat the Ring-3 sibling check 16 times and also assert zero extra wakes across the nested reaper. The existing counter and zero-wake requirement are retained.
  • Keep the rebuilt userspace ELF in a separate commit.

Fixes: 0a42bd8 (feat(sched): selective wait wake, guard-free SCHED-TRAP and a switch sentinel)

Validation

Executed on the requested remote host with Ubuntu 22.04.5, QEMU 6.2.0, OVMF and the pinned Rust toolchain.

Check Result
Diagnostic baseline, repeated sibling waits Reproduced two sibling wakes on the 24th pair; guest finished 50 passed / 1 failed. Stopped after PID 1 exited once the failure evidence was complete.
Negative control restoring only the broad publication filter New sibling-interleaving regression fails at the unexpected wake. All five focused tests pass with the fix.
Hosted subcrate gate PASS: 613 unit tests, CpuLocal doctests and 3 test-code compile checks; default test parallelism.
make fmt-check lint clippy build, syscall and musl feature builds PASS; ABI oracle: 11 structs / 100 values / 17 tripwires. Existing warnings retained.
Ring-3 oracle, four CPUs, 300 seconds PASS: 51 passed / 0 failed; PID 1 exit 0.
Ring-3 oracle, one CPU, 300 seconds PASS: 50 passed / 0 failed; PID 1 exit 0. The dual-CPU COW leg is explicitly skipped on one CPU.
Boot / runtime, 120 seconds each QUALIFIED (exit 3): 28/46/0 and 35/39/0 passed/deferred/failed.
SMP two and four CPUs, 120 seconds each QUALIFIED (exit 3): each 37/37/0; required topology and three cross-CPU witnesses present.
musl libc/ABI gate, one CPU, 300 seconds PASS (exit 0): required libc/ABI markers, namespace wait, blocked-signal and pthread checks; PID 1 exit 0 and zero NX faults. SMP-only musl probes are explicitly skipped on this lane.

Final guest images were built in a fresh source/build directory and frozen separately for each feature. Modified source files and the syscall-fixture hashes match the submitted tree. An earlier incremental-image run reused stale objects because archive timestamps predated the build; that result is excluded. A musl launch initially selected the default ESP and is also excluded; the corrected run uses the isolated musl artifact with its packaged SHA-256 verified. Diagnostic/Ring-3 serial evidence, gate verdicts and source/image hashes are retained privately. Qualified boot/runtime gates remain qualified; no hardware qualification is claimed.

Source/regressions: d1dcc62; generated syscall fixture: 6683ae9. All selected remote checks are complete with the qualified limits above. CI for 6683ae9 is running.

Resolve the namespace-visible target before publishing Blocked, then scan
again for reapable children so an exit during resolution cannot be lost.
Recheck signals under the parent PCB lock and leave unresolved targets
runnable for stale-child recovery.

Share the PID-filtered wake operation between exit notification and the
final switch-out handoff, and preserve targeted filters for group waits.
Add five hosted interleaving/cleanup tests and repeat the Ring-3 selective
wait check sixteen times, including the nested wait counter assertion.

Fixes: 0a42bd8 (feat(sched): selective wait wake, guard-free SCHED-TRAP and a switch sentinel)
@github-actions github-actions Bot added area: process/ABI Processes, syscalls, usercopy, signals, ELF, and Linux ABI area: scheduler/concurrency Scheduling, CPU-local state, synchronization, RCU, and lock ordering area: userspace Ring-3 programs, libc compatibility, and userspace support area: tooling/CI Build system, scripts, hooks, automation, and repository tooling size: M 200-499 review lines, excluding generated/binary artifacts bug Something isn't working labels Nov 1, 2026
@YUZHEthefool
YUZHEthefool marked this pull request as ready for review November 1, 2026 05:04
Exercise the production group wait loop and notifier with deterministic
hosted interleavings: sibling exit after blocking, target exit after the
scan, and target exit after the final event-counter check. Verify waiting
for another thread's child, namespace PID translation, and group isolation.

Keep synchronization hooks confined to hosted unit tests and update the
count-pinned hosted gate to include the three regressions.

Validation:
- Hosted gate: 616 unit tests, CpuLocal doctests, 3 compile checks.
- All three new regressions pass in debug and release profiles.
- Broad-filter and missing-event-check negative controls fail as expected.
- make fmt-check lint clippy build; ABI oracle: 11 structs, 100 values,
  17 tripwires.
@github-actions github-actions Bot added size: L 500-999 review lines, excluding generated/binary artifacts and removed size: M 200-499 review lines, excluding generated/binary artifacts labels Nov 1, 2026
@YUZHEthefool
YUZHEthefool merged commit 78dd11a into main Nov 1, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: process/ABI Processes, syscalls, usercopy, signals, ELF, and Linux ABI area: scheduler/concurrency Scheduling, CPU-local state, synchronization, RCU, and lock ordering area: tooling/CI Build system, scripts, hooks, automation, and repository tooling area: userspace Ring-3 programs, libc compatibility, and userspace support bug Something isn't working size: L 500-999 review lines, excluding generated/binary artifacts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant