| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/07/29 14:22 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"BPF_JIT"
],
"FocusSymbols": [
"bpf_jit_blind_constants",
"bpf_jit_subprogs",
"bpf_fixup_call_args",
"bpf_clear_insn_aux_data"
],
"Reasoning": "The patch modifies the BPF verifier and JIT compiler's handling of instruction auxiliary data (`insn_aux_data`) during constant blinding and subprogram JITing. It changes how the program is cloned and how auxiliary data is tracked (introducing `insn_aux_data_len`), which affects core BPF program loading and verification logic.",
"WorthFuzzing": true
} |
| 1/1 | 2026/07/29 14:22 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit f5dc2cf39ced21853b873140682fb7bfb8505878\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Jul 29 14:22:52 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h\nindex 682c2cd3b8443..cdd50049a0c14 100644\n--- a/include/linux/bpf_verifier.h\n+++ b/include/linux/bpf_verifier.h\n@@ -948,6 +948,7 @@ struct bpf_verifier_env {\n \tbool seen_direct_write;\n \tbool seen_exception;\n \tbool signature;\n+\tu32 insn_aux_data_len;\n \tstruct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */\n \tconst struct bpf_line_info *prev_linfo;\n \tstruct bpf_verifier_log log;\ndiff --git a/include/linux/filter.h b/include/linux/filter.h\nindex 32d5297c557e5..2d1aa062566c4 100644\n--- a/include/linux/filter.h\n+++ b/include/linux/filter.h\n@@ -1211,25 +1211,12 @@ struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,\n #ifdef CONFIG_BPF_SYSCALL\n struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 off,\n \t\t\t\t const struct bpf_insn *patch, u32 len);\n-struct bpf_insn_aux_data *bpf_dup_insn_aux_data(struct bpf_verifier_env *env);\n-void bpf_restore_insn_aux_data(struct bpf_verifier_env *env,\n-\t\t\t struct bpf_insn_aux_data *orig_insn_aux);\n #else\n static inline struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 off,\n \t\t\t\t\t\t const struct bpf_insn *patch, u32 len)\n {\n \treturn ERR_PTR(-ENOTSUPP);\n }\n-\n-static inline struct bpf_insn_aux_data *bpf_dup_insn_aux_data(struct bpf_verifier_env *env)\n-{\n-\treturn NULL;\n-}\n-\n-static inline void bpf_restore_insn_aux_data(struct bpf_verifier_env *env,\n-\t\t\t\t\t struct bpf_insn_aux_data *orig_insn_aux)\n-{\n-}\n #endif /* CONFIG_BPF_SYSCALL */\n \n int bpf_remove_insns(struct bpf_prog *prog, u32 off, u32 cnt);\n@@ -1369,7 +1356,8 @@ int bpf_jit_get_func_addr(const struct bpf_prog *prog,\n \n const char *bpf_jit_get_prog_name(struct bpf_prog *prog);\n \n-struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog *prog);\n+int bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog **pprog,\n+\t\t\t bool clone_needed, bool *cloned);\n void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other);\n \n static inline bool bpf_prog_need_blind(const struct bpf_prog *prog)\n@@ -1521,9 +1509,11 @@ static inline bool bpf_prog_need_blind(const struct bpf_prog *prog)\n }\n \n static inline\n-struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog *prog)\n+int bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog **pprog,\n+\t\t\t bool clone_needed, bool *cloned)\n {\n-\treturn prog;\n+\t*cloned = false;\n+\treturn 0;\n }\n \n static inline void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other)\ndiff --git a/kernel/bpf/core.c b/kernel/bpf/core.c\nindex e2076667b2451..ab5da3ff941aa 100644\n--- a/kernel/bpf/core.c\n+++ b/kernel/bpf/core.c\n@@ -1564,27 +1564,34 @@ void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other)\n * Now this function is used only to blind the main prog and must be invoked only when\n * bpf_prog_need_blind() returns true.\n */\n-struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog *prog)\n+int bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog **pprog,\n+\t\t\t bool clone_needed, bool *cloned)\n {\n \tstruct bpf_insn insn_buff[16], aux[2];\n-\tstruct bpf_prog *clone, *tmp;\n+\tstruct bpf_prog *prog, *orig_prog, *tmp;\n \tint insn_delta, insn_cnt;\n \tstruct bpf_insn *insn;\n \tint i, rewritten;\n \n-\tif (WARN_ON_ONCE(env \u0026\u0026 env-\u003eprog != prog))\n-\t\treturn ERR_PTR(-EINVAL);\n+\t*cloned = false;\n+\tif (WARN_ON_ONCE(env \u0026\u0026 env-\u003eprog != *pprog))\n+\t\treturn -EINVAL;\n \n-\tclone = bpf_prog_clone_create(prog, GFP_USER);\n-\tif (!clone)\n-\t\treturn ERR_PTR(-ENOMEM);\n+\tprog = orig_prog = *pprog;\n+\t/* only clone the prog when we can fall back to the interpreter */\n+\tif (clone_needed) {\n+\t\tprog = bpf_prog_clone_create(orig_prog, GFP_USER);\n+\t\tif (!prog)\n+\t\t\treturn -ENOMEM;\n \n-\t/* make sure bpf_patch_insn_data() patches the correct prog */\n-\tif (env)\n-\t\tenv-\u003eprog = clone;\n+\t\t*cloned = true;\n+\t\t/* make sure bpf_patch_insn_data() patches the correct prog */\n+\t\tif (env)\n+\t\t\tenv-\u003eprog = prog;\n+\t}\n \n-\tinsn_cnt = clone-\u003elen;\n-\tinsn = clone-\u003einsnsi;\n+\tinsn_cnt = prog-\u003elen;\n+\tinsn = prog-\u003einsnsi;\n \n \tfor (i = 0; i \u003c insn_cnt; i++, insn++) {\n \t\tif (bpf_pseudo_func(insn)) {\n@@ -1605,42 +1612,49 @@ struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bp\n \t\t insn[1].code == 0)\n \t\t\tmemcpy(aux, insn, sizeof(aux));\n \n-\t\trewritten = bpf_jit_blind_insn(insn, aux, insn_buff,\n-\t\t\t\t\t\tclone-\u003eaux-\u003everifier_zext);\n+\t\trewritten = bpf_jit_blind_insn(insn, aux, insn_buff, prog-\u003eaux-\u003everifier_zext);\n \t\tif (!rewritten)\n \t\t\tcontinue;\n \n \t\tif (env)\n \t\t\ttmp = bpf_patch_insn_data(env, i, insn_buff, rewritten);\n \t\telse\n-\t\t\ttmp = bpf_patch_insn_single(clone, i, insn_buff, rewritten);\n+\t\t\ttmp = bpf_patch_insn_single(prog, i, insn_buff, rewritten);\n \n \t\tif (IS_ERR_OR_NULL(tmp)) {\n-\t\t\tif (env)\n-\t\t\t\t/* restore the original prog */\n-\t\t\t\tenv-\u003eprog = prog;\n-\t\t\t/* Patching may have repointed aux-\u003eprog during\n-\t\t\t * realloc from the original one, so we need to\n-\t\t\t * fix it up here on error.\n-\t\t\t */\n-\t\t\tbpf_jit_prog_release_other(prog, clone);\n-\t\t\treturn IS_ERR(tmp) ? tmp : ERR_PTR(-ENOMEM);\n+\t\t\tif (*cloned) {\n+\t\t\t\t/* roll back to the original prog */\n+\t\t\t\t*pprog = orig_prog;\n+\t\t\t\tif (env)\n+\t\t\t\t\tenv-\u003eprog = orig_prog;\n+\t\t\t\t/* Patching may have repointed aux-\u003eprog during\n+\t\t\t\t * realloc from the original one, so we need to\n+\t\t\t\t * fix it up here on error.\n+\t\t\t\t */\n+\t\t\t\tbpf_jit_prog_release_other(orig_prog, prog);\n+\t\t\t} else {\n+\t\t\t\t/* just keep the latest successfully patched prog */\n+\t\t\t\t*pprog = prog;\n+\t\t\t}\n+\t\t\treturn IS_ERR(tmp) ? PTR_ERR(tmp) : -ENOMEM;\n \t\t}\n \n-\t\tclone = tmp;\n+\t\tprog = tmp;\n \t\tinsn_delta = rewritten - 1;\n \n \t\tif (env)\n-\t\t\tenv-\u003eprog = clone;\n+\t\t\tenv-\u003eprog = prog;\n \n \t\t/* Walk new program and skip insns we just inserted. */\n-\t\tinsn = clone-\u003einsnsi + i + insn_delta;\n+\t\tinsn = prog-\u003einsnsi + i + insn_delta;\n \t\tinsn_cnt += insn_delta;\n \t\ti += insn_delta;\n \t}\n \n-\tclone-\u003eblinded = 1;\n-\treturn clone;\n+\tprog-\u003eblinded = 1;\n+\t*pprog = prog;\n+\n+\treturn 0;\n }\n \n bool bpf_insn_is_indirect_target(const struct bpf_verifier_env *env, const struct bpf_prog *prog,\n@@ -2630,49 +2644,33 @@ static bool bpf_prog_select_interpreter(struct bpf_prog *fp)\n \treturn select_interpreter;\n }\n \n-static struct bpf_prog *bpf_prog_jit_compile(struct bpf_verifier_env *env, struct bpf_prog *prog)\n+static struct bpf_prog *bpf_prog_jit_compile(struct bpf_verifier_env *env, struct bpf_prog *prog,\n+\t\t\t\t\t bool jit_needed)\n {\n #ifdef CONFIG_BPF_JIT\n+\tint err;\n+\tbool cloned = false;\n \tstruct bpf_prog *orig_prog;\n-\tstruct bpf_insn_aux_data *orig_insn_aux;\n \n \tif (!bpf_prog_need_blind(prog))\n \t\treturn bpf_int_jit_compile(env, prog);\n \n-\tif (env) {\n-\t\t/*\n-\t\t * If env is not NULL, we are called from the end of bpf_check(), at this\n-\t\t * point, only insn_aux_data is used after failure, so it should be restored\n-\t\t * on failure.\n-\t\t */\n-\t\torig_insn_aux = bpf_dup_insn_aux_data(env);\n-\t\tif (!orig_insn_aux)\n-\t\t\treturn prog;\n-\t}\n-\n \torig_prog = prog;\n-\tprog = bpf_jit_blind_constants(env, prog);\n-\t/*\n-\t * If blinding was requested and we failed during blinding, we must fall\n-\t * back to the interpreter.\n-\t */\n-\tif (IS_ERR(prog))\n-\t\tgoto out_restore;\n+\terr = bpf_jit_blind_constants(env, \u0026prog, !jit_needed, \u0026cloned);\n+\tif (err)\n+\t\tgoto out;\n \n \tprog = bpf_int_jit_compile(env, prog);\n-\tif (prog-\u003ejited) {\n-\t\tbpf_jit_prog_release_other(prog, orig_prog);\n-\t\tif (env)\n-\t\t\tvfree(orig_insn_aux);\n-\t\treturn prog;\n+\tif (cloned) {\n+\t\tif (prog-\u003ejited) {\n+\t\t\tbpf_jit_prog_release_other(prog, orig_prog);\n+\t\t} else {\n+\t\t\tbpf_jit_prog_release_other(orig_prog, prog);\n+\t\t\tprog = orig_prog;\n+\t\t}\n \t}\n \n-\tbpf_jit_prog_release_other(orig_prog, prog);\n-\n-out_restore:\n-\tprog = orig_prog;\n-\tif (env)\n-\t\tbpf_restore_insn_aux_data(env, orig_insn_aux);\n+out:\n #endif\n \treturn prog;\n }\n@@ -2702,7 +2700,7 @@ struct bpf_prog *__bpf_prog_select_runtime(struct bpf_verifier_env *env, struct\n \t\tif (*err)\n \t\t\treturn fp;\n \n-\t\tfp = bpf_prog_jit_compile(env, fp);\n+\t\tfp = bpf_prog_jit_compile(env, fp, jit_needed);\n \t\tbpf_prog_jit_attempt_done(fp);\n \t\tif (!fp-\u003ejited \u0026\u0026 jit_needed) {\n \t\t\t*err = -ENOTSUPP;\ndiff --git a/kernel/bpf/fixups.c b/kernel/bpf/fixups.c\nindex a0bddada7964e..6da0f8d0b761b 100644\n--- a/kernel/bpf/fixups.c\n+++ b/kernel/bpf/fixups.c\n@@ -174,6 +174,7 @@ static void adjust_insn_aux_data(struct bpf_verifier_env *env,\n \tif (cnt == 1)\n \t\treturn;\n \tprog_len = new_prog-\u003elen;\n+\tenv-\u003einsn_aux_data_len = prog_len;\n \n \tmemmove(data + off + cnt - 1, data + off,\n \t\tsizeof(struct bpf_insn_aux_data) * (prog_len - off - cnt + 1));\n@@ -440,7 +441,6 @@ static int bpf_adj_linfo_after_remove(struct bpf_verifier_env *env, u32 off,\n void bpf_clear_insn_aux_data(struct bpf_verifier_env *env, int start, int len)\n {\n \tstruct bpf_insn_aux_data *aux_data = env-\u003einsn_aux_data;\n-\tstruct bpf_insn *insns = env-\u003eprog-\u003einsnsi;\n \tint end = start + len;\n \tint i;\n \n@@ -449,9 +449,6 @@ void bpf_clear_insn_aux_data(struct bpf_verifier_env *env, int start, int len)\n \t\t\tkvfree(aux_data[i].jt);\n \t\t\taux_data[i].jt = NULL;\n \t\t}\n-\n-\t\tif (bpf_is_ldimm64(\u0026insns[i]))\n-\t\t\ti++;\n \t}\n }\n \n@@ -464,7 +461,6 @@ static int verifier_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt)\n \tif (bpf_prog_is_offloaded(env-\u003eprog-\u003eaux))\n \t\tbpf_prog_offload_remove_insns(env, off, cnt);\n \n-\t/* Should be called before bpf_remove_insns, as it uses prog-\u003einsnsi */\n \tbpf_clear_insn_aux_data(env, off, cnt);\n \n \terr = bpf_remove_insns(env-\u003eprog, off, cnt);\n@@ -483,6 +479,7 @@ static int verifier_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt)\n \n \tmemmove(aux_data + off,\taux_data + off + cnt,\n \t\tsizeof(*aux_data) * (orig_prog_len - off - cnt));\n+\tenv-\u003einsn_aux_data_len -= cnt;\n \n \treturn 0;\n }\n@@ -999,32 +996,14 @@ static u32 *bpf_dup_subprog_starts(struct bpf_verifier_env *env)\n \n static void bpf_restore_subprog_starts(struct bpf_verifier_env *env, u32 *orig_starts)\n {\n+\tif (!orig_starts)\n+\t\treturn;\n \tfor (int i = 0; i \u003c env-\u003esubprog_cnt; i++)\n \t\tenv-\u003esubprog_info[i].start = orig_starts[i];\n \t/* restore the start of fake 'exit' subprog as well */\n \tenv-\u003esubprog_info[env-\u003esubprog_cnt].start = env-\u003eprog-\u003elen;\n }\n \n-struct bpf_insn_aux_data *bpf_dup_insn_aux_data(struct bpf_verifier_env *env)\n-{\n-\tsize_t size;\n-\tvoid *new_aux;\n-\n-\tsize = array_size(sizeof(struct bpf_insn_aux_data), env-\u003eprog-\u003elen);\n-\tnew_aux = __vmalloc(size, GFP_KERNEL_ACCOUNT);\n-\tif (new_aux)\n-\t\tmemcpy(new_aux, env-\u003einsn_aux_data, size);\n-\treturn new_aux;\n-}\n-\n-void bpf_restore_insn_aux_data(struct bpf_verifier_env *env,\n-\t\t\t struct bpf_insn_aux_data *orig_insn_aux)\n-{\n-\t/* the expanded elements are zero-filled, so no special handling is required */\n-\tvfree(env-\u003einsn_aux_data);\n-\tenv-\u003einsn_aux_data = orig_insn_aux;\n-}\n-\n static int jit_subprogs(struct bpf_verifier_env *env)\n {\n \tstruct bpf_prog *prog = env-\u003eprog, **func, *tmp;\n@@ -1296,57 +1275,47 @@ static int jit_subprogs(struct bpf_verifier_env *env)\n int bpf_jit_subprogs(struct bpf_verifier_env *env)\n {\n \tint err, i;\n-\tbool blinded = false;\n \tstruct bpf_insn *insn;\n \tstruct bpf_prog *prog, *orig_prog;\n-\tstruct bpf_insn_aux_data *orig_insn_aux;\n-\tu32 *orig_subprog_starts;\n+\tu32 *orig_subprog_starts = NULL;\n+\tbool cloned = false;\n \n \tif (env-\u003esubprog_cnt \u003c= 1)\n \t\treturn 0;\n \n \tprog = orig_prog = env-\u003eprog;\n \tif (bpf_prog_need_blind(prog)) {\n-\t\torig_insn_aux = bpf_dup_insn_aux_data(env);\n-\t\tif (!orig_insn_aux) {\n-\t\t\terr = -ENOMEM;\n-\t\t\tgoto out_cleanup;\n-\t\t}\n-\t\torig_subprog_starts = bpf_dup_subprog_starts(env);\n-\t\tif (!orig_subprog_starts) {\n-\t\t\tvfree(orig_insn_aux);\n-\t\t\terr = -ENOMEM;\n-\t\t\tgoto out_cleanup;\n+\t\tif (!prog-\u003ejit_required) {\n+\t\t\torig_subprog_starts = bpf_dup_subprog_starts(env);\n+\t\t\tif (!orig_subprog_starts) {\n+\t\t\t\terr = -ENOMEM;\n+\t\t\t\tgoto out_cleanup;\n+\t\t\t}\n \t\t}\n-\t\tprog = bpf_jit_blind_constants(env, prog);\n-\t\tif (IS_ERR(prog)) {\n-\t\t\terr = -ENOMEM;\n-\t\t\tprog = orig_prog;\n+\t\terr = bpf_jit_blind_constants(env, \u0026prog, !prog-\u003ejit_required, \u0026cloned);\n+\t\tif (err)\n \t\t\tgoto out_restore;\n-\t\t}\n-\t\tblinded = true;\n \t}\n \n \terr = jit_subprogs(env);\n \tif (err)\n \t\tgoto out_jit_err;\n \n-\tif (blinded) {\n+\tif (cloned) {\n \t\tbpf_jit_prog_release_other(prog, orig_prog);\n \t\tkvfree(orig_subprog_starts);\n-\t\tvfree(orig_insn_aux);\n \t}\n \n \treturn 0;\n \n out_jit_err:\n-\tif (blinded) {\n+\tif (cloned) {\n \t\tbpf_jit_prog_release_other(orig_prog, prog);\n \t\t/* roll back to the clean original prog */\n \t\tprog = env-\u003eprog = orig_prog;\n \t\tgoto out_restore;\n \t} else {\n-\t\tif (err != -EFAULT) {\n+\t\tif (err != -EFAULT \u0026\u0026 !prog-\u003ejit_required) {\n \t\t\t/*\n \t\t\t * We will fall back to interpreter mode when err is not -EFAULT, before\n \t\t\t * that, insn-\u003eoff and insn-\u003eimm should be restored to their original\n@@ -1364,7 +1333,6 @@ int bpf_jit_subprogs(struct bpf_verifier_env *env)\n \n out_restore:\n \tbpf_restore_subprog_starts(env, orig_subprog_starts);\n-\tbpf_restore_insn_aux_data(env, orig_insn_aux);\n \tkvfree(orig_subprog_starts);\n out_cleanup:\n \t/* cleanup main prog to be interpreted */\n@@ -1376,8 +1344,7 @@ int bpf_jit_subprogs(struct bpf_verifier_env *env)\n int bpf_fixup_call_args(struct bpf_verifier_env *env)\n {\n #ifndef CONFIG_BPF_JIT_ALWAYS_ON\n-\tstruct bpf_prog *prog = env-\u003eprog;\n-\tstruct bpf_insn *insn = prog-\u003einsnsi;\n+\tstruct bpf_insn *insn;\n \tint depth;\n #endif\n \tint i, err = 0;\n@@ -1403,7 +1370,7 @@ int bpf_fixup_call_args(struct bpf_verifier_env *env)\n \t\t\treturn err;\n \t}\n #ifndef CONFIG_BPF_JIT_ALWAYS_ON\n-\tif (prog-\u003ejit_required) {\n+\tif (env-\u003eprog-\u003ejit_required) {\n \t\tverbose(env, \"program requires BPF JIT compiler but it is not available\\n\");\n \t\treturn -EINVAL;\n \t}\n@@ -1420,7 +1387,7 @@ int bpf_fixup_call_args(struct bpf_verifier_env *env)\n \t\tverbose(env, \"tail_calls are not allowed in non-JITed programs with bpf-to-bpf calls\\n\");\n \t\treturn -EINVAL;\n \t}\n-\tfor (i = 0; i \u003c prog-\u003elen; i++, insn++) {\n+\tfor (i = 0, insn = env-\u003eprog-\u003einsnsi; i \u003c env-\u003eprog-\u003elen; i++, insn++) {\n \t\tif (bpf_pseudo_func(insn)) {\n \t\t\t/* When JIT fails the progs with callback calls\n \t\t\t * have to be rejected, since interpreter doesn't support them yet.\ndiff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c\nindex e6f35f4e715b6..e31c41203bdae 100644\n--- a/kernel/bpf/verifier.c\n+++ b/kernel/bpf/verifier.c\n@@ -20122,7 +20122,7 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr,\n \tif (!is_priv)\n \t\tmutex_lock(\u0026bpf_verifier_lock);\n \n-\tlen = env-\u003eprog-\u003elen;\n+\tlen = env-\u003einsn_aux_data_len = env-\u003eprog-\u003elen;\n \tenv-\u003einsn_aux_data =\n \t\t__vmalloc(array_size(sizeof(struct bpf_insn_aux_data), len),\n \t\t\t GFP_KERNEL_ACCOUNT | __GFP_ZERO);\n@@ -20368,7 +20368,7 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr,\n \trelease_btfs(env);\n err_free_env:\n \tif (env-\u003einsn_aux_data)\n-\t\tbpf_clear_insn_aux_data(env, 0, env-\u003eprog-\u003elen);\n+\t\tbpf_clear_insn_aux_data(env, 0, env-\u003einsn_aux_data_len);\n \tvfree(env-\u003einsn_aux_data);\n \tkvfree(env-\u003efd_array);\n \tbpf_stack_liveness_free(env);\n"
} |
| 2/1 | 2026/07/29 14:22 | agent | patch-evaluator |
0mModel:best-expensive Args: null Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"BPF_JIT"
],
"FocusSymbols": [
"bpf_jit_blind_constants",
"bpf_jit_subprogs",
"bpf_fixup_call_args",
"bpf_clear_insn_aux_data"
],
"Reasoning": "The patch modifies the BPF verifier and JIT compiler's handling of instruction auxiliary data (`insn_aux_data`) during constant blinding and subprogram JITing. It changes how the program is cloned and how auxiliary data is tracked (introducing `insn_aux_data_len`), which affects core BPF program loading and verification logic.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). - Code in vendor-specific PCIe switch, SmartNIC, or GPU drivers (e.g., mlxsw, pds_core, qed, ionic, amdgpu) that require physical PCIe hardware cards not emulated in standard QEMU. - Driver .remove, .shutdown, or pci_unregister_driver teardown callbacks (e.g., igb_remove) that are executed only during PCI hot-unplug or sysfs driver unbind operations. If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. Prefer non-static, non-inlined API entrypoint functions over internal static helper functions (which are inlined by the compiler and do not have distinct symbol addresses). 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Also check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed for Kbuild to compile the code statically into vmlinux. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit f5dc2cf39ced21853b873140682fb7bfb8505878
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Jul 29 14:22:52 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 682c2cd3b8443..cdd50049a0c14 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -948,6 +948,7 @@ struct bpf_verifier_env {
bool seen_direct_write;
bool seen_exception;
bool signature;
+ u32 insn_aux_data_len;
struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */
const struct bpf_line_info *prev_linfo;
struct bpf_verifier_log log;
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 32d5297c557e5..2d1aa062566c4 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -1211,25 +1211,12 @@ struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
#ifdef CONFIG_BPF_SYSCALL
struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 off,
const struct bpf_insn *patch, u32 len);
-struct bpf_insn_aux_data *bpf_dup_insn_aux_data(struct bpf_verifier_env *env);
-void bpf_restore_insn_aux_data(struct bpf_verifier_env *env,
- struct bpf_insn_aux_data *orig_insn_aux);
#else
static inline struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 off,
const struct bpf_insn *patch, u32 len)
{
return ERR_PTR(-ENOTSUPP);
}
-
-static inline struct bpf_insn_aux_data *bpf_dup_insn_aux_data(struct bpf_verifier_env *env)
-{
- return NULL;
-}
-
-static inline void bpf_restore_insn_aux_data(struct bpf_verifier_env *env,
- struct bpf_insn_aux_data *orig_insn_aux)
-{
-}
#endif /* CONFIG_BPF_SYSCALL */
int bpf_remove_insns(struct bpf_prog *prog, u32 off, u32 cnt);
@@ -1369,7 +1356,8 @@ int bpf_jit_get_func_addr(const struct bpf_prog *prog,
const char *bpf_jit_get_prog_name(struct bpf_prog *prog);
-struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog *prog);
+int bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog **pprog,
+ bool clone_needed, bool *cloned);
void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other);
static inline bool bpf_prog_need_blind(const struct bpf_prog *prog)
@@ -1521,9 +1509,11 @@ static inline bool bpf_prog_need_blind(const struct bpf_prog *prog)
}
static inline
-struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog *prog)
+int bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog **pprog,
+ bool clone_needed, bool *cloned)
{
- return prog;
+ *cloned = false;
+ return 0;
}
static inline void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index e2076667b2451..ab5da3ff941aa 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -1564,27 +1564,34 @@ void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other)
* Now this function is used only to blind the main prog and must be invoked only when
* bpf_prog_need_blind() returns true.
*/
-struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog *prog)
+int bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog **pprog,
+ bool clone_needed, bool *cloned)
{
struct bpf_insn insn_buff[16], aux[2];
- struct bpf_prog *clone, *tmp;
+ struct bpf_prog *prog, *orig_prog, *tmp;
int insn_delta, insn_cnt;
struct bpf_insn *insn;
int i, rewritten;
- if (WARN_ON_ONCE(env && env->prog != prog))
- return ERR_PTR(-EINVAL);
+ *cloned = false;
+ if (WARN_ON_ONCE(env && env->prog != *pprog))
+ return -EINVAL;
- clone = bpf_prog_clone_create(prog, GFP_USER);
- if (!clone)
- return ERR_PTR(-ENOMEM);
+ prog = orig_prog = *pprog;
+ /* only clone the prog when we can fall back to the interpreter */
+ if (clone_needed) {
+ prog = bpf_prog_clone_create(orig_prog, GFP_USER);
+ if (!prog)
+ return -ENOMEM;
- /* make sure bpf_patch_insn_data() patches the correct prog */
- if (env)
- env->prog = clone;
+ *cloned = true;
+ /* make sure bpf_patch_insn_data() patches the correct prog */
+ if (env)
+ env->prog = prog;
+ }
- insn_cnt = clone->len;
- insn = clone->insnsi;
+ insn_cnt = prog->len;
+ insn = prog->insnsi;
for (i = 0; i < insn_cnt; i++, insn++) {
if (bpf_pseudo_func(insn)) {
@@ -1605,42 +1612,49 @@ struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bp
insn[1].code == 0)
memcpy(aux, insn, sizeof(aux));
- rewritten = bpf_jit_blind_insn(insn, aux, insn_buff,
- clone->aux->verifier_zext);
+ rewritten = bpf_jit_blind_insn(insn, aux, insn_buff, prog->aux->verifier_zext);
if (!rewritten)
continue;
if (env)
tmp = bpf_patch_insn_data(env, i, insn_buff, rewritten);
else
- tmp = bpf_patch_insn_single(clone, i, insn_buff, rewritten);
+ tmp = bpf_patch_insn_single(prog, i, insn_buff, rewritten);
if (IS_ERR_OR_NULL(tmp)) {
- if (env)
- /* restore the original prog */
- env->prog = prog;
- /* Patching may have repointed aux->prog during
- * realloc from the original one, so we need to
- * fix it up here on error.
- */
- bpf_jit_prog_release_other(prog, clone);
- return IS_ERR(tmp) ? tmp : ERR_PTR(-ENOMEM);
+ if (*cloned) {
+ /* roll back to the original prog */
+ *pprog = orig_prog;
+ if (env)
+ env->prog = orig_prog;
+ /* Patching may have repointed aux->prog during
+ * realloc from the original one, so we need to
+ * fix it up here on error.
+ */
+ bpf_jit_prog_release_other(orig_prog, prog);
+ } else {
+ /* just keep the latest successfully patched prog */
+ *pprog = prog;
+ }
+ return IS_ERR(tmp) ? PTR_ERR(tmp) : -ENOMEM;
}
- clone = tmp;
+ prog = tmp;
insn_delta = rewritten - 1;
if (env)
- env->prog = clone;
+ env->prog = prog;
/* Walk new program and skip insns we just inserted. */
- insn = clone->insnsi + i + insn_delta;
+ insn = prog->insnsi + i + insn_delta;
insn_cnt += insn_delta;
i += insn_delta;
}
- clone->blinded = 1;
- return clone;
+ prog->blinded = 1;
+ *pprog = prog;
+
+ return 0;
}
bool bpf_insn_is_indirect_target(const struct bpf_verifier_env *env, const struct bpf_prog *prog,
@@ -2630,49 +2644,33 @@ static bool bpf_prog_select_interpreter(struct bpf_prog *fp)
return select_interpreter;
}
-static struct bpf_prog *bpf_prog_jit_compile(struct bpf_verifier_env *env, struct bpf_prog *prog)
+static struct bpf_prog *bpf_prog_jit_compile(struct bpf_verifier_env *env, struct bpf_prog *prog,
+ bool jit_needed)
{
#ifdef CONFIG_BPF_JIT
+ int err;
+ bool cloned = false;
struct bpf_prog *orig_prog;
- struct bpf_insn_aux_data *orig_insn_aux;
if (!bpf_prog_need_blind(prog))
return bpf_int_jit_compile(env, prog);
- if (env) {
- /*
- * If env is not NULL, we are called from the end of bpf_check(), at this
- * point, only insn_aux_data is used after failure, so it should be restored
- * on failure.
- */
- orig_insn_aux = bpf_dup_insn_aux_data(env);
- if (!orig_insn_aux)
- return prog;
- }
-
orig_prog = prog;
- prog = bpf_jit_blind_constants(env, prog);
- /*
- * If blinding was requested and we failed during blinding, we must fall
- * back to the interpreter.
- */
- if (IS_ERR(prog))
- goto out_restore;
+ err = bpf_jit_blind_constants(env, &prog, !jit_needed, &cloned);
+ if (err)
+ goto out;
prog = bpf_int_jit_compile(env, prog);
- if (prog->jited) {
- bpf_jit_prog_release_other(prog, orig_prog);
- if (env)
- vfree(orig_insn_aux);
- return prog;
+ if (cloned) {
+ if (prog->jited) {
+ bpf_jit_prog_release_other(prog, orig_prog);
+ } else {
+ bpf_jit_prog_release_other(orig_prog, prog);
+ prog = orig_prog;
+ }
}
- bpf_jit_prog_release_other(orig_prog, prog);
-
-out_restore:
- prog = orig_prog;
- if (env)
- bpf_restore_insn_aux_data(env, orig_insn_aux);
+out:
#endif
return prog;
}
@@ -2702,7 +2700,7 @@ struct bpf_prog *__bpf_prog_select_runtime(struct bpf_verifier_env *env, struct
if (*err)
return fp;
- fp = bpf_prog_jit_compile(env, fp);
+ fp = bpf_prog_jit_compile(env, fp, jit_needed);
bpf_prog_jit_attempt_done(fp);
if (!fp->jited && jit_needed) {
*err = -ENOTSUPP;
diff --git a/kernel/bpf/fixups.c b/kernel/bpf/fixups.c
index a0bddada7964e..6da0f8d0b761b 100644
--- a/kernel/bpf/fixups.c
+++ b/kernel/bpf/fixups.c
@@ -174,6 +174,7 @@ static void adjust_insn_aux_data(struct bpf_verifier_env *env,
if (cnt == 1)
return;
prog_len = new_prog->len;
+ env->insn_aux_data_len = prog_len;
memmove(data + off + cnt - 1, data + off,
sizeof(struct bpf_insn_aux_data) * (prog_len - off - cnt + 1));
@@ -440,7 +441,6 @@ static int bpf_adj_linfo_after_remove(struct bpf_verifier_env *env, u32 off,
void bpf_clear_insn_aux_data(struct bpf_verifier_env *env, int start, int len)
{
struct bpf_insn_aux_data *aux_data = env->insn_aux_data;
- struct bpf_insn *insns = env->prog->insnsi;
int end = start + len;
int i;
@@ -449,9 +449,6 @@ void bpf_clear_insn_aux_data(struct bpf_verifier_env *env, int start, int len)
kvfree(aux_data[i].jt);
aux_data[i].jt = NULL;
}
-
- if (bpf_is_ldimm64(&insns[i]))
- i++;
}
}
@@ -464,7 +461,6 @@ static int verifier_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt)
if (bpf_prog_is_offloaded(env->prog->aux))
bpf_prog_offload_remove_insns(env, off, cnt);
- /* Should be called before bpf_remove_insns, as it uses prog->insnsi */
bpf_clear_insn_aux_data(env, off, cnt);
err = bpf_remove_insns(env->prog, off, cnt);
@@ -483,6 +479,7 @@ static int verifier_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt)
memmove(aux_data + off, aux_data + off + cnt,
sizeof(*aux_data) * (orig_prog_len - off - cnt));
+ env->insn_aux_data_len -= cnt;
return 0;
}
@@ -999,32 +996,14 @@ static u32 *bpf_dup_subprog_starts(struct bpf_verifier_env *env)
static void bpf_restore_subprog_starts(struct bpf_verifier_env *env, u32 *orig_starts)
{
+ if (!orig_starts)
+ return;
for (int i = 0; i < env->subprog_cnt; i++)
env->subprog_info[i].start = orig_starts[i];
/* restore the start of fake 'exit' subprog as well */
env->subprog_info[env->subprog_cnt].start = env->prog->len;
}
-struct bpf_insn_aux_data *bpf_dup_insn_aux_data(struct bpf_verifier_env *env)
-{
- size_t size;
- void *new_aux;
-
- size = array_size(sizeof(struct bpf_insn_aux_data), env->prog->len);
- new_aux = __vmalloc(size, GFP_KERNEL_ACCOUNT);
- if (new_aux)
- memcpy(new_aux, env->insn_aux_data, size);
- return new_aux;
-}
-
-void bpf_restore_insn_aux_data(struct bpf_verifier_env *env,
- struct bpf_insn_aux_data *orig_insn_aux)
-{
- /* the expanded elements are zero-filled, so no special handling is required */
- vfree(env->insn_aux_data);
- env->insn_aux_data = orig_insn_aux;
-}
-
static int jit_subprogs(struct bpf_verifier_env *env)
{
struct bpf_prog *prog = env->prog, **func, *tmp;
@@ -1296,57 +1275,47 @@ static int jit_subprogs(struct bpf_verifier_env *env)
int bpf_jit_subprogs(struct bpf_verifier_env *env)
{
int err, i;
- bool blinded = false;
struct bpf_insn *insn;
struct bpf_prog *prog, *orig_prog;
- struct bpf_insn_aux_data *orig_insn_aux;
- u32 *orig_subprog_starts;
+ u32 *orig_subprog_starts = NULL;
+ bool cloned = false;
if (env->subprog_cnt <= 1)
return 0;
prog = orig_prog = env->prog;
if (bpf_prog_need_blind(prog)) {
- orig_insn_aux = bpf_dup_insn_aux_data(env);
- if (!orig_insn_aux) {
- err = -ENOMEM;
- goto out_cleanup;
- }
- orig_subprog_starts = bpf_dup_subprog_starts(env);
- if (!orig_subprog_starts) {
- vfree(orig_insn_aux);
- err = -ENOMEM;
- goto out_cleanup;
+ if (!prog->jit_required) {
+ orig_subprog_starts = bpf_dup_subprog_starts(env);
+ if (!orig_subprog_starts) {
+ err = -ENOMEM;
+ goto out_cleanup;
+ }
}
- prog = bpf_jit_blind_constants(env, prog);
- if (IS_ERR(prog)) {
- err = -ENOMEM;
- prog = orig_prog;
+ err = bpf_jit_blind_constants(env, &prog, !prog->jit_required, &cloned);
+ if (err)
goto out_restore;
- }
- blinded = true;
}
err = jit_subprogs(env);
if (err)
goto out_jit_err;
- if (blinded) {
+ if (cloned) {
bpf_jit_prog_release_other(prog, orig_prog);
kvfree(orig_subprog_starts);
- vfree(orig_insn_aux);
}
return 0;
out_jit_err:
- if (blinded) {
+ if (cloned) {
bpf_jit_prog_release_other(orig_prog, prog);
/* roll back to the clean original prog */
prog = env->prog = orig_prog;
goto out_restore;
} else {
- if (err != -EFAULT) {
+ if (err != -EFAULT && !prog->jit_required) {
/*
* We will fall back to interpreter mode when err is not -EFAULT, before
* that, insn->off and insn->imm should be restored to their original
@@ -1364,7 +1333,6 @@ int bpf_jit_subprogs(struct bpf_verifier_env *env)
out_restore:
bpf_restore_subprog_starts(env, orig_subprog_starts);
- bpf_restore_insn_aux_data(env, orig_insn_aux);
kvfree(orig_subprog_starts);
out_cleanup:
/* cleanup main prog to be interpreted */
@@ -1376,8 +1344,7 @@ int bpf_jit_subprogs(struct bpf_verifier_env *env)
int bpf_fixup_call_args(struct bpf_verifier_env *env)
{
#ifndef CONFIG_BPF_JIT_ALWAYS_ON
- struct bpf_prog *prog = env->prog;
- struct bpf_insn *insn = prog->insnsi;
+ struct bpf_insn *insn;
int depth;
#endif
int i, err = 0;
@@ -1403,7 +1370,7 @@ int bpf_fixup_call_args(struct bpf_verifier_env *env)
return err;
}
#ifndef CONFIG_BPF_JIT_ALWAYS_ON
- if (prog->jit_required) {
+ if (env->prog->jit_required) {
verbose(env, "program requires BPF JIT compiler but it is not available\n");
return -EINVAL;
}
@@ -1420,7 +1387,7 @@ int bpf_fixup_call_args(struct bpf_verifier_env *env)
verbose(env, "tail_calls are not allowed in non-JITed programs with bpf-to-bpf calls\n");
return -EINVAL;
}
- for (i = 0; i < prog->len; i++, insn++) {
+ for (i = 0, insn = env->prog->insnsi; i < env->prog->len; i++, insn++) {
if (bpf_pseudo_func(insn)) {
/* When JIT fails the progs with callback calls
* have to be rejected, since interpreter doesn't support them yet.
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index e6f35f4e715b6..e31c41203bdae 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -20122,7 +20122,7 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr,
if (!is_priv)
mutex_lock(&bpf_verifier_lock);
- len = env->prog->len;
+ len = env->insn_aux_data_len = env->prog->len;
env->insn_aux_data =
__vmalloc(array_size(sizeof(struct bpf_insn_aux_data), len),
GFP_KERNEL_ACCOUNT | __GFP_ZERO);
@@ -20368,7 +20368,7 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr,
release_btfs(env);
err_free_env:
if (env->insn_aux_data)
- bpf_clear_insn_aux_data(env, 0, env->prog->len);
+ bpf_clear_insn_aux_data(env, 0, env->insn_aux_data_len);
vfree(env->insn_aux_data);
kvfree(env->fd_array);
bpf_stack_liveness_free(env);
|
| 3/2 | 2026/07/29 14:22 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8275 output: 33 thoughts: 586 Thoughts: **My Assessment of the BPF Verifier and JIT Blinding Patch** Okay, so I'm looking at a patch that fundamentally alters the BPF verifier and JIT blinding logic. The core change seems to be in `bpf_jit_blind_constants`, which now returns an `int` instead of a `struct bpf_prog *`. That immediately piques my interest – this suggests a significant shift in how blinding is handled. We're also seeing modifications in how `insn_aux_data` is managed during blinding and JITing. The introduction of `env->insn_aux_data_len` to track the length and the removal of the duplication functions (`bpf_dup_insn_aux_data`, `bpf_restore_insn_aux_data`) strongly imply a focus on efficiency and potentially, addressing a subtle bug or race condition. The change in `bpf_clear_insn_aux_data`, specifically the removal of skipping `ldimm64` instructions, also warrants closer scrutiny. My first thought is, this is kernel core, and this is touchy. Specifically, the areas it's touching, kernel/bpf/fixups.c and kernel/bpf/core.c. This is definitely functional and reachable, and therefore, high-priority for fuzzing. I need to nail down the specific functions the patch touches. I see it modifies `bpf_jit_blind_constants`, `bpf_prog_jit_compile`, `bpf_clear_insn_aux_data`, `bpf_jit_subprogs`, `bpf_fixup_call_args`, and `bpf_check`. Alright, a nice, focused list. Now I need to check the scope. `bpf_jit_blind_constants` is not static, which means it's exported and more widely accessible. On the other hand, `bpf_prog_jit_compile` *is* static which limits its direct interaction to other parts of core. `bpf_clear_insn_aux_data`, `bpf_jit_subprogs` and `bpf_fixup_call_args` are also not static. Finally, `bpf_check` is the verifier entry point, so that's a key target. Before I go further, I should check the relevant config options. `CONFIG_BPF_SYSCALL` is a given; it's the foundation. And, naturally, `CONFIG_BPF_JIT` is going to be vital because we're talking about JIT blinding here. To verify my understanding, I think I'll use `default_api:grepper` to confirm my assumptions about the function visibility and relevant configurations. That should help me generate effective fuzzing strategies. |
| 4/2 | 2026/07/29 14:23 | tool | grepper |
0mArgs:{
"Expression": "bpf_jit_blind_constants",
"PathPrefix": "kernel/bpf/"
}Results: {
"Output": "kernel/bpf/core.c=1552=void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other)\n--\nkernel/bpf/core.c-1566- */\nkernel/bpf/core.c:1567:int bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bpf_prog **pprog,\nkernel/bpf/core.c-1568-\t\t\t bool clone_needed, bool *cloned)\n--\nkernel/bpf/core.c=2647=static struct bpf_prog *bpf_prog_jit_compile(struct bpf_verifier_env *env, struct bpf_prog *prog,\n--\nkernel/bpf/core.c-2658-\torig_prog = prog;\nkernel/bpf/core.c:2659:\terr = bpf_jit_blind_constants(env, \u0026prog, !jit_needed, \u0026cloned);\nkernel/bpf/core.c-2660-\tif (err)\n--\nkernel/bpf/fixups.c=1275=int bpf_jit_subprogs(struct bpf_verifier_env *env)\n--\nkernel/bpf/fixups.c-1294-\t\t}\nkernel/bpf/fixups.c:1295:\t\terr = bpf_jit_blind_constants(env, \u0026prog, !prog-\u003ejit_required, \u0026cloned);\nkernel/bpf/fixups.c-1296-\t\tif (err)\n"
} |
| 5/2 | 2026/07/29 14:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 9907 output: 26 thoughts: 243 Thoughts: **Analyzing Potential Optimization Targets in the BPF Verifier/JIT** Okay, let's break this down. My initial focus is on optimizing the BPF verifier and JIT. The core functions impacted by this patch are `bpf_jit_blind_constants`, `bpf_jit_subprogs`, `bpf_fixup_call_args`, `bpf_clear_insn_aux_data`, and `bpf_check`. These are the key areas to investigate. First, I need to consider if `bpf_check` is too broad to be a worthwhile target. It's the main entry point, so it might be heavily used, making gains there difficult. Instead, I should be looking at the others. The more promising functions are `bpf_jit_blind_constants`, `bpf_jit_subprogs`, `bpf_fixup_call_args`, and `bpf_clear_insn_aux_data`. These seem like the ideal candidates for this. Finally, I should check the Kconfig settings to make sure `BPF_JIT` is enabled. That should be a priority. |
| 6/2 | 2026/07/29 14:23 | tool | grepper |
0mArgs:{
"Expression": "config BPF_JIT",
"PathPrefix": ""
}Results: {
"Output": "kernel/bpf/Kconfig=27=config BPF_SYSCALL\n--\nkernel/bpf/Kconfig-41-\nkernel/bpf/Kconfig:42:config BPF_JIT\nkernel/bpf/Kconfig-43-\tbool \"Enable BPF Just In Time compiler\"\n--\nkernel/bpf/Kconfig-57-\nkernel/bpf/Kconfig:58:config BPF_JIT_ALWAYS_ON\nkernel/bpf/Kconfig-59-\tbool \"Permanently enable BPF JIT and remove BPF interpreter\"\n--\nkernel/bpf/Kconfig-68-\nkernel/bpf/Kconfig:69:config BPF_JIT_DEFAULT_ON\nkernel/bpf/Kconfig-70-\tdef_bool ARCH_WANT_DEFAULT_BPF_JIT || BPF_JIT_ALWAYS_ON\n"
} |
| 7/2 | 2026/07/29 14:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 10650 output: 36 thoughts: 282 Thoughts: **Analyzing the BPF Patch** Okay, so I'm looking at this BPF patch and the first thing I'm doing is checking the relevant configuration options. I see `BPF_SYSCALL` and `BPF_JIT` are the primary flags mentioned, with conditional compilation based on those configs in `include/linux/filter.h` and `kernel/bpf/core.c` respectively. I also note that `CONFIG_BPF_JIT_ALWAYS_ON` is used in `kernel/bpf/fixups.c`. Now, I need to pinpoint the key functions being modified. I've got a list here: `bpf_jit_blind_constants`, `bpf_jit_subprogs`, `bpf_fixup_call_args`, and `bpf_clear_insn_aux_data`. `bpf_check`, the verifier entry point, is also touched, but it's probably too general since it's only modified for `env->insn_aux_data_len`. I think I'll focus on those fixup and JIT functions for now. The next step is to quickly determine if `bpf_clear_insn_aux_data` is exported or just a global. That'll inform how directly it's being used. I'll need to check the symbol visibility. |
| 8/2 | 2026/07/29 14:23 | tool | grepper |
0mArgs:{
"Expression": "bpf_clear_insn_aux_data",
"PathPrefix": "kernel/bpf/"
}Results: {
"Output": "kernel/bpf/fixups.c=374=static int bpf_adj_linfo_after_remove(struct bpf_verifier_env *env, u32 off,\n--\nkernel/bpf/fixups.c-440- */\nkernel/bpf/fixups.c:441:void bpf_clear_insn_aux_data(struct bpf_verifier_env *env, int start, int len)\nkernel/bpf/fixups.c-442-{\n--\nkernel/bpf/fixups.c=455=static int verifier_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt)\n--\nkernel/bpf/fixups.c-463-\nkernel/bpf/fixups.c:464:\tbpf_clear_insn_aux_data(env, off, cnt);\nkernel/bpf/fixups.c-465-\n--\nkernel/bpf/verifier.c=20060=int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, bpfptr_t uattr,\n--\nkernel/bpf/verifier.c-20370-\tif (env-\u003einsn_aux_data)\nkernel/bpf/verifier.c:20371:\t\tbpf_clear_insn_aux_data(env, 0, env-\u003einsn_aux_data_len);\nkernel/bpf/verifier.c-20372-\tvfree(env-\u003einsn_aux_data);\n"
} |
| 9/2 | 2026/07/29 14:23 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 11663 output: 167 thoughts: 266 Thoughts: **My Assessment of the BPF Fixes** Okay, so this patch is a global change, impacting both `fixups.c` and `verifier.c`. My initial concern is that it touches core BPF functionality, so it needs careful review. I'm noting the specific functions it's modifying: `bpf_jit_blind_constants`, `bpf_jit_subprogs`, `bpf_fixup_call_args`, and `bpf_clear_insn_aux_data`. These are all crucial parts of how we handle constant blinding, subprogram JITting, and overall instruction auxiliary data. From what I can tell, the patch looks functional. The modifications to `insn_aux_data` handling, particularly the introduction of `insn_aux_data_len` and how the program is cloned, seem to be correctly addressing the issues. This means it *definitely* needs a thorough fuzzing campaign to validate its stability. The changes impact the fundamental loading and verification logic of BPF programs, which is why I'm confident in calling for this. I've confirmed that the relevant configs are `BPF_SYSCALL` and `BPF_JIT`. I briefly considered whether `BPF_JIT_ALWAYS_ON` needed special consideration, but since the patch modifies code both within and outside the `#ifndef CONFIG_BPF_JIT_ALWAYS_ON` block, it is not required for testing. I'm now certain that setting `BPF_SYSCALL` and `BPF_JIT` is sufficient for testing. I'm ready to proceed with this, so I will now call `set-results`. |
| 10/2 | 2026/07/29 14:23 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"BPF_SYSCALL",
"BPF_JIT"
],
"FocusSymbols": [
"bpf_jit_blind_constants",
"bpf_jit_subprogs",
"bpf_fixup_call_args",
"bpf_clear_insn_aux_data"
],
"Reasoning": "The patch modifies the BPF verifier and JIT compiler's handling of instruction auxiliary data (`insn_aux_data`) during constant blinding and subprogram JITing. It changes how the program is cloned and how auxiliary data is tracked (introducing `insn_aux_data_len`), which affects core BPF program loading and verification logic.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"BPF_SYSCALL",
"BPF_JIT"
],
"FocusSymbols": [
"bpf_jit_blind_constants",
"bpf_jit_subprogs",
"bpf_fixup_call_args",
"bpf_clear_insn_aux_data"
],
"Reasoning": "The patch modifies the BPF verifier and JIT compiler's handling of instruction auxiliary data (`insn_aux_data`) during constant blinding and subprogram JITing. It changes how the program is cloned and how auxiliary data is tracked (introducing `insn_aux_data_len`), which affects core BPF program loading and verification logic.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|