summaryrefslogtreecommitdiff
path: root/kernel/bpf/map_in_map.c
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2022-11-18 04:56:00 +0300
committerAlexei Starovoitov <ast@kernel.org>2022-11-18 06:11:32 +0300
commitb7ff97925b55a0603a7c215305df4b43ab632948 (patch)
tree2b0522134f08e737f364cfeaa6db0fa15b602e05 /kernel/bpf/map_in_map.c
parentd0d78c1df9b1dbfb5e172de473561ce09d5e9d39 (diff)
downloadlinux-b7ff97925b55a0603a7c215305df4b43ab632948.tar.xz
bpf: Allow locking bpf_spin_lock in inner map values
There is no need to restrict users from locking bpf_spin_lock in map values of inner maps. Each inner map lookup gets a unique reg->id assigned to the returned PTR_TO_MAP_VALUE which will be preserved after the NULL check. Distinct lookups into different inner map get unique IDs, and distinct lookups into same inner map also get unique IDs. Hence, lift the restriction by removing the check return -ENOTSUPP in map_in_map.c. Later commits will add comprehensive test cases to ensure that invalid cases are rejected. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20221118015614.2013203-11-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/map_in_map.c')
-rw-r--r--kernel/bpf/map_in_map.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/kernel/bpf/map_in_map.c b/kernel/bpf/map_in_map.c
index fae6a6c33e2d..7cce2047c6ef 100644
--- a/kernel/bpf/map_in_map.c
+++ b/kernel/bpf/map_in_map.c
@@ -30,11 +30,6 @@ struct bpf_map *bpf_map_meta_alloc(int inner_map_ufd)
goto put;
}
- if (btf_record_has_field(inner_map->record, BPF_SPIN_LOCK)) {
- ret = -ENOTSUPP;
- goto put;
- }
-
inner_map_meta_size = sizeof(*inner_map_meta);
/* In some cases verifier needs to access beyond just base map. */
if (inner_map->ops == &array_map_ops)