diff options
| author | Tiezhu Yang <yangtiezhu@loongson.cn> | 2026-07-08 18:18:05 +0800 |
|---|---|---|
| committer | Eduard Zingerman <eddyz87@gmail.com> | 2026-07-08 23:24:41 -0700 |
| commit | 9a6df65d5c6a9947ddab4e563e329720f44b8747 (patch) | |
| tree | ad97986c8239e8fcb88cfb7fdb25ca3ed7f0309a /include | |
| parent | 47b079e2117a2ee52e21f8b72935900c702fc0b5 (diff) | |
| download | linux-stable-9a6df65d5c6a9947ddab4e563e329720f44b8747.tar.gz linux-stable-9a6df65d5c6a9947ddab4e563e329720f44b8747.zip | |
bpf: Introduce jit_required flag and remove bpf_prog_has_kfunc_call()
Introduce a 'jit_required' bitfield flag in struct bpf_prog to track
whether a BPF program strictly requires the JIT compiler to run. This
prevents a dangerous runtime fallback to the interpreter for features
that are only implemented in the JIT compiler.
Currently, bpf_prog_has_kfunc_call() is used only for kernel function
calls, replace the kfunc-specific helper with the new 'jit_required'
flag. This makes it easy to support other JIT-only BPF features, such
as inlined helpers.
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Suggested-by: KaFai Wan <kafai.wan@linux.dev>
Suggested-by: Leon Hwang <leon.hwang@linux.dev>
Acked-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bpf.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index c1a98fa36738..31181e0c2b80 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -1864,8 +1864,9 @@ struct bpf_prog_aux { struct bpf_prog { u16 pages; /* Number of allocated pages */ - u16 jited:1, /* Is our filter JIT'ed? */ + u32 jited:1, /* Is our filter JIT'ed? */ jit_requested:1,/* archs need to JIT the prog */ + jit_required:1, /* program strictly requires JIT compiler */ gpl_compatible:1, /* Is filter GPL compatible? */ cb_access:1, /* Is control block accessed? */ dst_needed:1, /* Do we need dst entry? */ @@ -3169,7 +3170,6 @@ const struct bpf_func_proto *bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog); void bpf_task_storage_free(struct task_struct *task); void bpf_cgrp_storage_free(struct cgroup *cgroup); -bool bpf_prog_has_kfunc_call(const struct bpf_prog *prog); const struct btf_func_model * bpf_jit_find_kfunc_model(const struct bpf_prog *prog, const struct bpf_insn *insn); @@ -3508,11 +3508,6 @@ static inline void bpf_task_storage_free(struct task_struct *task) { } -static inline bool bpf_prog_has_kfunc_call(const struct bpf_prog *prog) -{ - return false; -} - static inline const struct btf_func_model * bpf_jit_find_kfunc_model(const struct bpf_prog *prog, const struct bpf_insn *insn) |
