All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/4] Attach a cookie to a tracing program.
@ 2022-03-16  0:42 Kui-Feng Lee
  2022-03-16  0:42 ` [PATCH bpf-next v2 1/4] bpf, x86: Generate trampolines from bpf_links Kui-Feng Lee
                   ` (3 more replies)
  0 siblings, 4 replies; 31+ messages in thread
From: Kui-Feng Lee @ 2022-03-16  0:42 UTC (permalink / raw)
  To: bpf, ast, daniel, andrii; +Cc: Kui-Feng Lee

Allow users to attach a 64-bits cookie to a BPF program when linking
it to fentry, fexit, or fmod_ret of a function.

This patchset includes several major changes.

 - Define struct bpf_tramp_links to replace bpf_tramp_prog.
   struct bpf_tramp_links collects bpf_links of a trampoline

 - Generate a trampoline to call bpf_progs of given bpf_links.

 - Trampolines always set/reset bpf_run_ctx before/after
   calling/leaving a BPF program.

 - Attach a cookie to a bpf_link of fentry/fexit/fmod_ret.  The value
   will be available when running the associated bpf_prog.

The major differences from v1:

 - Remove program ID and flags from stacks.

 - Create bpf_trace_run_ctx on stacks.

 - Attach a cookie to a bpf_link.

 - Store the cookie of the running BPF program/link in bpf_trace_run_ctx.

v1: https://lore.kernel.org/all/20220126214809.3868787-1-kuifeng@fb.com/

Kui-Feng Lee (4):
  bpf, x86: Generate trampolines from bpf_links
  bpf, x86: Create bpf_trace_run_ctx on the caller thread's stack
  bpf, x86: Support BPF cookie for fentry/fexit/fmod_ret.
  selftest/bpf: The test cses of BPF cookie for fentry/fexit/fmod_ret.

 arch/x86/net/bpf_jit_comp.c                   | 68 ++++++++++----
 include/linux/bpf.h                           | 40 ++++----
 include/linux/bpf_types.h                     |  1 +
 include/uapi/linux/bpf.h                      |  2 +
 kernel/bpf/bpf_struct_ops.c                   | 68 +++++++++-----
 kernel/bpf/syscall.c                          | 19 ++--
 kernel/bpf/trampoline.c                       | 94 ++++++++++++-------
 kernel/trace/bpf_trace.c                      | 17 ++++
 net/bpf/bpf_dummy_struct_ops.c                | 35 ++++++-
 tools/bpf/bpftool/link.c                      |  1 +
 tools/include/uapi/linux/bpf.h                |  2 +
 tools/lib/bpf/bpf.c                           | 14 +++
 tools/lib/bpf/bpf.h                           |  1 +
 tools/lib/bpf/libbpf.map                      |  1 +
 .../selftests/bpf/prog_tests/bpf_cookie.c     | 61 ++++++++++++
 .../selftests/bpf/progs/test_bpf_cookie.c     | 24 +++++
 16 files changed, 344 insertions(+), 104 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2022-04-12 16:50 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16  0:42 [PATCH bpf-next v2 0/4] Attach a cookie to a tracing program Kui-Feng Lee
2022-03-16  0:42 ` [PATCH bpf-next v2 1/4] bpf, x86: Generate trampolines from bpf_links Kui-Feng Lee
2022-03-16  0:42 ` [PATCH bpf-next v2 2/4] bpf, x86: Create bpf_trace_run_ctx on the caller thread's stack Kui-Feng Lee
2022-03-18 19:09   ` Alexei Starovoitov
2022-03-20  9:31     ` Kui-Feng Lee
2022-03-20 20:08       ` Alexei Starovoitov
2022-03-21 19:00         ` Kui-Feng Lee
2022-03-21 23:04   ` Andrii Nakryiko
2022-03-21 23:25     ` Alexei Starovoitov
2022-03-21 23:38       ` Andrii Nakryiko
2022-03-21 23:08   ` Andrii Nakryiko
2022-03-22 15:30     ` Kui-Feng Lee
2022-03-22 21:08       ` Andrii Nakryiko
2022-03-16  0:42 ` [PATCH bpf-next v2 3/4] bpf, x86: Support BPF cookie for fentry/fexit/fmod_ret Kui-Feng Lee
2022-03-18 19:13   ` Alexei Starovoitov
2022-03-21 23:24     ` Andrii Nakryiko
2022-03-21 23:37       ` Andrii Nakryiko
2022-04-12 16:50         ` Kui-Feng Lee
2022-03-22  1:15       ` Alexei Starovoitov
2022-03-22  4:32         ` Andrii Nakryiko
2022-04-06  5:35           ` Kui-Feng Lee
2022-04-06 17:00             ` Andrii Nakryiko
2022-03-21 23:18   ` Andrii Nakryiko
2022-03-22 16:08     ` Kui-Feng Lee
2022-03-22 21:06       ` Andrii Nakryiko
2022-04-06 22:44         ` Kui-Feng Lee
2022-03-16  0:42 ` [PATCH bpf-next v2 4/4] selftest/bpf: The test cses of " Kui-Feng Lee
2022-03-18 19:21   ` Alexei Starovoitov
2022-03-20  8:43     ` Kui-Feng Lee
2022-03-21 23:29       ` Andrii Nakryiko
2022-03-21 23:36   ` Andrii Nakryiko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.