summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKaitao Cheng <chengkaitao@kylinos.cn>2026-08-05 23:33:38 +0800
committerKumar Kartikeya Dwivedi <memxor@gmail.com>2026-08-06 10:57:59 +0200
commited3b3093b6242bdb2c4acfb932d4b15db4e33948 (patch)
tree4cdd8eab48c86f464ef1ea5f04f6ec3f80aa2804 /include/linux
parent11c1e836710dcba03e50454a4eedfdbaf8d3050e (diff)
bpf: Add KF_SPINLOCK_SAFE flag for kfuncs under bpf_spin_lock
Introduce the KF_SPINLOCK_SAFE kfunc metadata flag in BTF so kfuncs may be explicitly marked as safe to call while holding bpf_spin_lock. Allow kfuncs defined in kernel modules to be marked with KF_SPINLOCK_SAFE. Example: BTF_ID_FLAGS(func, $kfunc_name, KF_SPINLOCK_SAFE) Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn> Acked-by: Leon Hwang <leon.hwang@linux.dev> Link: https://lore.kernel.org/bpf/20260805153340.34776-2-kaitao.cheng@linux.dev Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/btf.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/btf.h b/include/linux/btf.h
index c09b7994de4e..3f5255d095a2 100644
--- a/include/linux/btf.h
+++ b/include/linux/btf.h
@@ -79,6 +79,7 @@
#define KF_ARENA_ARG1 (1 << 14) /* kfunc takes an arena pointer as its first argument */
#define KF_ARENA_ARG2 (1 << 15) /* kfunc takes an arena pointer as its second argument */
#define KF_IMPLICIT_ARGS (1 << 16) /* kfunc has implicit arguments supplied by the verifier */
+#define KF_SPINLOCK_SAFE (1 << 17) /* kfunc is allowed inside bpf_spin_lock-ed region */
/*
* Tag marking a kernel function as a kfunc. This is meant to minimize the