BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/4] bpf: Disable private stacks for uprobe programs
@ 2026-11-03  9:33 Jiri Olsa
  2026-11-03  9:33 ` [PATCH bpf-next 1/4] bpf: Disable private stack " Jiri Olsa
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Jiri Olsa @ 2026-11-03  9:33 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
	HyeongJun An, Christian Simon

hi,
uprobe programs can be preempted and re-entered on the same CPU. Since
the private stack is shared per program and CPU, a nested invocation can
overwrite the preempted invocation's stack.

Uprobe multi and session programs have attach types that let the kernel
identify them, so this series disables their private stacks.

As discussed in [1], there seems to be no known compatible fix for
private stack corruption in standard uprobes. This series leaves that
issue unchanged and adds the BPF_TRACE_UPROBE attach type for new
standard uprobe programs, allowing the kernel to identify them and
disable their private stacks.

Other possible fixes for standard uprobes include:

- disable private stacks for all KPROBE programs: protects uprobes,
  but may reject existing kprobe programs that rely on private stacks.

- reject untagged programs on uprobe events: protects uprobes, but
  breaks legacy loaders that attach standard uprobes without the new
  attach type.

- disable preemption while the uprobe program runs: may prevent overlapping
  invocations on the same CPU, but cannot be used for sleepable uprobe
  programs and may increase latency

We can pick the uprobe-multi fix and keep discussing standard uprobes fix,
I'm open to other suggestions.

thanks,
jirka


[1] https://lore.kernel.org/bpf/20260822225444.2774461-1-simon@swine.de/
---
Jiri Olsa (4):
      bpf: Disable private stack for uprobe programs
      bpf: Add BPF_TRACE_UPROBE attach type
      libbpf: Detect BPF_TRACE_UPROBE support
      selftests/bpf: Verify classic uprobe attach types

 Documentation/bpf/libbpf/program_types.rst      |  8 +++++---
 include/uapi/linux/bpf.h                        |  1 +
 kernel/bpf/verifier.c                           |  6 ++++++
 kernel/events/core.c                            |  3 +++
 tools/include/uapi/linux/bpf.h                  |  1 +
 tools/lib/bpf/features.c                        | 22 ++++++++++++++++++++++
 tools/lib/bpf/libbpf.c                          | 21 +++++++++++++++------
 tools/lib/bpf/libbpf_internal.h                 |  2 ++
 tools/testing/selftests/bpf/prog_tests/uprobe.c |  4 ++++
 9 files changed, 59 insertions(+), 9 deletions(-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-11-04 14:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03  9:33 [PATCH bpf-next 0/4] bpf: Disable private stacks for uprobe programs Jiri Olsa
2026-11-03  9:33 ` [PATCH bpf-next 1/4] bpf: Disable private stack " Jiri Olsa
2026-11-03  9:33 ` [PATCH bpf-next 2/4] bpf: Add BPF_TRACE_UPROBE attach type Jiri Olsa
2026-11-03  9:59   ` sashiko-bot
2026-11-03  9:33 ` [PATCH bpf-next 3/4] libbpf: Detect BPF_TRACE_UPROBE support Jiri Olsa
2026-11-03  9:54   ` sashiko-bot
2026-11-03  9:34 ` [PATCH bpf-next 4/4] selftests/bpf: Verify classic uprobe attach types Jiri Olsa
2026-11-03  9:56   ` sashiko-bot
2026-11-04  4:33 ` [PATCH bpf-next 0/4] bpf: Disable private stacks for uprobe programs Alexei Starovoitov
2026-11-04 14:17   ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox