Uprobe programs can be preempted, allowing another task to run the same program on the same CPU. Since the private stack is per program and CPU, the new invocation can reuse and overwrite the preempted invocation's stack. Disable private stacks for uprobe multi programs. Fixing the issue for standard uprobes requires additional changes and will be handled separately. Signed-off-by: Jiri Olsa --- kernel/bpf/verifier.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 935b163f81e4..a9c6a4b8eecc 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -5706,6 +5706,11 @@ static enum priv_stack_mode bpf_enable_priv_stack(struct bpf_prog *prog) */ switch (prog->type) { case BPF_PROG_TYPE_KPROBE: + /* Disable private stack for uprobe programs. */ + if (prog->expected_attach_type == BPF_TRACE_UPROBE_MULTI || + prog->expected_attach_type == BPF_TRACE_UPROBE_SESSION) + return NO_PRIV_STACK; + fallthrough; case BPF_PROG_TYPE_TRACEPOINT: case BPF_PROG_TYPE_PERF_EVENT: case BPF_PROG_TYPE_RAW_TRACEPOINT: -- 2.43.0