diff options
author | KP Singh <kpsingh@google.com> | 2020-08-25 21:29:18 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-08-26 01:00:04 +0300 |
commit | 30897832d8b97e93833fb52c0a02951db3692ed2 (patch) | |
tree | 7e10ebe1b8b5961832641bd4336dc23e35bb0c1c /include/net/bpf_sk_storage.h | |
parent | 8ea636848aca35b9f97c5b5dee30225cf2dd0fe6 (diff) | |
download | linux-30897832d8b97e93833fb52c0a02951db3692ed2.tar.xz |
bpf: Allow local storage to be used from LSM programs
Adds support for both bpf_{sk, inode}_storage_{get, delete} to be used
in LSM programs. These helpers are not used for tracing programs
(currently) as their usage is tied to the life-cycle of the object and
should only be used where the owning object won't be freed (when the
owning object is passed as an argument to the LSM hook). Thus, they
are safer to use in LSM hooks than tracing. Usage of local storage in
tracing programs will probably follow a per function based whitelist
approach.
Since the UAPI helper signature for bpf_sk_storage expect a bpf_sock,
it, leads to a compilation warning for LSM programs, it's also updated
to accept a void * pointer instead.
Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200825182919.1118197-7-kpsingh@chromium.org
Diffstat (limited to 'include/net/bpf_sk_storage.h')
-rw-r--r-- | include/net/bpf_sk_storage.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/bpf_sk_storage.h b/include/net/bpf_sk_storage.h index 3c516dd07caf..119f4c9c3a9c 100644 --- a/include/net/bpf_sk_storage.h +++ b/include/net/bpf_sk_storage.h @@ -20,6 +20,8 @@ void bpf_sk_storage_free(struct sock *sk); extern const struct bpf_func_proto bpf_sk_storage_get_proto; extern const struct bpf_func_proto bpf_sk_storage_delete_proto; +extern const struct bpf_func_proto sk_storage_get_btf_proto; +extern const struct bpf_func_proto sk_storage_delete_btf_proto; struct bpf_local_storage_elem; struct bpf_sk_storage_diag; |