diff options
author | KP Singh <kpsingh@google.com> | 2020-08-25 20:29:17 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-08-26 00:00:04 +0200 |
commit | 8ea636848aca35b9f97c5b5dee30225cf2dd0fe6 (patch) | |
tree | fd26d1b828552b8e1e4dc53fe61e928cfeaf7f61 /tools/lib | |
parent | bpf: Split bpf_local_storage to bpf_sk_storage (diff) | |
download | linux-8ea636848aca35b9f97c5b5dee30225cf2dd0fe6.tar.xz linux-8ea636848aca35b9f97c5b5dee30225cf2dd0fe6.zip |
bpf: Implement bpf_local_storage for inodes
Similar to bpf_local_storage for sockets, add local storage for inodes.
The life-cycle of storage is managed with the life-cycle of the inode.
i.e. the storage is destroyed along with the owning inode.
The BPF LSM allocates an __rcu pointer to the bpf_local_storage in the
security blob which are now stackable and can co-exist with other LSMs.
Signed-off-by: KP Singh <kpsingh@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200825182919.1118197-6-kpsingh@chromium.org
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/bpf/libbpf_probes.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c index 010c9a76fd2b..5482a9b7ae2d 100644 --- a/tools/lib/bpf/libbpf_probes.c +++ b/tools/lib/bpf/libbpf_probes.c @@ -170,7 +170,7 @@ int libbpf__load_raw_btf(const char *raw_types, size_t types_len, return btf_fd; } -static int load_sk_storage_btf(void) +static int load_local_storage_btf(void) { const char strs[] = "\0bpf_spin_lock\0val\0cnt\0l"; /* struct bpf_spin_lock { @@ -229,12 +229,13 @@ bool bpf_probe_map_type(enum bpf_map_type map_type, __u32 ifindex) key_size = 0; break; case BPF_MAP_TYPE_SK_STORAGE: + case BPF_MAP_TYPE_INODE_STORAGE: btf_key_type_id = 1; btf_value_type_id = 3; value_size = 8; max_entries = 0; map_flags = BPF_F_NO_PREALLOC; - btf_fd = load_sk_storage_btf(); + btf_fd = load_local_storage_btf(); if (btf_fd < 0) return false; break; |