Re: [PATCH v2 06/12] bpf: Don't read user memory without an mm in tracing helpers
From: Alexei Starovoitov
Date: Tue Dec 01 2026 - 23:07:22 EST
On Tue, Dec 01, 2026 at 06:39 PM James Houghton <jthoughton@xxxxxxxxxx> wrote:
> + /*
> + * Tracing programs may run in any context, including kernel threads
> + * and exiting tasks, which have no user memory to read. That's not a
> + * kernel bug, so fail before the user copy helpers warn about it.
> + */
> + if (unlikely(!current->mm))
> + ret = -EFAULT;
> + else
> + ret = copy_from_user_nofault(dst, unsafe_ptr, size);
The nofault helpers exist for callers that run in any context.
v1 had the check inside the helpers. That was the right place.
Nack to v2.
pw-bot: cr