bpf: Disable private stacks for uprobe programs
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 1 replyApplied 2/2
- v14 patches 3 repliesSuperseded
Changes in v2 from the cover letter
- drop the BPF_TRACE_UPROBE attach type and fail perf event kprobe attach for kprobe-multi/uprobe-multi [Alexei]
[1] https://lore.kernel.org/bpf/aus-b8Lo2oCw_cGd@krava/
---
Jiri Olsa (2):
bpf: Reject multi kprobe programs in perf event attach
bpf: Disable private stacks for untagged kprobe programs
Patches in v2 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: Reject multi kprobe programs in perf event attachkernel/ | +11 | 0 replies | Applied |
| 2/2 | bpf: Disable private stacks for untagged kprobe programskernel/ tools/ tools/ | +46 | 1 reply | Applied |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCHv2 bpf-next 0/2] bpf: Disable private stacks for uprobe programs
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.
This patch disables private stacks for KPROBE programs except kprobe multi and kprobe-session programs, identified by the BPF_TRACE_KPROBE_MULTI and BPF_TRACE_KPROBE_SESSION attach types. Standard kprobes lack an attach type, and uprobes use different attach types or none, so they run without private stacks.
It also rejects multi and session programs through the perf-event attach path, which lacks their required run context and could allow a uprobe to reach a private-stack tail-call target [1].
thanks,
jirka
v1: https://lore.kernel.org/bpf/[email protected]/
v2 changes:
- drop the BPF_TRACE_UPROBE attach type and fail perf event kprobe attach for kprobe-multi/uprobe-multi [Alexei]
[1] https://lore.kernel.org/bpf/aus-b8Lo2oCw_cGd@krava/
---
Jiri Olsa (2):
bpf: Reject multi kprobe programs in perf event attach
bpf: Disable private stacks for untagged kprobe programs
kernel/bpf/verifier.c | 9 +++++++ kernel/events/core.c | 13 ++++++++-- tools/testing/selftests/bpf/progs/verifier_large_stack.c | 2 +- tools/testing/selftests/bpf/progs/verifier_private_stack.c | 38 +++++++++++++++++++++++++++-- 4 files changed, 57 insertions(+), 5 deletions(-)