Skip to content

Fix ftrace for livepatch + BPF fexit programs

Song Liu bpf linux-trace-kernel live-patching stable 4 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. v4 Latest3 patches 3 repliesApplied 3/3
  2. v33 patches 5 repliesSuperseded
  3. v23 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches8 repliesSuperseded

Changes in v4 from the cover letter

1. Add helper reset_direct. (Steven)
2. Add Reviewed-by from Jiri.
3. Fix minor typo in comments.

Patches in v4 All 3 applied

#Subject and filesSizeRepliesApplied
1/3ftrace: Fix BPF fexit with livepatchkernel/bpf/trampoline.c kernel/trace/ftrace.c+14 -110 repliesApplied
2/3ftrace: bpf: Fix IPMODIFY + DIRECT in modify_ftrace_direct()kernel/trace/ftrace.c+31 -90 repliesApplied
3/3selftests/bpf: Add tests for livepatch + bpf trampolinetools/testing/selftests/bpf/config tools/testing/selftests/bpf/prog_tests/livepatch_trampoline.c tools/testing/selftests/bpf/progs/livepatch_trampoline.c+140 -00 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAndrey GrodzovskyJiri OlsaSteven Rostedt (Google)
SeriesA-b
1/3Acked-and-tested-by R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 bpf 0/3] Fix ftrace for livepatch + BPF fexit programs

livepatch and BPF trampoline are two special users of ftrace. livepatch uses ftrace with IPMODIFY flag and BPF trampoline uses ftrace direct functions. When livepatch and BPF trampoline with fexit programs attach to the same kernel function, BPF trampoline needs to call into the patched version of the kernel function.

1/3 and 2/3 of this patchset fix two issues with livepatch + fexit cases, one in the register_ftrace_direct path, the other in the modify_ftrace_direct path.

3/3 adds selftests for both cases.

---

Changes v3 => v4:
1. Add helper reset_direct. (Steven)
2. Add Reviewed-by from Jiri.
3. Fix minor typo in comments.

v3: https://lore.kernel.org/bpf/[email protected]/

Changes v2 => v3:
1. Incorporate feedback by AI, which also fixes build error reported by Steven and kernel test robot.

v2: https://lore.kernel.org/bpf/[email protected]/

Changes v1 => v2:
1. Target bpf tree. (Alexei)
2. Bring back the FTRACE_WARN_ON in __ftrace_hash_update_ipmodify for valid code paths. (Steven)
3. Update selftests with cleaner way to find livepatch-sample.ko. (offlline discussion with Ihor)

v1: https://lore.kernel.org/bpf/[email protected]/

Song Liu (3):
ftrace: Fix BPF fexit with livepatch
ftrace: bpf: Fix IPMODIFY + DIRECT in modify_ftrace_direct() selftests/bpf: Add tests for livepatch + bpf trampoline

 kernel/bpf/trampoline.c                       |   5 -
 kernel/trace/ftrace.c                         |  60 +++++++---
 tools/testing/selftests/bpf/config            |   3 +
 .../bpf/prog_tests/livepatch_trampoline.c     | 107 ++++++++++++++++++
 .../bpf/progs/livepatch_trampoline.c          |  30 +++++
 5 files changed, 185 insertions(+), 20 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/livepatch_trampoline.c
 create mode 100644 tools/testing/selftests/bpf/progs/livepatch_trampoline.c

--
2.47.3