Skip to content

Fix BPF multi-uprobe PID filtering logic

Andrii Nakryiko bpf stable 2 versions – Applied

Status from this message: This series was applied to bpf/bpf.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 1 replyApplied 5/5
  2. v15 patches 8 repliesSuperseded

Changes in v2 from the cover letter

- fix selftest in last patch (CI);
- use semicolon in patch #3 (Jiri).

Patches in v2 All 5 applied

#Subject and filesSizeRepliesApplied
1/5bpf: fix multi-uprobe PID filtering logickernel/trace/bpf_trace.c tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c+5 -50 repliesApplied
2/5bpf: remove unnecessary rcu_read_{lock,unlock}() in multi-uprobe attach logickernel/trace/bpf_trace.c+0 -20 repliesApplied
3/5libbpf: detect broken PID filtering logic for multi-uprobetools/lib/bpf/features.c+30 -10 repliesApplied
4/5selftests/bpf: extend multi-uprobe tests with child thread casetools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c tools/testing/selftests/bpf/progs/uprobe_multi.c+115 -91 replyApplied
5/5selftests/bpf: extend multi-uprobe tests with USDTstools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c tools/testing/selftests/bpf/progs/uprobe_multi.c+56 -20 repliesApplied

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchJiri Olsa
1/5A-b
2/5A-b
3/5A-b
4/5A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 bpf 0/5] Fix BPF multi-uprobe PID filtering logic

It turns out that current implementation of multi-uprobe PID filtering logic is broken. It filters by thread, while the promise is filtering by process. Patch #1 fixes the logic trivially. The rest is testing and mitigations that are necessary for libbpf to not break users of USDT programs.

v1->v2:
- fix selftest in last patch (CI);
- use semicolon in patch #3 (Jiri).

Andrii Nakryiko (5):
bpf: fix multi-uprobe PID filtering logic
bpf: remove unnecessary rcu_read_{lock,unlock}() in multi-uprobe
attach logic
libbpf: detect broken PID filtering logic for multi-uprobe selftests/bpf: extend multi-uprobe tests with child thread case selftests/bpf: extend multi-uprobe tests with USDTs

 kernel/trace/bpf_trace.c                      |  10 +-
 tools/lib/bpf/features.c                      |  31 +++-
 .../bpf/prog_tests/uprobe_multi_test.c        | 134 ++++++++++++++++--
 .../selftests/bpf/progs/uprobe_multi.c        |  50 ++++++-
 4 files changed, 206 insertions(+), 19 deletions(-)
Signature · 1 line
2.43.0