2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-20 19:23:57 +08:00
linux-next/drivers/media
Andrii Nakryiko 82e6b1eee6 bpf: Allow to specify user-provided bpf_cookie for BPF perf links
Add ability for users to specify custom u64 value (bpf_cookie) when creating
BPF link for perf_event-backed BPF programs (kprobe/uprobe, perf_event,
tracepoints).

This is useful for cases when the same BPF program is used for attaching and
processing invocation of different tracepoints/kprobes/uprobes in a generic
fashion, but such that each invocation is distinguished from each other (e.g.,
BPF program can look up additional information associated with a specific
kernel function without having to rely on function IP lookups). This enables
new use cases to be implemented simply and efficiently that previously were
possible only through code generation (and thus multiple instances of almost
identical BPF program) or compilation at runtime (BCC-style) on target hosts
(even more expensive resource-wise). For uprobes it is not even possible in
some cases to know function IP before hand (e.g., when attaching to shared
library without PID filtering, in which case base load address is not known
for a library).

This is done by storing u64 bpf_cookie in struct bpf_prog_array_item,
corresponding to each attached and run BPF program. Given cgroup BPF programs
already use two 8-byte pointers for their needs and cgroup BPF programs don't
have (yet?) support for bpf_cookie, reuse that space through union of
cgroup_storage and new bpf_cookie field.

Make it available to kprobe/tracepoint BPF programs through bpf_trace_run_ctx.
This is set by BPF_PROG_RUN_ARRAY, used by kprobe/uprobe/tracepoint BPF
program execution code, which luckily is now also split from
BPF_PROG_RUN_ARRAY_CG. This run context will be utilized by a new BPF helper
giving access to this user-provided cookie value from inside a BPF program.
Generic perf_event BPF programs will access this value from perf_event itself
through passed in BPF program context.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/bpf/20210815070609.987780-6-andrii@kernel.org
2021-08-17 00:45:07 +02:00
..
cec media: s5p: fix pm_runtime_get_sync() usage count 2021-05-10 11:36:33 +02:00
common media fixes for v5.14-rc5 2021-08-03 09:33:05 -07:00
dvb-core media: dvb-core: frontend: make GET/SET safer 2021-06-17 09:29:11 +02:00
dvb-frontends media: mxl692: make a const array static, makes object smaller 2021-06-08 15:50:38 +02:00
firewire module: remove never implemented MODULE_SUPPORTED_DEVICE 2021-03-17 13:16:18 -07:00
i2c media: i2c: rdacm20: Re-work ov10635 reset 2021-06-17 12:08:55 +02:00
mc media: Fix Media Controller API config checks 2021-06-24 14:26:00 +02:00
mmc media updates for v5.8-rc1 2020-06-03 20:59:38 -07:00
pci ACPI fixes for 5.14-rc3 2021-07-23 11:08:06 -07:00
platform media fixes for v5.14-rc5 2021-08-03 09:33:05 -07:00
radio media: radio: si4713: constify static struct v4l2_ioctl_ops 2021-06-02 13:26:11 +02:00
rc bpf: Allow to specify user-provided bpf_cookie for BPF perf links 2021-08-17 00:45:07 +02:00
spi media: cxd2880-spi: Fix some error messages 2021-06-08 15:51:35 +02:00
test-drivers media: v4l2-subdev: add subdev-wide state struct 2021-06-17 10:01:27 +02:00
tuners media: m88rs6000t: avoid potential out-of-bounds reads on arrays 2021-03-22 17:41:39 +01:00
usb media: rtl28xxu: fix zero-length control request 2021-07-30 12:59:18 +02:00
v4l2-core media: v4l2-event: Modified variable type 'unsigned' to 'unsigned int' 2021-06-17 10:22:59 +02:00
Kconfig media: Correct 'so' 2021-03-22 11:52:09 +01:00
Makefile media: media/test_drivers: rename to test-drivers 2020-04-16 10:38:31 +02:00