linux-stable/kernel/trace
Andrii Nakryiko 7adfc6c9b3 bpf: Add bpf_get_attach_cookie() BPF helper to access bpf_cookie value
Add new BPF helper, bpf_get_attach_cookie(), which can be used by BPF programs
to get access to a user-provided bpf_cookie value, specified during BPF
program attachment (BPF link creation) time.

Naming is hard, though. With the concept being named "BPF cookie", I've
considered calling the helper:
  - bpf_get_cookie() -- seems too unspecific and easily mistaken with socket
    cookie;
  - bpf_get_bpf_cookie() -- too much tautology;
  - bpf_get_link_cookie() -- would be ok, but while we create a BPF link to
    attach BPF program to BPF hook, it's still an "attachment" and the
    bpf_cookie is associated with BPF program attachment to a hook, not a BPF
    link itself. Technically, we could support bpf_cookie with old-style
    cgroup programs.So I ultimately rejected it in favor of
    bpf_get_attach_cookie().

Currently all perf_event-backed BPF program types support
bpf_get_attach_cookie() helper. Follow-up patches will add support for
fentry/fexit programs as well.

While at it, mark bpf_tracing_func_proto() as static to make it obvious that
it's only used from within the kernel/trace/bpf_trace.c.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210815070609.987780-7-andrii@kernel.org
2021-08-17 00:45:07 +02:00
..
blktrace.c block-5.12-2021-02-27 2021-02-28 11:23:38 -08:00
bpf_trace.c bpf: Add bpf_get_attach_cookie() BPF helper to access bpf_cookie value 2021-08-17 00:45:07 +02:00
bpf_trace.h
error_report-traces.c tracing: add error_report_end trace point 2021-02-26 09:41:02 -08:00
fgraph.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
ftrace.c ftrace: Remove redundant initialization of variable ret 2021-07-23 08:46:02 -04:00
ftrace_internal.h
Kconfig trace: Add timerlat tracer 2021-06-25 19:57:24 -04:00
kprobe_event_gen_test.c
Makefile trace: Add osnoise tracer 2021-06-25 19:57:01 -04:00
power-traces.c
preemptirq_delay_test.c kernel: trace: preemptirq_delay_test: add cpu affinity 2021-02-02 17:02:07 -05:00
ring_buffer.c tracing: Fix bug in rb_per_cpu_empty() that might cause deadloop. 2021-07-22 11:52:33 -04:00
ring_buffer_benchmark.c
rpm-traces.c
synth_event_gen_test.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace.c tracing: Fix NULL pointer dereference in start_creating 2021-07-30 18:45:11 -04:00
trace.h Tracing updates for 5.14: 2021-07-03 11:13:22 -07:00
trace_benchmark.c tracing: Fix some typos in comments 2020-11-10 20:39:40 -05:00
trace_benchmark.h
trace_boot.c tracing/boot: Add per-group/all events enablement 2021-06-10 11:16:20 -04:00
trace_branch.c tracing: Merge irqflags + preempt counter. 2021-02-02 17:02:06 -05:00
trace_clock.c tracing: Do no increment trace_clock_global() by one 2021-06-18 09:10:00 -04:00
trace_dynevent.c tracing/dynevent: Fix a memory leak in an error handling path 2021-04-13 12:29:48 -04:00
trace_dynevent.h tracing/dynevent: Delegate parsing to create function 2021-02-09 12:52:15 -05:00
trace_entries.h trace: Add timerlat tracer 2021-06-25 19:57:24 -04:00
trace_event_perf.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_events.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_events_filter.c tracing: Update create_system_filter() kernel-doc comment 2021-03-25 16:04:35 -04:00
trace_events_filter_test.h
trace_events_hist.c tracing: Reject string operand in the histogram expression 2021-08-04 17:49:26 -04:00
trace_events_inject.c tracing: Merge irqflags + preempt counter. 2021-02-02 17:02:06 -05:00
trace_events_synth.c tracing: Clean up alloc_synth_event() 2021-07-23 08:45:30 -04:00
trace_events_trigger.c tracing: Fix set_named_trigger_data() kernel-doc comment 2021-06-10 11:16:20 -04:00
trace_export.c tracing: Fix some typos in comments 2020-11-10 20:39:40 -05:00
trace_functions.c tracing: Add "func_no_repeats" option for function tracing 2021-04-15 14:50:02 -04:00
trace_functions_graph.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_hwlat.c tracing: Quiet smp_processor_id() use in preemptable warning in hwlat 2021-08-05 09:27:31 -04:00
trace_irqsoff.c tracing: Merge irqflags + preempt counter. 2021-02-02 17:02:06 -05:00
trace_kdb.c
trace_kprobe.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c tracing: Remove definition of DEBUG in trace_mmiotrace.c 2021-02-02 17:02:07 -05:00
trace_nop.c
trace_osnoise.c trace/timerlat: Fix indentation on timerlat_main() 2021-06-29 16:37:50 -04:00
trace_output.c trace: Add timerlat tracer 2021-06-25 19:57:24 -04:00
trace_output.h ftrace: Add recording of functions that caused recursion 2020-11-06 08:42:26 -05:00
trace_preemptirq.c
trace_printk.c tracing: Add a verifier to check string pointers for trace events 2021-03-18 12:58:27 -04:00
trace_probe.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_probe.h tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_probe_tmpl.h tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_recursion_record.c ftrace: Add recording of functions that caused recursion 2020-11-06 08:42:26 -05:00
trace_sched_switch.c
trace_sched_wakeup.c tracing: Change variable type as bool for clean-up 2021-06-30 09:19:14 -04:00
trace_selftest.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_selftest_dynamic.c
trace_seq.c tracing: Fix various typos in comments 2021-03-23 14:08:18 -04:00
trace_stack.c ftrace: Have the callbacks receive a struct ftrace_regs instead of pt_regs 2020-11-13 12:14:55 -05:00
trace_stat.c
trace_stat.h
trace_synth.h tracing: Synthetic event field_pos is an index not a boolean 2021-07-23 08:43:04 -04:00
trace_syscalls.c tracing: Merge irqflags + preempt counter. 2021-02-02 17:02:06 -05:00
trace_uprobe.c tracing/dynevent: Delegate parsing to create function 2021-02-09 12:52:15 -05:00
tracing_map.c tracing: Fix some typos in comments 2020-11-10 20:39:40 -05:00
tracing_map.h tracing: Fix some typos in comments 2020-11-10 20:39:40 -05:00