AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/09/06 08:51 flow patch-triage
0m Args:
null

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL"
  ],
  "FocusSymbols": [
    "mark_arg_precision",
    "check_mem_reg",
    "check_mem_size_reg",
    "check_func_arg",
    "btf_check_func_arg_match",
    "check_helper_call",
    "check_kfunc_args",
    "update_loop_inline_state"
  ],
  "KMSANReasoning": "The patch modifies the BPF verifier's precision tracking logic (in kernel/bpf/verifier.c) to ensure that scalar registers known to be NULL/zero for nullable arguments or specific helper/kfunc parameters are explicitly marked precise during verification. This prevents incorrect state pruning in the verifier.\n\nThe changes only affect internal verifier state propagation and error code handling. There are no allocations of uninitialized memory, no reads of uninitialized stack or heap data, and no data copies to user space. Therefore, there are no uninitialized memory or info-leak risks that would necessitate a dedicated KMSAN fuzzing session.",
  "NeedsKMSAN": false,
  "Reasoning": "The patch modifies the BPF verifier (kernel/bpf/verifier.c) to enforce precision tracking when null registers are passed to helpers, kfuncs, and subprog arguments. This affects core verifier state pruning logic and helper/kfunc argument checking, which is reachable via the bpf() system call.",
  "WorthFuzzing": true
}

1/1 2026/09/06 08:51 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 4ec0e6720cbc6148ee67bc117eb18598e281ae59\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Sun Sep 6 08:51:31 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c\nindex 9c6ad157a61ec..fc57275f15b61 100644\n--- a/kernel/bpf/verifier.c\n+++ b/kernel/bpf/verifier.c\n@@ -4246,6 +4246,15 @@ static int mark_stack_arg_precision(struct bpf_verifier_env *env, int arg_idx)\n \treturn mark_chain_precision_batch(env, env-\u003ecur_state);\n }\n \n+static int mark_arg_precision(struct bpf_verifier_env *env, argno_t argno)\n+{\n+\tint regno = reg_from_argno(argno);\n+\n+\tif (regno \u003e= 0)\n+\t\treturn mark_chain_precision(env, regno);\n+\treturn mark_stack_arg_precision(env, arg_idx_from_argno(argno));\n+}\n+\n static int check_outgoing_stack_args(struct bpf_verifier_env *env, struct bpf_func_state *caller,\n \t\t\t\t     int nargs, const char *callee_name, const struct btf *btf,\n \t\t\t\t     const struct btf_param *args)\n@@ -7144,14 +7153,8 @@ static int check_mem_size_reg(struct bpf_verifier_env *env,\n \tif (err \u0026\u0026 failure)\n \t\t*failure = BPF_MEM_SIZE_FAIL_MEMORY;\n \n-\tif (!err) {\n-\t\tint regno = reg_from_argno(size_argno);\n-\n-\t\tif (regno \u003e= 0)\n-\t\t\terr = mark_chain_precision(env, regno);\n-\t\telse\n-\t\t\terr = mark_stack_arg_precision(env, arg_idx_from_argno(size_argno));\n-\t}\n+\tif (!err)\n+\t\terr = mark_arg_precision(env, size_argno);\n \n \treturn err;\n \n@@ -7168,7 +7171,7 @@ static int check_mem_reg(struct bpf_verifier_env *env, struct bpf_reg_state *reg\n \tint size, err = 0;\n \n \tif (bpf_register_is_null(reg))\n-\t\treturn 0;\n+\t\treturn mark_arg_precision(env, argno);\n \tif (known_memory)\n \t\t*known_memory = true;\n \n@@ -8752,11 +8755,15 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,\n \t\t\treturn err;\n \t}\n \n-\tif (bpf_register_is_null(reg) \u0026\u0026 type_may_be_null(arg_type))\n+\tif (bpf_register_is_null(reg) \u0026\u0026 type_may_be_null(arg_type)) {\n \t\t/* A NULL register has a SCALAR_VALUE type, so skip\n \t\t * type checking.\n \t\t */\n+\t\terr = mark_chain_precision(env, regno);\n+\t\tif (err)\n+\t\t\treturn err;\n \t\tgoto skip_type_check;\n+\t}\n \n \t/* arg_btf_id and arg_size are in a union. */\n \tif (base_type(arg_type) == ARG_PTR_TO_BTF_ID ||\n@@ -9754,8 +9761,12 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog,\n \t\t\tstruct bpf_call_arg_meta meta;\n \t\t\tint err;\n \n-\t\t\tif (bpf_register_is_null(reg) \u0026\u0026 type_may_be_null(arg-\u003earg_type))\n+\t\t\tif (bpf_register_is_null(reg) \u0026\u0026 type_may_be_null(arg-\u003earg_type)) {\n+\t\t\t\terr = mark_arg_precision(env, argno);\n+\t\t\t\tif (err)\n+\t\t\t\t\treturn err;\n \t\t\t\tcontinue;\n+\t\t\t}\n \n \t\t\tmemset(\u0026meta, 0, sizeof(meta)); /* leave func_id as zero */\n \t\t\terr = check_reg_type(env, reg, argno, arg-\u003earg_type, \u0026arg-\u003ebtf_id, \u0026meta,\n@@ -10668,33 +10679,45 @@ static struct bpf_insn_aux_data *cur_aux(const struct bpf_verifier_env *env)\n \treturn \u0026env-\u003einsn_aux_data[env-\u003einsn_idx];\n }\n \n-static bool loop_flag_is_zero(struct bpf_verifier_env *env)\n+/* Returns 1 if R4 is a known zero, 0 if it is not, a negative errno on error. */\n+static int loop_flag_is_zero(struct bpf_verifier_env *env)\n {\n \tstruct bpf_reg_state *reg = reg_state(env, BPF_REG_4);\n-\tbool reg_is_null = bpf_register_is_null(reg);\n+\tint err;\n \n-\tif (reg_is_null)\n-\t\tmark_chain_precision(env, BPF_REG_4);\n+\tif (!bpf_register_is_null(reg))\n+\t\treturn 0;\n \n-\treturn reg_is_null;\n+\terr = mark_chain_precision(env, BPF_REG_4);\n+\tif (err)\n+\t\treturn err;\n+\treturn 1;\n }\n \n-static void update_loop_inline_state(struct bpf_verifier_env *env, u32 subprogno)\n+static int update_loop_inline_state(struct bpf_verifier_env *env, u32 subprogno)\n {\n \tstruct bpf_loop_inline_state *state = \u0026cur_aux(env)-\u003eloop_inline_state;\n+\tint flag_is_zero;\n \n \tif (!state-\u003einitialized) {\n+\t\tflag_is_zero = loop_flag_is_zero(env);\n+\t\tif (flag_is_zero \u003c 0)\n+\t\t\treturn flag_is_zero;\n \t\tstate-\u003einitialized = 1;\n-\t\tstate-\u003efit_for_inline = loop_flag_is_zero(env);\n+\t\tstate-\u003efit_for_inline = flag_is_zero;\n \t\tstate-\u003ecallback_subprogno = subprogno;\n-\t\treturn;\n+\t\treturn 0;\n \t}\n \n \tif (!state-\u003efit_for_inline)\n-\t\treturn;\n+\t\treturn 0;\n \n-\tstate-\u003efit_for_inline = (loop_flag_is_zero(env) \u0026\u0026\n+\tflag_is_zero = loop_flag_is_zero(env);\n+\tif (flag_is_zero \u003c 0)\n+\t\treturn flag_is_zero;\n+\tstate-\u003efit_for_inline = (flag_is_zero \u0026\u0026\n \t\t\t\t state-\u003ecallback_subprogno == subprogno);\n+\treturn 0;\n }\n \n /* Returns whether or not the given map can potentially elide\n@@ -10906,6 +10929,9 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn\n \t\t\tverbose(env, \"get_local_storage() doesn't support non-zero flags\\n\");\n \t\t\treturn -EINVAL;\n \t\t}\n+\t\terr = mark_chain_precision(env, BPF_REG_2);\n+\t\tif (err)\n+\t\t\treturn err;\n \t\tbreak;\n \tcase BPF_FUNC_for_each_map_elem:\n \t\terr = push_callback_call(env, insn, insn_idx, meta.subprogno,\n@@ -10923,7 +10949,9 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn\n \t\terr = check_bpf_snprintf_call(env, regs);\n \t\tbreak;\n \tcase BPF_FUNC_loop:\n-\t\tupdate_loop_inline_state(env, meta.subprogno);\n+\t\terr = update_loop_inline_state(env, meta.subprogno);\n+\t\tif (err)\n+\t\t\treturn err;\n \t\t/* Verifier relies on R1 value to determine if bpf_loop() iteration\n \t\t * is finished, thus mark it precise.\n \t\t */\n@@ -12700,8 +12728,12 @@ static int check_kfunc_args(struct bpf_verifier_env *env, struct bpf_call_arg_me\n \t\tif (reg_is_referenced(env, reg))\n \t\t\tupdate_ref_obj(\u0026meta-\u003eref_obj, reg);\n \n-\t\tif (bpf_register_is_null(reg) \u0026\u0026 type_may_be_null(kf_arg_type))\n+\t\tif (bpf_register_is_null(reg) \u0026\u0026 type_may_be_null(kf_arg_type)) {\n+\t\t\tret = mark_arg_precision(env, argno);\n+\t\t\tif (ret)\n+\t\t\t\treturn ret;\n \t\t\tcontinue;\n+\t\t}\n \n \t\tif (is_kfunc_arg_map(btf, \u0026args[i])) {\n \t\t\tref_id = *reg2btf_ids[CONST_PTR_TO_MAP];\ndiff --git a/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c b/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c\nindex 9a13f5c11ac7e..884080a5bffc5 100644\n--- a/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c\n+++ b/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c\n@@ -305,4 +305,33 @@ __naked void cpu_cgroup_storage_access_6(void)\n \t: __clobber_all);\n }\n \n+/*\n+ * Verification takes two paths: with r2 being scalar zero on path (1)\n+ * and with r2 being some other scalar on path (2).\n+ * Check that the verifier does not use checkpoints created\n+ * on path (1) to prune path (2).\n+ */\n+SEC(\"cgroup/skb\")\n+__failure\n+__flag(BPF_F_TEST_STATE_FREQ)\n+__msg(\"get_local_storage() doesn't support non-zero flags\")\n+__naked void non_zero_flags_on_a_pruned_path(void)\n+{\n+\tasm volatile (\"\t\t\t\t\t\\\n+\tcall %[bpf_get_prandom_u32];\t\t\t\\\n+\t/* r2 is 0 on the path explored first, 1 on the other */\\\n+\tr2 = 1;\t\t\t\t\t\t\\\n+\tif r0 == 0 goto 1f;\t\t\t\t\\\n+\tr2 = 0;\t\t\t\t\t\t\\\n+1:\tr1 = %[cgroup_storage] ll;\t\t\t\\\n+\tcall %[bpf_get_local_storage];\t\t\t\\\n+\tr0 = 0;\t\t\t\t\t\t\\\n+\texit;\t\t\t\t\t\t\\\n+\"\t:\n+\t: __imm(bpf_get_prandom_u32),\n+\t  __imm(bpf_get_local_storage),\n+\t  __imm_addr(cgroup_storage)\n+\t: __clobber_all);\n+}\n+\n char _license[] SEC(\"license\") = \"GPL\";\ndiff --git a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c\nindex 0bdeb7bc4687a..a3d2af8dc8396 100644\n--- a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c\n+++ b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c\n@@ -56,6 +56,30 @@ int trusted_task_arg_nullable(void *ctx)\n \treturn res;\n }\n \n+/*\n+ * Check that the verifier does not use checkpoints created\n+ * on path with r1 == 0 to prune path with r1 != 0.\n+ */\n+SEC(\"?tp_btf/task_newtask\")\n+__failure\n+__flag(BPF_F_TEST_STATE_FREQ)\n+__msg(\"R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_\")\n+__naked int null_btf_id_arg_global_subprog(void)\n+{\n+\tasm volatile (\n+\t\t\"call %[bpf_get_prandom_u32];\"\n+\t\t\"r1 = 42;\"\n+\t\t\"if r0 \u003e 42 goto 1f;\"\n+\t\t\"r1 = 0;\"\n+\t\"1:\"\n+\t\t\"call subprog_trusted_task_nullable;\"\n+\t\t\"r0 = 0;\"\n+\t\t\"exit;\"\n+\t\t:\n+\t\t: __imm(bpf_get_prandom_u32)\n+\t\t: __clobber_all);\n+}\n+\n __weak int subprog_trusted_task_nonnull(struct task_struct *task __arg_trusted)\n {\n \treturn task-\u003epid + task-\u003etgid;\ndiff --git a/tools/testing/selftests/bpf/progs/verifier_precision.c b/tools/testing/selftests/bpf/progs/verifier_precision.c\nindex 6f325876efdd1..f4459561bf393 100644\n--- a/tools/testing/selftests/bpf/progs/verifier_precision.c\n+++ b/tools/testing/selftests/bpf/progs/verifier_precision.c\n@@ -2,8 +2,10 @@\n /* Copyright (C) 2023 SUSE LLC */\n #include \u003clinux/bpf.h\u003e\n #include \u003cbpf/bpf_helpers.h\u003e\n+#include \u003cstdbool.h\u003e\n #include \"../../../include/linux/filter.h\"\n #include \"bpf_misc.h\"\n+#include \"bpf_kfuncs.h\"\n \n struct {\n \t__uint(type, BPF_MAP_TYPE_ARRAY);\n@@ -642,4 +644,102 @@ __naked int bpf_atomic_cmpxchg_32bit_precision(void)\n \t: __clobber_all);\n }\n \n+/*\n+ * Verification takes two paths: with r1 being scalar zero on path (1)\n+ * and with r1 being some other scalar on path (2).\n+ * Check that the verifier does not use checkpoints created\n+ * on path (1) to prune path (2).\n+ */\n+SEC(\"?tc\")\n+__flag(BPF_F_TEST_STATE_FREQ)\n+__failure __msg(\"R1 type=scalar expected=fp\")\n+__naked int null_mem_arg_zero_size(void)\n+{\n+\tasm volatile (\n+\t\t\"call %[bpf_get_prandom_u32];\"\n+\t\t\"r1 = 42;\"\n+\t\t\"if r0 \u003e 42 goto 1f;\"\n+\t\t\"r1 = 0;\"\n+\t\"1:\"\n+\t\t\"r2 = 0;\"\n+\t\t\"r3 = 0;\"\n+\t\t\"r4 = 0;\"\n+\t\t\"r5 = 0;\"\n+\t\t/*\n+\t\t * ARG_PTR_TO_MEM | PTR_MAYBE_NULL parameter can be NULL,\n+\t\t * but can't be some other scalar value.\n+\t\t */\n+\t\t\"call %[bpf_csum_diff];\"\n+\t\t\"r0 = 0;\"\n+\t\t\"exit;\"\n+\t\t:\n+\t\t: __imm(bpf_get_prandom_u32),\n+\t\t  __imm(bpf_csum_diff)\n+\t\t: __clobber_all);\n+}\n+\n+__weak int subprog_mem_arg(int *p)\n+{\n+\tif (p)\n+\t\treturn *p;\n+\treturn 0;\n+}\n+\n+/*\n+ * Verification takes two paths: with r1 being scalar zero on path (1)\n+ * and with r1 being some other scalar on path (2).\n+ * Check that the verifier does not use checkpoints created\n+ * on path (1) to prune path (2).\n+ */\n+SEC(\"?raw_tp\")\n+__flag(BPF_F_TEST_STATE_FREQ)\n+__failure __msg(\"R1 type=scalar expected=fp\")\n+__naked int null_mem_arg_global_subprog(void)\n+{\n+\tasm volatile (\n+\t\t\"call %[bpf_get_prandom_u32];\"\n+\t\t\"r1 = 42;\"\n+\t\t\"if r0 \u003e 42 goto 1f;\"\n+\t\t\"r1 = 0;\"\n+\t\"1:\"\n+\t\t\"call subprog_mem_arg;\"\n+\t\t\"r0 = 0;\"\n+\t\t\"exit;\"\n+\t\t:\n+\t\t: __imm(bpf_get_prandom_u32)\n+\t\t: __clobber_all);\n+}\n+\n+/* Same as above, check that path with r3 == 0 does not prune the path with r3 != 0 */\n+SEC(\"?tc\")\n+__flag(BPF_F_TEST_STATE_FREQ)\n+__failure __msg(\"R3 type=scalar expected=fp\")\n+int null_kfunc_arg_dynptr_slice(struct __sk_buff *skb)\n+{\n+\tstruct bpf_dynptr ptr;\n+\n+\tbpf_dynptr_from_skb(skb, 0, \u0026ptr);\n+\tasm volatile (\n+\t\t\"call %[bpf_get_prandom_u32];\"\n+\t\t\"r3 = 42;\"\n+\t\t\"if r0 \u003e 42 goto 1f;\"\n+\t\t\"r3 = 0;\"\n+\t\"1:\"\n+\t\t\"r1 = %[ptr];\"\n+\t\t\"r2 = 0;\"\n+\t\t\"r4 = 8;\"\n+\t\t\"call %[bpf_dynptr_slice];\"\n+\t\t:\n+\t\t: __imm_ptr(ptr),\n+\t\t  __imm(bpf_get_prandom_u32),\n+\t\t  __imm(bpf_dynptr_slice)\n+\t\t: __clobber_common);\n+\treturn 0;\n+}\n+\n+void __kfunc_btf_root(void)\n+{\n+\tbpf_dynptr_slice(0, 0, 0, 0);\n+}\n+\n char _license[] SEC(\"license\") = \"GPL\";\ndiff --git a/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c b/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c\nindex e174a905c5628..dc0c7034c04f1 100644\n--- a/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c\n+++ b/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c\n@@ -287,9 +287,9 @@ __msg(\"17: (b7) r0 = 0\")\n __msg(\"18: (95) exit\")\n __msg(\"returning from callee:\")\n __msg(\"to caller at 9:\")\n-__msg(\"frame 0: propagating r1,r4\")\n+__msg(\"frame 0: propagating r1,r3,r4\")\n __msg(\"mark_precise: frame0: last_idx 9 first_idx 9 subseq_idx -1\")\n-__msg(\"mark_precise: frame0: regs=r1,r4 stack= before 18: (95) exit\")\n+__msg(\"mark_precise: frame0: regs=r1,r3,r4 stack= before 18: (95) exit\")\n __msg(\"from 18 to 9: safe\")\n __naked int callback_result_precise(void)\n {\n@@ -419,9 +419,9 @@ __msg(\"to caller at 9:\")\n /* r1, r4 are always precise for bpf_loop(),\n  * r6 was marked before backtracking to callback body.\n  */\n-__msg(\"frame 0: propagating r1,r4,r6\")\n+__msg(\"frame 0: propagating r1,r3,r4,r6\")\n __msg(\"mark_precise: frame0: last_idx 9 first_idx 9 subseq_idx -1\")\n-__msg(\"mark_precise: frame0: regs=r1,r4,r6 stack= before 16: (95) exit\")\n+__msg(\"mark_precise: frame0: regs=r1,r3,r4,r6 stack= before 16: (95) exit\")\n __msg(\"mark_precise: frame1: regs= stack= before 15: (b7) r0 = 0\")\n __msg(\"mark_precise: frame1: regs= stack= before 9: (85) call bpf_loop\")\n __msg(\"mark_precise: frame0: parent state regs= stack=:\")\n@@ -575,9 +575,9 @@ __msg(\"to caller at 10:\")\n /* r1, r4 are always precise for bpf_loop(),\n  * fp-8 was marked before backtracking to callback body.\n  */\n-__msg(\"frame 0: propagating r1,r4,fp-8\")\n+__msg(\"frame 0: propagating r1,r3,r4,fp-8\")\n __msg(\"mark_precise: frame0: last_idx 10 first_idx 10 subseq_idx -1\")\n-__msg(\"mark_precise: frame0: regs=r1,r4 stack=-8 before 18: (95) exit\")\n+__msg(\"mark_precise: frame0: regs=r1,r3,r4 stack=-8 before 18: (95) exit\")\n __msg(\"mark_precise: frame1: regs= stack= before 17: (b7) r0 = 0\")\n __msg(\"mark_precise: frame1: regs= stack= before 10: (85) call bpf_loop#181\")\n __msg(\"mark_precise: frame0: parent state regs= stack=:\")\n"
}

2/1 2026/09/06 08:51 agent patch-evaluator
0m Model:
core

Args:
null

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL"
  ],
  "FocusSymbols": [
    "mark_arg_precision",
    "check_mem_reg",
    "check_mem_size_reg",
    "check_func_arg",
    "btf_check_func_arg_match",
    "check_helper_call",
    "check_kfunc_args",
    "update_loop_inline_state"
  ],
  "Reasoning": "The patch modifies the BPF verifier (kernel/bpf/verifier.c) to enforce precision tracking when null registers are passed to helpers, kfuncs, and subprog arguments. This affects core verifier state pruning logic and helper/kfunc argument checking, which is reachable via the bpf() system call.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any '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:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 4ec0e6720cbc6148ee67bc117eb18598e281ae59
Author: syz-cluster <triage@syzkaller.com>
Date:   Sun Sep 6 08:51:31 2026 +0000

    syz-cluster: applied patch under review

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 9c6ad157a61ec..fc57275f15b61 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -4246,6 +4246,15 @@ static int mark_stack_arg_precision(struct bpf_verifier_env *env, int arg_idx)
 	return mark_chain_precision_batch(env, env->cur_state);
 }
 
+static int mark_arg_precision(struct bpf_verifier_env *env, argno_t argno)
+{
+	int regno = reg_from_argno(argno);
+
+	if (regno >= 0)
+		return mark_chain_precision(env, regno);
+	return mark_stack_arg_precision(env, arg_idx_from_argno(argno));
+}
+
 static int check_outgoing_stack_args(struct bpf_verifier_env *env, struct bpf_func_state *caller,
 				     int nargs, const char *callee_name, const struct btf *btf,
 				     const struct btf_param *args)
@@ -7144,14 +7153,8 @@ static int check_mem_size_reg(struct bpf_verifier_env *env,
 	if (err && failure)
 		*failure = BPF_MEM_SIZE_FAIL_MEMORY;
 
-	if (!err) {
-		int regno = reg_from_argno(size_argno);
-
-		if (regno >= 0)
-			err = mark_chain_precision(env, regno);
-		else
-			err = mark_stack_arg_precision(env, arg_idx_from_argno(size_argno));
-	}
+	if (!err)
+		err = mark_arg_precision(env, size_argno);
 
 	return err;
 
@@ -7168,7 +7171,7 @@ static int check_mem_reg(struct bpf_verifier_env *env, struct bpf_reg_state *reg
 	int size, err = 0;
 
 	if (bpf_register_is_null(reg))
-		return 0;
+		return mark_arg_precision(env, argno);
 	if (known_memory)
 		*known_memory = true;
 
@@ -8752,11 +8755,15 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,
 			return err;
 	}
 
-	if (bpf_register_is_null(reg) && type_may_be_null(arg_type))
+	if (bpf_register_is_null(reg) && type_may_be_null(arg_type)) {
 		/* A NULL register has a SCALAR_VALUE type, so skip
 		 * type checking.
 		 */
+		err = mark_chain_precision(env, regno);
+		if (err)
+			return err;
 		goto skip_type_check;
+	}
 
 	/* arg_btf_id and arg_size are in a union. */
 	if (base_type(arg_type) == ARG_PTR_TO_BTF_ID ||
@@ -9754,8 +9761,12 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog,
 			struct bpf_call_arg_meta meta;
 			int err;
 
-			if (bpf_register_is_null(reg) && type_may_be_null(arg->arg_type))
+			if (bpf_register_is_null(reg) && type_may_be_null(arg->arg_type)) {
+				err = mark_arg_precision(env, argno);
+				if (err)
+					return err;
 				continue;
+			}
 
 			memset(&meta, 0, sizeof(meta)); /* leave func_id as zero */
 			err = check_reg_type(env, reg, argno, arg->arg_type, &arg->btf_id, &meta,
@@ -10668,33 +10679,45 @@ static struct bpf_insn_aux_data *cur_aux(const struct bpf_verifier_env *env)
 	return &env->insn_aux_data[env->insn_idx];
 }
 
-static bool loop_flag_is_zero(struct bpf_verifier_env *env)
+/* Returns 1 if R4 is a known zero, 0 if it is not, a negative errno on error. */
+static int loop_flag_is_zero(struct bpf_verifier_env *env)
 {
 	struct bpf_reg_state *reg = reg_state(env, BPF_REG_4);
-	bool reg_is_null = bpf_register_is_null(reg);
+	int err;
 
-	if (reg_is_null)
-		mark_chain_precision(env, BPF_REG_4);
+	if (!bpf_register_is_null(reg))
+		return 0;
 
-	return reg_is_null;
+	err = mark_chain_precision(env, BPF_REG_4);
+	if (err)
+		return err;
+	return 1;
 }
 
-static void update_loop_inline_state(struct bpf_verifier_env *env, u32 subprogno)
+static int update_loop_inline_state(struct bpf_verifier_env *env, u32 subprogno)
 {
 	struct bpf_loop_inline_state *state = &cur_aux(env)->loop_inline_state;
+	int flag_is_zero;
 
 	if (!state->initialized) {
+		flag_is_zero = loop_flag_is_zero(env);
+		if (flag_is_zero < 0)
+			return flag_is_zero;
 		state->initialized = 1;
-		state->fit_for_inline = loop_flag_is_zero(env);
+		state->fit_for_inline = flag_is_zero;
 		state->callback_subprogno = subprogno;
-		return;
+		return 0;
 	}
 
 	if (!state->fit_for_inline)
-		return;
+		return 0;
 
-	state->fit_for_inline = (loop_flag_is_zero(env) &&
+	flag_is_zero = loop_flag_is_zero(env);
+	if (flag_is_zero < 0)
+		return flag_is_zero;
+	state->fit_for_inline = (flag_is_zero &&
 				 state->callback_subprogno == subprogno);
+	return 0;
 }
 
 /* Returns whether or not the given map can potentially elide
@@ -10906,6 +10929,9 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn
 			verbose(env, "get_local_storage() doesn't support non-zero flags\n");
 			return -EINVAL;
 		}
+		err = mark_chain_precision(env, BPF_REG_2);
+		if (err)
+			return err;
 		break;
 	case BPF_FUNC_for_each_map_elem:
 		err = push_callback_call(env, insn, insn_idx, meta.subprogno,
@@ -10923,7 +10949,9 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn
 		err = check_bpf_snprintf_call(env, regs);
 		break;
 	case BPF_FUNC_loop:
-		update_loop_inline_state(env, meta.subprogno);
+		err = update_loop_inline_state(env, meta.subprogno);
+		if (err)
+			return err;
 		/* Verifier relies on R1 value to determine if bpf_loop() iteration
 		 * is finished, thus mark it precise.
 		 */
@@ -12700,8 +12728,12 @@ static int check_kfunc_args(struct bpf_verifier_env *env, struct bpf_call_arg_me
 		if (reg_is_referenced(env, reg))
 			update_ref_obj(&meta->ref_obj, reg);
 
-		if (bpf_register_is_null(reg) && type_may_be_null(kf_arg_type))
+		if (bpf_register_is_null(reg) && type_may_be_null(kf_arg_type)) {
+			ret = mark_arg_precision(env, argno);
+			if (ret)
+				return ret;
 			continue;
+		}
 
 		if (is_kfunc_arg_map(btf, &args[i])) {
 			ref_id = *reg2btf_ids[CONST_PTR_TO_MAP];
diff --git a/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c b/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c
index 9a13f5c11ac7e..884080a5bffc5 100644
--- a/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c
+++ b/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c
@@ -305,4 +305,33 @@ __naked void cpu_cgroup_storage_access_6(void)
 	: __clobber_all);
 }
 
+/*
+ * Verification takes two paths: with r2 being scalar zero on path (1)
+ * and with r2 being some other scalar on path (2).
+ * Check that the verifier does not use checkpoints created
+ * on path (1) to prune path (2).
+ */
+SEC("cgroup/skb")
+__failure
+__flag(BPF_F_TEST_STATE_FREQ)
+__msg("get_local_storage() doesn't support non-zero flags")
+__naked void non_zero_flags_on_a_pruned_path(void)
+{
+	asm volatile ("					\
+	call %[bpf_get_prandom_u32];			\
+	/* r2 is 0 on the path explored first, 1 on the other */\
+	r2 = 1;						\
+	if r0 == 0 goto 1f;				\
+	r2 = 0;						\
+1:	r1 = %[cgroup_storage] ll;			\
+	call %[bpf_get_local_storage];			\
+	r0 = 0;						\
+	exit;						\
+"	:
+	: __imm(bpf_get_prandom_u32),
+	  __imm(bpf_get_local_storage),
+	  __imm_addr(cgroup_storage)
+	: __clobber_all);
+}
+
 char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
index 0bdeb7bc4687a..a3d2af8dc8396 100644
--- a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
+++ b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
@@ -56,6 +56,30 @@ int trusted_task_arg_nullable(void *ctx)
 	return res;
 }
 
+/*
+ * Check that the verifier does not use checkpoints created
+ * on path with r1 == 0 to prune path with r1 != 0.
+ */
+SEC("?tp_btf/task_newtask")
+__failure
+__flag(BPF_F_TEST_STATE_FREQ)
+__msg("R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_")
+__naked int null_btf_id_arg_global_subprog(void)
+{
+	asm volatile (
+		"call %[bpf_get_prandom_u32];"
+		"r1 = 42;"
+		"if r0 > 42 goto 1f;"
+		"r1 = 0;"
+	"1:"
+		"call subprog_trusted_task_nullable;"
+		"r0 = 0;"
+		"exit;"
+		:
+		: __imm(bpf_get_prandom_u32)
+		: __clobber_all);
+}
+
 __weak int subprog_trusted_task_nonnull(struct task_struct *task __arg_trusted)
 {
 	return task->pid + task->tgid;
diff --git a/tools/testing/selftests/bpf/progs/verifier_precision.c b/tools/testing/selftests/bpf/progs/verifier_precision.c
index 6f325876efdd1..f4459561bf393 100644
--- a/tools/testing/selftests/bpf/progs/verifier_precision.c
+++ b/tools/testing/selftests/bpf/progs/verifier_precision.c
@@ -2,8 +2,10 @@
 /* Copyright (C) 2023 SUSE LLC */
 #include <linux/bpf.h>
 #include <bpf/bpf_helpers.h>
+#include <stdbool.h>
 #include "../../../include/linux/filter.h"
 #include "bpf_misc.h"
+#include "bpf_kfuncs.h"
 
 struct {
 	__uint(type, BPF_MAP_TYPE_ARRAY);
@@ -642,4 +644,102 @@ __naked int bpf_atomic_cmpxchg_32bit_precision(void)
 	: __clobber_all);
 }
 
+/*
+ * Verification takes two paths: with r1 being scalar zero on path (1)
+ * and with r1 being some other scalar on path (2).
+ * Check that the verifier does not use checkpoints created
+ * on path (1) to prune path (2).
+ */
+SEC("?tc")
+__flag(BPF_F_TEST_STATE_FREQ)
+__failure __msg("R1 type=scalar expected=fp")
+__naked int null_mem_arg_zero_size(void)
+{
+	asm volatile (
+		"call %[bpf_get_prandom_u32];"
+		"r1 = 42;"
+		"if r0 > 42 goto 1f;"
+		"r1 = 0;"
+	"1:"
+		"r2 = 0;"
+		"r3 = 0;"
+		"r4 = 0;"
+		"r5 = 0;"
+		/*
+		 * ARG_PTR_TO_MEM | PTR_MAYBE_NULL parameter can be NULL,
+		 * but can't be some other scalar value.
+		 */
+		"call %[bpf_csum_diff];"
+		"r0 = 0;"
+		"exit;"
+		:
+		: __imm(bpf_get_prandom_u32),
+		  __imm(bpf_csum_diff)
+		: __clobber_all);
+}
+
+__weak int subprog_mem_arg(int *p)
+{
+	if (p)
+		return *p;
+	return 0;
+}
+
+/*
+ * Verification takes two paths: with r1 being scalar zero on path (1)
+ * and with r1 being some other scalar on path (2).
+ * Check that the verifier does not use checkpoints created
+ * on path (1) to prune path (2).
+ */
+SEC("?raw_tp")
+__flag(BPF_F_TEST_STATE_FREQ)
+__failure __msg("R1 type=scalar expected=fp")
+__naked int null_mem_arg_global_subprog(void)
+{
+	asm volatile (
+		"call %[bpf_get_prandom_u32];"
+		"r1 = 42;"
+		"if r0 > 42 goto 1f;"
+		"r1 = 0;"
+	"1:"
+		"call subprog_mem_arg;"
+		"r0 = 0;"
+		"exit;"
+		:
+		: __imm(bpf_get_prandom_u32)
+		: __clobber_all);
+}
+
+/* Same as above, check that path with r3 == 0 does not prune the path with r3 != 0 */
+SEC("?tc")
+__flag(BPF_F_TEST_STATE_FREQ)
+__failure __msg("R3 type=scalar expected=fp")
+int null_kfunc_arg_dynptr_slice(struct __sk_buff *skb)
+{
+	struct bpf_dynptr ptr;
+
+	bpf_dynptr_from_skb(skb, 0, &ptr);
+	asm volatile (
+		"call %[bpf_get_prandom_u32];"
+		"r3 = 42;"
+		"if r0 > 42 goto 1f;"
+		"r3 = 0;"
+	"1:"
+		"r1 = %[ptr];"
+		"r2 = 0;"
+		"r4 = 8;"
+		"call %[bpf_dynptr_slice];"
+		:
+		: __imm_ptr(ptr),
+		  __imm(bpf_get_prandom_u32),
+		  __imm(bpf_dynptr_slice)
+		: __clobber_common);
+	return 0;
+}
+
+void __kfunc_btf_root(void)
+{
+	bpf_dynptr_slice(0, 0, 0, 0);
+}
+
 char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c b/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c
index e174a905c5628..dc0c7034c04f1 100644
--- a/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c
+++ b/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c
@@ -287,9 +287,9 @@ __msg("17: (b7) r0 = 0")
 __msg("18: (95) exit")
 __msg("returning from callee:")
 __msg("to caller at 9:")
-__msg("frame 0: propagating r1,r4")
+__msg("frame 0: propagating r1,r3,r4")
 __msg("mark_precise: frame0: last_idx 9 first_idx 9 subseq_idx -1")
-__msg("mark_precise: frame0: regs=r1,r4 stack= before 18: (95) exit")
+__msg("mark_precise: frame0: regs=r1,r3,r4 stack= before 18: (95) exit")
 __msg("from 18 to 9: safe")
 __naked int callback_result_precise(void)
 {
@@ -419,9 +419,9 @@ __msg("to caller at 9:")
 /* r1, r4 are always precise for bpf_loop(),
  * r6 was marked before backtracking to callback body.
  */
-__msg("frame 0: propagating r1,r4,r6")
+__msg("frame 0: propagating r1,r3,r4,r6")
 __msg("mark_precise: frame0: last_idx 9 first_idx 9 subseq_idx -1")
-__msg("mark_precise: frame0: regs=r1,r4,r6 stack= before 16: (95) exit")
+__msg("mark_precise: frame0: regs=r1,r3,r4,r6 stack= before 16: (95) exit")
 __msg("mark_precise: frame1: regs= stack= before 15: (b7) r0 = 0")
 __msg("mark_precise: frame1: regs= stack= before 9: (85) call bpf_loop")
 __msg("mark_precise: frame0: parent state regs= stack=:")
@@ -575,9 +575,9 @@ __msg("to caller at 10:")
 /* r1, r4 are always precise for bpf_loop(),
  * fp-8 was marked before backtracking to callback body.
  */
-__msg("frame 0: propagating r1,r4,fp-8")
+__msg("frame 0: propagating r1,r3,r4,fp-8")
 __msg("mark_precise: frame0: last_idx 10 first_idx 10 subseq_idx -1")
-__msg("mark_precise: frame0: regs=r1,r4 stack=-8 before 18: (95) exit")
+__msg("mark_precise: frame0: regs=r1,r3,r4 stack=-8 before 18: (95) exit")
 __msg("mark_precise: frame1: regs= stack= before 17: (b7) r0 = 0")
 __msg("mark_precise: frame1: regs= stack= before 10: (85) call bpf_loop#181")
 __msg("mark_precise: frame0: parent state regs= stack=:")

3/2 2026/09/06 08:51 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 8273
							output: 31
							thoughts: 261
						

Thoughts:
**My Initial Thoughts on the BPF Verifier Patch**

Okay, here's a new patch for syzkaller fuzzing. Let's dig in. The description mentions a review of a patch, so my initial focus is on the diff. Looks like it's touching `kernel/bpf/verifier.c` and some selftests in `tools/testing/selftests/bpf/`. My Spidey sense is already tingling - any change in the BPF verifier is significant for fuzzing efforts.

Specifically in `kernel/bpf/verifier.c`, I see a new function, `mark_arg_precision()`, and modifications to several existing verification functions: `check_mem_size_reg()`, `check_mem_reg()`, `check_func_arg()`, `btf_check_func_arg_match()`, `loop_flag_is_zero()`, `update_loop_inline_state()`, `check_helper_call()`, and `check_kfunc_args()`. All of these are highly relevant, because if they are reachable, any subtle change can have a big impact on the fuzzing coverage.

Reachable? Absolutely. The BPF verifier is in `kernel/bpf/verifier.c`, and it's a critical component accessed via the `bpf(BPF_PROG_LOAD, ...)` syscall. So, we're talking about the core BPF subsystem – a prime target for fuzzing, and it's something syzkaller already heavily exercises. Great, that confirms this is a good area to focus on for this patch.

Before I dive too deep into the code, I need to confirm the configuration requirements. I'll need to check the Kconfig files or the current system configuration to make sure BPF and the verifier are enabled. We can't really evaluate the impact of this if the subsystem isn't even compiled. Let me find that information first.



4/2 2026/09/06 08:51 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "config BPF_SYSCALL",
  "PathPrefix": "init/Kconfig"
}

Results:
{
  "error": "no matches"
}

5/2 2026/09/06 08:51 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 8997
							output: 27
							thoughts: 19
						

Thoughts:
Here's my thought process, as requested:

**Navigating the BPF Codebase**

Okay, so I need to figure out where the `BPF_SYSCALL` macro and the `verifier.c` file are built within this kernel or BPF project. Time to dig in. I'm thinking I'll start with a few initial approaches. First, I'll need to figure out where the macro `BPF_SYSCALL` is defined and used. I'll need to locate where `verifier.c` comes into play in the build process too, since that's a key component for BPF security and execution. That should give me a good handle on its integration with the build. From there I'll start looking at build scripts, Makefiles, or build system configurations, knowing where those are placed relative to the files I've already discovered. Then I can pinpoint the specific commands and dependencies involved in creating the relevant object files and linking them into the kernel or BPF runtime.



6/2 2026/09/06 08:51 tool grepper
0m Args:
{
  "Expression": "verifier\\.o",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/Makefile=7=CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy)\nkernel/bpf/Makefile-8-\nkernel/bpf/Makefile:9:obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o cnum.o log.o token.o liveness.o const_fold.o diagnostics.o\nkernel/bpf/Makefile-10-obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o\n"
}

7/2 2026/09/06 08:51 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 9422
							output: 21
							thoughts: 18
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Investigating `CONFIG_BPF_SYSCALL` in Kconfig**

Okay, so I'm looking at something BPF-related, and the first thing that jumps to mind is the `CONFIG_BPF_SYSCALL` Kconfig option. I need to understand its implications for whatever I'm working on. My immediate thought process is:

*   **Is it even enabled?** That's the first question. I need to make sure this feature is part of the running kernel configuration or if I'll need to enable it for my goals. A quick check of the configuration files or, ideally, a programmatic query if I'm working on an automated build environment is in order.
*   **What exactly does it control?** I know it's related to the BPF syscall, but I need to be precise. Does it just enable the base syscall entry point, or does it control the availability of specific BPF features (e.g., helpers, verifier capabilities) behind the scenes? There might be dependencies on other Kconfig options related to BPF functionality. I need the full picture.
*   **What are the consequences of enabling/disabling it?** This ties into security and performance. Enabling the syscall increases the attack surface, so I need to be aware of the potential risks (privilege escalation, etc.). Disabling it might restrict certain BPF applications or tools, so I have to determine if this is a worthwhile trade-off.
*   **Where is it defined and used?** I want to trace the dependencies of `CONFIG_BPF_SYSCALL`, see where it is used within the kernel source. Knowing how the config option affects the broader code can offer insights into the overall design.
*   **How does it interplay with other related Kconfig options?** There's likely a whole web of `CONFIG_BPF_*` options. I need to consider these to get a holistic view. I would expect an architecture-specific implementation to take into account processor and kernel versions.

Ultimately, I need to form a clear mental model of how `CONFIG_BPF_SYSCALL` shapes the BPF subsystem, which will guide my next steps in the current investigation.



8/2 2026/09/06 08:51 tool grepper
0m Args:
{
  "Expression": "config BPF_SYSCALL"
}

Results:
{
  "Output": "kernel/bpf/Kconfig=25=menu \"BPF subsystem\"\nkernel/bpf/Kconfig-26-\nkernel/bpf/Kconfig:27:config BPF_SYSCALL\nkernel/bpf/Kconfig-28-\tbool \"Enable bpf() system call\"\n"
}

9/2 2026/09/06 08:51 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 10029
							output: 34
							thoughts: 19
						

Thoughts:
Here's my summary, as though I'm thinking through this process:

**Diving into the BPF Configuration**

Okay, time to get this sorted. I need to refresh my memory on the BPF configuration options. I think I need to double-check something in the `kernel/bpf/Kconfig` file. Specifically, I'm pretty sure what I'm looking for is around line 25. Let me navigate there quickly and see what's what. I should be able to get a clear picture of the relevant configuration options pretty fast from there. I expect it's a relatively straightforward setting I need to adjust, but best to confirm my understanding and make sure I'm not missing anything critical.



10/2 2026/09/06 08:51 tool read-file
0m Args:
{
  "File": "kernel/bpf/Kconfig",
  "FirstLine": 25,
  "LineCount": 40
}

Results:
{
  "Contents": "  25:\tmenu \"BPF subsystem\"\n  26:\t\n  27:\tconfig BPF_SYSCALL\n  28:\t\tbool \"Enable bpf() system call\"\n  29:\t\tselect BPF\n  30:\t\tselect IRQ_WORK\n  31:\t\tselect NEED_TASKS_RCU\n  32:\t\tselect TASKS_TRACE_RCU\n  33:\t\tselect BINARY_PRINTF\n  34:\t\tselect NET_SOCK_MSG if NET\n  35:\t\tselect NET_XGRESS if NET\n  36:\t\tselect PAGE_POOL if NET\n  37:\t\tdefault n\n  38:\t\thelp\n  39:\t\t  Enable the bpf() system call that allows to manipulate BPF programs\n  40:\t\t  and maps via file descriptors.\n  41:\t\n  42:\tconfig BPF_JIT\n  43:\t\tbool \"Enable BPF Just In Time compiler\"\n  44:\t\tdepends on BPF\n  45:\t\tdepends on HAVE_CBPF_JIT || HAVE_EBPF_JIT\n  46:\t\tselect EXECMEM\n  47:\t\thelp\n  48:\t\t  BPF programs are normally handled by a BPF interpreter. This option\n  49:\t\t  allows the kernel to generate native code when a program is loaded\n  50:\t\t  into the kernel. This will significantly speed-up processing of BPF\n  51:\t\t  programs.\n  52:\t\n  53:\t\t  Note, an admin should enable this feature changing:\n  54:\t\t  /proc/sys/net/core/bpf_jit_enable\n  55:\t\t  /proc/sys/net/core/bpf_jit_harden   (optional)\n  56:\t\t  /proc/sys/net/core/bpf_jit_kallsyms (optional)\n  57:\t\n  58:\tconfig BPF_JIT_ALWAYS_ON\n  59:\t\tbool \"Permanently enable BPF JIT and remove BPF interpreter\"\n  60:\t\tdepends on BPF_SYSCALL \u0026\u0026 HAVE_EBPF_JIT \u0026\u0026 BPF_JIT\n  61:\t\thelp\n  62:\t\t  Enables BPF JIT and removes BPF interpreter to avoid speculative\n  63:\t\t  execution of BPF instructions by the interpreter.\n  64:\t\n"
}

11/2 2026/09/06 08:51 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 10819
							output: 37
							thoughts: 660
						

Thoughts:
**Focusing on Verifier Functionality for BPF Enhancements**

Okay, so I need to hone in on the verifier changes specifically related to the feature I'm working on. The primary configuration seems to revolve around `BPF_SYSCALL`, and now it's time to dig into the verifier code. Let's see... I need to figure out which functions are the *most* relevant.

I'm starting with a list of modified functions in `kernel/bpf/verifier.c`: `mark_arg_precision`, `check_mem_size_reg`, `check_mem_reg`, `check_func_arg`, `btf_check_func_arg_match`, `loop_flag_is_zero`, `update_loop_inline_state`, `check_helper_call`, and `check_kfunc_args`. I need to figure out their scope – are these static or global? And, more importantly, how do they interrelate?

I need to look closer at `bpf_check`. It’s the main entry point, but according to the guidelines, I need to focus on *specific feature logic* and entry points. `bpf_check` is important, but it might not be the most informative. I need to make sure I don't get sidetracked by generic functions.

Let's see. Section 4 guidelines are clear: target specific logic, avoid ubiquitous hotpaths, and address static inline functions. Okay, so these functions in `verifier.c`... are they static, non-inline? If they're inlined, then they won't have distinct symbols, and that complicates things. If they're non-inlined static functions, they should still be symbols, and therefore, listed. Otherwise, my list of modified verifier functions is what I should include.

Let's explicitly check what symbols exist in `kernel/bpf/verifier.c`, both static and non-static: `mark_arg_precision`, `check_mem_size_reg`, `check_mem_reg`, `check_func_arg`, `btf_check_func_arg_match`, `loop_flag_is_zero`, `update_loop_inline_state`, `check_helper_call`, `check_kfunc_args`, and `bpf_check`. Though `bpf_check` is the main entry point, `check_helper_call` or `check_func_arg` seem more specific to what I'm adding.

Okay, let's determine if `mark_arg_precision`, `check_mem_reg`, `check_func_arg`, `btf_check_func_arg_match`, `check_kfunc_args`, `check_helper_call`, and `update_loop_inline_state` are suitable as FocusSymbols. To be sure, I should check the context around them in `kernel/bpf/verifier.c`, specifically around lines 4246, 7168, 8752, 9754, 10668, 10906, and 12700. This should give me a better understanding of how these functions relate to the core feature logic.



12/2 2026/09/06 08:52 tool read-file
0m Args:
{
  "File": "kernel/bpf/verifier.c",
  "FirstLine": 4240,
  "LineCount": 25
}

Results:
{
  "Contents": "4240:\tstatic int mark_stack_arg_precision(struct bpf_verifier_env *env, int arg_idx)\n4241:\t{\n4242:\t\tstruct bpf_func_state *caller = cur_func(env);\n4243:\t\tint spi = arg_idx - MAX_BPF_FUNC_REG_ARGS;\n4244:\t\n4245:\t\tbt_set_frame_stack_arg_slot(\u0026env-\u003ebt, caller-\u003eframeno, spi);\n4246:\t\treturn mark_chain_precision_batch(env, env-\u003ecur_state);\n4247:\t}\n4248:\t\n4249:\tstatic int mark_arg_precision(struct bpf_verifier_env *env, argno_t argno)\n4250:\t{\n4251:\t\tint regno = reg_from_argno(argno);\n4252:\t\n4253:\t\tif (regno \u003e= 0)\n4254:\t\t\treturn mark_chain_precision(env, regno);\n4255:\t\treturn mark_stack_arg_precision(env, arg_idx_from_argno(argno));\n4256:\t}\n4257:\t\n4258:\tstatic int check_outgoing_stack_args(struct bpf_verifier_env *env, struct bpf_func_state *caller,\n4259:\t\t\t\t\t     int nargs, const char *callee_name, const struct btf *btf,\n4260:\t\t\t\t\t     const struct btf_param *args)\n4261:\t{\n4262:\t\tint i, spi;\n4263:\t\n4264:\t\tfor (i = MAX_BPF_FUNC_REG_ARGS; i \u003c nargs; i++) {\n"
}

13/2 2026/09/06 08:52 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 12678
							output: 177
							thoughts: 308
						

Thoughts:
**My Assessment of the BPF Verifier Patch**

Okay, let's systematically go through this. I need to make sure I've got a comprehensive understanding of the modifications. First, I need to look closely at the function calls: `mark_arg_precision`, `check_mem_reg`, `check_mem_size_reg`, `check_func_arg`, `btf_check_func_arg_match`, `update_loop_inline_state`, `check_helper_call`, and `check_kfunc_args`. Each of these seems critical to the argument handling logic, and my understanding of them is key.

My focus is on the core problem: null registers potentially leading to state pruning issues within the BPF verifier. The patch appears to address the risk of incorrect path pruning where the verifier might assume a null pointer in a checkpoint is always null, leading it to eliminate valid code paths where non-null scalars are subsequently used. This, as I understand, could directly impact the soundness and security of the BPF verifier. The implications could lead to missed verification or incorrect verification.

The fix seems centered around enhanced precision tracking, particularly with nullable pointer arguments and helper/kfunc argument handling. It is making sure that the verifier does not miss paths. This is reflected in the key functions. This is critical for avoiding false negatives. It is an excellent focus.

Given the potential severity and the nature of the issue I think this patch is WorthFuzzing, with the `BPF_SYSCALL` config enabled. These are the key functions I should be paying attention to: `mark_arg_precision`, `check_mem_reg`, `check_mem_size_reg`, `check_func_arg`, `btf_check_func_arg_match`, `check_helper_call`, `check_kfunc_args` and `update_loop_inline_state` - these are the functions that need the highest level of scrutiny.

Okay, with this level of assessment I can now call `set-results`. I have a good handle on this.



14/2 2026/09/06 08:52 tool set-results
0m Args:
{
  "EnableConfigs": [
    "BPF_SYSCALL"
  ],
  "FocusSymbols": [
    "mark_arg_precision",
    "check_mem_reg",
    "check_mem_size_reg",
    "check_func_arg",
    "btf_check_func_arg_match",
    "check_helper_call",
    "check_kfunc_args",
    "update_loop_inline_state"
  ],
  "Reasoning": "The patch modifies the BPF verifier (kernel/bpf/verifier.c) to enforce precision tracking when null registers are passed to helpers, kfuncs, and subprog arguments. This affects core verifier state pruning logic and helper/kfunc argument checking, which is reachable via the bpf() system call.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL"
  ],
  "FocusSymbols": [
    "mark_arg_precision",
    "check_mem_reg",
    "check_mem_size_reg",
    "check_func_arg",
    "btf_check_func_arg_match",
    "check_helper_call",
    "check_kfunc_args",
    "update_loop_inline_state"
  ],
  "Reasoning": "The patch modifies the BPF verifier (kernel/bpf/verifier.c) to enforce precision tracking when null registers are passed to helpers, kfuncs, and subprog arguments. This affects core verifier state pruning logic and helper/kfunc argument checking, which is reachable via the bpf() system call.",
  "WorthFuzzing": true
}

15/1 2026/09/06 08:52 action If
0m Args:
{
  "WorthFuzzing": true
}

Results:
null

16/2 2026/09/06 08:52 agent kmsan-evaluator
0m Model:
core

Args:
null

Results:
{
  "KMSANReasoning": "The patch modifies the BPF verifier's precision tracking logic (in kernel/bpf/verifier.c) to ensure that scalar registers known to be NULL/zero for nullable arguments or specific helper/kfunc parameters are explicitly marked precise during verification. This prevents incorrect state pruning in the verifier.\n\nThe changes only affect internal verifier state propagation and error code handling. There are no allocations of uninitialized memory, no reads of uninitialized stack or heap data, and no data copies to user space. Therefore, there are no uninitialized memory or info-leak risks that would necessitate a dedicated KMSAN fuzzing session.",
  "NeedsKMSAN": false
}

Instruction:
You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.

CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
  a comprehensive suite of debugging tools and sanitizers, including KASAN
  (out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
  (locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
  or page allocations) and kernel-to-user memory info-leaks.

Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.

Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.

Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
   attributes, ioctl output arguments, socket options, or BPF buffers) where fields
   or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
   or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
   could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
   uninitialized bytes of existing buffers.

Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
  dereferences, locking deadlocks, or use-after-free bugs (these are already caught
  by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
  or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.

Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
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:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 4ec0e6720cbc6148ee67bc117eb18598e281ae59
Author: syz-cluster <triage@syzkaller.com>
Date:   Sun Sep 6 08:51:31 2026 +0000

    syz-cluster: applied patch under review

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 9c6ad157a61ec..fc57275f15b61 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -4246,6 +4246,15 @@ static int mark_stack_arg_precision(struct bpf_verifier_env *env, int arg_idx)
 	return mark_chain_precision_batch(env, env->cur_state);
 }
 
+static int mark_arg_precision(struct bpf_verifier_env *env, argno_t argno)
+{
+	int regno = reg_from_argno(argno);
+
+	if (regno >= 0)
+		return mark_chain_precision(env, regno);
+	return mark_stack_arg_precision(env, arg_idx_from_argno(argno));
+}
+
 static int check_outgoing_stack_args(struct bpf_verifier_env *env, struct bpf_func_state *caller,
 				     int nargs, const char *callee_name, const struct btf *btf,
 				     const struct btf_param *args)
@@ -7144,14 +7153,8 @@ static int check_mem_size_reg(struct bpf_verifier_env *env,
 	if (err && failure)
 		*failure = BPF_MEM_SIZE_FAIL_MEMORY;
 
-	if (!err) {
-		int regno = reg_from_argno(size_argno);
-
-		if (regno >= 0)
-			err = mark_chain_precision(env, regno);
-		else
-			err = mark_stack_arg_precision(env, arg_idx_from_argno(size_argno));
-	}
+	if (!err)
+		err = mark_arg_precision(env, size_argno);
 
 	return err;
 
@@ -7168,7 +7171,7 @@ static int check_mem_reg(struct bpf_verifier_env *env, struct bpf_reg_state *reg
 	int size, err = 0;
 
 	if (bpf_register_is_null(reg))
-		return 0;
+		return mark_arg_precision(env, argno);
 	if (known_memory)
 		*known_memory = true;
 
@@ -8752,11 +8755,15 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,
 			return err;
 	}
 
-	if (bpf_register_is_null(reg) && type_may_be_null(arg_type))
+	if (bpf_register_is_null(reg) && type_may_be_null(arg_type)) {
 		/* A NULL register has a SCALAR_VALUE type, so skip
 		 * type checking.
 		 */
+		err = mark_chain_precision(env, regno);
+		if (err)
+			return err;
 		goto skip_type_check;
+	}
 
 	/* arg_btf_id and arg_size are in a union. */
 	if (base_type(arg_type) == ARG_PTR_TO_BTF_ID ||
@@ -9754,8 +9761,12 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, int subprog,
 			struct bpf_call_arg_meta meta;
 			int err;
 
-			if (bpf_register_is_null(reg) && type_may_be_null(arg->arg_type))
+			if (bpf_register_is_null(reg) && type_may_be_null(arg->arg_type)) {
+				err = mark_arg_precision(env, argno);
+				if (err)
+					return err;
 				continue;
+			}
 
 			memset(&meta, 0, sizeof(meta)); /* leave func_id as zero */
 			err = check_reg_type(env, reg, argno, arg->arg_type, &arg->btf_id, &meta,
@@ -10668,33 +10679,45 @@ static struct bpf_insn_aux_data *cur_aux(const struct bpf_verifier_env *env)
 	return &env->insn_aux_data[env->insn_idx];
 }
 
-static bool loop_flag_is_zero(struct bpf_verifier_env *env)
+/* Returns 1 if R4 is a known zero, 0 if it is not, a negative errno on error. */
+static int loop_flag_is_zero(struct bpf_verifier_env *env)
 {
 	struct bpf_reg_state *reg = reg_state(env, BPF_REG_4);
-	bool reg_is_null = bpf_register_is_null(reg);
+	int err;
 
-	if (reg_is_null)
-		mark_chain_precision(env, BPF_REG_4);
+	if (!bpf_register_is_null(reg))
+		return 0;
 
-	return reg_is_null;
+	err = mark_chain_precision(env, BPF_REG_4);
+	if (err)
+		return err;
+	return 1;
 }
 
-static void update_loop_inline_state(struct bpf_verifier_env *env, u32 subprogno)
+static int update_loop_inline_state(struct bpf_verifier_env *env, u32 subprogno)
 {
 	struct bpf_loop_inline_state *state = &cur_aux(env)->loop_inline_state;
+	int flag_is_zero;
 
 	if (!state->initialized) {
+		flag_is_zero = loop_flag_is_zero(env);
+		if (flag_is_zero < 0)
+			return flag_is_zero;
 		state->initialized = 1;
-		state->fit_for_inline = loop_flag_is_zero(env);
+		state->fit_for_inline = flag_is_zero;
 		state->callback_subprogno = subprogno;
-		return;
+		return 0;
 	}
 
 	if (!state->fit_for_inline)
-		return;
+		return 0;
 
-	state->fit_for_inline = (loop_flag_is_zero(env) &&
+	flag_is_zero = loop_flag_is_zero(env);
+	if (flag_is_zero < 0)
+		return flag_is_zero;
+	state->fit_for_inline = (flag_is_zero &&
 				 state->callback_subprogno == subprogno);
+	return 0;
 }
 
 /* Returns whether or not the given map can potentially elide
@@ -10906,6 +10929,9 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn
 			verbose(env, "get_local_storage() doesn't support non-zero flags\n");
 			return -EINVAL;
 		}
+		err = mark_chain_precision(env, BPF_REG_2);
+		if (err)
+			return err;
 		break;
 	case BPF_FUNC_for_each_map_elem:
 		err = push_callback_call(env, insn, insn_idx, meta.subprogno,
@@ -10923,7 +10949,9 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn
 		err = check_bpf_snprintf_call(env, regs);
 		break;
 	case BPF_FUNC_loop:
-		update_loop_inline_state(env, meta.subprogno);
+		err = update_loop_inline_state(env, meta.subprogno);
+		if (err)
+			return err;
 		/* Verifier relies on R1 value to determine if bpf_loop() iteration
 		 * is finished, thus mark it precise.
 		 */
@@ -12700,8 +12728,12 @@ static int check_kfunc_args(struct bpf_verifier_env *env, struct bpf_call_arg_me
 		if (reg_is_referenced(env, reg))
 			update_ref_obj(&meta->ref_obj, reg);
 
-		if (bpf_register_is_null(reg) && type_may_be_null(kf_arg_type))
+		if (bpf_register_is_null(reg) && type_may_be_null(kf_arg_type)) {
+			ret = mark_arg_precision(env, argno);
+			if (ret)
+				return ret;
 			continue;
+		}
 
 		if (is_kfunc_arg_map(btf, &args[i])) {
 			ref_id = *reg2btf_ids[CONST_PTR_TO_MAP];
diff --git a/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c b/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c
index 9a13f5c11ac7e..884080a5bffc5 100644
--- a/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c
+++ b/tools/testing/selftests/bpf/progs/verifier_cgroup_storage.c
@@ -305,4 +305,33 @@ __naked void cpu_cgroup_storage_access_6(void)
 	: __clobber_all);
 }
 
+/*
+ * Verification takes two paths: with r2 being scalar zero on path (1)
+ * and with r2 being some other scalar on path (2).
+ * Check that the verifier does not use checkpoints created
+ * on path (1) to prune path (2).
+ */
+SEC("cgroup/skb")
+__failure
+__flag(BPF_F_TEST_STATE_FREQ)
+__msg("get_local_storage() doesn't support non-zero flags")
+__naked void non_zero_flags_on_a_pruned_path(void)
+{
+	asm volatile ("					\
+	call %[bpf_get_prandom_u32];			\
+	/* r2 is 0 on the path explored first, 1 on the other */\
+	r2 = 1;						\
+	if r0 == 0 goto 1f;				\
+	r2 = 0;						\
+1:	r1 = %[cgroup_storage] ll;			\
+	call %[bpf_get_local_storage];			\
+	r0 = 0;						\
+	exit;						\
+"	:
+	: __imm(bpf_get_prandom_u32),
+	  __imm(bpf_get_local_storage),
+	  __imm_addr(cgroup_storage)
+	: __clobber_all);
+}
+
 char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
index 0bdeb7bc4687a..a3d2af8dc8396 100644
--- a/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
+++ b/tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c
@@ -56,6 +56,30 @@ int trusted_task_arg_nullable(void *ctx)
 	return res;
 }
 
+/*
+ * Check that the verifier does not use checkpoints created
+ * on path with r1 == 0 to prune path with r1 != 0.
+ */
+SEC("?tp_btf/task_newtask")
+__failure
+__flag(BPF_F_TEST_STATE_FREQ)
+__msg("R1 type=scalar expected=ptr_, trusted_ptr_, rcu_ptr_")
+__naked int null_btf_id_arg_global_subprog(void)
+{
+	asm volatile (
+		"call %[bpf_get_prandom_u32];"
+		"r1 = 42;"
+		"if r0 > 42 goto 1f;"
+		"r1 = 0;"
+	"1:"
+		"call subprog_trusted_task_nullable;"
+		"r0 = 0;"
+		"exit;"
+		:
+		: __imm(bpf_get_prandom_u32)
+		: __clobber_all);
+}
+
 __weak int subprog_trusted_task_nonnull(struct task_struct *task __arg_trusted)
 {
 	return task->pid + task->tgid;
diff --git a/tools/testing/selftests/bpf/progs/verifier_precision.c b/tools/testing/selftests/bpf/progs/verifier_precision.c
index 6f325876efdd1..f4459561bf393 100644
--- a/tools/testing/selftests/bpf/progs/verifier_precision.c
+++ b/tools/testing/selftests/bpf/progs/verifier_precision.c
@@ -2,8 +2,10 @@
 /* Copyright (C) 2023 SUSE LLC */
 #include <linux/bpf.h>
 #include <bpf/bpf_helpers.h>
+#include <stdbool.h>
 #include "../../../include/linux/filter.h"
 #include "bpf_misc.h"
+#include "bpf_kfuncs.h"
 
 struct {
 	__uint(type, BPF_MAP_TYPE_ARRAY);
@@ -642,4 +644,102 @@ __naked int bpf_atomic_cmpxchg_32bit_precision(void)
 	: __clobber_all);
 }
 
+/*
+ * Verification takes two paths: with r1 being scalar zero on path (1)
+ * and with r1 being some other scalar on path (2).
+ * Check that the verifier does not use checkpoints created
+ * on path (1) to prune path (2).
+ */
+SEC("?tc")
+__flag(BPF_F_TEST_STATE_FREQ)
+__failure __msg("R1 type=scalar expected=fp")
+__naked int null_mem_arg_zero_size(void)
+{
+	asm volatile (
+		"call %[bpf_get_prandom_u32];"
+		"r1 = 42;"
+		"if r0 > 42 goto 1f;"
+		"r1 = 0;"
+	"1:"
+		"r2 = 0;"
+		"r3 = 0;"
+		"r4 = 0;"
+		"r5 = 0;"
+		/*
+		 * ARG_PTR_TO_MEM | PTR_MAYBE_NULL parameter can be NULL,
+		 * but can't be some other scalar value.
+		 */
+		"call %[bpf_csum_diff];"
+		"r0 = 0;"
+		"exit;"
+		:
+		: __imm(bpf_get_prandom_u32),
+		  __imm(bpf_csum_diff)
+		: __clobber_all);
+}
+
+__weak int subprog_mem_arg(int *p)
+{
+	if (p)
+		return *p;
+	return 0;
+}
+
+/*
+ * Verification takes two paths: with r1 being scalar zero on path (1)
+ * and with r1 being some other scalar on path (2).
+ * Check that the verifier does not use checkpoints created
+ * on path (1) to prune path (2).
+ */
+SEC("?raw_tp")
+__flag(BPF_F_TEST_STATE_FREQ)
+__failure __msg("R1 type=scalar expected=fp")
+__naked int null_mem_arg_global_subprog(void)
+{
+	asm volatile (
+		"call %[bpf_get_prandom_u32];"
+		"r1 = 42;"
+		"if r0 > 42 goto 1f;"
+		"r1 = 0;"
+	"1:"
+		"call subprog_mem_arg;"
+		"r0 = 0;"
+		"exit;"
+		:
+		: __imm(bpf_get_prandom_u32)
+		: __clobber_all);
+}
+
+/* Same as above, check that path with r3 == 0 does not prune the path with r3 != 0 */
+SEC("?tc")
+__flag(BPF_F_TEST_STATE_FREQ)
+__failure __msg("R3 type=scalar expected=fp")
+int null_kfunc_arg_dynptr_slice(struct __sk_buff *skb)
+{
+	struct bpf_dynptr ptr;
+
+	bpf_dynptr_from_skb(skb, 0, &ptr);
+	asm volatile (
+		"call %[bpf_get_prandom_u32];"
+		"r3 = 42;"
+		"if r0 > 42 goto 1f;"
+		"r3 = 0;"
+	"1:"
+		"r1 = %[ptr];"
+		"r2 = 0;"
+		"r4 = 8;"
+		"call %[bpf_dynptr_slice];"
+		:
+		: __imm_ptr(ptr),
+		  __imm(bpf_get_prandom_u32),
+		  __imm(bpf_dynptr_slice)
+		: __clobber_common);
+	return 0;
+}
+
+void __kfunc_btf_root(void)
+{
+	bpf_dynptr_slice(0, 0, 0, 0);
+}
+
 char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c b/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c
index e174a905c5628..dc0c7034c04f1 100644
--- a/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c
+++ b/tools/testing/selftests/bpf/progs/verifier_subprog_precision.c
@@ -287,9 +287,9 @@ __msg("17: (b7) r0 = 0")
 __msg("18: (95) exit")
 __msg("returning from callee:")
 __msg("to caller at 9:")
-__msg("frame 0: propagating r1,r4")
+__msg("frame 0: propagating r1,r3,r4")
 __msg("mark_precise: frame0: last_idx 9 first_idx 9 subseq_idx -1")
-__msg("mark_precise: frame0: regs=r1,r4 stack= before 18: (95) exit")
+__msg("mark_precise: frame0: regs=r1,r3,r4 stack= before 18: (95) exit")
 __msg("from 18 to 9: safe")
 __naked int callback_result_precise(void)
 {
@@ -419,9 +419,9 @@ __msg("to caller at 9:")
 /* r1, r4 are always precise for bpf_loop(),
  * r6 was marked before backtracking to callback body.
  */
-__msg("frame 0: propagating r1,r4,r6")
+__msg("frame 0: propagating r1,r3,r4,r6")
 __msg("mark_precise: frame0: last_idx 9 first_idx 9 subseq_idx -1")
-__msg("mark_precise: frame0: regs=r1,r4,r6 stack= before 16: (95) exit")
+__msg("mark_precise: frame0: regs=r1,r3,r4,r6 stack= before 16: (95) exit")
 __msg("mark_precise: frame1: regs= stack= before 15: (b7) r0 = 0")
 __msg("mark_precise: frame1: regs= stack= before 9: (85) call bpf_loop")
 __msg("mark_precise: frame0: parent state regs= stack=:")
@@ -575,9 +575,9 @@ __msg("to caller at 10:")
 /* r1, r4 are always precise for bpf_loop(),
  * fp-8 was marked before backtracking to callback body.
  */
-__msg("frame 0: propagating r1,r4,fp-8")
+__msg("frame 0: propagating r1,r3,r4,fp-8")
 __msg("mark_precise: frame0: last_idx 10 first_idx 10 subseq_idx -1")
-__msg("mark_precise: frame0: regs=r1,r4 stack=-8 before 18: (95) exit")
+__msg("mark_precise: frame0: regs=r1,r3,r4 stack=-8 before 18: (95) exit")
 __msg("mark_precise: frame1: regs= stack= before 17: (b7) r0 = 0")
 __msg("mark_precise: frame1: regs= stack= before 10: (85) call bpf_loop#181")
 __msg("mark_precise: frame0: parent state regs= stack=:")

17/3 2026/09/06 08:52 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 7485
							output: 154
							thoughts: 1534
						

Thoughts:
**KMSAN Needs Assessment for BPF Verifier Patch**

Okay, let's break this down. The patch focuses on the BPF verifier, specifically improving its precision in tracking register values, particularly when handling NULL arguments or zero flags. My initial assessment is that this doesn't warrant a dedicated KMSAN fuzzing session. Let me explain my reasoning, step by step.

The patch modifies `kernel/bpf/verifier.c` and adds test cases, so I looked into the changes within `kernel/bpf/verifier.c`. It's essentially refining how the verifier handles the assumption that a register is zero when a nullable pointer or zero flag is passed as NULL. The primary change is the introduction of `mark_arg_precision` and its integration within various argument checking functions. The goal is to prevent state pruning from incorrectly matching states and bypassing the verifier.

The core of the issue is about soundness – ensuring the verifier's logic is correct in identifying valid and invalid BPF programs. This involves precision in the verifier's internal state tracking. There are no kernel structure changes or new allocations, and the changes are strictly focused on improving the verifier's state pruning logic.

So, does this introduce uninitialized memory risks? No. I checked thoroughly:

1.  **No kernel-to-user copies or structure changes.** Therefore, no potential for uninitialized data leaking to userspace.
2.  **No conditional logic or branching depending on uninitialized variables.** All the variables (`err`, `ret`, `flag_is_zero`, `regno`) in the code snippets are explicitly initialized before use, as is standard practice.
3.  **No new allocations or complex data structures** that could leave uninitialized fields.
4.  **No changes to bounds checks or logic that might access uninitialized bytes.**

KMSAN detects reads of uninitialized memory and information leaks from kernel to user space. This patch does not touch on those areas. KMSAN is great for memory safety issues, and detecting user-space information leaks. But the bug types that this patch addresses are more of a logic bug in the verifier itself: possibly rejecting valid programs, accepting invalid ones, or C errors like incorrect error propagation. None of these involve uninitialized memory usage. Therefore, standard bug detectors and KASAN are sufficient.

I've even double-checked the local variables and control flow in the modified functions: `mark_arg_precision`, `loop_flag_is_zero`, and `update_loop_inline_state`. Everything is initialized correctly, and the code handles states cleanly. No information leaks, no uninitialized reads, no padding leaks.

So, in conclusion, `NeedsKMSAN` is definitely `false`. Time to prepare the tool call to `set-results`.



18/3 2026/09/06 08:52 tool set-results
0m Args:
{
  "KMSANReasoning": "The patch modifies the BPF verifier's precision tracking logic (in kernel/bpf/verifier.c) to ensure that scalar registers known to be NULL/zero for nullable arguments or specific helper/kfunc parameters are explicitly marked precise during verification. This prevents incorrect state pruning in the verifier.\n\nThe changes only affect internal verifier state propagation and error code handling. There are no allocations of uninitialized memory, no reads of uninitialized stack or heap data, and no data copies to user space. Therefore, there are no uninitialized memory or info-leak risks that would necessitate a dedicated KMSAN fuzzing session.",
  "NeedsKMSAN": false
}

Results:
{
  "KMSANReasoning": "The patch modifies the BPF verifier's precision tracking logic (in kernel/bpf/verifier.c) to ensure that scalar registers known to be NULL/zero for nullable arguments or specific helper/kfunc parameters are explicitly marked precise during verification. This prevents incorrect state pruning in the verifier.\n\nThe changes only affect internal verifier state propagation and error code handling. There are no allocations of uninitialized memory, no reads of uninitialized stack or heap data, and no data copies to user space. Therefore, there are no uninitialized memory or info-leak risks that would necessitate a dedicated KMSAN fuzzing session.",
  "NeedsKMSAN": false
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)