TencentOS-kernel/drivers/media
Alexei Starovoitov 990023faf2 bpf: Implement CAP_BPF
[upstream commit 2c78ee898d8f10ae6fb2fa23a3fbaec96b1b7366]

Implement permissions as stated in uapi/linux/capability.h
In order to do that the verifier allow_ptr_leaks flag is split
into four flags and they are set as:
  env->allow_ptr_leaks = bpf_allow_ptr_leaks();
  env->bypass_spec_v1 = bpf_bypass_spec_v1();
  env->bypass_spec_v4 = bpf_bypass_spec_v4();
  env->bpf_capable = bpf_capable();

The first three currently equivalent to perfmon_capable(), since leaking kernel
pointers and reading kernel memory via side channel attacks is roughly
equivalent to reading kernel memory with cap_perfmon.

'bpf_capable' enables bounded loops, precision tracking, bpf to bpf calls and
other verifier features. 'allow_ptr_leaks' enable ptr leaks, ptr conversions,
subtraction of pointers. 'bypass_spec_v1' disables speculative analysis in the
verifier, run time mitigations in bpf array, and enables indirect variable
access in bpf programs. 'bypass_spec_v4' disables emission of sanitation code
by the verifier.

That means that the networking BPF program loaded with CAP_BPF + CAP_NET_ADMIN
will have speculative checks done by the verifier and other spectre mitigation
applied. Such networking BPF program will not be able to leak kernel pointers
and will not be able to access arbitrary kernel memory.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200513230355.7858-3-alexei.starovoitov@gmail.com
2022-06-21 10:27:12 +08:00
..
cec cec-api: prevent leaking memory through hole in structure 2021-03-16 16:34:50 +08:00
common media: siano: fix memory leak of debugfs members in smsdvb_hotplug 2021-03-16 16:42:53 +08:00
dvb-core media: dvbdev: Fix memory leak in dvb_media_device_free() 2021-05-20 16:07:36 +08:00
dvb-frontends media: tda10071: fix unsigned sign extension overflow 2021-03-16 16:37:00 +08:00
firewire media: firewire: fix memory leak 2021-03-16 16:39:12 +08:00
i2c media: i2c: adv7842: fix possible use-after-free in adv7842_remove() 2021-05-20 16:07:30 +08:00
mc media: mc-device.c: fix memleak in media_device_register_entity 2021-03-16 16:36:31 +08:00
mmc Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pci media: media/saa7164: fix saa7164_encoder_register() memory leak bugs 2021-05-20 16:07:27 +08:00
platform media: platform: sunxi: sun6i-csi: fix error return code of sun6i_video_start_streaming() 2021-05-20 16:07:52 +08:00
radio Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
rc bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
spi Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tuners media: m88rs6000t: avoid potential out-of-bounds reads on arrays 2021-05-20 16:07:52 +08:00
usb media: dvb-usb: Fix memory leak at error in dvb_usb_device_init() 2021-05-20 16:07:36 +08:00
v4l2-core media: v4l2-ctrls.c: fix race condition in hdl->requests list 2021-05-20 16:07:53 +08:00
Kconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00