syscall: bound the pipe user window and bounce the slice outside the lock
Closed · #494 · open 2026-10-30 22:20 UTC · closed 2026-11-06 02:44 UTC (reason completed)
Imported from GitHub aien-dev/aienux#494, by cursor[bot]
cursor[bot] wrote on 2026-10-30 22:20 UTC
ck_pipe_dispatch now takes user_lo / user_hi and rejects a read or write whose slice lies outside that window (INVALID_ARG before the slice is touched). That is must-fix (d) from review 5719220696 on #433. There is still no syscall path into the pipe. Two duties stay with that layer:
On each architecture, assert user_hi is below the user-VA top before it is passed in. On ARM64 that top is TTBR1, 0xFFFF000000000000. On x86 it is the canonical upper half.
Copy the user slice in and out through a kernel bounce buffer outside the pool lock. The ring copy dereferences the slice while the ticket lock is held, so a user fault on that path would stick the CPU inside the lock.
Fix: #510 (head fab12a6). Dispatch bounces the slice through a 1 KiB kernel buffer outside the pool lock, and user_hi is capped at CK_PIPE_USER_TOP. Failing before: 9 of 1415 checks failed against main's pipe.c. Passing after: 1415 checks, plus ASan. Two new mutants (pipe-bounce-mutant, pipe-top-mutant) are caught. QEMU AIENOS_CK_PIPE PASS. Hardware NOT_RUN.