Kernel would block user-memory access from tasks with no address space
The change is meant to stop silent reads and writes of another process's memory, but the BPF maintainer rejected where the check should live.
A patch series from James Houghton would make the Linux kernel refuse, and warn, when code touches user memory from a task that has no address space, closing a class of bugs in which that access can silently hit another process instead of failing.
The work follows KVM bugs in which the kernel wrote into a random process's user memory. One was hit in production and was hard to debug. KVM fixes for those cases have already been merged. Houghton says they are still required, because they also cover a virtual machine torn down from another process, which this change cannot detect.
The failure mode is not a reliable fault. A kernel thread that has not borrowed an address space, or a task that has already dropped its own on the way out, can still issue a user access. The user half of the virtual address space then belongs to whatever memory map happens to be lazily loaded. If the page is already mapped, the copy does not fault. It reads or writes the wrong process.
Houghton also fixed the same pattern, some of it found by static analysis, in BPF helpers, tracing and probe events, user-stack unwinding, and a PowerPC performance-monitoring path. Those callers can run from kernel threads or late in process exit, including from BPF programs that did not choose their context. There is no user memory that belongs to the current task, so the access should fail as if it had faulted. Without that, an unwinder or a tracing program can record another task's memory. On x86 some nofault copies already refuse this; string copies and several other architectures do not.
Following a suggestion from Arnd Bergmann, the refusal sits in the common check that almost every user access makes first, plus the masked user-access paths and the unchecked copy helpers that skip that check. Callers that may legitimately run with no address space are updated to fail first, so they do not trip the new warning. Bergmann reviewed the sleepable BPF copy-from-user fix, which covers programs running from a kernel worker or from late exit work.
Alexei Starovoitov, the BPF maintainer, rejected that placement for the nofault helpers. "The nofault helpers exist for callers that run in any context," he wrote, arguing that the check belonged inside those helpers, where an earlier version of the work had put it.
An automated review also flagged Arm's branch-record filter, which uses the same access check only to classify whether a recorded address looks like user space, not to touch that memory. A warning there would fire during CPU-wide branch profiling of idle or kernel threads and could mis-classify records.