Commit 082f1db0 authored by Blaise Boscaccy's avatar Blaise Boscaccy Committed by Alexei Starovoitov
Browse files

security: Propagate caller information in bpf hooks



Certain bpf syscall subcommands are available for usage from both
userspace and the kernel. LSM modules or eBPF gatekeeper programs may
need to take a different course of action depending on whether or not
a BPF syscall originated from the kernel or userspace.

Additionally, some of the bpf_attr struct fields contain pointers to
arbitrary memory. Currently the functionality to determine whether or
not a pointer refers to kernel memory or userspace memory is exposed
to the bpf verifier, but that information is missing from various LSM
hooks.

Here we augment the LSM hooks to provide this data, by simply passing
a boolean flag indicating whether or not the call originated in the
kernel, in any hook that contains a bpf_attr struct that corresponds
to a subcommand that may be called from the kernel.

Signed-off-by: default avatarBlaise Boscaccy <bboscaccy@linux.microsoft.com>
Acked-by: default avatarSong Liu <song@kernel.org>
Acked-by: default avatarPaul Moore <paul@paul-moore.com>
Link: https://lore.kernel.org/r/20250310221737.821889-2-bboscaccy@linux.microsoft.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent a03d3753
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment