AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/08/31 12:40 flow patch-triage
8m Args:
null

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL",
    "DEBUG_INFO_BTF",
    "BPF_EVENTS"
  ],
  "FocusSymbols": [
    "btf_type_snprintf_show",
    "btf_type_seq_show_flags",
    "bpf_snprintf_btf"
  ],
  "KMSANReasoning": "The patch addresses NULL pointer dereferences in BPF BTF type formatting (btf_modifier_show and btf_var_show) and BPF hash map BTF validation (htab_map_check_btf and rhtab_map_check_btf).\n\nSpecifically:\n1. In btf_modifier_show(), it adds a check for NULL btf_type_ops(t) when modifiers resolve to void, falling back to btf_df_show() to avoid NULL pointer dereference.\n2. In btf_var_show(), it checks if btf-\u003eresolved_ids is NULL before resolving, falling back to btf_type_skip_modifiers() to prevent NULL pointer dereference.\n3. In htab_map_check_btf() and rhtab_map_check_btf(), it rejects key-less BTF definitions with -EINVAL to avoid crashes during map dumping.\n\nNone of these changes touch uninitialized memory, modify memory initialization logic, or expose kernel-to-user info-leaks. The bugs addressed are NULL pointer dereferences, which are standard crashes detected without KMSAN. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
  "NeedsKMSAN": false,
  "Reasoning": "The patch fixes potential NULL pointer dereferences in the BTF show routines (btf_modifier_show and btf_var_show) when dealing with void modifiers and base BTFs, and adds checks in htab_map_check_btf/rhtab_map_check_btf to reject hash maps created with key-less BTFs. These are functional changes to core BPF/BTF validation and formatting paths reachable from userspace via the bpf() syscall and BPF helper programs.",
  "WorthFuzzing": true
}

1/1 2026/08/31 12:40 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 454d65808e0aba0f5f40071a491135a660c5b9bf\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Mon Aug 31 12:40:31 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c\nindex 91b8ce77f699a..3cf35ee49c102 100644\n--- a/kernel/bpf/btf.c\n+++ b/kernel/bpf/btf.c\n@@ -2911,14 +2911,30 @@ static void btf_modifier_show(const struct btf *btf,\n \telse\n \t\tt = btf_type_skip_modifiers(btf, type_id, NULL);\n \n-\tbtf_type_ops(t)-\u003eshow(btf, t, type_id, data, bits_offset, show);\n+\t/*\n+\t * A modifier can resolve to the void type (e.g. \"const void\"), which\n+\t * has no show op (kind_ops[BTF_KIND_UNKN] is NULL). Print a placeholder\n+\t * instead of dereferencing NULL.\n+\t */\n+\tif (!btf_type_ops(t))\n+\t\tbtf_df_show(btf, t, type_id, data, bits_offset, show);\n+\telse\n+\t\tbtf_type_ops(t)-\u003eshow(btf, t, type_id, data, bits_offset, show);\n }\n \n static void btf_var_show(const struct btf *btf, const struct btf_type *t,\n \t\t\t u32 type_id, void *data, u8 bits_offset,\n \t\t\t struct btf_show *show)\n {\n-\tt = btf_type_id_resolve(btf, \u0026type_id);\n+\t/*\n+\t * btf_type_id_resolve() dereferences btf-\u003eresolved_ids, which is NULL\n+\t * for a base BTF (e.g. the vmlinux BTF that bpf_snprintf_btf() uses).\n+\t * Resolve the var's type directly in that case.\n+\t */\n+\tif (btf-\u003eresolved_ids)\n+\t\tt = btf_type_id_resolve(btf, \u0026type_id);\n+\telse\n+\t\tt = btf_type_skip_modifiers(btf, t-\u003etype, \u0026type_id);\n \n \tbtf_type_ops(t)-\u003eshow(btf, t, type_id, data, bits_offset, show);\n }\ndiff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c\nindex d40cb5dd446ca..43123424183c7 100644\n--- a/kernel/bpf/hashtab.c\n+++ b/kernel/bpf/hashtab.c\n@@ -530,6 +530,10 @@ static int htab_map_check_btf(struct bpf_map *map, const struct btf *btf,\n {\n \tstruct bpf_htab *htab = container_of(map, struct bpf_htab, map);\n \n+\t/* Hash maps have no use for a key-less BTF. */\n+\tif (btf_type_is_void(key_type))\n+\t\treturn -EINVAL;\n+\n \tif (htab_is_prealloc(htab))\n \t\treturn 0;\n \t/*\n@@ -3110,6 +3114,10 @@ static int rhtab_map_check_btf(struct bpf_map *map, const struct btf *btf,\n {\n \tstruct bpf_rhtab *rhtab = container_of(map, struct bpf_rhtab, map);\n \n+\t/* Hash maps have no use for a key-less BTF. */\n+\tif (btf_type_is_void(key_type))\n+\t\treturn -EINVAL;\n+\n \treturn bpf_ma_set_dtor(map, \u0026rhtab-\u003ema, rhtab_mem_dtor);\n }\n \ndiff --git a/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c b/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c\nnew file mode 100644\nindex 0000000000000..a7d037f57a7ef\n--- /dev/null\n+++ b/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c\n@@ -0,0 +1,82 @@\n+// SPDX-License-Identifier: GPL-2.0\n+#include \u003ctest_progs.h\u003e\n+#include \u003cbpf/btf.h\u003e\n+\n+/*\n+ * A hash map with a key-less BTF (btf_key_type_id == 0) used to NULL-deref in\n+ * btf_type_show() when dumped via bpffs.\n+ * A fixed kernel rejects such a map at creation; on an unfixed kernel the\n+ * pin-and-read below deliberately walks that bpffs dump path, so it doubles\n+ * as a reproducer: it oopses an unfixed kernel (and panics it under\n+ * panic_on_oops).\n+ */\n+static void check_keyless(int map_type, __u32 map_flags, int btf_fd, int val_id)\n+{\n+\tLIBBPF_OPTS(bpf_map_create_opts, opts);\n+\tconst char *path = \"/sys/fs/bpf/keyless_map\";\n+\t__u32 key = 1, val = 0x41424344;\n+\tchar buf[256];\n+\tint map_fd;\n+\tFILE *f;\n+\n+\topts.map_flags = map_flags;\n+\topts.btf_fd = btf_fd;\n+\topts.btf_value_type_id = val_id;\n+\n+\t/*\n+\t * Positive control: the same map with a real key type must be accepted,\n+\t * so the -EINVAL below is about the key-less BTF and not some unrelated\n+\t * rejection (e.g. an unknown map type).\n+\t */\n+\topts.btf_key_type_id = val_id;\n+\tmap_fd = bpf_map_create(map_type, \"keyed_map\", 4, 4, 8, \u0026opts);\n+\tif (!ASSERT_GE(map_fd, 0, \"keyed create is accepted\"))\n+\t\treturn;\n+\tclose(map_fd);\n+\n+\t/* A key-less BTF must be rejected. */\n+\topts.btf_key_type_id = 0;\n+\tmap_fd = bpf_map_create(map_type, \"keyless_map\", 4, 4, 8, \u0026opts);\n+\n+\tif (map_fd \u003e= 0) {\n+\t\t/* Unfixed kernel: reproduce the oops via the bpffs dump path. */\n+\t\t(void)bpf_map_update_elem(map_fd, \u0026key, \u0026val, 0);\n+\t\tif (bpf_obj_pin(map_fd, path) == 0) {\n+\t\t\tf = fopen(path, \"r\");\n+\t\t\tif (f) {\n+\t\t\t\twhile (fgets(buf, sizeof(buf), f))\n+\t\t\t\t\t;\n+\t\t\t\tfclose(f);\n+\t\t\t}\n+\t\t\tunlink(path);\n+\t\t}\n+\t\tclose(map_fd);\n+\t}\n+\n+\tASSERT_EQ(map_fd, -EINVAL, \"key-less create is rejected\");\n+}\n+\n+void test_btf_map_keyless(void)\n+{\n+\tint btf_fd, val_id;\n+\tstruct btf *btf;\n+\n+\tbtf = btf__new_empty();\n+\tif (!ASSERT_OK_PTR(btf, \"btf__new_empty\"))\n+\t\treturn;\n+\n+\tval_id = btf__add_int(btf, \"int\", 4, BTF_INT_SIGNED);\n+\tif (!ASSERT_GT(val_id, 0, \"btf__add_int\"))\n+\t\tgoto out;\n+\n+\tif (!ASSERT_OK(btf__load_into_kernel(btf), \"btf__load_into_kernel\"))\n+\t\tgoto out;\n+\tbtf_fd = btf__fd(btf);\n+\n+\tif (test__start_subtest(\"hash\"))\n+\t\tcheck_keyless(BPF_MAP_TYPE_HASH, 0, btf_fd, val_id);\n+\tif (test__start_subtest(\"rhash\"))\n+\t\tcheck_keyless(BPF_MAP_TYPE_RHASH, BPF_F_NO_PREALLOC, btf_fd, val_id);\n+out:\n+\tbtf__free(btf);\n+}\ndiff --git a/tools/testing/selftests/bpf/prog_tests/btf_show_void.c b/tools/testing/selftests/bpf/prog_tests/btf_show_void.c\nnew file mode 100644\nindex 0000000000000..d73232dc2a045\n--- /dev/null\n+++ b/tools/testing/selftests/bpf/prog_tests/btf_show_void.c\n@@ -0,0 +1,81 @@\n+// SPDX-License-Identifier: GPL-2.0\n+#include \u003ctest_progs.h\u003e\n+#include \u003cbpf/btf.h\u003e\n+#include \"btf_show_void.skel.h\"\n+\n+/*\n+ * bpf_snprintf_btf() renders a type_id taken straight from the vmlinux BTF.\n+ * Two such type_ids used to NULL-deref in the BTF show path:\n+ *   - a \"const void\" (a modifier resolving to void) in btf_modifier_show()\n+ *   - a BTF_KIND_VAR in btf_var_show() (base BTF has no resolved_ids)\n+ * A fixed kernel renders both without crashing.\n+ */\n+static long run(struct btf_show_void *skel, __u32 type_id)\n+{\n+\tLIBBPF_OPTS(bpf_test_run_opts, topts);\n+\tchar ctx[8] = {};\n+\n+\tskel-\u003ebss-\u003etype_id = type_id;\n+\ttopts.ctx_in = ctx;\n+\ttopts.ctx_size_in = sizeof(ctx);\n+\tif (!ASSERT_OK(bpf_prog_test_run_opts(bpf_program__fd(skel-\u003eprogs.dump_type),\n+\t\t\t\t\t      \u0026topts), \"test_run\"))\n+\t\treturn -1;\n+\treturn skel-\u003ebss-\u003eret;\n+}\n+\n+void test_btf_show_void(void)\n+{\n+\tconst struct btf_type *t;\n+\tstruct btf_show_void *skel;\n+\tint i, n, cv = 0, var = 0;\n+\tstruct btf *btf;\n+\n+\tbtf = btf__parse(\"/sys/kernel/btf/vmlinux\", NULL);\n+\tif (!btf) {\n+\t\ttest__skip();\n+\t\treturn;\n+\t}\n+\n+\tskel = btf_show_void__open_and_load();\n+\tif (!ASSERT_OK_PTR(skel, \"skel_open_and_load\"))\n+\t\tgoto out_btf;\n+\n+\tn = btf__type_cnt(btf);\n+\tfor (i = 1; i \u003c n \u0026\u0026 !(cv \u0026\u0026 var); i++) {\n+\t\tt = btf__type_by_id(btf, i);\n+\t\tif (!cv \u0026\u0026 btf_kind(t) == BTF_KIND_CONST \u0026\u0026 t-\u003etype == 0)\n+\t\t\tcv = i;\n+\t\t/* Pick a VAR small enough to render from the program's buffer. */\n+\t\tif (!var \u0026\u0026 btf_kind(t) == BTF_KIND_VAR) {\n+\t\t\tlong sz = btf__resolve_size(btf, t-\u003etype);\n+\n+\t\t\tif (sz \u003e 0 \u0026\u0026 sz \u003c= (long)sizeof(skel-\u003ebss-\u003eobj))\n+\t\t\t\tvar = i;\n+\t\t}\n+\t}\n+\n+\t/* \"const void\" renders the \"\u003cunsupported kind:0\u003e\" placeholder. */\n+\tif (test__start_subtest(\"const_void\")) {\n+\t\tif (cv) {\n+\t\t\tASSERT_EQ(run(skel, cv),\n+\t\t\t\t  sizeof(\"\u003cunsupported kind:0\u003e\") - 1, \"ret\");\n+\t\t\tASSERT_STREQ(skel-\u003ebss-\u003eout, \"\u003cunsupported kind:0\u003e\",\n+\t\t\t\t     \"placeholder\");\n+\t\t} else {\n+\t\t\ttest__skip();\n+\t\t}\n+\t}\n+\n+\t/* A BTF_KIND_VAR must resolve and render without error. */\n+\tif (test__start_subtest(\"var\")) {\n+\t\tif (var)\n+\t\t\tASSERT_GT(run(skel, var), 0, \"ret\");\n+\t\telse\n+\t\t\ttest__skip();\n+\t}\n+\n+\tbtf_show_void__destroy(skel);\n+out_btf:\n+\tbtf__free(btf);\n+}\ndiff --git a/tools/testing/selftests/bpf/progs/btf_show_void.c b/tools/testing/selftests/bpf/progs/btf_show_void.c\nnew file mode 100644\nindex 0000000000000..44af80fbbb808\n--- /dev/null\n+++ b/tools/testing/selftests/bpf/progs/btf_show_void.c\n@@ -0,0 +1,24 @@\n+// SPDX-License-Identifier: GPL-2.0\n+#include \"btf_ptr.h\"\n+#include \u003cbpf/bpf_helpers.h\u003e\n+\n+__u32 type_id;\n+/* A buffer we own to render the selected type from, kept in bounds. */\n+char obj[256];\n+char out[64];\n+long ret;\n+\n+SEC(\"raw_tp/sys_enter\")\n+int dump_type(void *ctx)\n+{\n+\tstruct btf_ptr ptr = {\n+\t\t.ptr = obj,\n+\t\t.type_id = type_id,\n+\t\t.flags = 0,\n+\t};\n+\n+\tret = bpf_snprintf_btf(out, sizeof(out), \u0026ptr, sizeof(ptr), 0);\n+\treturn 0;\n+}\n+\n+char _license[] SEC(\"license\") = \"GPL\";\n"
}

2/1 2026/08/31 12:40 agent patch-evaluator
5m Model:
core

Args:
null

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL",
    "DEBUG_INFO_BTF",
    "BPF_EVENTS"
  ],
  "FocusSymbols": [
    "btf_type_snprintf_show",
    "btf_type_seq_show_flags",
    "bpf_snprintf_btf"
  ],
  "Reasoning": "The patch fixes potential NULL pointer dereferences in the BTF show routines (btf_modifier_show and btf_var_show) when dealing with void modifiers and base BTFs, and adds checks in htab_map_check_btf/rhtab_map_check_btf to reject hash maps created with key-less BTFs. These are functional changes to core BPF/BTF validation and formatting paths reachable from userspace via the bpf() syscall and BPF helper programs.",
  "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 454d65808e0aba0f5f40071a491135a660c5b9bf
Author: syz-cluster <triage@syzkaller.com>
Date:   Mon Aug 31 12:40:31 2026 +0000

    syz-cluster: applied patch under review

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 91b8ce77f699a..3cf35ee49c102 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -2911,14 +2911,30 @@ static void btf_modifier_show(const struct btf *btf,
 	else
 		t = btf_type_skip_modifiers(btf, type_id, NULL);
 
-	btf_type_ops(t)->show(btf, t, type_id, data, bits_offset, show);
+	/*
+	 * A modifier can resolve to the void type (e.g. "const void"), which
+	 * has no show op (kind_ops[BTF_KIND_UNKN] is NULL). Print a placeholder
+	 * instead of dereferencing NULL.
+	 */
+	if (!btf_type_ops(t))
+		btf_df_show(btf, t, type_id, data, bits_offset, show);
+	else
+		btf_type_ops(t)->show(btf, t, type_id, data, bits_offset, show);
 }
 
 static void btf_var_show(const struct btf *btf, const struct btf_type *t,
 			 u32 type_id, void *data, u8 bits_offset,
 			 struct btf_show *show)
 {
-	t = btf_type_id_resolve(btf, &type_id);
+	/*
+	 * btf_type_id_resolve() dereferences btf->resolved_ids, which is NULL
+	 * for a base BTF (e.g. the vmlinux BTF that bpf_snprintf_btf() uses).
+	 * Resolve the var's type directly in that case.
+	 */
+	if (btf->resolved_ids)
+		t = btf_type_id_resolve(btf, &type_id);
+	else
+		t = btf_type_skip_modifiers(btf, t->type, &type_id);
 
 	btf_type_ops(t)->show(btf, t, type_id, data, bits_offset, show);
 }
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index d40cb5dd446ca..43123424183c7 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -530,6 +530,10 @@ static int htab_map_check_btf(struct bpf_map *map, const struct btf *btf,
 {
 	struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
 
+	/* Hash maps have no use for a key-less BTF. */
+	if (btf_type_is_void(key_type))
+		return -EINVAL;
+
 	if (htab_is_prealloc(htab))
 		return 0;
 	/*
@@ -3110,6 +3114,10 @@ static int rhtab_map_check_btf(struct bpf_map *map, const struct btf *btf,
 {
 	struct bpf_rhtab *rhtab = container_of(map, struct bpf_rhtab, map);
 
+	/* Hash maps have no use for a key-less BTF. */
+	if (btf_type_is_void(key_type))
+		return -EINVAL;
+
 	return bpf_ma_set_dtor(map, &rhtab->ma, rhtab_mem_dtor);
 }
 
diff --git a/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c b/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c
new file mode 100644
index 0000000000000..a7d037f57a7ef
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <test_progs.h>
+#include <bpf/btf.h>
+
+/*
+ * A hash map with a key-less BTF (btf_key_type_id == 0) used to NULL-deref in
+ * btf_type_show() when dumped via bpffs.
+ * A fixed kernel rejects such a map at creation; on an unfixed kernel the
+ * pin-and-read below deliberately walks that bpffs dump path, so it doubles
+ * as a reproducer: it oopses an unfixed kernel (and panics it under
+ * panic_on_oops).
+ */
+static void check_keyless(int map_type, __u32 map_flags, int btf_fd, int val_id)
+{
+	LIBBPF_OPTS(bpf_map_create_opts, opts);
+	const char *path = "/sys/fs/bpf/keyless_map";
+	__u32 key = 1, val = 0x41424344;
+	char buf[256];
+	int map_fd;
+	FILE *f;
+
+	opts.map_flags = map_flags;
+	opts.btf_fd = btf_fd;
+	opts.btf_value_type_id = val_id;
+
+	/*
+	 * Positive control: the same map with a real key type must be accepted,
+	 * so the -EINVAL below is about the key-less BTF and not some unrelated
+	 * rejection (e.g. an unknown map type).
+	 */
+	opts.btf_key_type_id = val_id;
+	map_fd = bpf_map_create(map_type, "keyed_map", 4, 4, 8, &opts);
+	if (!ASSERT_GE(map_fd, 0, "keyed create is accepted"))
+		return;
+	close(map_fd);
+
+	/* A key-less BTF must be rejected. */
+	opts.btf_key_type_id = 0;
+	map_fd = bpf_map_create(map_type, "keyless_map", 4, 4, 8, &opts);
+
+	if (map_fd >= 0) {
+		/* Unfixed kernel: reproduce the oops via the bpffs dump path. */
+		(void)bpf_map_update_elem(map_fd, &key, &val, 0);
+		if (bpf_obj_pin(map_fd, path) == 0) {
+			f = fopen(path, "r");
+			if (f) {
+				while (fgets(buf, sizeof(buf), f))
+					;
+				fclose(f);
+			}
+			unlink(path);
+		}
+		close(map_fd);
+	}
+
+	ASSERT_EQ(map_fd, -EINVAL, "key-less create is rejected");
+}
+
+void test_btf_map_keyless(void)
+{
+	int btf_fd, val_id;
+	struct btf *btf;
+
+	btf = btf__new_empty();
+	if (!ASSERT_OK_PTR(btf, "btf__new_empty"))
+		return;
+
+	val_id = btf__add_int(btf, "int", 4, BTF_INT_SIGNED);
+	if (!ASSERT_GT(val_id, 0, "btf__add_int"))
+		goto out;
+
+	if (!ASSERT_OK(btf__load_into_kernel(btf), "btf__load_into_kernel"))
+		goto out;
+	btf_fd = btf__fd(btf);
+
+	if (test__start_subtest("hash"))
+		check_keyless(BPF_MAP_TYPE_HASH, 0, btf_fd, val_id);
+	if (test__start_subtest("rhash"))
+		check_keyless(BPF_MAP_TYPE_RHASH, BPF_F_NO_PREALLOC, btf_fd, val_id);
+out:
+	btf__free(btf);
+}
diff --git a/tools/testing/selftests/bpf/prog_tests/btf_show_void.c b/tools/testing/selftests/bpf/prog_tests/btf_show_void.c
new file mode 100644
index 0000000000000..d73232dc2a045
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/btf_show_void.c
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <test_progs.h>
+#include <bpf/btf.h>
+#include "btf_show_void.skel.h"
+
+/*
+ * bpf_snprintf_btf() renders a type_id taken straight from the vmlinux BTF.
+ * Two such type_ids used to NULL-deref in the BTF show path:
+ *   - a "const void" (a modifier resolving to void) in btf_modifier_show()
+ *   - a BTF_KIND_VAR in btf_var_show() (base BTF has no resolved_ids)
+ * A fixed kernel renders both without crashing.
+ */
+static long run(struct btf_show_void *skel, __u32 type_id)
+{
+	LIBBPF_OPTS(bpf_test_run_opts, topts);
+	char ctx[8] = {};
+
+	skel->bss->type_id = type_id;
+	topts.ctx_in = ctx;
+	topts.ctx_size_in = sizeof(ctx);
+	if (!ASSERT_OK(bpf_prog_test_run_opts(bpf_program__fd(skel->progs.dump_type),
+					      &topts), "test_run"))
+		return -1;
+	return skel->bss->ret;
+}
+
+void test_btf_show_void(void)
+{
+	const struct btf_type *t;
+	struct btf_show_void *skel;
+	int i, n, cv = 0, var = 0;
+	struct btf *btf;
+
+	btf = btf__parse("/sys/kernel/btf/vmlinux", NULL);
+	if (!btf) {
+		test__skip();
+		return;
+	}
+
+	skel = btf_show_void__open_and_load();
+	if (!ASSERT_OK_PTR(skel, "skel_open_and_load"))
+		goto out_btf;
+
+	n = btf__type_cnt(btf);
+	for (i = 1; i < n && !(cv && var); i++) {
+		t = btf__type_by_id(btf, i);
+		if (!cv && btf_kind(t) == BTF_KIND_CONST && t->type == 0)
+			cv = i;
+		/* Pick a VAR small enough to render from the program's buffer. */
+		if (!var && btf_kind(t) == BTF_KIND_VAR) {
+			long sz = btf__resolve_size(btf, t->type);
+
+			if (sz > 0 && sz <= (long)sizeof(skel->bss->obj))
+				var = i;
+		}
+	}
+
+	/* "const void" renders the "<unsupported kind:0>" placeholder. */
+	if (test__start_subtest("const_void")) {
+		if (cv) {
+			ASSERT_EQ(run(skel, cv),
+				  sizeof("<unsupported kind:0>") - 1, "ret");
+			ASSERT_STREQ(skel->bss->out, "<unsupported kind:0>",
+				     "placeholder");
+		} else {
+			test__skip();
+		}
+	}
+
+	/* A BTF_KIND_VAR must resolve and render without error. */
+	if (test__start_subtest("var")) {
+		if (var)
+			ASSERT_GT(run(skel, var), 0, "ret");
+		else
+			test__skip();
+	}
+
+	btf_show_void__destroy(skel);
+out_btf:
+	btf__free(btf);
+}
diff --git a/tools/testing/selftests/bpf/progs/btf_show_void.c b/tools/testing/selftests/bpf/progs/btf_show_void.c
new file mode 100644
index 0000000000000..44af80fbbb808
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/btf_show_void.c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "btf_ptr.h"
+#include <bpf/bpf_helpers.h>
+
+__u32 type_id;
+/* A buffer we own to render the selected type from, kept in bounds. */
+char obj[256];
+char out[64];
+long ret;
+
+SEC("raw_tp/sys_enter")
+int dump_type(void *ctx)
+{
+	struct btf_ptr ptr = {
+		.ptr = obj,
+		.type_id = type_id,
+		.flags = 0,
+	};
+
+	ret = bpf_snprintf_btf(out, sizeof(out), &ptr, sizeof(ptr), 0);
+	return 0;
+}
+
+char _license[] SEC("license") = "GPL";

3/2 2026/08/31 12:40 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 5536
							output: 37
							thoughts: 403
						

Thoughts:
**Patch Analysis & Fuzzing Assessment**

Okay, let's break this down. My initial instinct is to assess whether this patch introduces functional changes that warrant a fuzzing campaign. This is a bit of a nuanced area, but the core of it is whether these code modifications could introduce new paths or vulnerabilities that fuzzing could potentially uncover.

First, let me analyze the specific code changes. I see adjustments to `btf_modifier_show` within `kernel/bpf/btf.c`. Specifically, they are adding null checks `if (!btf_type_ops(t))` when skipping modifiers resolves to void type. This logic change might be interesting. The added call to `btf_df_show()` could potentially introduce unexpected behavior. Similarly, the check in `btf_var_show` with `btf->resolved_ids` versus `btf_type_skip_modifiers` is something to investigate further.

The changes in `kernel/bpf/hashtab.c`, specifically `htab_map_check_btf` and `rhtab_map_check_btf`, now explicitly reject void key types with `if (btf_type_is_void(key_type)) return -EINVAL;`. This is likely a hardening measure, but anytime there are new error checks, there's a chance the error handling itself could be flawed. These are good candidates for fuzzing, depending on what the error returns to.

Finally, the inclusion of new selftests, `btf_map_keyless.c`, `btf_show_void.c`, and `btf_show_void.c` indicates the developers are aware of these changes and are actively testing them, which is a good sign. However, they might not be testing the full state space. I need to review those tests, and then go deeper into the surrounding code with `read-file` and `grepper` to understand Kconfig dependencies and potentially other related functions. That will give me a broader picture of the affected code and what the potential attack surfaces might be. I need to ascertain if the tests are comprehensive enough. Then I can determine if fuzzing is truly necessary, and if so, how to best target it.



4/2 2026/08/31 12:40 tool grepper
0m Args:
{
  "Expression": "btf_type_show|btf_modifier_show",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/btf.c=350=const char *btf_type_str(const struct btf_type *t)\n--\nkernel/bpf/btf.c-378- * their own data to a structure containing a struct btf_show and consult it\nkernel/bpf/btf.c:379: * in the show callback.  See btf_type_show() below.\nkernel/bpf/btf.c-380- *\n--\nkernel/bpf/btf.c=1077=static const char *btf_show_name(struct btf_show *show)\n--\nkernel/bpf/btf.c-1113-\t * Start with type_id, as we have resolved the struct btf_type *\nkernel/bpf/btf.c:1114:\t * via btf_modifier_show() past the parent typedef to the child\nkernel/bpf/btf.c-1115-\t * struct, int etc it is defined as.  In such cases, the type_id\n--\nkernel/bpf/btf.c=2847=static int btf_ptr_resolve(struct btf_verifier_env *env,\n--\nkernel/bpf/btf.c-2903-\nkernel/bpf/btf.c:2904:static void btf_modifier_show(const struct btf *btf,\nkernel/bpf/btf.c-2905-\t\t\t      const struct btf_type *t,\n--\nkernel/bpf/btf.c=2966=static const struct btf_kind_operations modifier_ops = {\n--\nkernel/bpf/btf.c-2971-\t.log_details = btf_ref_type_log,\nkernel/bpf/btf.c:2972:\t.show = btf_modifier_show,\nkernel/bpf/btf.c-2973-};\n--\nkernel/bpf/btf.c=8029=int btf_prepare_func_args(struct bpf_verifier_env *env, int subprog)\n--\nkernel/bpf/btf.c-8257-\nkernel/bpf/btf.c:8258:static void btf_type_show(const struct btf *btf, u32 type_id, void *obj,\nkernel/bpf/btf.c-8259-\t\t\t  struct btf_show *show)\n--\nkernel/bpf/btf.c=8276=int btf_type_seq_show_flags(const struct btf *btf, u32 type_id,\n--\nkernel/bpf/btf.c-8284-\nkernel/bpf/btf.c:8285:\tbtf_type_show(btf, type_id, obj, \u0026sseq);\nkernel/bpf/btf.c-8286-\n--\nkernel/bpf/btf.c=8326=int btf_type_snprintf_show(const struct btf *btf, u32 type_id, void *obj,\n--\nkernel/bpf/btf.c-8336-\nkernel/bpf/btf.c:8337:\tbtf_type_show(btf, type_id, obj, (struct btf_show *)\u0026ssnprintf);\nkernel/bpf/btf.c-8338-\n"
}

5/2 2026/08/31 12:40 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 7317
							output: 33
							thoughts: 43
						

Thoughts:
**BPF and BTF Configuration Deep Dive**

Okay, so I need to get a handle on the BPF and BTF configurations. Time to dig in. My first thought is to get a list of the required configurations, think hashtables, etc. Let's start with the kernel source and see what's being done. I'll head straight for the likely candidates: `kernel/bpf/Makefile` and `kernel/bpf/Kconfig`. That should give me a good overview of the dependencies and how these features are managed during the build process. From there, I can get a better picture of what I need to enable and configure.



6/2 2026/08/31 12:41 tool grepper
0m Args:
{
  "Expression": "btf\\.o|hashtab\\.o",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/Makefile=10=obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o\nkernel/bpf/Makefile:11:obj-$(CONFIG_BPF_SYSCALL) += hashtab.o arraymap.o percpu_freelist.o bpf_lru_list.o lpm_trie.o map_in_map.o bloom_filter.o\nkernel/bpf/Makefile-12-obj-$(CONFIG_BPF_SYSCALL) += local_storage.o queue_stack_maps.o ringbuf.o bpf_insn_array.o\nkernel/bpf/Makefile=13=obj-$(CONFIG_BPF_SYSCALL) += bpf_local_storage.o bpf_task_storage.o\nkernel/bpf/Makefile:14:obj-$(CONFIG_BPF_SYSCALL) += fixups.o cfg.o states.o backtrack.o check_btf.o\nkernel/bpf/Makefile-15-obj-${CONFIG_BPF_LSM}\t  += bpf_inode_storage.o\n--\nkernel/bpf/Makefile=17=obj-$(CONFIG_BPF_JIT) += trampoline.o\nkernel/bpf/Makefile:18:obj-$(CONFIG_BPF_SYSCALL) += btf.o memalloc.o rqspinlock.o stream.o\nkernel/bpf/Makefile-19-ifeq ($(CONFIG_MMU)$(CONFIG_64BIT),yy)\n--\nkernel/bpf/Makefile=40=ifeq ($(CONFIG_SYSFS),y)\nkernel/bpf/Makefile:41:obj-$(CONFIG_DEBUG_INFO_BTF) += sysfs_btf.o\nkernel/bpf/Makefile-42-endif\n"
}

7/2 2026/08/31 12:41 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 7984
							output: 54
							thoughts: 24
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Investigating Potential BPF Syscall and BTF Configuration Issues**

Alright, before I dive too deep into the code, I need to take a step back and examine the configuration. My initial thought is to cross-reference the `Kconfig` files. Specifically, I need to make sure `BPF_SYSCALL` is enabled, as that's fundamental for BPF program execution via syscalls. I'll also be searching for and checking `DEBUG_INFO_BTF`, and any other relevant configurations that relate to BTF. I'm thinking perhaps related configs can shed light on any potential conflicts or dependencies I need to be aware of when it comes to BTF and syscalls related to BPF. I'm assuming that proper configuration is always the first step.



8/2 2026/08/31 12:41 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "config BPF_SYSCALL|config DEBUG_INFO_BTF",
  "PathPrefix": "init/Kconfig|kernel/bpf/Kconfig|lib/Kconfig.debug"
}

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

9/2 2026/08/31 12:41 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 8257
							output: 21
							thoughts: 16
						

Thoughts:
Okay, here's my attempt at summarizing that thought process, tailored for an expert audience:

**Investigating the `BPF_SYSCALL` Macro**

Alright, time to dive in. My immediate thought is, "Where exactly is this `BPF_SYSCALL` macro defined?" It's a key piece in this whole BPF puzzle, and understanding its definition is crucial for the task at hand (which is assumed from the context, as the prompt lacks it). I need to understand its expansion, its arguments, and how it interacts with the underlying kernel infrastructure. I'm thinking of quickly using a grep or an IDE's search function to pinpoint the definition file. Knowing this will give me a better understanding of how the system calls interface with eBPF.



10/2 2026/08/31 12:41 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"
}

11/2 2026/08/31 12:41 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 8540
							output: 21
							thoughts: 16
						

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

**Investigating `DEBUG_INFO_BTF` in Kconfig**

Okay, first things first, let's take a look at `DEBUG_INFO_BTF` within the Kconfig configuration system. I need to refresh my understanding of how this option is currently behaving. I should think about its dependencies and relationships with other debugging options, such as `DEBUG_INFO`, `DEBUG_INFO_DWARF`, and, of course, the general BTF infrastructure enablement. I wonder if there are any recent changes or regressions in how this is set or used. I will review the associated help text and perhaps search the kernel mailing lists to see if there have been any recent discussions around this config option that might be relevant to my current debugging efforts. Let's see what the documentation says about any potential impact on build times, kernel size, and runtime performance. A quick cross-reference of relevant defconfigs would also be wise. Ultimately, my goal is to assess whether enabling or disabling this feature is the right approach for my current investigation.



12/2 2026/08/31 12:41 tool grepper
0m Args:
{
  "Expression": "config DEBUG_INFO_BTF"
}

Results:
{
  "Output": "lib/Kconfig.debug=378=config DEBUG_INFO_SPLIT\n--\nlib/Kconfig.debug-397-\nlib/Kconfig.debug:398:config DEBUG_INFO_BTF\nlib/Kconfig.debug-399-\tbool \"Generate BTF type information\"\n--\nlib/Kconfig.debug=419=config PAHOLE_HAS_LANG_EXCLUDE\n--\nlib/Kconfig.debug-427-\nlib/Kconfig.debug:428:config DEBUG_INFO_BTF_MODULES\nlib/Kconfig.debug-429-\tbool \"Generate BTF type information for kernel modules\"\n"
}

13/2 2026/08/31 12:41 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 8977
							output: 34
							thoughts: 19
						

Thoughts:
**Debugging the Debugging Configuration**

Okay, time to dive into the nitty-gritty. I need to take a look at the debugging configuration, so I'm heading straight for `lib/Kconfig.debug`. Specifically, I'm thinking I need to zero in on line 398. That's usually where the meat of a specific debugging setting, or a related grouping, tends to be. I've got a feeling the solution I'm seeking is going to be nearby. Let's see what's what.



14/2 2026/08/31 12:42 tool read-file
0m Args:
{
  "File": "lib/Kconfig.debug",
  "FirstLine": 395,
  "LineCount": 35
}

Results:
{
  "Contents": " 395:\t\t  to know about the .dwo files and include them.\n 396:\t\t  Incompatible with older versions of ccache.\n 397:\t\n 398:\tconfig DEBUG_INFO_BTF\n 399:\t\tbool \"Generate BTF type information\"\n 400:\t\tdepends on !DEBUG_INFO_SPLIT \u0026\u0026 !DEBUG_INFO_REDUCED\n 401:\t\tdepends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST\n 402:\t\tdepends on BPF_SYSCALL\n 403:\t\tdepends on PAHOLE_VERSION \u003e= 122\n 404:\t\t# pahole uses elfutils, which does not have support for Hexagon relocations\n 405:\t\tdepends on !HEXAGON\n 406:\t\thelp\n 407:\t\t  Generate deduplicated BTF type information from DWARF debug info.\n 408:\t\t  Turning this on requires pahole v1.22 or later, which will convert\n 409:\t\t  DWARF type info into equivalent deduplicated BTF type info.\n 410:\t\n 411:\tconfig PAHOLE_HAS_BTF_TAG\n 412:\t\tdef_bool PAHOLE_VERSION \u003e= 123\n 413:\t\tdepends on CC_IS_CLANG\n 414:\t\thelp\n 415:\t\t  Decide whether pahole emits btf_tag attributes (btf_type_tag and\n 416:\t\t  btf_decl_tag) or not. Currently only clang compiler implements\n 417:\t\t  these attributes, so make the config depend on CC_IS_CLANG.\n 418:\t\n 419:\tconfig PAHOLE_HAS_LANG_EXCLUDE\n 420:\t\tdef_bool PAHOLE_VERSION \u003e= 124\n 421:\t\thelp\n 422:\t\t  Support for the --lang_exclude flag which makes pahole exclude\n 423:\t\t  compilation units from the supplied language. Used in Kbuild to\n 424:\t\t  omit Rust CUs which are not supported in version 1.24 of pahole,\n 425:\t\t  otherwise it would emit malformed kernel and module binaries when\n 426:\t\t  using DEBUG_INFO_BTF_MODULES.\n 427:\t\n 428:\tconfig DEBUG_INFO_BTF_MODULES\n 429:\t\tbool \"Generate BTF type information for kernel modules\"\n"
}

15/2 2026/08/31 12:42 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 9764
							output: 32
							thoughts: 174
						

Thoughts:
**Investigating BTF Display and Map Verification**

Okay, so I need to understand how the BTF show functions and the map creation check functions are being called. Time to dive in. Let's see, in `kernel/bpf/btf.c` specifically, it looks like `btf_type_snprintf_show`, `btf_type_seq_show_flags`, `bpf_snprintf_btf` (which I assume is a helper), and also functions like `map_check_btf` and `htab_map_check_btf` are key players here. I'm focusing on those. Right, I need to trace the calling paths. I'll need to figure out where `btf_type_seq_show_flags`, `btf_type_snprintf_show`, and `bpf_snprintf_btf` are actually being invoked, as well as those map check functions. That should give me a solid understanding of the control flow.



16/2 2026/08/31 12:42 tool grepper
0m Args:
{
  "Expression": "bpf_snprintf_btf",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/btf.c=2925=static void btf_var_show(const struct btf *btf, const struct btf_type *t,\n--\nkernel/bpf/btf.c-2930-\t * btf_type_id_resolve() dereferences btf-\u003eresolved_ids, which is NULL\nkernel/bpf/btf.c:2931:\t * for a base BTF (e.g. the vmlinux BTF that bpf_snprintf_btf() uses).\nkernel/bpf/btf.c-2932-\t * Resolve the var's type directly in that case.\n--\nkernel/bpf/core.c=3172=const struct bpf_func_proto bpf_get_ns_current_pid_tgid_proto __weak;\nkernel/bpf/core.c:3173:const struct bpf_func_proto bpf_snprintf_btf_proto __weak;\nkernel/bpf/core.c-3174-const struct bpf_func_proto bpf_seq_printf_btf_proto __weak;\n--\nkernel/bpf/helpers.c=2067=bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)\n--\nkernel/bpf/helpers.c-2218-\tcase BPF_FUNC_snprintf_btf:\nkernel/bpf/helpers.c:2219:\t\treturn \u0026bpf_snprintf_btf_proto;\nkernel/bpf/helpers.c-2220-\tcase BPF_FUNC_snprintf:\n"
}

17/2 2026/08/31 12:42 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 10602
							output: 34
							thoughts: 28
						

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

**Diving into `bpf_snprintf_btf` in `kernel/bpf/btf.c`**

Okay, so I need to understand how the BTF information is being formatted for output, specifically looking at how `bpf_snprintf_btf` works. This function is obviously critical for the human-readable representation of BTF data, which is essential for debugging, analysis, and possibly even dynamic instrumentation. I need to get a clear picture of its implementation. I'm assuming it handles the nitty-gritty details of traversing the BTF type information, decoding the various type descriptors, and generating a string representation suitable for logging or user display. The formatting likely depends on the type of BTF entry it's encountering, and I'll need to see how it manages recursive structures and handles complex data types. I'll pay close attention to the buffer management and error handling within that function as well. I'm expecting some clever use of format specifiers to generate the output, and hopefully, I'll see some good examples of how it handles the details. Now, let's get into the details of the function.



18/2 2026/08/31 12:43 tool grepper
0m Args:
{
  "Expression": "bpf_snprintf_btf_proto",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/core.c=3172=const struct bpf_func_proto bpf_get_ns_current_pid_tgid_proto __weak;\nkernel/bpf/core.c:3173:const struct bpf_func_proto bpf_snprintf_btf_proto __weak;\nkernel/bpf/core.c-3174-const struct bpf_func_proto bpf_seq_printf_btf_proto __weak;\n--\nkernel/bpf/helpers.c=2067=bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)\n--\nkernel/bpf/helpers.c-2218-\tcase BPF_FUNC_snprintf_btf:\nkernel/bpf/helpers.c:2219:\t\treturn \u0026bpf_snprintf_btf_proto;\nkernel/bpf/helpers.c-2220-\tcase BPF_FUNC_snprintf:\n"
}

19/2 2026/08/31 12:43 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 11178
							output: 29
							thoughts: 32
						

Thoughts:
Here's my take on those thoughts:

**Investigating `bpf_snprintf_btf_proto`**

Okay, so I need to understand what `bpf_snprintf_btf_proto` is really doing. Given its name, it's pretty likely it's related to printing or formatting information about eBPF programs, specifically dealing with BTF (BPF Type Format) data, and probably related to prototypes or function signatures. My immediate move is to track down its definition. Kernel code being kernel code, the most logical place to look first is within `kernel/bpf/btf.c` or a file similarly named within the BPF subsystem. I'll need to confirm its exact purpose and implementation details from there.



20/2 2026/08/31 12:43 tool grepper
0m Args:
{
  "Expression": "bpf_snprintf_btf",
  "PathPrefix": "kernel"
}

Results:
{
  "Output": "kernel/bpf/btf.c=2925=static void btf_var_show(const struct btf *btf, const struct btf_type *t,\n--\nkernel/bpf/btf.c-2930-\t * btf_type_id_resolve() dereferences btf-\u003eresolved_ids, which is NULL\nkernel/bpf/btf.c:2931:\t * for a base BTF (e.g. the vmlinux BTF that bpf_snprintf_btf() uses).\nkernel/bpf/btf.c-2932-\t * Resolve the var's type directly in that case.\n--\nkernel/bpf/core.c=3172=const struct bpf_func_proto bpf_get_ns_current_pid_tgid_proto __weak;\nkernel/bpf/core.c:3173:const struct bpf_func_proto bpf_snprintf_btf_proto __weak;\nkernel/bpf/core.c-3174-const struct bpf_func_proto bpf_seq_printf_btf_proto __weak;\n--\nkernel/bpf/helpers.c=2067=bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)\n--\nkernel/bpf/helpers.c-2218-\tcase BPF_FUNC_snprintf_btf:\nkernel/bpf/helpers.c:2219:\t\treturn \u0026bpf_snprintf_btf_proto;\nkernel/bpf/helpers.c-2220-\tcase BPF_FUNC_snprintf:\n--\nkernel/trace/bpf_trace.c=1006=static int bpf_btf_printf_prepare(struct btf_ptr *ptr, u32 btf_ptr_size,\n--\nkernel/trace/bpf_trace.c-1035-\nkernel/trace/bpf_trace.c:1036:BPF_CALL_5(bpf_snprintf_btf, char *, str, u32, str_size, struct btf_ptr *, ptr,\nkernel/trace/bpf_trace.c-1037-\t   u32, btf_ptr_size, u64, flags)\n--\nkernel/trace/bpf_trace.c-1050-\nkernel/trace/bpf_trace.c:1051:const struct bpf_func_proto bpf_snprintf_btf_proto = {\nkernel/trace/bpf_trace.c:1052:\t.func\t\t= bpf_snprintf_btf,\nkernel/trace/bpf_trace.c-1053-\t.gpl_only\t= false,\n"
}

21/2 2026/08/31 12:43 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 12086
							output: 44
							thoughts: 315
						

Thoughts:
**Analyzing BTF-Related Code Changes**

Okay, let's break down these changes related to BTF (BPF Type Format). First, I need to identify which functions have been modified. It looks like we have two key areas: `kernel/bpf/btf.c` and `kernel/bpf/hashtab.c`.

In `btf.c`, the changes center around display functions. Specifically, `btf_modifier_show` and `btf_var_show` are the targets. These are *static* callbacks, which means they're internal to that file. The important thing now is to see where these are *used*. Looking at the code, these show up in places that format and output BTF information: `btf_type_seq_show_flags`, `btf_type_snprintf_show`, and, crucially, functions called via BPF programs like `bpf_snprintf_btf` and `bpf_seq_printf_btf`. Additionally, the map dump functions in bpffs, such as `map_seq_show`, `bpf_map_seq_show`, and `bpf_obj_pin`, are also involved. So, it seems like these changes refine the way BTF data is formatted and presented to the user, particularly through sequence files and potentially via BPF programs themselves.

Next, in `hashtab.c`, the changes affect `htab_map_check_btf` and `rhtab_map_check_btf`, which, again, are static. These are clearly related to *hash table* maps and BTF. Now, I need to understand the entry points for creating maps where BTF is relevant. Looking at the broader code, `map_create`, `bpf_map_new_fd`, and `bpf_map_alloc_id` in `syscall.c` all seem to be entry points called from the `sys_bpf` system call when `BPF_MAP_CREATE` is invoked. This suggests that these changes deal with checking or validating BTF during the creation of hash table-based BPF maps. Now I want to quickly investigate where `htab_map_check_btf` is being called to see the whole context.



22/2 2026/08/31 12:43 tool grepper
0m Args:
{
  "Expression": "htab_map_check_btf|rhtab_map_check_btf",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/hashtab.c=504=static int bpf_ma_set_dtor(struct bpf_map *map, struct bpf_mem_alloc *ma,\n--\nkernel/bpf/hashtab.c-527-\nkernel/bpf/hashtab.c:528:static int htab_map_check_btf(struct bpf_map *map, const struct btf *btf,\nkernel/bpf/hashtab.c-529-\t\t\t      const struct btf_type *key_type, const struct btf_type *value_type)\n--\nkernel/bpf/hashtab.c=2361=const struct bpf_map_ops htab_map_ops = {\n--\nkernel/bpf/hashtab.c-2375-\t.map_for_each_callback = bpf_for_each_hash_elem,\nkernel/bpf/hashtab.c:2376:\t.map_check_btf = htab_map_check_btf,\nkernel/bpf/hashtab.c-2377-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=2383=const struct bpf_map_ops htab_lru_map_ops = {\n--\nkernel/bpf/hashtab.c-2398-\t.map_for_each_callback = bpf_for_each_hash_elem,\nkernel/bpf/hashtab.c:2399:\t.map_check_btf = htab_map_check_btf,\nkernel/bpf/hashtab.c-2400-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=2564=const struct bpf_map_ops htab_percpu_map_ops = {\n--\nkernel/bpf/hashtab.c-2578-\t.map_for_each_callback = bpf_for_each_hash_elem,\nkernel/bpf/hashtab.c:2579:\t.map_check_btf = htab_map_check_btf,\nkernel/bpf/hashtab.c-2580-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=2586=const struct bpf_map_ops htab_lru_percpu_map_ops = {\n--\nkernel/bpf/hashtab.c-2599-\t.map_for_each_callback = bpf_for_each_hash_elem,\nkernel/bpf/hashtab.c:2600:\t.map_check_btf = htab_map_check_btf,\nkernel/bpf/hashtab.c-2601-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=3096=static int rhtab_map_gen_lookup(struct bpf_map *map, struct bpf_insn *insn_buf)\n--\nkernel/bpf/hashtab.c-3110-\nkernel/bpf/hashtab.c:3111:static int rhtab_map_check_btf(struct bpf_map *map, const struct btf *btf,\nkernel/bpf/hashtab.c-3112-\t\t\t       const struct btf_type *key_type,\n--\nkernel/bpf/hashtab.c=3521=const struct bpf_map_ops rhtab_map_ops = {\n--\nkernel/bpf/hashtab.c-3527-\t.map_release_uref = rhtab_map_free_internal_structs,\nkernel/bpf/hashtab.c:3528:\t.map_check_btf = rhtab_map_check_btf,\nkernel/bpf/hashtab.c-3529-\t.map_lookup_elem = rhtab_map_lookup_elem,\n"
}

23/2 2026/08/31 12:43 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 13950
							output: 30
							thoughts: 19
						

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

**Investigating `.map_check_btf` Calls**

Alright, let's dive in. I need to understand the usage patterns of `.map_check_btf` within the kernel. My initial thought process is to trace down where this function is actually *called*. It's critical for understanding how the BTF (BPF Type Format) verification is implemented in the kernel context. I need to map out the call graph here. The goal is a clear picture of how `map_check_btf` fits into the broader validation infrastructure, to see if there are any subtle uses, or unusual code flows that require a closer look. I'll need to use my usual tools to pinpoint all call sites, paying close attention to any conditional or context-dependent calls. From there, I can begin to reason about how that function’s design affects performance, and if there are any potential vulnerabilities, or design improvements needed.



24/2 2026/08/31 12:43 tool grepper
0m Args:
{
  "Expression": "map_check_btf",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/arena.c=406=static long arena_map_update_elem(struct bpf_map *map, void *key,\n--\nkernel/bpf/arena.c-411-\nkernel/bpf/arena.c:412:static int arena_map_check_btf(struct bpf_map *map, const struct btf *btf,\nkernel/bpf/arena.c-413-\t\t\t       const struct btf_type *key_type, const struct btf_type *value_type)\n--\nkernel/bpf/arena.c=640=const struct bpf_map_ops arena_map_ops = {\n--\nkernel/bpf/arena.c-653-\t.map_delete_elem = arena_map_delete_elem,\nkernel/bpf/arena.c:654:\t.map_check_btf = arena_map_check_btf,\nkernel/bpf/arena.c-655-\t.map_mem_usage = arena_map_mem_usage,\n--\nkernel/bpf/arraymap.c=557=static void percpu_array_map_seq_show_elem(struct bpf_map *map, void *key,\n--\nkernel/bpf/arraymap.c-579-\nkernel/bpf/arraymap.c:580:static int array_map_check_btf(struct bpf_map *map,\nkernel/bpf/arraymap.c-581-\t\t\t       const struct btf *btf,\n--\nkernel/bpf/arraymap.c=858=const struct bpf_map_ops array_map_ops = {\n--\nkernel/bpf/arraymap.c-873-\t.map_seq_show_elem = array_map_seq_show_elem,\nkernel/bpf/arraymap.c:874:\t.map_check_btf = array_map_check_btf,\nkernel/bpf/arraymap.c-875-\t.map_lookup_batch = generic_map_lookup_batch,\n--\nkernel/bpf/arraymap.c=885=const struct bpf_map_ops percpu_array_map_ops = {\n--\nkernel/bpf/arraymap.c-898-\t.map_seq_show_elem = percpu_array_map_seq_show_elem,\nkernel/bpf/arraymap.c:899:\t.map_check_btf = array_map_check_btf,\nkernel/bpf/arraymap.c-900-\t.map_lookup_batch = generic_map_lookup_batch,\n--\nkernel/bpf/arraymap.c=1382=const struct bpf_map_ops perf_event_array_map_ops = {\n--\nkernel/bpf/arraymap.c-1392-\t.map_release = perf_event_fd_array_release,\nkernel/bpf/arraymap.c:1393:\t.map_check_btf = map_check_no_btf,\nkernel/bpf/arraymap.c-1394-\t.map_mem_usage = array_map_mem_usage,\n--\nkernel/bpf/arraymap.c=1418=const struct bpf_map_ops cgroup_array_map_ops = {\n--\nkernel/bpf/arraymap.c-1427-\t.map_fd_put_ptr = cgroup_fd_array_put_ptr,\nkernel/bpf/arraymap.c:1428:\t.map_check_btf = map_check_no_btf,\nkernel/bpf/arraymap.c-1429-\t.map_mem_usage = array_map_mem_usage,\n--\nkernel/bpf/arraymap.c=1504=const struct bpf_map_ops array_of_maps_map_ops = {\n--\nkernel/bpf/arraymap.c-1516-\t.map_update_batch = generic_map_update_batch,\nkernel/bpf/arraymap.c:1517:\t.map_check_btf = map_check_no_btf,\nkernel/bpf/arraymap.c-1518-\t.map_mem_usage = array_map_mem_usage,\n--\nkernel/bpf/bloom_filter.c=175=static long bloom_map_update_elem(struct bpf_map *map, void *key,\n--\nkernel/bpf/bloom_filter.c-181-\nkernel/bpf/bloom_filter.c:182:static int bloom_map_check_btf(struct bpf_map *map,\nkernel/bpf/bloom_filter.c-183-\t\t\t       const struct btf *btf,\n--\nkernel/bpf/bloom_filter.c=203=const struct bpf_map_ops bloom_filter_map_ops = {\n--\nkernel/bpf/bloom_filter.c-214-\t.map_delete_elem = bloom_map_delete_elem,\nkernel/bpf/bloom_filter.c:215:\t.map_check_btf = bloom_map_check_btf,\nkernel/bpf/bloom_filter.c-216-\t.map_mem_usage = bloom_map_mem_usage,\n--\nkernel/bpf/bpf_cgrp_storage.c=160=const struct bpf_map_ops cgrp_storage_map_ops = {\n--\nkernel/bpf/bpf_cgrp_storage.c-168-\t.map_delete_elem = bpf_cgrp_storage_delete_elem,\nkernel/bpf/bpf_cgrp_storage.c:169:\t.map_check_btf = bpf_local_storage_map_check_btf,\nkernel/bpf/bpf_cgrp_storage.c-170-\t.map_mem_usage = bpf_local_storage_map_mem_usage,\n--\nkernel/bpf/bpf_inode_storage.c=198=const struct bpf_map_ops inode_storage_map_ops = {\n--\nkernel/bpf/bpf_inode_storage.c-206-\t.map_delete_elem = bpf_fd_inode_storage_delete_elem,\nkernel/bpf/bpf_inode_storage.c:207:\t.map_check_btf = bpf_local_storage_map_check_btf,\nkernel/bpf/bpf_inode_storage.c-208-\t.map_mem_usage = bpf_local_storage_map_mem_usage,\n--\nkernel/bpf/bpf_insn_array.c=136=const struct bpf_map_ops insn_array_map_ops = {\n--\nkernel/bpf/bpf_insn_array.c-143-\t.map_delete_elem = insn_array_delete_elem,\nkernel/bpf/bpf_insn_array.c:144:\t.map_check_btf = insn_array_check_btf,\nkernel/bpf/bpf_insn_array.c-145-\t.map_mem_usage = insn_array_mem_usage,\n--\nkernel/bpf/bpf_local_storage.c=702=int bpf_local_storage_map_alloc_check(union bpf_attr *attr)\n--\nkernel/bpf/bpf_local_storage.c-717-\nkernel/bpf/bpf_local_storage.c:718:int bpf_local_storage_map_check_btf(struct bpf_map *map,\nkernel/bpf/bpf_local_storage.c-719-\t\t\t\t    const struct btf *btf,\n--\nkernel/bpf/bpf_task_storage.c=223=const struct bpf_map_ops task_storage_map_ops = {\n--\nkernel/bpf/bpf_task_storage.c-231-\t.map_delete_elem = bpf_pid_task_storage_delete_elem,\nkernel/bpf/bpf_task_storage.c:232:\t.map_check_btf = bpf_local_storage_map_check_btf,\nkernel/bpf/bpf_task_storage.c-233-\t.map_mem_usage = bpf_local_storage_map_mem_usage,\n--\nkernel/bpf/cpumap.c=709=const struct bpf_map_ops cpu_map_ops = {\n--\nkernel/bpf/cpumap.c-716-\t.map_get_next_key\t= cpu_map_get_next_key,\nkernel/bpf/cpumap.c:717:\t.map_check_btf\t\t= map_check_no_btf,\nkernel/bpf/cpumap.c-718-\t.map_mem_usage\t\t= cpu_map_mem_usage,\n--\nkernel/bpf/devmap.c=1087=const struct bpf_map_ops dev_map_ops = {\n--\nkernel/bpf/devmap.c-1095-\t.map_delete_elem = dev_map_delete_elem,\nkernel/bpf/devmap.c:1096:\t.map_check_btf = map_check_no_btf,\nkernel/bpf/devmap.c-1097-\t.map_mem_usage = dev_map_mem_usage,\n--\nkernel/bpf/devmap.c=1102=const struct bpf_map_ops dev_map_hash_ops = {\n--\nkernel/bpf/devmap.c-1110-\t.map_delete_elem = dev_map_hash_delete_elem,\nkernel/bpf/devmap.c:1111:\t.map_check_btf = map_check_no_btf,\nkernel/bpf/devmap.c-1112-\t.map_mem_usage = dev_map_mem_usage,\n--\nkernel/bpf/hashtab.c=504=static int bpf_ma_set_dtor(struct bpf_map *map, struct bpf_mem_alloc *ma,\n--\nkernel/bpf/hashtab.c-527-\nkernel/bpf/hashtab.c:528:static int htab_map_check_btf(struct bpf_map *map, const struct btf *btf,\nkernel/bpf/hashtab.c-529-\t\t\t      const struct btf_type *key_type, const struct btf_type *value_type)\n--\nkernel/bpf/hashtab.c=2361=const struct bpf_map_ops htab_map_ops = {\n--\nkernel/bpf/hashtab.c-2375-\t.map_for_each_callback = bpf_for_each_hash_elem,\nkernel/bpf/hashtab.c:2376:\t.map_check_btf = htab_map_check_btf,\nkernel/bpf/hashtab.c-2377-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=2383=const struct bpf_map_ops htab_lru_map_ops = {\n--\nkernel/bpf/hashtab.c-2398-\t.map_for_each_callback = bpf_for_each_hash_elem,\nkernel/bpf/hashtab.c:2399:\t.map_check_btf = htab_map_check_btf,\nkernel/bpf/hashtab.c-2400-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=2564=const struct bpf_map_ops htab_percpu_map_ops = {\n--\nkernel/bpf/hashtab.c-2578-\t.map_for_each_callback = bpf_for_each_hash_elem,\nkernel/bpf/hashtab.c:2579:\t.map_check_btf = htab_map_check_btf,\nkernel/bpf/hashtab.c-2580-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=2586=const struct bpf_map_ops htab_lru_percpu_map_ops = {\n--\nkernel/bpf/hashtab.c-2599-\t.map_for_each_callback = bpf_for_each_hash_elem,\nkernel/bpf/hashtab.c:2600:\t.map_check_btf = htab_map_check_btf,\nkernel/bpf/hashtab.c-2601-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=2732=const struct bpf_map_ops htab_of_maps_map_ops = {\n--\nkernel/bpf/hashtab.c-2742-\t.map_gen_lookup = htab_of_map_gen_lookup,\nkernel/bpf/hashtab.c:2743:\t.map_check_btf = map_check_no_btf,\nkernel/bpf/hashtab.c-2744-\t.map_mem_usage = htab_map_mem_usage,\n--\nkernel/bpf/hashtab.c=3096=static int rhtab_map_gen_lookup(struct bpf_map *map, struct bpf_insn *insn_buf)\n--\nkernel/bpf/hashtab.c-3110-\nkernel/bpf/hashtab.c:3111:static int rhtab_map_check_btf(struct bpf_map *map, const struct btf *btf,\nkernel/bpf/hashtab.c-3112-\t\t\t       const struct btf_type *key_type,\n--\nkernel/bpf/hashtab.c=3521=const struct bpf_map_ops rhtab_map_ops = {\n--\nkernel/bpf/hashtab.c-3527-\t.map_release_uref = rhtab_map_free_internal_structs,\nkernel/bpf/hashtab.c:3528:\t.map_check_btf = rhtab_map_check_btf,\nkernel/bpf/hashtab.c-3529-\t.map_lookup_elem = rhtab_map_lookup_elem,\n--\nkernel/bpf/local_storage.c=461=const struct bpf_map_ops cgroup_storage_map_ops = {\n--\nkernel/bpf/local_storage.c-467-\t.map_delete_elem = cgroup_storage_delete_elem,\nkernel/bpf/local_storage.c:468:\t.map_check_btf = cgroup_storage_check_btf,\nkernel/bpf/local_storage.c-469-\t.map_seq_show_elem = cgroup_storage_seq_show_elem,\n--\nkernel/bpf/lpm_trie.c=775=const struct bpf_map_ops trie_map_ops = {\n--\nkernel/bpf/lpm_trie.c-785-\t.map_delete_batch = generic_map_delete_batch,\nkernel/bpf/lpm_trie.c:786:\t.map_check_btf = trie_check_btf,\nkernel/bpf/lpm_trie.c-787-\t.map_mem_usage = trie_mem_usage,\n--\nkernel/bpf/stackmap.c=1141=const struct bpf_map_ops stack_trace_map_ops = {\n--\nkernel/bpf/stackmap.c-1149-\t.map_delete_elem = stack_map_delete_elem,\nkernel/bpf/stackmap.c:1150:\t.map_check_btf = map_check_no_btf,\nkernel/bpf/stackmap.c-1151-\t.map_mem_usage = stack_map_mem_usage,\n--\nkernel/bpf/syscall.c=114=const struct bpf_map_ops bpf_map_offload_ops = {\n--\nkernel/bpf/syscall.c-117-\t.map_free = bpf_map_offload_map_free,\nkernel/bpf/syscall.c:118:\t.map_check_btf = map_check_no_btf,\nkernel/bpf/syscall.c-119-\t.map_mem_usage = bpf_map_offload_map_mem_usage,\n--\nkernel/bpf/syscall.c=1247=int map_check_no_btf(struct bpf_map *map,\n--\nkernel/bpf/syscall.c-1254-\nkernel/bpf/syscall.c:1255:static int map_check_btf(struct bpf_map *map, struct bpf_token *token,\nkernel/bpf/syscall.c-1256-\t\t\t const struct btf *btf, u32 btf_key_id, u32 btf_value_id)\n--\nkernel/bpf/syscall.c-1268-\t\tkey_type = btf_type_by_id(btf, 0);\nkernel/bpf/syscall.c:1269:\t\tif (!map-\u003eops-\u003emap_check_btf)\nkernel/bpf/syscall.c-1270-\t\t\treturn -EINVAL;\n--\nkernel/bpf/syscall.c-1367-\nkernel/bpf/syscall.c:1368:\tif (map-\u003eops-\u003emap_check_btf) {\nkernel/bpf/syscall.c:1369:\t\tret = map-\u003eops-\u003emap_check_btf(map, btf, key_type, value_type);\nkernel/bpf/syscall.c-1370-\t\tif (ret \u003c 0)\n--\nkernel/bpf/syscall.c=1382=static int map_create_alloc(union bpf_attr *attr, bpfptr_t uattr, struct bpf_verifier_log *log,\n--\nkernel/bpf/syscall.c-1581-\t\tif (attr-\u003ebtf_value_type_id) {\nkernel/bpf/syscall.c:1582:\t\t\terr = map_check_btf(map, token, btf, attr-\u003ebtf_key_type_id,\nkernel/bpf/syscall.c-1583-\t\t\t\t\t    attr-\u003ebtf_value_type_id);\n"
}

25/2 2026/08/31 12:43 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 18920
							output: 31
							thoughts: 523
						

Thoughts:
**Fuzzing Feasibility Analysis: BPF Patch**

Okay, let's break this down from a fuzzing perspective. This patch targets two key areas within the BPF subsystem: `kernel/bpf/btf.c` and `kernel/bpf/hashtab.c`. Specifically, it addresses NULL pointer dereferences in BTF (Berkeley Packet Filter Type Format) handling and adds validation checks for void key types in hash tables.

First, the `btf.c` changes are fixing potential crashes during BTF type resolution and dumping. We're dealing with edge cases – specifically, when a modifier resolves to a void type or when handling `BTF_KIND_VAR` types in a base BTF structure that lacks `resolved_ids`. The `hashtab.c` change rejects void key types for BPF maps, preventing later issues during bpffs dumps.

Now, does this warrant fuzzing? Following the guidelines, this definitely *isn't* documentation, configuration, or purely decorative code. It directly modifies core BPF logic that's fully reachable from userspace through the `bpf()` syscall and BPF programs/bpffs. The BPF subsystem is a known target for exploitation, and these patches are fixing potential vulnerabilities related to NULL pointer dereferences and unexpected behavior with void types. Therefore, based on the reachability of the modified code and the potential for these types of bugs, I'm concluding that `WorthFuzzing = true`.

Next, we need to nail down the configuration requirements for reproducibility. The initial assessment suggests `BPF_SYSCALL` and `DEBUG_INFO_BTF` are necessary. But BPF and BTF are deeply intertwined, so I need to verify that there aren't any other subtly related configurations. I should check `kernel/bpf/Kconfig` for any dependencies of `BPF_SYSCALL` or any other related configurations that could be critical for enabling this functionality and reproducing the reported issues. This is a critical step to ensure a properly configured fuzzing environment that fully exposes the code paths touched by the patch.



26/2 2026/08/31 12:44 tool grepper
0m Args:
{
  "Expression": "config BPF_",
  "PathPrefix": "kernel/bpf/Kconfig"
}

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--\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--\nkernel/bpf/Kconfig-72-\nkernel/bpf/Kconfig:73:config BPF_UNPRIV_DEFAULT_OFF\nkernel/bpf/Kconfig-74-\tbool \"Disable unprivileged BPF by default\"\n--\nkernel/bpf/Kconfig=90=source \"kernel/bpf/preload/Kconfig\"\nkernel/bpf/Kconfig-91-\nkernel/bpf/Kconfig:92:config BPF_LSM\nkernel/bpf/Kconfig-93-\tbool \"Enable BPF LSM Instrumentation\"\n"
}

27/2 2026/08/31 12:44 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 20328
							output: 27
							thoughts: 127
						

Thoughts:
**Examining BPF Compilation**

Okay, so I need to understand how these BPF components are built. First, I'll dive into the kernel's build process. Let's see how `kernel/bpf/btf.c` and `kernel/bpf/hashtab.c` are compiled. I'll open up `kernel/bpf/Makefile` to check.

Alright, looking at Line 11, it's pretty clear: `obj-$(CONFIG_BPF_SYSCALL) += hashtab.o...` So, `hashtab.o` is only included if `CONFIG_BPF_SYSCALL` is enabled. Makes sense. And just below that, on line 18, it seems the same rule is applied to `btf.o` -- `obj-$(CONFIG_BPF_SYSCALL) += btf.o...`. Good, that makes the build configuration really clear.

Now, for that `bpf_snprintf_btf` function… where's that defined? My initial intuition is it might live in the tracing subsystem. So, I need to check `kernel/trace/bpf_trace.c` or perhaps the `Makefile` in that directory. Let's get to that next.



28/2 2026/08/31 12:44 tool grepper
0m Args:
{
  "Expression": "bpf_trace\\.o",
  "PathPrefix": "kernel"
}

Results:
{
  "Output": "kernel/trace/Makefile=54=KCOV_INSTRUMENT_trace_irqsoff.o := n\nkernel/trace/Makefile-55-\nkernel/trace/Makefile:56:CFLAGS_bpf_trace.o := -I$(src)\nkernel/trace/Makefile-57-\n--\nkernel/trace/Makefile=109=obj-$(CONFIG_USER_EVENTS) += trace_events_user.o\nkernel/trace/Makefile:110:obj-$(CONFIG_BPF_EVENTS) += bpf_trace.o\nkernel/trace/Makefile-111-obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe.o\n"
}

29/2 2026/08/31 12:44 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 20927
							output: 31
							thoughts: 19
						

Thoughts:
Here's my take on those thoughts:

**Checking Kernel Configuration for BPF Events**

Okay, so I need to understand how `BPF_EVENTS` are handled within the kernel. My first step is to dive right into the `kernel/trace/Kconfig` file. That's where I'd expect to find the configuration options that control the build-time inclusion and settings of features related to Berkeley Packet Filter (BPF) events. This is the logical starting point to see if this feature is enabled, disabled, or if there are any specific options associated with it. I'll be looking for how this ties into the overall tracing infrastructure. Understanding the build configuration is critical before I dig deeper into the code.



30/2 2026/08/31 12:44 tool grepper
0m Args:
{
  "Expression": "config BPF_EVENTS",
  "PathPrefix": "kernel/trace/Kconfig"
}

Results:
{
  "Output": "kernel/trace/Kconfig=839=config EPROBE_EVENTS\n--\nkernel/trace/Kconfig-852-\nkernel/trace/Kconfig:853:config BPF_EVENTS\nkernel/trace/Kconfig-854-\tdepends on BPF_SYSCALL\n"
}

31/2 2026/08/31 12:44 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 21210
							output: 34
							thoughts: 26
						

Thoughts:
Here's a summary of my thought process, as requested:

**Investigating Potential BPF Event Configuration**

Okay, so I'm thinking I need to understand how `BPF_EVENTS` is configured within the kernel. My initial thought is to go straight to the source, the `Kconfig` file. I'm pretty sure that's where the relevant configuration options are defined. I specifically remember seeing it within the trace directory. Let's see... I'm going to look around line 853 in `kernel/trace/Kconfig`. Hopefully, that location is recent enough, and I can quickly get an idea of the build configuration for it.



32/2 2026/08/31 12:44 tool read-file
0m Args:
{
  "File": "kernel/trace/Kconfig",
  "FirstLine": 850,
  "LineCount": 20
}

Results:
{
  "Contents": " 850:\t\t  convert the type of an event field. For example, turn an\n 851:\t\t  address into a string.\n 852:\t\n 853:\tconfig BPF_EVENTS\n 854:\t\tdepends on BPF_SYSCALL\n 855:\t\tdepends on (KPROBE_EVENTS || UPROBE_EVENTS) \u0026\u0026 PERF_EVENTS\n 856:\t\tbool\n 857:\t\tdefault y\n 858:\t\thelp\n 859:\t\t  This allows the user to attach BPF programs to kprobe, uprobe, and\n 860:\t\t  tracepoint events.\n 861:\t\n 862:\tconfig DYNAMIC_EVENTS\n 863:\t\tdef_bool n\n 864:\t\n 865:\tconfig PROBE_EVENTS\n 866:\t\tdef_bool n\n 867:\t\n 868:\tconfig BPF_KPROBE_OVERRIDE\n 869:\t\tbool \"Enable BPF programs to override a kprobed function\"\n"
}

33/2 2026/08/31 12:44 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 21687
							output: 51
							thoughts: 252
						

Thoughts:
**My Fuzzing Focus: BPF BTF Functions**

Okay, time to refine the fuzzing strategy. I need to make sure I'm targeting the right functions – the ones that are likely to expose interesting bugs and that are *actually* accessible. Let's start with `FocusSymbols`. Remember the key guidelines: I need to prioritize specific kernel functions crucial for fuzzing. Avoid generic hot-path functions, otherwise the tests will be skewed. Non-static, non-inlined API entrypoints are the gold standard, not internal static helpers. Those get optimized away by the compiler, and don't provide a unique symbol to target anyway.

Alright, let's dive into the non-static functions related to BTF show and map creation paths. I know there's interesting stuff happening in `kernel/bpf/btf.c`. Let me take a look:

First, let's confirm whether these are appropriate.
I need to check, and I will, whether these functions, `btf_type_snprintf_show`, `btf_type_seq_show_flags`, `btf_type_id_resolve`, `btf_type_skip_modifiers`, and `btf_df_show` are non-static and non-inlined. I think `btf_df_show` *might* be static, so I will check that one specifically.

Now, let me make sure I add to the list things like `bpf_snprintf_btf`, `map_check_btf`, `htab_map_check_btf` – those are all key areas. I need to make sure I get a good, targeted set of functions for this fuzzing campaign. This is important.



34/2 2026/08/31 12:44 tool grepper
0m Args:
{
  "Expression": "btf_type_snprintf_show|btf_type_seq_show_flags|btf_df_show",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/btf.c=2263=static int btf_df_resolve(struct btf_verifier_env *env,\n--\nkernel/bpf/btf.c-2269-\nkernel/bpf/btf.c:2270:static void btf_df_show(const struct btf *btf, const struct btf_type *t,\nkernel/bpf/btf.c-2271-\t\t\tu32 type_id, void *data, u8 bits_offsets,\n--\nkernel/bpf/btf.c=2904=static void btf_modifier_show(const struct btf *btf,\n--\nkernel/bpf/btf.c-2919-\tif (!btf_type_ops(t))\nkernel/bpf/btf.c:2920:\t\tbtf_df_show(btf, t, type_id, data, bits_offset, show);\nkernel/bpf/btf.c-2921-\telse\n--\nkernel/bpf/btf.c=3016=static const struct btf_kind_operations fwd_ops = {\n--\nkernel/bpf/btf.c-3021-\t.log_details = btf_fwd_type_log,\nkernel/bpf/btf.c:3022:\t.show = btf_df_show,\nkernel/bpf/btf.c-3023-};\n--\nkernel/bpf/btf.c=4786=static const struct btf_kind_operations func_proto_ops = {\n--\nkernel/bpf/btf.c-4800-\t.log_details = btf_func_proto_log,\nkernel/bpf/btf.c:4801:\t.show = btf_df_show,\nkernel/bpf/btf.c-4802-};\n--\nkernel/bpf/btf.c=4844=static const struct btf_kind_operations func_ops = {\n--\nkernel/bpf/btf.c-4849-\t.log_details = btf_ref_type_log,\nkernel/bpf/btf.c:4850:\t.show = btf_df_show,\nkernel/bpf/btf.c-4851-};\n--\nkernel/bpf/btf.c=5135=static const struct btf_kind_operations float_ops = {\n--\nkernel/bpf/btf.c-5140-\t.log_details = btf_float_log,\nkernel/bpf/btf.c:5141:\t.show = btf_df_show,\nkernel/bpf/btf.c-5142-};\n--\nkernel/bpf/btf.c=5234=static const struct btf_kind_operations decl_tag_ops = {\n--\nkernel/bpf/btf.c-5239-\t.log_details = btf_decl_tag_log,\nkernel/bpf/btf.c:5240:\t.show = btf_df_show,\nkernel/bpf/btf.c-5241-};\n--\nkernel/bpf/btf.c=8270=__printf(2, 0) static void btf_seq_show(struct btf_show *show, const char *fmt,\n--\nkernel/bpf/btf.c-8275-\nkernel/bpf/btf.c:8276:int btf_type_seq_show_flags(const struct btf *btf, u32 type_id,\nkernel/bpf/btf.c-8277-\t\t\t    void *obj, struct seq_file *m, u64 flags)\n--\nkernel/bpf/btf.c=8290=void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,\n--\nkernel/bpf/btf.c-8292-{\nkernel/bpf/btf.c:8293:\t(void) btf_type_seq_show_flags(btf, type_id, obj, m,\nkernel/bpf/btf.c-8294-\t\t\t\t       BTF_SHOW_NONAME | BTF_SHOW_COMPACT |\n--\nkernel/bpf/btf.c=8304=__printf(2, 0) static void btf_snprintf_show(struct btf_show *show, const char *fmt,\n--\nkernel/bpf/btf.c-8325-\nkernel/bpf/btf.c:8326:int btf_type_snprintf_show(const struct btf *btf, u32 type_id, void *obj,\nkernel/bpf/btf.c-8327-\t\t\t   char *buf, int len, u64 flags)\n"
}

35/2 2026/08/31 12:44 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 23602
							output: 32
							thoughts: 27
						

Thoughts:
Here's my take on the thought process, as if it were my own:

**Diving into BTF Type Resolution**

Okay, time to get my hands dirty. I need to understand how these BTF type IDs are actually resolved. That means I need to start digging into the core functions responsible for that process. My immediate targets are the declarations for `btf_type_id_resolve` and `btf_type_skip_modifiers`. I'm guessing these are the crucial building blocks – the workhorses that actually do the heavy lifting of figuring out what a BTF type ID *really* points to, and potentially cleaning up any extraneous modifiers that might be hanging around. Gotta understand their signatures, their interactions, and how they contribute to the overall type resolution flow. Knowing the *what* and the *how* of these two will lay the groundwork for understanding the *why* of the broader scheme. Let's see what we can find.



36/2 2026/08/31 12:45 tool grepper
0m Args:
{
  "Expression": "btf_type_skip_modifiers",
  "PathPrefix": "kernel/bpf"
}

Results:
{
  "Output": "kernel/bpf/btf.c=722=EXPORT_SYMBOL_GPL(bpf_find_btf_id);\nkernel/bpf/btf.c-723-\nkernel/bpf/btf.c:724:const struct btf_type *btf_type_skip_modifiers(const struct btf *btf,\nkernel/bpf/btf.c-725-\t\t\t\t\t       u32 id, u32 *res_id)\n--\nkernel/bpf/btf.c=740=const struct btf_type *btf_type_resolve_ptr(const struct btf *btf,\n--\nkernel/bpf/btf.c-744-\nkernel/bpf/btf.c:745:\tt = btf_type_skip_modifiers(btf, id, NULL);\nkernel/bpf/btf.c-746-\tif (!btf_type_is_ptr(t))\n--\nkernel/bpf/btf.c-748-\nkernel/bpf/btf.c:749:\treturn btf_type_skip_modifiers(btf, t-\u003etype, res_id);\nkernel/bpf/btf.c-750-}\n--\nkernel/bpf/btf.c=1016=bool btf_member_is_reg_int(const struct btf *btf, const struct btf_type *s,\n--\nkernel/bpf/btf.c-1052-\nkernel/bpf/btf.c:1053:/* Similar to btf_type_skip_modifiers() but does not skip typedefs. */\nkernel/bpf/btf.c-1054-static const struct btf_type *btf_type_skip_qualifiers(const struct btf *btf,\n--\nkernel/bpf/btf.c=2904=static void btf_modifier_show(const struct btf *btf,\n--\nkernel/bpf/btf.c-2911-\telse\nkernel/bpf/btf.c:2912:\t\tt = btf_type_skip_modifiers(btf, type_id, NULL);\nkernel/bpf/btf.c-2913-\n--\nkernel/bpf/btf.c=2925=static void btf_var_show(const struct btf *btf, const struct btf_type *t,\n--\nkernel/bpf/btf.c-2936-\telse\nkernel/bpf/btf.c:2937:\t\tt = btf_type_skip_modifiers(btf, t-\u003etype, \u0026type_id);\nkernel/bpf/btf.c-2938-\n--\nkernel/bpf/btf.c=3181=static void __btf_array_show(const struct btf *btf, const struct btf_type *t,\n--\nkernel/bpf/btf.c-3191-\telem_type_id = array-\u003etype;\nkernel/bpf/btf.c:3192:\telem_type = btf_type_skip_modifiers(btf, elem_type_id, NULL);\nkernel/bpf/btf.c-3193-\tif (elem_type \u0026\u0026 btf_type_has_size(elem_type))\n--\nkernel/bpf/btf.c=6604=u32 btf_ctx_arg_idx(struct btf *btf, const struct btf_type *func_proto,\n--\nkernel/bpf/btf.c-6617-\tfor (i = 0; i \u003c nr_args; i++) {\nkernel/bpf/btf.c:6618:\t\tt = btf_type_skip_modifiers(btf, args[i].type, NULL);\nkernel/bpf/btf.c-6619-\t\toffset += btf_type_is_ptr(t) ? 8 : roundup(t-\u003esize, 8);\n--\nkernel/bpf/btf.c-6623-\nkernel/bpf/btf.c:6624:\tt = btf_type_skip_modifiers(btf, func_proto-\u003etype, NULL);\nkernel/bpf/btf.c-6625-\toffset += btf_type_is_ptr(t) ? 8 : roundup(t-\u003esize, 8);\n--\nkernel/bpf/btf.c=6858=bool btf_ctx_access(int off, int size, enum bpf_access_type type,\n--\nkernel/bpf/btf.c-6932-\nkernel/bpf/btf.c:6933:\t\t\tt = btf_type_skip_modifiers(btf, t-\u003etype, NULL);\nkernel/bpf/btf.c-6934-\t\t\tif (!btf_type_is_small_int(t)) {\n--\nkernel/bpf/btf.c=7122=static int btf_struct_walk(struct bpf_verifier_log *log, const struct btf *btf,\n--\nkernel/bpf/btf.c-7134-\tif (btf_type_is_modifier(t))\nkernel/bpf/btf.c:7135:\t\tt = btf_type_skip_modifiers(btf, t-\u003etype, NULL);\nkernel/bpf/btf.c-7136-\ttname = __btf_name_by_offset(btf, t-\u003ename_off);\n--\nkernel/bpf/btf.c-7163-\t\tmember = btf_type_member(t) + vlen - 1;\nkernel/bpf/btf.c:7164:\t\tmtype = btf_type_skip_modifiers(btf, member-\u003etype,\nkernel/bpf/btf.c-7165-\t\t\t\t\t\tNULL);\n--\nkernel/bpf/btf.c-7177-\t\t/* allow structure and integer */\nkernel/bpf/btf.c:7178:\t\tt = btf_type_skip_modifiers(btf, array_elem-\u003etype,\nkernel/bpf/btf.c-7179-\t\t\t\t\t    NULL);\n--\nkernel/bpf/btf.c=7649=static int btf_check_func_type_match(struct bpf_verifier_log *log,\n--\nkernel/bpf/btf.c-7686-\nkernel/bpf/btf.c:7687:\tt1 = btf_type_skip_modifiers(btf1, t1-\u003etype, NULL);\nkernel/bpf/btf.c:7688:\tt2 = btf_type_skip_modifiers(btf2, t2-\u003etype, NULL);\nkernel/bpf/btf.c-7689-\tif (t1-\u003einfo != t2-\u003einfo) {\n--\nkernel/bpf/btf.c-7703-\tfor (i = 0; i \u003c nargs1; i++) {\nkernel/bpf/btf.c:7704:\t\tt1 = btf_type_skip_modifiers(btf1, args1[i].type, NULL);\nkernel/bpf/btf.c:7705:\t\tt2 = btf_type_skip_modifiers(btf2, args2[i].type, NULL);\nkernel/bpf/btf.c-7706-\n--\nkernel/bpf/btf.c-7732-\t\t}\nkernel/bpf/btf.c:7733:\t\tt1 = btf_type_skip_modifiers(btf1, t1-\u003etype, NULL);\nkernel/bpf/btf.c:7734:\t\tt2 = btf_type_skip_modifiers(btf2, t2-\u003etype, NULL);\nkernel/bpf/btf.c-7735-\t\tif (!btf_type_is_struct(t1)) {\n--\nkernel/bpf/btf.c=7946=static int btf_scan_type_tags(struct bpf_verifier_env *env,\n--\nkernel/bpf/btf.c-7957-\t/* Find the first pointer type in the chain. */\nkernel/bpf/btf.c:7958:\tt = btf_type_skip_modifiers(btf, type_id, NULL);\nkernel/bpf/btf.c-7959-\n--\nkernel/bpf/btf.c=7981=static int btf_validate_return_type(struct bpf_verifier_env *env, struct btf *btf,\n--\nkernel/bpf/btf.c-7990-\nkernel/bpf/btf.c:7991:\tt = btf_type_skip_modifiers(btf, t-\u003etype, NULL);\nkernel/bpf/btf.c-7992-\n--\nkernel/bpf/btf.c=8029=int btf_prepare_func_args(struct bpf_verifier_env *env, int subprog)\n--\nkernel/bpf/btf.c-8181-\nkernel/bpf/btf.c:8182:\t\t\tref_t = btf_type_skip_modifiers(btf, t-\u003etype, NULL);\nkernel/bpf/btf.c-8183-\t\t\tif (btf_type_is_void(ref_t) || btf_type_is_primitive(ref_t)) {\n--\nkernel/bpf/btf.c-8220-\nkernel/bpf/btf.c:8221:\t\t\tt = btf_type_skip_modifiers(btf, t-\u003etype, NULL);\nkernel/bpf/btf.c-8222-\t\t\tref_t = btf_resolve_size(btf, t, \u0026mem_size);\n--\nkernel/bpf/btf.c=8781=int btf_check_iter_arg(struct btf *btf, const struct btf_type *func, int arg_idx)\n--\nkernel/bpf/btf.c-8791-\targ = \u0026btf_params(func)[arg_idx];\nkernel/bpf/btf.c:8792:\tt = btf_type_skip_modifiers(btf, arg-\u003etype, NULL);\nkernel/bpf/btf.c-8793-\tif (!t || !btf_type_is_ptr(t))\nkernel/bpf/btf.c-8794-\t\treturn -EINVAL;\nkernel/bpf/btf.c:8795:\tt = btf_type_skip_modifiers(btf, t-\u003etype, \u0026btf_id);\nkernel/bpf/btf.c-8796-\tif (!t || !__btf_type_is_struct(t))\n--\nkernel/bpf/btf.c=8806=static int btf_check_iter_kfuncs(struct btf *btf, const char *func_name,\n--\nkernel/bpf/btf.c-8856-\t\t/* bpf_iter_\u003ctype\u003e_next() should return pointer */\nkernel/bpf/btf.c:8857:\t\tt = btf_type_skip_modifiers(btf, func-\u003etype, NULL);\nkernel/bpf/btf.c-8858-\t\tif (!t || !btf_type_is_ptr(t))\n--\nkernel/bpf/btf.c=9822=bool btf_nested_type_is_trusted(struct bpf_verifier_log *log,\n--\nkernel/bpf/btf.c-9859-\nkernel/bpf/btf.c:9860:\t\tbtf_type_skip_modifiers(btf, mtype-\u003etype, \u0026id);\nkernel/bpf/btf.c-9861-\t\t/* If we match on both type and name, the field is considered trusted. */\n--\nkernel/bpf/check_btf.c=133=static int check_btf_func(struct bpf_verifier_env *env,\n--\nkernel/bpf/check_btf.c-185-\nkernel/bpf/check_btf.c:186:\t\tret_type = btf_type_skip_modifiers(btf, func_proto-\u003etype, NULL);\nkernel/bpf/check_btf.c-187-\t\tscalar_return =\n--\nkernel/bpf/verifier.c=388=static const struct btf_type *subprog_ret_type(struct bpf_verifier_env *env, int subprog)\n--\nkernel/bpf/verifier.c-402-\nkernel/bpf/verifier.c:403:\treturn btf_type_skip_modifiers(btf, func_proto-\u003etype, NULL);\nkernel/bpf/verifier.c-404-}\n--\nkernel/bpf/verifier.c=10837=static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn,\n--\nkernel/bpf/verifier.c-11169-\t\tmark_reg_known_zero(env, regs, BPF_REG_0);\nkernel/bpf/verifier.c:11170:\t\tt = btf_type_skip_modifiers(meta.ret_btf, meta.ret_btf_id, NULL);\nkernel/bpf/verifier.c-11171-\t\tif (!btf_type_is_struct(t)) {\n--\nkernel/bpf/verifier.c=11408=static bool is_kfunc_arg_mem_size(const struct btf *btf,\n--\nkernel/bpf/verifier.c-11412-\nkernel/bpf/verifier.c:11413:\tt = btf_type_skip_modifiers(btf, arg-\u003etype, NULL);\nkernel/bpf/verifier.c-11414-\tif (!btf_type_is_scalar(t))\n--\nkernel/bpf/verifier.c=11420=static bool is_kfunc_arg_const_mem_size(const struct btf *btf,\n--\nkernel/bpf/verifier.c-11424-\nkernel/bpf/verifier.c:11425:\tt = btf_type_skip_modifiers(btf, arg-\u003etype, NULL);\nkernel/bpf/verifier.c-11426-\tif (!btf_type_is_scalar(t))\n--\nkernel/bpf/verifier.c=11538=static bool __is_kfunc_ptr_arg_type(const struct btf *btf,\n--\nkernel/bpf/verifier.c-11543-\nkernel/bpf/verifier.c:11544:\tt = btf_type_skip_modifiers(btf, arg-\u003etype, NULL);\nkernel/bpf/verifier.c-11545-\tif (!t)\n--\nkernel/bpf/verifier.c-11548-\t\treturn false;\nkernel/bpf/verifier.c:11549:\tt = btf_type_skip_modifiers(btf, t-\u003etype, \u0026res_id);\nkernel/bpf/verifier.c-11550-\tif (!t)\n--\nkernel/bpf/verifier.c=11650=bool btf_type_is_scalar_struct(struct bpf_verifier_env *env,\n--\nkernel/bpf/verifier.c-11663-\nkernel/bpf/verifier.c:11664:\t\tmember_type = btf_type_skip_modifiers(btf, member-\u003etype, NULL);\nkernel/bpf/verifier.c-11665-\t\tif (btf_type_is_struct(member_type)) {\n--\nkernel/bpf/verifier.c-11677-\t\t\t\treturn false;\nkernel/bpf/verifier.c:11678:\t\t\tmember_type = btf_type_skip_modifiers(btf, array-\u003etype, NULL);\nkernel/bpf/verifier.c-11679-\t\t\tif (!btf_type_is_scalar(member_type))\n--\nkernel/bpf/verifier.c=11965=get_kfunc_arg_type(struct bpf_verifier_env *env, struct bpf_call_arg_meta *meta,\n--\nkernel/bpf/verifier.c-11972-\nkernel/bpf/verifier.c:11973:\tt = btf_type_skip_modifiers(meta-\u003ebtf, args[arg].type, NULL);\nkernel/bpf/verifier.c-11974-\n--\nkernel/bpf/verifier.c-11993-\t}\nkernel/bpf/verifier.c:11994:\tref_t = btf_type_skip_modifiers(meta-\u003ebtf, t-\u003etype, NULL);\nkernel/bpf/verifier.c-11995-\tref_tname = btf_name_by_offset(meta-\u003ebtf, ref_t-\u003ename_off);\n--\nkernel/bpf/verifier.c=12136=static int process_kf_arg_ptr_to_btf_id(struct bpf_verifier_env *env,\n--\nkernel/bpf/verifier.c-12188-\nkernel/bpf/verifier.c:12189:\treg_ref_t = btf_type_skip_modifiers(reg_btf, reg_ref_id, \u0026reg_ref_id);\nkernel/bpf/verifier.c-12190-\treg_ref_tname = btf_name_by_offset(reg_btf, reg_ref_t-\u003ename_off);\n--\nkernel/bpf/verifier.c=12698=static int check_kfunc_args(struct bpf_verifier_env *env, struct bpf_call_arg_meta *meta,\n--\nkernel/bpf/verifier.c-12748-\nkernel/bpf/verifier.c:12749:\t\tt = btf_type_skip_modifiers(btf, args[i].type, NULL);\nkernel/bpf/verifier.c-12750-\nkernel/bpf/verifier.c-12751-\t\tif (btf_type_is_ptr(t)) {\nkernel/bpf/verifier.c:12752:\t\t\tref_t = btf_type_skip_modifiers(btf, t-\u003etype, \u0026ref_id);\nkernel/bpf/verifier.c-12753-\t\t\tref_tname = btf_name_by_offset(btf, ref_t-\u003ename_off);\n--\nkernel/bpf/verifier.c=13549=s64 bpf_kfunc_stack_access_bytes(struct bpf_verifier_env *env, struct bpf_insn *insn,\n--\nkernel/bpf/verifier.c-13568-\nkernel/bpf/verifier.c:13569:\tt = btf_type_skip_modifiers(btf, args[arg].type, NULL);\nkernel/bpf/verifier.c-13570-\tif (!btf_type_is_ptr(t))\n--\nkernel/bpf/verifier.c-13592-\t/* fixed-size pointed-to type: resolve via BTF */\nkernel/bpf/verifier.c:13593:\tref_t = btf_type_skip_modifiers(btf, t-\u003etype, NULL);\nkernel/bpf/verifier.c-13594-\tif (!IS_ERR(btf_resolve_size(btf, ref_t, \u0026type_size))) {\n--\nkernel/bpf/verifier.c=13785=static int check_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn,\n--\nkernel/bpf/verifier.c-14037-\t/* Check return type */\nkernel/bpf/verifier.c:14038:\tt = btf_type_skip_modifiers(desc_btf, meta.func_proto-\u003etype, NULL);\nkernel/bpf/verifier.c-14039-\n--\nkernel/bpf/verifier.c-14070-\t} else if (btf_type_is_ptr(t)) {\nkernel/bpf/verifier.c:14071:\t\tptr_type = btf_type_skip_modifiers(desc_btf, t-\u003etype, \u0026ptr_type_id);\nkernel/bpf/verifier.c-14072-\t\terr = check_special_kfunc(env, \u0026meta, regs, insn_aux, ptr_type, desc_btf);\n--\nkernel/bpf/verifier.c=18636=static int __check_pseudo_btf_id(struct bpf_verifier_env *env,\n--\nkernel/bpf/verifier.c-18689-\ttype = t-\u003etype;\nkernel/bpf/verifier.c:18690:\tt = btf_type_skip_modifiers(btf, type, NULL);\nkernel/bpf/verifier.c-18691-\tif (percpu) {\n"
}

37/2 2026/08/31 12:45 llm patch-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 29189
							output: 196
							thoughts: 527
						

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

Okay, let's break this down. My initial instinct was to zero in on `map_create`, potentially in `syscall.c` or within the `map_check_btf` function. However, I immediately note `map_check_btf` is static, which limits its direct exposure.  I'm seeing a suite of functions and data structures that are *not* static, so, therefore, are exported and need further examination. I'm focusing on these: `btf_type_snprintf_show`, `btf_type_seq_show_flags`, `btf_type_seq_show`, the `htab_map_ops` and `rhtab_map_ops` structs, `bpf_map_create` or `map_create` (the potential point of entry!), and `bpf_snprintf_btf`.  `bpf_snprintf_btf` especially grabs my attention because it is a BPF helper and a non-static BPF_CALL_5. That is potentially interesting.

Now, let's dig into `bpf_snprintf_btf`. I'm going to look at it within `kernel/trace/bpf_trace.c`. The `BPF_CALL_5` macro generates that symbol, either directly as `bpf_snprintf_btf` or potentially as `___bpf_snprintf_btf`. Also, both `btf_type_snprintf_show` and `btf_type_seq_show_flags` are defined in `kernel/bpf/btf.c`. That gives me a slightly wider picture of the attack surface.

Let's now consider any other relevant configuration options or symbols. I see `BPF_SYSCALL`, `DEBUG_INFO_BTF`, and `BPF_EVENTS`. Those are important for context, but not directly exploitable at this stage. My focus, though, narrows to these specific symbols: `btf_type_snprintf_show`, `btf_type_seq_show_flags`, and, again, `bpf_snprintf_btf`. Those are what I'm homing in on.

Before I jump to conclusions, I need a final, quick review. The patch modifies two specific areas: the BTF show logic, to prevent potential NULL dereferences when handling void modifiers and `BTF_KIND_VAR` with a base BTF. Specifically, in `kernel/bpf/btf.c` with `btf_modifier_show` and `btf_var_show`. It also impacts BTF map validation within `kernel/bpf/hashtab.c` via the `htab_map_check_btf` and `rhtab_map_check_btf` functions, to reject keyless BTF maps.

This is core kernel BPF functionality – and it's reachable via both syscalls and BPF programs themselves. My expert intuition is telling me this is worth fuzzing. The changes are potentially subtle, but they're dealing with fundamental data structures and validation. I'm now going to flag it as "WorthFuzzing: true."

Now, let's call `set-results`.



38/2 2026/08/31 12:45 tool set-results
0m Args:
{
  "EnableConfigs": [
    "BPF_SYSCALL",
    "DEBUG_INFO_BTF",
    "BPF_EVENTS"
  ],
  "FocusSymbols": [
    "btf_type_snprintf_show",
    "btf_type_seq_show_flags",
    "bpf_snprintf_btf"
  ],
  "Reasoning": "The patch fixes potential NULL pointer dereferences in the BTF show routines (btf_modifier_show and btf_var_show) when dealing with void modifiers and base BTFs, and adds checks in htab_map_check_btf/rhtab_map_check_btf to reject hash maps created with key-less BTFs. These are functional changes to core BPF/BTF validation and formatting paths reachable from userspace via the bpf() syscall and BPF helper programs.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL",
    "DEBUG_INFO_BTF",
    "BPF_EVENTS"
  ],
  "FocusSymbols": [
    "btf_type_snprintf_show",
    "btf_type_seq_show_flags",
    "bpf_snprintf_btf"
  ],
  "Reasoning": "The patch fixes potential NULL pointer dereferences in the BTF show routines (btf_modifier_show and btf_var_show) when dealing with void modifiers and base BTFs, and adds checks in htab_map_check_btf/rhtab_map_check_btf to reject hash maps created with key-less BTFs. These are functional changes to core BPF/BTF validation and formatting paths reachable from userspace via the bpf() syscall and BPF helper programs.",
  "WorthFuzzing": true
}

39/1 2026/08/31 12:45 action If
2m Args:
{
  "WorthFuzzing": true
}

Results:
null

40/2 2026/08/31 12:45 agent kmsan-evaluator
2m Model:
core

Args:
null

Results:
{
  "KMSANReasoning": "The patch addresses NULL pointer dereferences in BPF BTF type formatting (btf_modifier_show and btf_var_show) and BPF hash map BTF validation (htab_map_check_btf and rhtab_map_check_btf).\n\nSpecifically:\n1. In btf_modifier_show(), it adds a check for NULL btf_type_ops(t) when modifiers resolve to void, falling back to btf_df_show() to avoid NULL pointer dereference.\n2. In btf_var_show(), it checks if btf-\u003eresolved_ids is NULL before resolving, falling back to btf_type_skip_modifiers() to prevent NULL pointer dereference.\n3. In htab_map_check_btf() and rhtab_map_check_btf(), it rejects key-less BTF definitions with -EINVAL to avoid crashes during map dumping.\n\nNone of these changes touch uninitialized memory, modify memory initialization logic, or expose kernel-to-user info-leaks. The bugs addressed are NULL pointer dereferences, which are standard crashes detected without KMSAN. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
  "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:
For your convenience, here is the diff of the changes:
commit 454d65808e0aba0f5f40071a491135a660c5b9bf
Author: syz-cluster <triage@syzkaller.com>
Date:   Mon Aug 31 12:40:31 2026 +0000

    syz-cluster: applied patch under review

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 91b8ce77f699a..3cf35ee49c102 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -2911,14 +2911,30 @@ static void btf_modifier_show(const struct btf *btf,
 	else
 		t = btf_type_skip_modifiers(btf, type_id, NULL);
 
-	btf_type_ops(t)->show(btf, t, type_id, data, bits_offset, show);
+	/*
+	 * A modifier can resolve to the void type (e.g. "const void"), which
+	 * has no show op (kind_ops[BTF_KIND_UNKN] is NULL). Print a placeholder
+	 * instead of dereferencing NULL.
+	 */
+	if (!btf_type_ops(t))
+		btf_df_show(btf, t, type_id, data, bits_offset, show);
+	else
+		btf_type_ops(t)->show(btf, t, type_id, data, bits_offset, show);
 }
 
 static void btf_var_show(const struct btf *btf, const struct btf_type *t,
 			 u32 type_id, void *data, u8 bits_offset,
 			 struct btf_show *show)
 {
-	t = btf_type_id_resolve(btf, &type_id);
+	/*
+	 * btf_type_id_resolve() dereferences btf->resolved_ids, which is NULL
+	 * for a base BTF (e.g. the vmlinux BTF that bpf_snprintf_btf() uses).
+	 * Resolve the var's type directly in that case.
+	 */
+	if (btf->resolved_ids)
+		t = btf_type_id_resolve(btf, &type_id);
+	else
+		t = btf_type_skip_modifiers(btf, t->type, &type_id);
 
 	btf_type_ops(t)->show(btf, t, type_id, data, bits_offset, show);
 }
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index d40cb5dd446ca..43123424183c7 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -530,6 +530,10 @@ static int htab_map_check_btf(struct bpf_map *map, const struct btf *btf,
 {
 	struct bpf_htab *htab = container_of(map, struct bpf_htab, map);
 
+	/* Hash maps have no use for a key-less BTF. */
+	if (btf_type_is_void(key_type))
+		return -EINVAL;
+
 	if (htab_is_prealloc(htab))
 		return 0;
 	/*
@@ -3110,6 +3114,10 @@ static int rhtab_map_check_btf(struct bpf_map *map, const struct btf *btf,
 {
 	struct bpf_rhtab *rhtab = container_of(map, struct bpf_rhtab, map);
 
+	/* Hash maps have no use for a key-less BTF. */
+	if (btf_type_is_void(key_type))
+		return -EINVAL;
+
 	return bpf_ma_set_dtor(map, &rhtab->ma, rhtab_mem_dtor);
 }
 
diff --git a/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c b/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c
new file mode 100644
index 0000000000000..a7d037f57a7ef
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/btf_map_keyless.c
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <test_progs.h>
+#include <bpf/btf.h>
+
+/*
+ * A hash map with a key-less BTF (btf_key_type_id == 0) used to NULL-deref in
+ * btf_type_show() when dumped via bpffs.
+ * A fixed kernel rejects such a map at creation; on an unfixed kernel the
+ * pin-and-read below deliberately walks that bpffs dump path, so it doubles
+ * as a reproducer: it oopses an unfixed kernel (and panics it under
+ * panic_on_oops).
+ */
+static void check_keyless(int map_type, __u32 map_flags, int btf_fd, int val_id)
+{
+	LIBBPF_OPTS(bpf_map_create_opts, opts);
+	const char *path = "/sys/fs/bpf/keyless_map";
+	__u32 key = 1, val = 0x41424344;
+	char buf[256];
+	int map_fd;
+	FILE *f;
+
+	opts.map_flags = map_flags;
+	opts.btf_fd = btf_fd;
+	opts.btf_value_type_id = val_id;
+
+	/*
+	 * Positive control: the same map with a real key type must be accepted,
+	 * so the -EINVAL below is about the key-less BTF and not some unrelated
+	 * rejection (e.g. an unknown map type).
+	 */
+	opts.btf_key_type_id = val_id;
+	map_fd = bpf_map_create(map_type, "keyed_map", 4, 4, 8, &opts);
+	if (!ASSERT_GE(map_fd, 0, "keyed create is accepted"))
+		return;
+	close(map_fd);
+
+	/* A key-less BTF must be rejected. */
+	opts.btf_key_type_id = 0;
+	map_fd = bpf_map_create(map_type, "keyless_map", 4, 4, 8, &opts);
+
+	if (map_fd >= 0) {
+		/* Unfixed kernel: reproduce the oops via the bpffs dump path. */
+		(void)bpf_map_update_elem(map_fd, &key, &val, 0);
+		if (bpf_obj_pin(map_fd, path) == 0) {
+			f = fopen(path, "r");
+			if (f) {
+				while (fgets(buf, sizeof(buf), f))
+					;
+				fclose(f);
+			}
+			unlink(path);
+		}
+		close(map_fd);
+	}
+
+	ASSERT_EQ(map_fd, -EINVAL, "key-less create is rejected");
+}
+
+void test_btf_map_keyless(void)
+{
+	int btf_fd, val_id;
+	struct btf *btf;
+
+	btf = btf__new_empty();
+	if (!ASSERT_OK_PTR(btf, "btf__new_empty"))
+		return;
+
+	val_id = btf__add_int(btf, "int", 4, BTF_INT_SIGNED);
+	if (!ASSERT_GT(val_id, 0, "btf__add_int"))
+		goto out;
+
+	if (!ASSERT_OK(btf__load_into_kernel(btf), "btf__load_into_kernel"))
+		goto out;
+	btf_fd = btf__fd(btf);
+
+	if (test__start_subtest("hash"))
+		check_keyless(BPF_MAP_TYPE_HASH, 0, btf_fd, val_id);
+	if (test__start_subtest("rhash"))
+		check_keyless(BPF_MAP_TYPE_RHASH, BPF_F_NO_PREALLOC, btf_fd, val_id);
+out:
+	btf__free(btf);
+}
diff --git a/tools/testing/selftests/bpf/prog_tests/btf_show_void.c b/tools/testing/selftests/bpf/prog_tests/btf_show_void.c
new file mode 100644
index 0000000000000..d73232dc2a045
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/btf_show_void.c
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <test_progs.h>
+#include <bpf/btf.h>
+#include "btf_show_void.skel.h"
+
+/*
+ * bpf_snprintf_btf() renders a type_id taken straight from the vmlinux BTF.
+ * Two such type_ids used to NULL-deref in the BTF show path:
+ *   - a "const void" (a modifier resolving to void) in btf_modifier_show()
+ *   - a BTF_KIND_VAR in btf_var_show() (base BTF has no resolved_ids)
+ * A fixed kernel renders both without crashing.
+ */
+static long run(struct btf_show_void *skel, __u32 type_id)
+{
+	LIBBPF_OPTS(bpf_test_run_opts, topts);
+	char ctx[8] = {};
+
+	skel->bss->type_id = type_id;
+	topts.ctx_in = ctx;
+	topts.ctx_size_in = sizeof(ctx);
+	if (!ASSERT_OK(bpf_prog_test_run_opts(bpf_program__fd(skel->progs.dump_type),
+					      &topts), "test_run"))
+		return -1;
+	return skel->bss->ret;
+}
+
+void test_btf_show_void(void)
+{
+	const struct btf_type *t;
+	struct btf_show_void *skel;
+	int i, n, cv = 0, var = 0;
+	struct btf *btf;
+
+	btf = btf__parse("/sys/kernel/btf/vmlinux", NULL);
+	if (!btf) {
+		test__skip();
+		return;
+	}
+
+	skel = btf_show_void__open_and_load();
+	if (!ASSERT_OK_PTR(skel, "skel_open_and_load"))
+		goto out_btf;
+
+	n = btf__type_cnt(btf);
+	for (i = 1; i < n && !(cv && var); i++) {
+		t = btf__type_by_id(btf, i);
+		if (!cv && btf_kind(t) == BTF_KIND_CONST && t->type == 0)
+			cv = i;
+		/* Pick a VAR small enough to render from the program's buffer. */
+		if (!var && btf_kind(t) == BTF_KIND_VAR) {
+			long sz = btf__resolve_size(btf, t->type);
+
+			if (sz > 0 && sz <= (long)sizeof(skel->bss->obj))
+				var = i;
+		}
+	}
+
+	/* "const void" renders the "<unsupported kind:0>" placeholder. */
+	if (test__start_subtest("const_void")) {
+		if (cv) {
+			ASSERT_EQ(run(skel, cv),
+				  sizeof("<unsupported kind:0>") - 1, "ret");
+			ASSERT_STREQ(skel->bss->out, "<unsupported kind:0>",
+				     "placeholder");
+		} else {
+			test__skip();
+		}
+	}
+
+	/* A BTF_KIND_VAR must resolve and render without error. */
+	if (test__start_subtest("var")) {
+		if (var)
+			ASSERT_GT(run(skel, var), 0, "ret");
+		else
+			test__skip();
+	}
+
+	btf_show_void__destroy(skel);
+out_btf:
+	btf__free(btf);
+}
diff --git a/tools/testing/selftests/bpf/progs/btf_show_void.c b/tools/testing/selftests/bpf/progs/btf_show_void.c
new file mode 100644
index 0000000000000..44af80fbbb808
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/btf_show_void.c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "btf_ptr.h"
+#include <bpf/bpf_helpers.h>
+
+__u32 type_id;
+/* A buffer we own to render the selected type from, kept in bounds. */
+char obj[256];
+char out[64];
+long ret;
+
+SEC("raw_tp/sys_enter")
+int dump_type(void *ctx)
+{
+	struct btf_ptr ptr = {
+		.ptr = obj,
+		.type_id = type_id,
+		.flags = 0,
+	};
+
+	ret = bpf_snprintf_btf(out, sizeof(out), &ptr, sizeof(ptr), 0);
+	return 0;
+}
+
+char _license[] SEC("license") = "GPL";

41/3 2026/08/31 12:45 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 5533
							output: 35
							thoughts: 690
						

Thoughts:
**Analyzing the Patch for Fuzzing Needs**

Okay, let's break down this patch and figure out the fuzzing strategy. The primary question is whether this merits a dedicated KMSAN fuzzing session, or if KASAN and standard detectors are sufficient to cover the relevant areas. My initial impression is that these changes, while potentially complex in their logic, might be adequately covered by existing tools.

First, I'll examine the code modifications. The changes in `kernel/bpf/btf.c` are definitely the most interesting. We've got two specific areas of focus within that file: `btf_modifier_show` and `btf_var_show`. In `btf_modifier_show`, the code is now handling cases where a modifier resolves to a `void` type, which lacks a show operation. The patch adds a null check to guard against dereferencing a NULL pointer and utilizes `btf_df_show` as a fallback. `btf_var_show` adjusts the resolution logic for variable types, particularly addressing cases with base BTFs where `btf->resolved_ids` is NULL. This direct resolve using `btf_type_skip_modifiers` looks like a fix to avoid NULL dereferences in specific contexts. Both appear to be addressing potential null pointer dereferences, a classic KASAN target.

In `kernel/bpf/hashtab.c`, the new code in `htab_map_check_btf` and `rhtab_map_check_btf` explicitly disallows hash maps with key-less BTFs using `btf_type_is_void`. This is a type safety check. The interesting case is `btf_type_is_void`, which might open up new code paths.

Finally, the added selftests for `btf_map_keyless` and `btf_show_void` are good to see. These will offer some initial coverage and validation, but they might not be comprehensive.

Now, I'll dig into `btf_df_show` and the surrounding code, especially in relation to those null checks. I need to understand the potential data flows and edge cases that might trigger those conditions. This will help determine how effective KASAN is in identifying any potential memory safety issues. Given the changes primarily target null pointer dereferences and type checks, KASAN seems like the primary tool for validation here. While I'll keep KMSAN in mind, it seems less likely to uncover significant new issues in this specific patch.



42/3 2026/08/31 12:46 tool grepper
0m Args:
{
  "Expression": "btf_df_show",
  "PathPrefix": "kernel/bpf/btf.c"
}

Results:
{
  "Output": "kernel/bpf/btf.c=2263=static int btf_df_resolve(struct btf_verifier_env *env,\n--\nkernel/bpf/btf.c-2269-\nkernel/bpf/btf.c:2270:static void btf_df_show(const struct btf *btf, const struct btf_type *t,\nkernel/bpf/btf.c-2271-\t\t\tu32 type_id, void *data, u8 bits_offsets,\n--\nkernel/bpf/btf.c=2904=static void btf_modifier_show(const struct btf *btf,\n--\nkernel/bpf/btf.c-2919-\tif (!btf_type_ops(t))\nkernel/bpf/btf.c:2920:\t\tbtf_df_show(btf, t, type_id, data, bits_offset, show);\nkernel/bpf/btf.c-2921-\telse\n--\nkernel/bpf/btf.c=3016=static const struct btf_kind_operations fwd_ops = {\n--\nkernel/bpf/btf.c-3021-\t.log_details = btf_fwd_type_log,\nkernel/bpf/btf.c:3022:\t.show = btf_df_show,\nkernel/bpf/btf.c-3023-};\n--\nkernel/bpf/btf.c=4786=static const struct btf_kind_operations func_proto_ops = {\n--\nkernel/bpf/btf.c-4800-\t.log_details = btf_func_proto_log,\nkernel/bpf/btf.c:4801:\t.show = btf_df_show,\nkernel/bpf/btf.c-4802-};\n--\nkernel/bpf/btf.c=4844=static const struct btf_kind_operations func_ops = {\n--\nkernel/bpf/btf.c-4849-\t.log_details = btf_ref_type_log,\nkernel/bpf/btf.c:4850:\t.show = btf_df_show,\nkernel/bpf/btf.c-4851-};\n--\nkernel/bpf/btf.c=5135=static const struct btf_kind_operations float_ops = {\n--\nkernel/bpf/btf.c-5140-\t.log_details = btf_float_log,\nkernel/bpf/btf.c:5141:\t.show = btf_df_show,\nkernel/bpf/btf.c-5142-};\n--\nkernel/bpf/btf.c=5234=static const struct btf_kind_operations decl_tag_ops = {\n--\nkernel/bpf/btf.c-5239-\t.log_details = btf_decl_tag_log,\nkernel/bpf/btf.c:5240:\t.show = btf_df_show,\nkernel/bpf/btf.c-5241-};\n"
}

43/3 2026/08/31 12:46 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 7610
							output: 38
							thoughts: 27
						

Thoughts:
Okay, let's dive into this. Here's my take on those lines:

**Analyzing `kernel/bpf/btf.c`, Lines 2265-2280**

Right, let me pull up `kernel/bpf/btf.c` and zero in on lines 2265-2280. This usually indicates a specific area of interest, likely related to the handling of BTF (BPF Type Format) data structures, perhaps decoding or processing some aspect of them. Based on the line numbers, I'm guessing this might be within a larger function, likely a core function for reading, parsing, or validating BTF information.

I'd expect to see some sort of pointer manipulation or structure member access at this range, perhaps dealing with extracting type information, resolving references between types, or handling error conditions during the parsing process. If it's near the end of a block, it could be the final cleanup or error handling. Could be any of the `btf_` function calls that are frequently used in the `bpf/` directory. Given the scope, it might be about the `btf_type` structure, a key data structure used to represent BTF information.

I'm hoping to see how the BTF data is being accessed, perhaps casting some sort of generic data buffer into specific BTF structures, or maybe verifying some field values against expected ranges. It could involve checking type IDs, member offsets, or any other structural element relevant to the BTF format. Knowing the exact function surrounding this code block would give me more context, but just from the line numbers, I'm expecting some critical BTF-related operation to occur.



44/3 2026/08/31 12:46 tool read-file
0m Args:
{
  "File": "kernel/bpf/btf.c",
  "FirstLine": 2265,
  "LineCount": 30
}

Results:
{
  "Contents": "2265:\t{\n2266:\t\tbtf_verifier_log_basic(env, v-\u003et, \"Unsupported resolve\");\n2267:\t\treturn -EINVAL;\n2268:\t}\n2269:\t\n2270:\tstatic void btf_df_show(const struct btf *btf, const struct btf_type *t,\n2271:\t\t\t\tu32 type_id, void *data, u8 bits_offsets,\n2272:\t\t\t\tstruct btf_show *show)\n2273:\t{\n2274:\t\tbtf_show(show, \"\u003cunsupported kind:%u\u003e\", BTF_INFO_KIND(t-\u003einfo));\n2275:\t}\n2276:\t\n2277:\tstatic int btf_int_check_member(struct btf_verifier_env *env,\n2278:\t\t\t\t\tconst struct btf_type *struct_type,\n2279:\t\t\t\t\tconst struct btf_member *member,\n2280:\t\t\t\t\tconst struct btf_type *member_type)\n2281:\t{\n2282:\t\tu32 int_data = btf_type_int(member_type);\n2283:\t\tu32 struct_bits_off = member-\u003eoffset;\n2284:\t\tu32 struct_size = struct_type-\u003esize;\n2285:\t\tu32 nr_copy_bits;\n2286:\t\tu32 bytes_offset;\n2287:\t\n2288:\t\tif (U32_MAX - struct_bits_off \u003c BTF_INT_OFFSET(int_data)) {\n2289:\t\t\tbtf_verifier_log_member(env, struct_type, member,\n2290:\t\t\t\t\t\t\"bits_offset exceeds U32_MAX\");\n2291:\t\t\treturn -EINVAL;\n2292:\t\t}\n2293:\t\n2294:\t\tstruct_bits_off += BTF_INT_OFFSET(int_data);\n"
}

45/3 2026/08/31 12:46 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 8552
							output: 38
							thoughts: 37
						

Thoughts:
Okay, here's my interpretation of those thoughts, presented as a personal thought process, as requested:

**Diving Deeper into BTF Inspection**

Right, so we're talking about BTF (BPF Type Format) inspection again. I need to zero in on how these modifications are being displayed, and the context around variable presentation within the BTF information. My initial scan of the code didn't fully satisfy my need for a deep understanding. Therefore, I need to take a closer look at the `btf_modifier_show` and `btf_var_show` functions specifically, around lines 2900 to 2940. This range should give me a good handle on how these elements are integrated and rendered in the output. I'm hoping to get a clearer picture of potential bottlenecks or areas where further optimization or clarification could be needed. This focused investigation should give me the fine detail I am seeking.



46/3 2026/08/31 12:46 tool read-file
0m Args:
{
  "File": "kernel/bpf/btf.c",
  "FirstLine": 2900,
  "LineCount": 45
}

Results:
{
  "Contents": "2900:\t\n2901:\t\treturn 0;\n2902:\t}\n2903:\t\n2904:\tstatic void btf_modifier_show(const struct btf *btf,\n2905:\t\t\t\t      const struct btf_type *t,\n2906:\t\t\t\t      u32 type_id, void *data,\n2907:\t\t\t\t      u8 bits_offset, struct btf_show *show)\n2908:\t{\n2909:\t\tif (btf-\u003eresolved_ids)\n2910:\t\t\tt = btf_type_id_resolve(btf, \u0026type_id);\n2911:\t\telse\n2912:\t\t\tt = btf_type_skip_modifiers(btf, type_id, NULL);\n2913:\t\n2914:\t\t/*\n2915:\t\t * A modifier can resolve to the void type (e.g. \"const void\"), which\n2916:\t\t * has no show op (kind_ops[BTF_KIND_UNKN] is NULL). Print a placeholder\n2917:\t\t * instead of dereferencing NULL.\n2918:\t\t */\n2919:\t\tif (!btf_type_ops(t))\n2920:\t\t\tbtf_df_show(btf, t, type_id, data, bits_offset, show);\n2921:\t\telse\n2922:\t\t\tbtf_type_ops(t)-\u003eshow(btf, t, type_id, data, bits_offset, show);\n2923:\t}\n2924:\t\n2925:\tstatic void btf_var_show(const struct btf *btf, const struct btf_type *t,\n2926:\t\t\t\t u32 type_id, void *data, u8 bits_offset,\n2927:\t\t\t\t struct btf_show *show)\n2928:\t{\n2929:\t\t/*\n2930:\t\t * btf_type_id_resolve() dereferences btf-\u003eresolved_ids, which is NULL\n2931:\t\t * for a base BTF (e.g. the vmlinux BTF that bpf_snprintf_btf() uses).\n2932:\t\t * Resolve the var's type directly in that case.\n2933:\t\t */\n2934:\t\tif (btf-\u003eresolved_ids)\n2935:\t\t\tt = btf_type_id_resolve(btf, \u0026type_id);\n2936:\t\telse\n2937:\t\t\tt = btf_type_skip_modifiers(btf, t-\u003etype, \u0026type_id);\n2938:\t\n2939:\t\tbtf_type_ops(t)-\u003eshow(btf, t, type_id, data, bits_offset, show);\n2940:\t}\n2941:\t\n2942:\tstatic void btf_ptr_show(const struct btf *btf, const struct btf_type *t,\n2943:\t\t\t\t u32 type_id, void *data, u8 bits_offset,\n2944:\t\t\t\t struct btf_show *show)\n"
}

47/3 2026/08/31 12:46 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 9629
							output: 37
							thoughts: 40
						

Thoughts:
Okay, let's dive into this. I need to get a handle on the BPF hashtable verification process within the kernel. Specifically, I'm going to focus on the `htab_map_check_btf` and `rhtab_map_check_btf` functions located in `kernel/bpf/hashtab.c`. I need to understand how these functions, presumably, validate BTF (BPF Type Format) information in the context of regular and re-hashed hashtables. Given my expertise, I'll be looking for nuances and potential areas of optimization or concern. I'm probably going to be mentally tracing execution paths, considering potential edge cases related to concurrent access, and thinking about the implications of any checks performed for program security and resource utilization. Let's see what's what.



48/3 2026/08/31 12:47 tool read-file
0m Args:
{
  "File": "kernel/bpf/hashtab.c",
  "FirstLine": 525,
  "LineCount": 25
}

Results:
{
  "Contents": " 525:\t\treturn 0;\n 526:\t}\n 527:\t\n 528:\tstatic int htab_map_check_btf(struct bpf_map *map, const struct btf *btf,\n 529:\t\t\t\t      const struct btf_type *key_type, const struct btf_type *value_type)\n 530:\t{\n 531:\t\tstruct bpf_htab *htab = container_of(map, struct bpf_htab, map);\n 532:\t\n 533:\t\t/* Hash maps have no use for a key-less BTF. */\n 534:\t\tif (btf_type_is_void(key_type))\n 535:\t\t\treturn -EINVAL;\n 536:\t\n 537:\t\tif (htab_is_prealloc(htab))\n 538:\t\t\treturn 0;\n 539:\t\t/*\n 540:\t\t * We must set the dtor using this callback, as map's BTF record is not\n 541:\t\t * populated in htab_map_alloc(), so it will always appear as NULL.\n 542:\t\t */\n 543:\t\tif (htab_is_percpu(htab))\n 544:\t\t\treturn bpf_ma_set_dtor(map, \u0026htab-\u003epcpu_ma, htab_pcpu_mem_dtor);\n 545:\t\telse\n 546:\t\t\treturn bpf_ma_set_dtor(map, \u0026htab-\u003ema, htab_mem_dtor);\n 547:\t}\n 548:\t\n 549:\tstatic struct bpf_map *htab_map_alloc(union bpf_attr *attr)\n"
}

49/3 2026/08/31 12:47 llm kmsan-evaluator
0m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 10338
							output: 38
							thoughts: 19
						

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

**Investigating a Potential Issue**

Okay, so we're diving in. Given the context, my initial thought is to make sure we haven't overlooked something in the `rhtab_map_check_btf` function. It seems like a logical next step to examine its role and ensure it's not the source or a contributing factor to whatever problem we're tracking down. Gotta be methodical and cover all the bases, especially when dealing with something potentially related to... well, I'll need more context to know what it is related to, but this is a solid place to start and make sure it is in order.



50/3 2026/08/31 12:47 tool read-file
0m Args:
{
  "File": "kernel/bpf/hashtab.c",
  "FirstLine": 3105,
  "LineCount": 20
}

Results:
{
  "Contents": "3105:\t\t*insn++ = BPF_ALU64_IMM(BPF_ADD, ret,\n3106:\t\t\t\t\toffsetof(struct rhtab_elem, data) + round_up(map-\u003ekey_size, 8));\n3107:\t\n3108:\t\treturn insn - insn_buf;\n3109:\t}\n3110:\t\n3111:\tstatic int rhtab_map_check_btf(struct bpf_map *map, const struct btf *btf,\n3112:\t\t\t\t       const struct btf_type *key_type,\n3113:\t\t\t\t       const struct btf_type *value_type)\n3114:\t{\n3115:\t\tstruct bpf_rhtab *rhtab = container_of(map, struct bpf_rhtab, map);\n3116:\t\n3117:\t\t/* Hash maps have no use for a key-less BTF. */\n3118:\t\tif (btf_type_is_void(key_type))\n3119:\t\t\treturn -EINVAL;\n3120:\t\n3121:\t\treturn bpf_ma_set_dtor(map, \u0026rhtab-\u003ema, rhtab_mem_dtor);\n3122:\t}\n3123:\t\n3124:\tstatic void rhtab_map_free_internal_structs(struct bpf_map *map)\n"
}

51/3 2026/08/31 12:47 llm kmsan-evaluator
1m Model:
gemini-3.7-flash

Args:
null

Results:
null

Tokens:
							input: 10926
							output: 284
							thoughts: 508
						

Thoughts:
**Patch Analysis and KMSAN Decision**

Okay, let's break down this patch and see if we need to fire up the KMSAN fuzzing. First, I'm noting the changes. In `kernel/bpf/btf.c`, we're hardening against NULL pointer dereferences. Specifically, `btf_modifier_show` is being patched to handle the `void` modifier gracefully and `btf_var_show` is handling a potential NULL `resolved_ids` pointer in base BTF scenarios. Good, defensive coding. Then, we see that `kernel/bpf/hashtab.c` is being tweaked to reject key-less BTF maps, again, to prevent NULL pointer dereferences later in the `bpffs` dump operation. Finally, there's the addition of selftests.

Now, the crucial question: uninitialized memory risks? Let's go through the checklist. Are we sending kernel structures with garbage data to userspace? Nope. Are we reading uninitialized variables or struct fields, or branching based on them? Not happening here. New memory allocations or buffers introduced? No. Are bounds checks being relaxed in a way that could lead to reading uninitialized memory? No. The bugs being fixed are classic NULL pointer dereferences, which KASAN, and the kernel's normal oops system should catch. So, not KMSAN material.

That takes care of the technical review, but I have to make sure this meets the criteria for skipping KMSAN.

My rule of thumb is: if a bug can be caught by standard detectors like KASAN, LOCKDEP, or similar, we *don't* run a KMSAN session. KMSAN is resource-intensive; we use it only when we have to. The code change does not introduce any risks that KMSAN alone can detect.

Therefore, this is clear: I'll invoke `set-results` with `NeedsKMSAN=false` and provide the reasoning I just laid out.



52/3 2026/08/31 12:48 tool set-results
0m Args:
{
  "KMSANReasoning": "The patch addresses NULL pointer dereferences in BPF BTF type formatting (btf_modifier_show and btf_var_show) and BPF hash map BTF validation (htab_map_check_btf and rhtab_map_check_btf).\n\nSpecifically:\n1. In btf_modifier_show(), it adds a check for NULL btf_type_ops(t) when modifiers resolve to void, falling back to btf_df_show() to avoid NULL pointer dereference.\n2. In btf_var_show(), it checks if btf-\u003eresolved_ids is NULL before resolving, falling back to btf_type_skip_modifiers() to prevent NULL pointer dereference.\n3. In htab_map_check_btf() and rhtab_map_check_btf(), it rejects key-less BTF definitions with -EINVAL to avoid crashes during map dumping.\n\nNone of these changes touch uninitialized memory, modify memory initialization logic, or expose kernel-to-user info-leaks. The bugs addressed are NULL pointer dereferences, which are standard crashes detected without KMSAN. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
  "NeedsKMSAN": false
}

Results:
{
  "KMSANReasoning": "The patch addresses NULL pointer dereferences in BPF BTF type formatting (btf_modifier_show and btf_var_show) and BPF hash map BTF validation (htab_map_check_btf and rhtab_map_check_btf).\n\nSpecifically:\n1. In btf_modifier_show(), it adds a check for NULL btf_type_ops(t) when modifiers resolve to void, falling back to btf_df_show() to avoid NULL pointer dereference.\n2. In btf_var_show(), it checks if btf-\u003eresolved_ids is NULL before resolving, falling back to btf_type_skip_modifiers() to prevent NULL pointer dereference.\n3. In htab_map_check_btf() and rhtab_map_check_btf(), it rejects key-less BTF definitions with -EINVAL to avoid crashes during map dumping.\n\nNone of these changes touch uninitialized memory, modify memory initialization logic, or expose kernel-to-user info-leaks. The bugs addressed are NULL pointer dereferences, which are standard crashes detected without KMSAN. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
  "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)