summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2026-07-19 13:35:49 +0200
committerAndrii Nakryiko <andrii@kernel.org>2026-07-27 15:41:03 -0700
commit59b9731addc7633a39d3a042ed968864f7b3aaf5 (patch)
treefca8e02e369b5411808a05fc72e00f037552e783 /kernel
parentfcf741584a562aaa89b0ace71f410b1c1a3e5193 (diff)
bpf: Allow bpf_res_spin_lock() in all contexts
There is no particular reason to keep bpf_res_spin_lock() disabled in tracing programs, since it is safe against reentrancy and deadlocks. Remove the restriction for tracing programs covered by the predicate is_tracing_prog_type(). This is a prerequisite before the definition of is_tracing_prog_type() is updated to include raw_tp, fentry, fexit, and fmod_ret. Existing tracing programs will be updated to use bpf_res_spin_lock() instead when it is available. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/bpf/20260719113551.1294284-2-memxor@gmail.com
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/verifier.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 641c3c62c1ec..e6f35f4e715b 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -17816,7 +17816,9 @@ static int check_map_prog_compatibility(struct bpf_verifier_env *env,
verbose(env, "socket filter progs cannot use bpf_spin_lock yet\n");
return -EINVAL;
}
+ }
+ if (btf_record_has_field(map->record, BPF_SPIN_LOCK)) {
if (is_tracing_prog_type(prog_type)) {
verbose(env, "tracing progs cannot use bpf_spin_lock yet\n");
return -EINVAL;