TencentOS-kernel/include
KP Singh ebe1f06d76 bpf: lsm: Implement attach, detach and execution
[upstream commit 9e4e01dfd3254c7f04f24b7c6b29596bc12332f3]

JITed BPF programs are dynamically attached to the LSM hooks
using BPF trampolines. The trampoline prologue generates code to handle
conversion of the signature of the hook to the appropriate BPF context.

The allocated trampoline programs are attached to the nop functions
initialized as LSM hooks.

BPF_PROG_TYPE_LSM programs must have a GPL compatible license and
and need CAP_SYS_ADMIN (required for loading eBPF programs).

Upon attachment:

* A BPF fexit trampoline is used for LSM hooks with a void return type.
* A BPF fmod_ret trampoline is used for LSM hooks which return an
  int. The attached programs can override the return value of the
  bpf LSM hook to indicate a MAC Policy decision.

Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Brendan Jackman <jackmanb@google.com>
Reviewed-by: Florent Revest <revest@google.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: James Morris <jamorris@linux.microsoft.com>
Link: https://lore.kernel.org/bpf/20200329004356.27286-5-kpsingh@chromium.org
2022-08-30 11:33:21 +08:00
..
acpi ACPI: scan: Use unique number for instance_no 2021-04-12 12:53:31 +08:00
asm-generic locking/qspinlock: Rename mcs lock/unlock macros and make them more generic 2022-03-02 10:48:05 +08:00
clocksource Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
crypto crypto: api - check for ERR pointers in crypto_destroy_tfm() 2021-05-20 16:07:23 +08:00
drm iommu/vt-d: Move intel_iommu_gfx_mapped to Intel IOMMU header 2021-03-16 16:41:21 +08:00
dt-bindings Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
keys KEYS: Don't write out to userspace while holding key semaphore 2021-03-16 16:26:42 +08:00
kvm Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
linux bpf: lsm: Implement attach, detach and execution 2022-08-30 11:33:21 +08:00
math-emu Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
media media: rc: compile rc-cec.c into rc-core 2021-04-12 12:53:01 +08:00
misc Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
net bpf: Add sockmap hooks for UDP sockets 2022-08-30 11:33:21 +08:00
pcmcia Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ras Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
rdma RDMA/umem: Fix signature of stub ib_umem_find_best_pgsz() 2021-03-16 16:38:49 +08:00
scsi kabi: reserve space for kabi 2021-06-23 07:24:18 +00:00
soc irqchip/eznps: Fix build error for !ARC700 builds 2021-03-16 16:35:56 +08:00
sound ALSA: hda: intel-nhlt: verify config type 2021-04-12 12:52:52 +08:00
target scsi: target: core: Add cmd length set before cmd complete 2021-04-12 12:53:04 +08:00
trace writeback: Drop I_DIRTY_TIME_EXPIRE 2021-04-12 12:51:42 +08:00
uapi bpf: Introduce BPF_PROG_TYPE_LSM 2022-08-30 11:33:21 +08:00
vdso Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
video Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xen Xen/gntdev: correct error checking in gntdev_map_grant_pages() 2021-04-12 12:52:07 +08:00