mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-02 06:29:37 +08:00
kw_user_addr() gave up after three faults, so a system call could fail with EFAULT on a valid address when other threads of the mm took the page away again after each fault (MADV_DONTNEED, a fork's COW write-protect under host load). It now walks again for as long as the fault succeeds, ended by a fatal signal or a real fault error, with a backstop of 10000 rounds. A kernel access whose fault returned VM_FAULT_RETRY failed with any signal pending (user_mode() of a NULL pt_regs); only a fatal signal ends it now, and its faults wait killable. On SMP the futex ops on user words were not atomic against user AMOs on other CPUs, and the page-table walk reads each level once. kwtest gets `uaccess:` checks (a userfaultfd read with a signal pending, FUTEX_WAKE_OP beside amoadd). The kernel changes are two fixup! patches at the end of the series, for the arch patch and `wasm: SMP`.