AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/07/11 19:32 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL",
    "BPF_JIT",
    "DEBUG_INFO_BTF"
  ],
  "FocusSymbols": [
    "bpf_struct_ops_desc_init",
    "bpf_check_attach_target",
    "bpf_check_attach_btf_id_multi",
    "arch_prepare_bpf_trampoline"
  ],
  "Reasoning": "The patch modifies BPF trampoline and struct_ops logic to correctly handle arguments and return values larger than 8 bytes (e.g., __int128). It fixes a bug where the trampoline did not allocate enough registers for large arguments and rejects attaching to functions with \u003e8 byte return values for certain attach types. The changes are functional and reachable from userspace via BPF program loading and attachment.",
  "WorthFuzzing": true
}

1/1 2026/07/11 19:32 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit db607d2567ec443b5f571fab15a95d3142b4c930\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Sat Jul 11 19:32:08 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c\nindex de7515ea1beae8..0b8bd30f7c8700 100644\n--- a/arch/x86/net/bpf_jit_comp.c\n+++ b/arch/x86/net/bpf_jit_comp.c\n@@ -3369,11 +3369,8 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im\n \tWARN_ON_ONCE((flags \u0026 BPF_TRAMP_F_INDIRECT) \u0026\u0026\n \t\t     (flags \u0026 ~(BPF_TRAMP_F_INDIRECT | BPF_TRAMP_F_RET_FENTRY_RET)));\n \n-\t/* extra registers for struct arguments */\n-\tfor (i = 0; i \u003c m-\u003enr_args; i++) {\n-\t\tif (m-\u003earg_flags[i] \u0026 BTF_FMODEL_STRUCT_ARG)\n-\t\t\tnr_regs += (m-\u003earg_size[i] + 7) / 8 - 1;\n-\t}\n+\tfor (i = 0; i \u003c m-\u003enr_args; i++)\n+\t\tnr_regs += (m-\u003earg_size[i] + 7) / 8 - 1;\n \n \t/* x86-64 supports up to MAX_BPF_FUNC_ARGS arguments. 1-6\n \t * are passed through regs, the remains are through stack.\ndiff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c\nindex 51b16e5f5534e0..4e7a48c02be5cd 100644\n--- a/kernel/bpf/bpf_struct_ops.c\n+++ b/kernel/bpf/bpf_struct_ops.c\n@@ -445,6 +445,18 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,\n \t\t\tgoto errout;\n \t\t}\n \n+\t\t/*\n+\t\t * A \u003e8 byte return value is passed back in a register pair,\n+\t\t * which the struct_ops trampoline does not preserve (only\n+\t\t * 8 bytes of the return value are saved and restored).\n+\t\t */\n+\t\tif (st_ops-\u003efunc_models[i].ret_size \u003e 8) {\n+\t\t\tpr_warn(\"func ptr %s in struct %s has a \u003e8 byte return value, which is not supported\\n\",\n+\t\t\t\tmname, st_ops-\u003ename);\n+\t\t\terr = -EOPNOTSUPP;\n+\t\t\tgoto errout;\n+\t\t}\n+\n \t\tstub_func_addr = *(void **)(st_ops-\u003ecfi_stubs + moff);\n \t\terr = prepare_arg_info(btf, st_ops-\u003ename, mname,\n \t\t\t\t       func_proto, stub_func_addr,\ndiff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c\nindex 6515d4d3c0032f..26d281b77a6e72 100644\n--- a/kernel/bpf/verifier.c\n+++ b/kernel/bpf/verifier.c\n@@ -18873,6 +18873,20 @@ static int btf_id_allow_sleepable(u32 btf_id, unsigned long addr, const struct b\n \treturn -EINVAL;\n }\n \n+static bool attach_uses_trampoline_retval(enum bpf_attach_type type)\n+{\n+\tswitch (type) {\n+\tcase BPF_MODIFY_RETURN:\n+\tcase BPF_TRACE_FEXIT:\n+\tcase BPF_TRACE_FEXIT_MULTI:\n+\tcase BPF_TRACE_FSESSION:\n+\tcase BPF_TRACE_FSESSION_MULTI:\n+\t\treturn true;\n+\tdefault:\n+\t\treturn false;\n+\t}\n+}\n+\n int bpf_check_attach_target(struct bpf_verifier_log *log,\n \t\t\t    const struct bpf_prog *prog,\n \t\t\t    const struct bpf_prog *tgt_prog,\n@@ -19137,6 +19151,14 @@ int bpf_check_attach_target(struct bpf_verifier_log *log,\n \t\tif (ret \u003c 0)\n \t\t\treturn ret;\n \n+\t\tif (tgt_info-\u003efmodel.ret_size \u003e 8 \u0026\u0026\n+\t\t    attach_uses_trampoline_retval(prog-\u003eexpected_attach_type)) {\n+\t\t\tbpf_log(log,\n+\t\t\t\t\"Attach to function %s with a \u003e8 byte return value is not supported for this attach type\\n\",\n+\t\t\t\ttname);\n+\t\t\treturn -EOPNOTSUPP;\n+\t\t}\n+\n \t\t/*\n \t\t * *.multi programs don't need an address during program\n \t\t * verification, we just take the module ref if needed.\n@@ -19413,6 +19435,9 @@ int bpf_check_attach_btf_id_multi(struct btf *btf, struct bpf_prog *prog, u32 bt\n \terr = btf_distill_func_proto(NULL, btf, t, tname, \u0026tgt_info-\u003efmodel);\n \tif (err \u003c 0)\n \t\treturn err;\n+\tif (tgt_info-\u003efmodel.ret_size \u003e 8 \u0026\u0026\n+\t    attach_uses_trampoline_retval(prog-\u003eexpected_attach_type))\n+\t\treturn -EOPNOTSUPP;\n \tif (btf_is_module(btf)) {\n \t\t/* The bpf program already holds reference to module. */\n \t\tif (WARN_ON_ONCE(!prog-\u003eaux-\u003emod))\ndiff --git a/tools/testing/selftests/bpf/prog_tests/tracing_failure.c b/tools/testing/selftests/bpf/prog_tests/tracing_failure.c\nindex f9f9e1cb87bf1c..345dd21ad62170 100644\n--- a/tools/testing/selftests/bpf/prog_tests/tracing_failure.c\n+++ b/tools/testing/selftests/bpf/prog_tests/tracing_failure.c\n@@ -76,6 +76,16 @@ static void test_fexit_noreturns(void)\n \t\t\t       \"Attaching fexit/fsession/fmod_ret to __noreturn function 'do_exit' is rejected.\");\n }\n \n+static void test_fexit_int128_ret(void)\n+{\n+#ifdef __SIZEOF_INT128__\n+\ttest_tracing_fail_prog(\"fexit_int128_ret\",\n+\t\t\t       \"with a \u003e8 byte return value is not supported for this attach type\");\n+#else\n+\ttest__skip();\n+#endif\n+}\n+\n void test_tracing_failure(void)\n {\n \tif (test__start_subtest(\"bpf_spin_lock\"))\n@@ -86,4 +96,6 @@ void test_tracing_failure(void)\n \t\ttest_tracing_deny();\n \tif (test__start_subtest(\"fexit_noreturns\"))\n \t\ttest_fexit_noreturns();\n+\tif (test__start_subtest(\"fexit_int128_ret\"))\n+\t\ttest_fexit_int128_ret();\n }\ndiff --git a/tools/testing/selftests/bpf/prog_tests/tracing_struct.c b/tools/testing/selftests/bpf/prog_tests/tracing_struct.c\nindex 6f8c0bfb041559..15b95d0235b522 100644\n--- a/tools/testing/selftests/bpf/prog_tests/tracing_struct.c\n+++ b/tools/testing/selftests/bpf/prog_tests/tracing_struct.c\n@@ -4,6 +4,7 @@\n #include \u003ctest_progs.h\u003e\n #include \"tracing_struct.skel.h\"\n #include \"tracing_struct_many_args.skel.h\"\n+#include \"tracing_struct_int128.skel.h\"\n \n static void test_struct_args(void)\n {\n@@ -112,6 +113,39 @@ static void test_struct_many_args(void)\n \ttracing_struct_many_args__destroy(skel);\n }\n \n+static void test_int128_args(void)\n+{\n+\t/*\n+\t * __int128 arguments are passed in a register pair on x86_64 and\n+\t * arm64, which the trampoline packs into two context slots. Other\n+\t * architectures pass a __int128 differently (e.g. s390x passes larger\n+\t * arguments by reference), so only exercise this on x86_64 and arm64.\n+\t */\n+#if defined(__x86_64__) || defined(__aarch64__)\n+\tstruct tracing_struct_int128 *skel;\n+\tint err;\n+\n+\tskel = tracing_struct_int128__open_and_load();\n+\tif (!ASSERT_OK_PTR(skel, \"tracing_struct_int128__open_and_load\"))\n+\t\treturn;\n+\n+\terr = tracing_struct_int128__attach(skel);\n+\tif (!ASSERT_OK(err, \"tracing_struct_int128__attach\"))\n+\t\tgoto destroy_skel;\n+\n+\tASSERT_OK(trigger_module_test_read(256), \"trigger_read\");\n+\n+\tASSERT_EQ(skel-\u003ebss-\u003et_b, 2, \"t:b\");\n+\tASSERT_EQ(skel-\u003ebss-\u003et_c, 3, \"t:c\");\n+\tASSERT_EQ(skel-\u003ebss-\u003et_ret, 6, \"t ret\");\n+\n+destroy_skel:\n+\ttracing_struct_int128__destroy(skel);\n+#else\n+\ttest__skip();\n+#endif\n+}\n+\n static void test_union_args(void)\n {\n \tstruct tracing_struct *skel;\n@@ -145,6 +179,8 @@ void test_tracing_struct(void)\n \t\ttest_struct_args();\n \tif (test__start_subtest(\"struct_many_args\"))\n \t\ttest_struct_many_args();\n+\tif (test__start_subtest(\"int128_args\"))\n+\t\ttest_int128_args();\n \tif (test__start_subtest(\"union_args\"))\n \t\ttest_union_args();\n }\ndiff --git a/tools/testing/selftests/bpf/progs/tracing_failure.c b/tools/testing/selftests/bpf/progs/tracing_failure.c\nindex 65e485c4468c62..f7a09576767954 100644\n--- a/tools/testing/selftests/bpf/progs/tracing_failure.c\n+++ b/tools/testing/selftests/bpf/progs/tracing_failure.c\n@@ -30,3 +30,9 @@ int BPF_PROG(fexit_noreturns)\n {\n \treturn 0;\n }\n+\n+SEC(\"?fexit/bpf_testmod_test_int128_ret\")\n+int BPF_PROG(fexit_int128_ret)\n+{\n+\treturn 0;\n+}\ndiff --git a/tools/testing/selftests/bpf/progs/tracing_struct_int128.c b/tools/testing/selftests/bpf/progs/tracing_struct_int128.c\nnew file mode 100644\nindex 00000000000000..4638dfec1f38ef\n--- /dev/null\n+++ b/tools/testing/selftests/bpf/progs/tracing_struct_int128.c\n@@ -0,0 +1,18 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */\n+#include \u003cvmlinux.h\u003e\n+#include \u003cbpf/bpf_tracing.h\u003e\n+#include \u003cbpf/bpf_helpers.h\u003e\n+\n+long t_b, t_c, t_ret;\n+\n+SEC(\"fexit/bpf_testmod_test_int128_arg\")\n+int test_int128_arg_fexit(unsigned long long *ctx)\n+{\n+\tt_b = (int)ctx[2];\n+\tt_c = (long)ctx[3];\n+\tt_ret = (long)ctx[4];\n+\treturn 0;\n+}\n+\n+char _license[] SEC(\"license\") = \"GPL\";\ndiff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c\nindex 30f1cd23093cbe..eb0f9b5e18d85f 100644\n--- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c\n+++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c\n@@ -161,6 +161,33 @@ bpf_testmod_test_arg_ptr_to_struct(struct bpf_testmod_struct_arg_1 *a) {\n \treturn bpf_testmod_test_struct_arg_result;\n }\n \n+#ifdef __SIZEOF_INT128__\n+noinline __int128\n+bpf_testmod_test_int128_ret(int a)\n+{\n+\tbpf_testmod_test_struct_arg_result = a;\n+\treturn (__int128)a;\n+}\n+\n+/*\n+ * The __int128 'a' is the first argument on purpose. On arm64 a 16-byte\n+ * argument must start in an even-numbered register pair, so placing it\n+ * after a single-register scalar would leave a padding register (x1)\n+ * unused. pahole maps parameters to registers positionally and would then\n+ * see the following argument in an \"unexpected\" register and skip BTF\n+ * encoding of the whole function, making it unattachable. Keeping the\n+ * __int128 first (x0:x1) avoids the padding while still exercising the\n+ * trampoline packing of a 128-bit argument together with the trailing\n+ * int and long arguments.\n+ */\n+noinline long\n+bpf_testmod_test_int128_arg(__int128 a, int b, long c)\n+{\n+\tbpf_testmod_test_struct_arg_result = (long)a + b + c;\n+\treturn bpf_testmod_test_struct_arg_result;\n+}\n+#endif\n+\n __weak noinline void bpf_testmod_looooooooooooooooooooooooooooooong_name(void)\n {\n }\n@@ -514,6 +541,11 @@ bpf_testmod_test_read(struct file *file, struct kobject *kobj,\n \n \t(void)bpf_testmod_test_arg_ptr_to_struct(\u0026struct_arg1_2);\n \n+#ifdef __SIZEOF_INT128__\n+\t(void)bpf_testmod_test_int128_ret(i);\n+\t(void)bpf_testmod_test_int128_arg((__int128)1, 2, 3);\n+#endif\n+\n \t(void)trace_bpf_testmod_test_raw_tp_null_tp(NULL);\n \n \tbpf_testmod_test_struct_ops3();\n"
}

2/1 2026/07/11 19:32 agent patch-evaluator
1m Model:
gemini-3.1-pro-preview

Args:
null

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL",
    "BPF_JIT",
    "DEBUG_INFO_BTF"
  ],
  "FocusSymbols": [
    "bpf_struct_ops_desc_init",
    "bpf_check_attach_target",
    "bpf_check_attach_btf_id_multi",
    "arch_prepare_bpf_trampoline"
  ],
  "Reasoning": "The patch modifies BPF trampoline and struct_ops logic to correctly handle arguments and return values larger than 8 bytes (e.g., __int128). It fixes a bug where the trampoline did not allocate enough registers for large arguments and rejects attaching to functions with \u003e8 byte return values for certain attach types. The changes are functional and reachable from userspace via BPF program loading and attachment.",
  "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).

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.
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.
   Do not list too generic configs (we already have them enabled). Only list those that
   specifically cover the modified code. 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 db607d2567ec443b5f571fab15a95d3142b4c930
Author: syz-cluster <triage@syzkaller.com>
Date:   Sat Jul 11 19:32:08 2026 +0000

    syz-cluster: applied patch under review

diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index de7515ea1beae8..0b8bd30f7c8700 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -3369,11 +3369,8 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im
 	WARN_ON_ONCE((flags & BPF_TRAMP_F_INDIRECT) &&
 		     (flags & ~(BPF_TRAMP_F_INDIRECT | BPF_TRAMP_F_RET_FENTRY_RET)));
 
-	/* extra registers for struct arguments */
-	for (i = 0; i < m->nr_args; i++) {
-		if (m->arg_flags[i] & BTF_FMODEL_STRUCT_ARG)
-			nr_regs += (m->arg_size[i] + 7) / 8 - 1;
-	}
+	for (i = 0; i < m->nr_args; i++)
+		nr_regs += (m->arg_size[i] + 7) / 8 - 1;
 
 	/* x86-64 supports up to MAX_BPF_FUNC_ARGS arguments. 1-6
 	 * are passed through regs, the remains are through stack.
diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c
index 51b16e5f5534e0..4e7a48c02be5cd 100644
--- a/kernel/bpf/bpf_struct_ops.c
+++ b/kernel/bpf/bpf_struct_ops.c
@@ -445,6 +445,18 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
 			goto errout;
 		}
 
+		/*
+		 * A >8 byte return value is passed back in a register pair,
+		 * which the struct_ops trampoline does not preserve (only
+		 * 8 bytes of the return value are saved and restored).
+		 */
+		if (st_ops->func_models[i].ret_size > 8) {
+			pr_warn("func ptr %s in struct %s has a >8 byte return value, which is not supported\n",
+				mname, st_ops->name);
+			err = -EOPNOTSUPP;
+			goto errout;
+		}
+
 		stub_func_addr = *(void **)(st_ops->cfi_stubs + moff);
 		err = prepare_arg_info(btf, st_ops->name, mname,
 				       func_proto, stub_func_addr,
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 6515d4d3c0032f..26d281b77a6e72 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -18873,6 +18873,20 @@ static int btf_id_allow_sleepable(u32 btf_id, unsigned long addr, const struct b
 	return -EINVAL;
 }
 
+static bool attach_uses_trampoline_retval(enum bpf_attach_type type)
+{
+	switch (type) {
+	case BPF_MODIFY_RETURN:
+	case BPF_TRACE_FEXIT:
+	case BPF_TRACE_FEXIT_MULTI:
+	case BPF_TRACE_FSESSION:
+	case BPF_TRACE_FSESSION_MULTI:
+		return true;
+	default:
+		return false;
+	}
+}
+
 int bpf_check_attach_target(struct bpf_verifier_log *log,
 			    const struct bpf_prog *prog,
 			    const struct bpf_prog *tgt_prog,
@@ -19137,6 +19151,14 @@ int bpf_check_attach_target(struct bpf_verifier_log *log,
 		if (ret < 0)
 			return ret;
 
+		if (tgt_info->fmodel.ret_size > 8 &&
+		    attach_uses_trampoline_retval(prog->expected_attach_type)) {
+			bpf_log(log,
+				"Attach to function %s with a >8 byte return value is not supported for this attach type\n",
+				tname);
+			return -EOPNOTSUPP;
+		}
+
 		/*
 		 * *.multi programs don't need an address during program
 		 * verification, we just take the module ref if needed.
@@ -19413,6 +19435,9 @@ int bpf_check_attach_btf_id_multi(struct btf *btf, struct bpf_prog *prog, u32 bt
 	err = btf_distill_func_proto(NULL, btf, t, tname, &tgt_info->fmodel);
 	if (err < 0)
 		return err;
+	if (tgt_info->fmodel.ret_size > 8 &&
+	    attach_uses_trampoline_retval(prog->expected_attach_type))
+		return -EOPNOTSUPP;
 	if (btf_is_module(btf)) {
 		/* The bpf program already holds reference to module. */
 		if (WARN_ON_ONCE(!prog->aux->mod))
diff --git a/tools/testing/selftests/bpf/prog_tests/tracing_failure.c b/tools/testing/selftests/bpf/prog_tests/tracing_failure.c
index f9f9e1cb87bf1c..345dd21ad62170 100644
--- a/tools/testing/selftests/bpf/prog_tests/tracing_failure.c
+++ b/tools/testing/selftests/bpf/prog_tests/tracing_failure.c
@@ -76,6 +76,16 @@ static void test_fexit_noreturns(void)
 			       "Attaching fexit/fsession/fmod_ret to __noreturn function 'do_exit' is rejected.");
 }
 
+static void test_fexit_int128_ret(void)
+{
+#ifdef __SIZEOF_INT128__
+	test_tracing_fail_prog("fexit_int128_ret",
+			       "with a >8 byte return value is not supported for this attach type");
+#else
+	test__skip();
+#endif
+}
+
 void test_tracing_failure(void)
 {
 	if (test__start_subtest("bpf_spin_lock"))
@@ -86,4 +96,6 @@ void test_tracing_failure(void)
 		test_tracing_deny();
 	if (test__start_subtest("fexit_noreturns"))
 		test_fexit_noreturns();
+	if (test__start_subtest("fexit_int128_ret"))
+		test_fexit_int128_ret();
 }
diff --git a/tools/testing/selftests/bpf/prog_tests/tracing_struct.c b/tools/testing/selftests/bpf/prog_tests/tracing_struct.c
index 6f8c0bfb041559..15b95d0235b522 100644
--- a/tools/testing/selftests/bpf/prog_tests/tracing_struct.c
+++ b/tools/testing/selftests/bpf/prog_tests/tracing_struct.c
@@ -4,6 +4,7 @@
 #include <test_progs.h>
 #include "tracing_struct.skel.h"
 #include "tracing_struct_many_args.skel.h"
+#include "tracing_struct_int128.skel.h"
 
 static void test_struct_args(void)
 {
@@ -112,6 +113,39 @@ static void test_struct_many_args(void)
 	tracing_struct_many_args__destroy(skel);
 }
 
+static void test_int128_args(void)
+{
+	/*
+	 * __int128 arguments are passed in a register pair on x86_64 and
+	 * arm64, which the trampoline packs into two context slots. Other
+	 * architectures pass a __int128 differently (e.g. s390x passes larger
+	 * arguments by reference), so only exercise this on x86_64 and arm64.
+	 */
+#if defined(__x86_64__) || defined(__aarch64__)
+	struct tracing_struct_int128 *skel;
+	int err;
+
+	skel = tracing_struct_int128__open_and_load();
+	if (!ASSERT_OK_PTR(skel, "tracing_struct_int128__open_and_load"))
+		return;
+
+	err = tracing_struct_int128__attach(skel);
+	if (!ASSERT_OK(err, "tracing_struct_int128__attach"))
+		goto destroy_skel;
+
+	ASSERT_OK(trigger_module_test_read(256), "trigger_read");
+
+	ASSERT_EQ(skel->bss->t_b, 2, "t:b");
+	ASSERT_EQ(skel->bss->t_c, 3, "t:c");
+	ASSERT_EQ(skel->bss->t_ret, 6, "t ret");
+
+destroy_skel:
+	tracing_struct_int128__destroy(skel);
+#else
+	test__skip();
+#endif
+}
+
 static void test_union_args(void)
 {
 	struct tracing_struct *skel;
@@ -145,6 +179,8 @@ void test_tracing_struct(void)
 		test_struct_args();
 	if (test__start_subtest("struct_many_args"))
 		test_struct_many_args();
+	if (test__start_subtest("int128_args"))
+		test_int128_args();
 	if (test__start_subtest("union_args"))
 		test_union_args();
 }
diff --git a/tools/testing/selftests/bpf/progs/tracing_failure.c b/tools/testing/selftests/bpf/progs/tracing_failure.c
index 65e485c4468c62..f7a09576767954 100644
--- a/tools/testing/selftests/bpf/progs/tracing_failure.c
+++ b/tools/testing/selftests/bpf/progs/tracing_failure.c
@@ -30,3 +30,9 @@ int BPF_PROG(fexit_noreturns)
 {
 	return 0;
 }
+
+SEC("?fexit/bpf_testmod_test_int128_ret")
+int BPF_PROG(fexit_int128_ret)
+{
+	return 0;
+}
diff --git a/tools/testing/selftests/bpf/progs/tracing_struct_int128.c b/tools/testing/selftests/bpf/progs/tracing_struct_int128.c
new file mode 100644
index 00000000000000..4638dfec1f38ef
--- /dev/null
+++ b/tools/testing/selftests/bpf/progs/tracing_struct_int128.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */
+#include <vmlinux.h>
+#include <bpf/bpf_tracing.h>
+#include <bpf/bpf_helpers.h>
+
+long t_b, t_c, t_ret;
+
+SEC("fexit/bpf_testmod_test_int128_arg")
+int test_int128_arg_fexit(unsigned long long *ctx)
+{
+	t_b = (int)ctx[2];
+	t_c = (long)ctx[3];
+	t_ret = (long)ctx[4];
+	return 0;
+}
+
+char _license[] SEC("license") = "GPL";
diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
index 30f1cd23093cbe..eb0f9b5e18d85f 100644
--- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
+++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
@@ -161,6 +161,33 @@ bpf_testmod_test_arg_ptr_to_struct(struct bpf_testmod_struct_arg_1 *a) {
 	return bpf_testmod_test_struct_arg_result;
 }
 
+#ifdef __SIZEOF_INT128__
+noinline __int128
+bpf_testmod_test_int128_ret(int a)
+{
+	bpf_testmod_test_struct_arg_result = a;
+	return (__int128)a;
+}
+
+/*
+ * The __int128 'a' is the first argument on purpose. On arm64 a 16-byte
+ * argument must start in an even-numbered register pair, so placing it
+ * after a single-register scalar would leave a padding register (x1)
+ * unused. pahole maps parameters to registers positionally and would then
+ * see the following argument in an "unexpected" register and skip BTF
+ * encoding of the whole function, making it unattachable. Keeping the
+ * __int128 first (x0:x1) avoids the padding while still exercising the
+ * trampoline packing of a 128-bit argument together with the trailing
+ * int and long arguments.
+ */
+noinline long
+bpf_testmod_test_int128_arg(__int128 a, int b, long c)
+{
+	bpf_testmod_test_struct_arg_result = (long)a + b + c;
+	return bpf_testmod_test_struct_arg_result;
+}
+#endif
+
 __weak noinline void bpf_testmod_looooooooooooooooooooooooooooooong_name(void)
 {
 }
@@ -514,6 +541,11 @@ bpf_testmod_test_read(struct file *file, struct kobject *kobj,
 
 	(void)bpf_testmod_test_arg_ptr_to_struct(&struct_arg1_2);
 
+#ifdef __SIZEOF_INT128__
+	(void)bpf_testmod_test_int128_ret(i);
+	(void)bpf_testmod_test_int128_arg((__int128)1, 2, 3);
+#endif
+
 	(void)trace_bpf_testmod_test_raw_tp_null_tp(NULL);
 
 	bpf_testmod_test_struct_ops3();

3/2 2026/07/11 19:32 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 5671
							output: 24
							thoughts: 967
						

Thoughts:
**Analyzing the BPF Subsystem Change**

Okay, so I've got this patch in front of me, and it's touching the BPF subsystem, specifically the handling of large arguments and return values in BPF trampolines and struct ops. The key idea here is to correctly handle values larger than 8 bytes, like `__int128` or sizable structs, which are now being addressed. Let's break it down:

First, in `arch/x86/net/bpf_jit_comp.c`, the change in `__arch_prepare_bpf_trampoline` is significant. The code now unconditionally allocates extra registers for any argument larger than 8 bytes, as opposed to only for struct arguments. This is a fundamental fix for the original logic.

Then, looking at `kernel/bpf/verifier.c`, there's a new `attach_uses_trampoline_retval` function that essentially gates the attachment to functions based on return size for certain attach types like `BPF_MODIFY_RETURN` and `BPF_TRACE_FEXIT`. This prevents attaching to functions that would generate incorrect return sizes if the size exceeds 8 bytes.

This seems like a solid candidate for fuzzing to ensure it handles these edge cases correctly and doesn't introduce any regressions or security holes.

I'm thinking the focus symbols for fuzzing should be:
*   `__arch_prepare_bpf_trampoline`. I believe this is good because it’s called during the loading and attaching of BPF programs, which is not an execution bottleneck.
*   `bpf_struct_ops_desc_init` – for BPF struct_ops registration.
*   `bpf_check_attach_target` and `bpf_check_attach_btf_id_multi` – because these are called during BPF program verification.

I should also make sure the relevant BPF configurations are enabled. We're looking at `CONFIG_BPF_SYSCALL`, `CONFIG_BPF_JIT`, and `CONFIG_DEBUG_INFO_BTF`.

Finally, I'll double-check `kernel/bpf/bpf_struct_ops.c` and `kernel/bpf/verifier.c` to see if those depend on the BPF configurations, by using `grepper`.



4/2 2026/07/11 19:32 tool grepper
0m Args:
{
  "Expression": "bpf_struct_ops_desc_init"
}

Results:
{
  "Output": "include/linux/bpf.h=2262=int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,\n--\ninclude/linux/bpf.h-2264-#endif\ninclude/linux/bpf.h:2265:int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,\ninclude/linux/bpf.h-2266-\t\t\t     struct btf *btf,\n--\nkernel/bpf/bpf_struct_ops.c=324=int bpf_struct_ops_supported(const struct bpf_struct_ops *st_ops, u32 moff)\n--\nkernel/bpf/bpf_struct_ops.c-330-\nkernel/bpf/bpf_struct_ops.c:331:int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,\nkernel/bpf/bpf_struct_ops.c-332-\t\t\t     struct btf *btf,\n--\nkernel/bpf/btf.c=9835=btf_add_struct_ops(struct btf *btf, struct bpf_struct_ops *st_ops,\n--\nkernel/bpf/btf.c-9866-\nkernel/bpf/btf.c:9867:\terr = bpf_struct_ops_desc_init(\u0026tab-\u003eops[btf-\u003estruct_ops_tab-\u003ecnt], btf, log);\nkernel/bpf/btf.c-9868-\tif (err)\n"
}

5/2 2026/07/11 19:32 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 7586
							output: 24
							thoughts: 33
						

Thoughts:
Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts:

**Analyzing BPF Verification and JIT Compilation**

Alright, I need to get a handle on how BPF bytecode gets verified and then potentially Just-In-Time compiled. The core of this process, the first thing that jumps out is the need to examine the verification process and the JIT compilation process. Therefore, I need to check two specific files: `kernel/bpf/verifier.c` and `arch/x86/net/bpf_jit_comp.c`. I know that `verifier.c` should contain the logic to analyze the BPF bytecode for safety and adherence to rules before it's executed in the kernel. This is critical for preventing crashes and security vulnerabilities. On the other hand, `bpf_jit_comp.c` is likely where the actual JIT compilation happens, specifically for the x86 architecture, translating the BPF instructions into native x86 machine code for faster execution. So, understanding the interaction between these two files is key. I'll start with the verifier, but I need to keep in mind that the JIT compiler will have its own expectations and assumptions based on what the verifier allows. The compilation might fail or be suboptimal if the verifier doesn't enforce the right constraints. Let's see what we can find.



6/2 2026/07/11 19:32 tool grepper
0m Args:
{
  "Expression": "__arch_prepare_bpf_trampoline"
}

Results:
{
  "Output": "arch/loongarch/net/bpf_jit.c=1809=static void sign_extend(struct jit_ctx *ctx, int rd, int rj, u8 size, bool sign)\n--\narch/loongarch/net/bpf_jit.c-1836-\narch/loongarch/net/bpf_jit.c:1837:static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,\narch/loongarch/net/bpf_jit.c-1838-\t\t\t\t\t const struct btf_func_model *m, struct bpf_tramp_nodes *tnodes,\n--\narch/loongarch/net/bpf_jit.c=2144=int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *ro_image,\n--\narch/loongarch/net/bpf_jit.c-2161-\tjit_fill_hole(image, (unsigned int)(ro_image_end - ro_image));\narch/loongarch/net/bpf_jit.c:2162:\tret = __arch_prepare_bpf_trampoline(\u0026ctx, im, m, tnodes, func_addr, flags);\narch/loongarch/net/bpf_jit.c-2163-\tif (ret \u003c 0)\n--\narch/loongarch/net/bpf_jit.c=2182=int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,\n--\narch/loongarch/net/bpf_jit.c-2191-\narch/loongarch/net/bpf_jit.c:2192:\tret = __arch_prepare_bpf_trampoline(\u0026ctx, \u0026im, m, tnodes, func_addr, flags);\narch/loongarch/net/bpf_jit.c-2193-\n--\narch/powerpc/net/bpf_jit_comp.c=686=static int invoke_bpf_mod_ret(u32 *image, u32 *ro_image, struct codegen_context *ctx,\n--\narch/powerpc/net/bpf_jit_comp.c-723-/*\narch/powerpc/net/bpf_jit_comp.c:724: * Refer __arch_prepare_bpf_trampoline() for stack component details.\narch/powerpc/net/bpf_jit_comp.c-725- *\n--\narch/powerpc/net/bpf_jit_comp.c=797=static void bpf_trampoline_restore_args_stack(u32 *image, struct codegen_context *ctx,\n--\narch/powerpc/net/bpf_jit_comp.c-811-\narch/powerpc/net/bpf_jit_comp.c:812:static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_image,\narch/powerpc/net/bpf_jit_comp.c-813-\t\t\t\t\t void *rw_image_end, void *ro_image,\n--\narch/powerpc/net/bpf_jit_comp.c=1192=int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,\n--\narch/powerpc/net/bpf_jit_comp.c-1197-\narch/powerpc/net/bpf_jit_comp.c:1198:\tret = __arch_prepare_bpf_trampoline(\u0026im, NULL, NULL, NULL, m, flags, tnodes, func_addr);\narch/powerpc/net/bpf_jit_comp.c-1199-\treturn ret;\n--\narch/powerpc/net/bpf_jit_comp.c=1202=int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end,\n--\narch/powerpc/net/bpf_jit_comp.c-1218-\narch/powerpc/net/bpf_jit_comp.c:1219:\tret = __arch_prepare_bpf_trampoline(im, rw_image, rw_image + size, image, m,\narch/powerpc/net/bpf_jit_comp.c-1220-\t\t\t\t\t    flags, tnodes, func_addr);\n--\narch/riscv/net/bpf_jit_comp64.c=999=static int invoke_bpf(struct bpf_tramp_nodes *tn, int args_off, int retval_off,\n--\narch/riscv/net/bpf_jit_comp64.c-1021-\narch/riscv/net/bpf_jit_comp64.c:1022:static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,\narch/riscv/net/bpf_jit_comp64.c-1023-\t\t\t\t\t const struct btf_func_model *m,\n--\narch/riscv/net/bpf_jit_comp64.c=1307=int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,\n--\narch/riscv/net/bpf_jit_comp64.c-1316-\tctx.ro_insns = NULL;\narch/riscv/net/bpf_jit_comp64.c:1317:\tret = __arch_prepare_bpf_trampoline(\u0026im, m, tnodes, func_addr, flags, \u0026ctx);\narch/riscv/net/bpf_jit_comp64.c-1318-\n--\narch/riscv/net/bpf_jit_comp64.c=1332=int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *ro_image,\n--\narch/riscv/net/bpf_jit_comp64.c-1348-\tctx.ro_insns = ro_image;\narch/riscv/net/bpf_jit_comp64.c:1349:\tret = __arch_prepare_bpf_trampoline(im, m, tnodes, func_addr, flags, \u0026ctx);\narch/riscv/net/bpf_jit_comp64.c-1350-\tif (ret \u003c 0)\n--\narch/s390/net/bpf_jit_comp.c=2632=static int alloc_stack(struct bpf_tramp_jit *tjit, size_t size)\n--\narch/s390/net/bpf_jit_comp.c-2649-\narch/s390/net/bpf_jit_comp.c:2650:static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im,\narch/s390/net/bpf_jit_comp.c-2651-\t\t\t\t\t struct bpf_tramp_jit *tjit,\n--\narch/s390/net/bpf_jit_comp.c=2966=int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,\n--\narch/s390/net/bpf_jit_comp.c-2974-\narch/s390/net/bpf_jit_comp.c:2975:\tret = __arch_prepare_bpf_trampoline(\u0026im, \u0026tjit, m, flags,\narch/s390/net/bpf_jit_comp.c-2976-\t\t\t\t\t    tnodes, orig_call);\n--\narch/s390/net/bpf_jit_comp.c=2981=int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,\n--\narch/s390/net/bpf_jit_comp.c-2990-\tmemset(\u0026tjit, 0, sizeof(tjit));\narch/s390/net/bpf_jit_comp.c:2991:\tret = __arch_prepare_bpf_trampoline(im, \u0026tjit, m, flags,\narch/s390/net/bpf_jit_comp.c-2992-\t\t\t\t\t    tnodes, func_addr);\n--\narch/s390/net/bpf_jit_comp.c-3004-\ttjit.common.prg_buf = image;\narch/s390/net/bpf_jit_comp.c:3005:\tret = __arch_prepare_bpf_trampoline(im, \u0026tjit, m, flags,\narch/s390/net/bpf_jit_comp.c-3006-\t\t\t\t\t    tnodes, func_addr);\n--\narch/x86/net/bpf_jit_comp.c=3244=static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog,\n--\narch/x86/net/bpf_jit_comp.c-3345- */\narch/x86/net/bpf_jit_comp.c:3346:static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_image,\narch/x86/net/bpf_jit_comp.c-3347-\t\t\t\t\t void *rw_image_end, void *image,\n--\narch/x86/net/bpf_jit_comp.c=3666=int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end,\n--\narch/x86/net/bpf_jit_comp.c-3681-\narch/x86/net/bpf_jit_comp.c:3682:\tret = __arch_prepare_bpf_trampoline(im, rw_image, rw_image + size, image, m,\narch/x86/net/bpf_jit_comp.c-3683-\t\t\t\t\t    flags, tnodes, func_addr);\n--\narch/x86/net/bpf_jit_comp.c=3695=int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,\n--\narch/x86/net/bpf_jit_comp.c-3701-\narch/x86/net/bpf_jit_comp.c:3702:\t/* Allocate a temporary buffer for __arch_prepare_bpf_trampoline().\narch/x86/net/bpf_jit_comp.c-3703-\t * This will NOT cause fragmentation in direct map, as we do not\n--\narch/x86/net/bpf_jit_comp.c-3712-\narch/x86/net/bpf_jit_comp.c:3713:\tret = __arch_prepare_bpf_trampoline(\u0026im, image, image + PAGE_SIZE, image,\narch/x86/net/bpf_jit_comp.c-3714-\t\t\t\t\t    m, flags, tnodes, func_addr);\n"
}

7/2 2026/07/11 19:32 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 10791
							output: 21
							thoughts: 87
						

Thoughts:
Okay, let's see, I need to get this BPF trampoline setup right. I'm going to need to enable a few key configurations in the kernel. First, obviously, I need `BPF_SYSCALL` – that's fundamental. Then, `BPF_JIT` for Just-In-Time compilation, can't really do much without that. The `DEBUG_INFO_BTF` option is also crucial for debugging and introspection with BTF (BPF Type Format). And since this *is* about BPF trampolines, I'm going to need `FTRACE`. Finally, and this is important, I will need `DYNAMIC_FTRACE_WITH_DIRECT_CALLS` so that the BPF trampolines function correctly. That should be a good start. Time to double-check that this is correct.



8/2 2026/07/11 19:32 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "config BPF_TRAMP"
}

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

9/2 2026/07/11 19:32 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 11092
							output: 20
							thoughts: 27
						

Thoughts:
Okay, here's my take on those thoughts, framed as a first-person expert summary:

**Kernel Configuration Hunting: Where to Find the Trampoline?**

Alright, so I'm looking for the configuration options related to a trampoline, presumably something used in the context of BPF or possibly even architecture-specific features. My first instinct, given the likely involvement of BPF, is to dive straight into `kernel/bpf/Kconfig`. That's the logical starting point. It's the central hub for anything related to Berkeley Packet Filter within the kernel. I'd expect to find something there, potentially related to enabling or disabling trampoline functionality within the BPF subsystem.

However, a trampoline could also be a very specific architectural feature. If it's x86-specific, or uses x86 hardware capabilities, then I'll immediately shift my attention to `arch/x86/Kconfig`. That would be where I'd anticipate finding configuration options related to it, particularly if it's tied to things like CPU features, specific instructions, or memory management.

Basically, I'm thinking about two distinct paths here. BPF is my first guess, but x86 is a very strong contender, depending on the particular context of this "trampoline" implementation. Both of those locations are my go-to starting points for kernel configuration related to those concerns.



10/2 2026/07/11 19:32 tool grepper
0m Args:
{
  "Expression": "config BPF_JIT"
}

Results:
{
  "Output": "kernel/bpf/Kconfig=27=config BPF_SYSCALL\n--\nkernel/bpf/Kconfig-41-\nkernel/bpf/Kconfig:42:config BPF_JIT\nkernel/bpf/Kconfig-43-\tbool \"Enable BPF Just In Time compiler\"\n--\nkernel/bpf/Kconfig-57-\nkernel/bpf/Kconfig:58:config BPF_JIT_ALWAYS_ON\nkernel/bpf/Kconfig-59-\tbool \"Permanently enable BPF JIT and remove BPF interpreter\"\n--\nkernel/bpf/Kconfig-68-\nkernel/bpf/Kconfig:69:config BPF_JIT_DEFAULT_ON\nkernel/bpf/Kconfig-70-\tdef_bool ARCH_WANT_DEFAULT_BPF_JIT || BPF_JIT_ALWAYS_ON\n"
}

11/2 2026/07/11 19:32 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 11653
							output: 22
							thoughts: 16
						

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

**Diving into the BPF Verifier Configuration**

Alright, time to get my hands dirty. I'm going to jump straight into `kernel/bpf/verifier.c`. Specifically, I need to understand the configuration aspects related to the BPF verifier. I'm not looking for a high-level overview; I need to dig deep into the knobs and levers available. I'm thinking about the compile-time options, runtime parameters, and any debug flags that control its behavior. Specifically I want to see how these configurations impact its safety guarantees and performance characteristics. I suspect there are some hidden gems in there regarding the trade-offs it makes to avoid overly aggressive verification that might impact performance. Time to check the includes, macro definitions, and conditional compilation blocks within the file – that's where the real meat of the configuration will be. I'm especially interested in anything related to feature gating or enabling/disabling specific verification checks. This is the starting point for really optimizing BPF programs.



12/2 2026/07/11 19:32 tool grepper
0m Args:
{
  "Expression": "bpf_check_attach_target"
}

Results:
{
  "Output": "include/linux/bpf_verifier.h=1161=int bpf_check_btf_info(struct bpf_verifier_env *env,\n--\ninclude/linux/bpf_verifier.h-1163-\ninclude/linux/bpf_verifier.h:1164:int bpf_check_attach_target(struct bpf_verifier_log *log,\ninclude/linux/bpf_verifier.h-1165-\t\t\t    const struct bpf_prog *prog,\n--\nkernel/bpf/btf.c=6848=bool btf_ctx_access(int off, int size, enum bpf_access_type type,\n--\nkernel/bpf/btf.c-7025-\t\t\treturn false;\nkernel/bpf/btf.c:7026:\t\t/* Checked by bpf_check_attach_target */\nkernel/bpf/btf.c-7027-\t\ttname += sizeof(\"btf_trace_\") - 1;\n--\nkernel/bpf/syscall.c=3689=static int bpf_tracing_prog_attach(struct bpf_prog *prog,\n--\nkernel/bpf/syscall.c-3821-\nkernel/bpf/syscall.c:3822:\t\terr = bpf_check_attach_target(NULL, prog, tgt_prog, btf_id,\nkernel/bpf/syscall.c-3823-\t\t\t\t\t      \u0026tgt_info);\n--\nkernel/bpf/trampoline.c=1076=int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,\n--\nkernel/bpf/trampoline.c-1086-\nkernel/bpf/trampoline.c:1087:\terr = bpf_check_attach_target(NULL, prog, NULL,\nkernel/bpf/trampoline.c-1088-\t\t\t\t      prog-\u003eaux-\u003eattach_btf_id,\n--\nkernel/bpf/verifier.c=11888=static int process_kf_arg_ptr_to_rbtree_node(struct bpf_verifier_env *env,\n--\nkernel/bpf/verifier.c-11899- * LSM hooks and iters (both sleepable and non-sleepable) are safe.\nkernel/bpf/verifier.c:11900: * Any sleepable progs are also safe since bpf_check_attach_target() enforce\nkernel/bpf/verifier.c-11901- * them can only be attached to some specific hook points.\n--\nkernel/bpf/verifier.c=18876=static bool attach_uses_trampoline_retval(enum bpf_attach_type type)\n--\nkernel/bpf/verifier.c-18889-\nkernel/bpf/verifier.c:18890:int bpf_check_attach_target(struct bpf_verifier_log *log,\nkernel/bpf/verifier.c-18891-\t\t\t    const struct bpf_prog *prog,\n--\nkernel/bpf/verifier.c=19303=static int check_attach_btf_id(struct bpf_verifier_env *env)\n--\nkernel/bpf/verifier.c-19333-\nkernel/bpf/verifier.c:19334:\tret = bpf_check_attach_target(\u0026env-\u003elog, prog, tgt_prog, btf_id, \u0026tgt_info);\nkernel/bpf/verifier.c-19335-\tif (ret)\n"
}

13/2 2026/07/11 19:32 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 12802
							output: 21
							thoughts: 223
						

Thoughts:
**My BPF Implementation Deep Dive**

Okay, let's break down this BPF stuff, focusing on some specific symbols and configurations. I'm zeroing in on `bpf_struct_ops_desc_init`, `bpf_check_attach_target`, and `bpf_check_attach_btf_id_multi`, as well as those key configs: `BPF_SYSCALL`, `BPF_JIT`, and `DEBUG_INFO_BTF`.

First, `bpf_struct_ops_desc_init`... is that even reachable? Ah, yes, it’s clearly accessible through `bpf_struct_ops_supported` and `btf_add_struct_ops`. That makes sense; it's right in the heart of BTF parsing and struct_ops registration. 

Now, on to `bpf_check_attach_target`. I remember this one; it gets invoked during both BPF program verification *and* during the attach process. Same with `bpf_check_attach_btf_id_multi`; that's another critical check during verification. So the verification process is pretty thorough.

Hmm, what else might be important config-wise? Wait... `FTRACE`! That's almost always a key dependency when working with BPF trampolines. I should probably double-check the dependencies of `kernel/bpf/trampoline.c` to make sure nothing has changed recently. These can be tricky and easy to miss on quick reviews.



14/2 2026/07/11 19:32 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "config BPF_TRAMP"
}

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

15/2 2026/07/11 19:32 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 13386
							output: 18
							thoughts: 19
						

Thoughts:
Okay, here's my thought process rendered in the first person, assuming I'm an expert:

**Locating the Trampoline Object File**

Alright, I need to find where the `trampoline.o` object file is defined within the BPF kernel build process. Given the context, the logical starting point is the `kernel/bpf/Makefile`. This is where the core BPF-related compilation is likely controlled, so that's where I should be able to pinpoint its creation. I will check for this now.



16/2 2026/07/11 19:32 tool grepper
0m Args:
{
  "Expression": "trampoline.o"
}

Results:
{
  "Output": "Documentation/livepatch/reliable-stacktrace.rst=179=information is not in a consistent location for the duration of the entry\nDocumentation/livepatch/reliable-stacktrace.rst:180:trampoline or return trampoline. For example, considering the x86_64\nDocumentation/livepatch/reliable-stacktrace.rst-181-'return_to_handler' return trampoline:\n--\narch/arc/include/uapi/asm/signal.h-18- * which allows sigreturn based re-entry into kernel after handling signal.\narch/arc/include/uapi/asm/signal.h:19: * W/o this kernel needs to \"synthesize\" the sigreturn trampoline on user\narch/arc/include/uapi/asm/signal.h-20- * mode stack which in turn forces the following:\n--\narch/arm64/kernel/probes/Makefile=2=obj-$(CONFIG_KPROBES)\t\t+= kprobes.o decode-insn.o\t\\\narch/arm64/kernel/probes/Makefile:3:\t\t\t\t   kprobes_trampoline.o\t\t\\\narch/arm64/kernel/probes/Makefile-4-\t\t\t\t   simulate-insn.o\n--\narch/arm64/kernel/signal.c=1434=static int gcs_signal_entry(__sigrestore_t sigtramp, struct ksignal *ksig)\n--\narch/arm64/kernel/signal.c-1451-\t/*\narch/arm64/kernel/signal.c:1452:\t * Push a cap and the GCS entry for the trampoline onto the GCS.\narch/arm64/kernel/signal.c-1453-\t */\n--\narch/arm64/net/bpf_jit_comp.c=2553=static void store_func_meta(struct jit_ctx *ctx, u64 func_meta, int func_meta_off)\n--\narch/arm64/net/bpf_jit_comp.c-2566- *   mov x9, lr\narch/arm64/net/bpf_jit_comp.c:2567: *   bl  \u003cbpf_trampoline or plt\u003e\narch/arm64/net/bpf_jit_comp.c-2568- *\n--\narch/csky/kernel/probes/Makefile=2=obj-$(CONFIG_KPROBES)\t\t+= kprobes.o decode-insn.o simulate-insn.o\narch/csky/kernel/probes/Makefile:3:obj-$(CONFIG_KPROBES)\t\t+= kprobes_trampoline.o\narch/csky/kernel/probes/Makefile-4-obj-$(CONFIG_KPROBES_ON_FTRACE)\t+= ftrace.o\n--\narch/hexagon/kernel/Makefile=7=obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o\narch/hexagon/kernel/Makefile:8:obj-y += process.o trampoline.o reset.o ptrace.o vdso.o\narch/hexagon/kernel/Makefile-9-\n--\narch/loongarch/kernel/Makefile=29=ifdef CONFIG_FUNCTION_TRACER\n--\narch/loongarch/kernel/Makefile-40-  CFLAGS_REMOVE_rethook.o = $(CC_FLAGS_FTRACE)\narch/loongarch/kernel/Makefile:41:  CFLAGS_REMOVE_rethook_trampoline.o = $(CC_FLAGS_FTRACE)\narch/loongarch/kernel/Makefile-42-endif\n--\narch/loongarch/kernel/Makefile=76=obj-$(CONFIG_KPROBES)\t\t+= kprobes.o\narch/loongarch/kernel/Makefile:77:obj-$(CONFIG_RETHOOK)\t\t+= rethook.o rethook_trampoline.o\narch/loongarch/kernel/Makefile-78-obj-$(CONFIG_UPROBES)\t\t+= uprobes.o\n--\narch/nios2/kernel/signal.c=182=static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,\n--\narch/nios2/kernel/signal.c-203-\t/* Set up to return from userspace; jump to fixed address sigreturn\narch/nios2/kernel/signal.c:204:\t   trampoline on kuser page.  */\narch/nios2/kernel/signal.c-205-\tregs-\u003era = (unsigned long) (0x1044);\n--\narch/powerpc/net/bpf_jit_comp.c=535=bool bpf_jit_supports_fsession(void)\n--\narch/powerpc/net/bpf_jit_comp.c-538-\t * TODO: Remove after validating support\narch/powerpc/net/bpf_jit_comp.c:539:\t * for fsession and trampoline on ppc32.\narch/powerpc/net/bpf_jit_comp.c-540-\t */\n--\narch/riscv/kernel/probes/Makefile=2=obj-$(CONFIG_KPROBES)\t\t+= kprobes.o decode-insn.o simulate-insn.o\narch/riscv/kernel/probes/Makefile:3:obj-$(CONFIG_RETHOOK)\t\t+= rethook.o rethook_trampoline.o\narch/riscv/kernel/probes/Makefile-4-obj-$(CONFIG_UPROBES)\t\t+= uprobes.o decode-insn.o simulate-insn.o\n--\narch/riscv/kernel/probes/Makefile=6=CFLAGS_REMOVE_rethook.o = $(CC_FLAGS_FTRACE)\narch/riscv/kernel/probes/Makefile:7:CFLAGS_REMOVE_rethook_trampoline.o = $(CC_FLAGS_FTRACE)\n--\narch/s390/boot/Makefile=35=obj-y\t+= version.o pgm_check.o ctype.o ipl_data.o relocs.o alternative.o\narch/s390/boot/Makefile:36:obj-y\t+= uv.o printk.o trampoline.o\narch/s390/boot/Makefile-37-obj-$(CONFIG_RANDOMIZE_BASE)\t+= kaslr.o\n--\narch/x86/hyperv/Makefile=12=obj-$(CONFIG_PARAVIRT_SPINLOCKS)\t+= hv_spinlock.o\n--\narch/x86/hyperv/Makefile-14- ifdef CONFIG_MSHV_ROOT\narch/x86/hyperv/Makefile:15:  CFLAGS_REMOVE_hv_trampoline.o += -pg\narch/x86/hyperv/Makefile:16:  CFLAGS_hv_trampoline.o        += -fno-stack-protector\narch/x86/hyperv/Makefile:17:  obj-$(CONFIG_CRASH_DUMP)      += hv_crash.o hv_trampoline.o\narch/x86/hyperv/Makefile-18- endif\n--\narch/x86/kernel/ftrace.c=283=extern void ftrace_regs_caller_jmp(void);\n--\narch/x86/kernel/ftrace.c-290- * The ftrace_ops is passed to the function callback. Since the\narch/x86/kernel/ftrace.c:291: * trampoline only services a single ftrace_ops, we can pass in\narch/x86/kernel/ftrace.c-292- * that ops directly.\n--\narch/x86/kernel/ftrace.c=477=void arch_ftrace_update_trampoline(struct ftrace_ops *ops)\n--\narch/x86/kernel/ftrace.c-485-\tif (!ops-\u003etrampoline) {\narch/x86/kernel/ftrace.c:486:\t\tops-\u003etrampoline = create_trampoline(ops, \u0026size);\narch/x86/kernel/ftrace.c-487-\t\tif (!ops-\u003etrampoline)\n--\nkernel/bpf/Makefile=16=obj-$(CONFIG_BPF_SYSCALL) += disasm.o mprog.o\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\n--\nkernel/bpf/trampoline.c=57=static void trampoline_unlock(struct bpf_trampoline *tr)\n--\nkernel/bpf/trampoline.c-61-\nkernel/bpf/trampoline.c:62:struct bpf_trampoline_ops {\nkernel/bpf/trampoline.c-63-\tint (*register_fentry)(struct bpf_trampoline *tr, struct bpf_tramp_image *im, void *data);\n--\nkernel/bpf/trampoline.c=70=static int bpf_trampoline_update(struct bpf_trampoline *tr, bool lock_direct_mutex,\nkernel/bpf/trampoline.c:71:\t\t\t\t const struct bpf_trampoline_ops *ops, void *data);\nkernel/bpf/trampoline.c:72:static const struct bpf_trampoline_ops trampoline_ops;\nkernel/bpf/trampoline.c-73-\n--\nkernel/bpf/trampoline.c=98=static int bpf_tramp_ftrace_ops_func(struct ftrace_ops *ops, unsigned long ip,\n--\nkernel/bpf/trampoline.c-157-\t\t\tret = bpf_trampoline_update(tr, false /* lock_direct_mutex */,\nkernel/bpf/trampoline.c:158:\t\t\t\t\t\t    \u0026trampoline_ops, NULL);\nkernel/bpf/trampoline.c-159-\t\tbreak;\n--\nkernel/bpf/trampoline.c-164-\t\t\tret = bpf_trampoline_update(tr, false /* lock_direct_mutex */,\nkernel/bpf/trampoline.c:165:\t\t\t\t\t\t    \u0026trampoline_ops, NULL);\nkernel/bpf/trampoline.c-166-\t\tbreak;\n--\nkernel/bpf/trampoline.c=473=static int register_fentry(struct bpf_trampoline *tr, struct bpf_tramp_image *im,\n--\nkernel/bpf/trampoline.c-500-\nkernel/bpf/trampoline.c:501:static const struct bpf_trampoline_ops trampoline_ops = {\nkernel/bpf/trampoline.c-502-\t.register_fentry   = register_fentry,\n--\nkernel/bpf/trampoline.c=673=static int bpf_trampoline_update(struct bpf_trampoline *tr, bool lock_direct_mutex,\nkernel/bpf/trampoline.c:674:\t\t\t\t const struct bpf_trampoline_ops *ops, void *data)\nkernel/bpf/trampoline.c-675-{\n--\nkernel/bpf/trampoline.c=905=static int __bpf_trampoline_link_prog(struct bpf_tramp_node *node,\n--\nkernel/bpf/trampoline.c-907-\t\t\t\t      struct bpf_prog *tgt_prog,\nkernel/bpf/trampoline.c:908:\t\t\t\t      const struct bpf_trampoline_ops *ops,\nkernel/bpf/trampoline.c-909-\t\t\t\t      void *data)\n--\nkernel/bpf/trampoline.c=946=int bpf_trampoline_link_prog(struct bpf_tramp_node *node,\n--\nkernel/bpf/trampoline.c-952-\ttrampoline_lock(tr);\nkernel/bpf/trampoline.c:953:\terr = __bpf_trampoline_link_prog(node, tr, tgt_prog, \u0026trampoline_ops, NULL);\nkernel/bpf/trampoline.c-954-\ttrampoline_unlock(tr);\n--\nkernel/bpf/trampoline.c=958=static int __bpf_trampoline_unlink_prog(struct bpf_tramp_node *node,\n--\nkernel/bpf/trampoline.c-960-\t\t\t\t\tstruct bpf_prog *tgt_prog,\nkernel/bpf/trampoline.c:961:\t\t\t\t\tconst struct bpf_trampoline_ops *ops,\nkernel/bpf/trampoline.c-962-\t\t\t\t\tvoid *data)\n--\nkernel/bpf/trampoline.c=983=int bpf_trampoline_unlink_prog(struct bpf_tramp_node *node,\n--\nkernel/bpf/trampoline.c-989-\ttrampoline_lock(tr);\nkernel/bpf/trampoline.c:990:\terr = __bpf_trampoline_unlink_prog(node, tr, tgt_prog, \u0026trampoline_ops, NULL);\nkernel/bpf/trampoline.c-991-\ttrampoline_unlock(tr);\n--\nkernel/bpf/trampoline.c=1076=int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,\n--\nkernel/bpf/trampoline.c-1118-\nkernel/bpf/trampoline.c:1119:\terr = __bpf_trampoline_link_prog(\u0026shim_link-\u003elink.node, tr, NULL, \u0026trampoline_ops, NULL);\nkernel/bpf/trampoline.c-1120-\tif (err)\n--\nkernel/bpf/trampoline.c=1558=static int modify_fentry_multi(struct bpf_trampoline *tr, u32 orig_flags, struct bpf_tramp_image *im,\n--\nkernel/bpf/trampoline.c-1572-\nkernel/bpf/trampoline.c:1573:static const struct bpf_trampoline_ops trampoline_multi_ops = {\nkernel/bpf/trampoline.c-1574-\t.register_fentry   = register_fentry_multi,\n--\nkernel/events/uprobes.c=2635=void uprobe_handle_trampoline(struct pt_regs *regs)\n--\nkernel/events/uprobes.c-2655-\t\t * or NULL; the latter case means that nobody but ri-\u003efunc\nkernel/events/uprobes.c:2656:\t\t * could hit this trampoline on return. TODO: sigaltstack().\nkernel/events/uprobes.c-2657-\t\t */\n--\nkernel/trace/ftrace.c=330=int __register_ftrace_function(struct ftrace_ops *ops)\n--\nkernel/trace/ftrace.c-364-\nkernel/trace/ftrace.c:365:\tftrace_update_trampoline(ops);\nkernel/trace/ftrace.c-366-\n--\nkernel/trace/ftrace.c=393=static void ftrace_update_pid_func(void)\n--\nkernel/trace/ftrace.c-404-\t\t\t\tftrace_pid_func : op-\u003esaved_func;\nkernel/trace/ftrace.c:405:\t\t\tftrace_update_trampoline(op);\nkernel/trace/ftrace.c-406-\t\t}\n--\nkernel/trace/ftrace.c=8414=static void ftrace_update_trampoline(struct ftrace_ops *ops)\n--\nkernel/trace/ftrace.c-8417-\nkernel/trace/ftrace.c:8418:\tarch_ftrace_update_trampoline(ops);\nkernel/trace/ftrace.c-8419-\tif (ops-\u003etrampoline \u0026\u0026 ops-\u003etrampoline != trampoline \u0026\u0026\n--\ntools/perf/util/dso.h=28=enum dso_binary_type {\n--\ntools/perf/util/dso.h-97-\tDSO_BINARY_TYPE__BPF_PROG_INFO,\ntools/perf/util/dso.h:98:\t/** @DSO_BINARY_TYPE__BPF_IMAGE: jitted BPF trampoline or dispatcher code. */\ntools/perf/util/dso.h-99-\tDSO_BINARY_TYPE__BPF_IMAGE,\n--\ntools/perf/util/map.c=529=u64 map__rip_2objdump(const struct map *map, u64 rip)\n--\ntools/perf/util/map.c-535-\t * vmlinux does not have program headers for PTI entry trampolines and\ntools/perf/util/map.c:536:\t * kcore may not either. However the trampoline object code is on the\ntools/perf/util/map.c-537-\t * main kernel map, so just use that instead.\n"
}

17/2 2026/07/11 19:33 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 17685
							output: 27
							thoughts: 99
						

Thoughts:
**Kernel BPF JIT Analysis**

Okay, so the `CONFIG_BPF_JIT` option is clearly the lynchpin here, that's my starting point. Now, to make sure I'm focusing on the right symbols for this deep dive, I should double check that `bpf_struct_ops_desc_init` is indeed a good place to start. It seems right - it's called during the registration process for a struct_ops, which is a key part of how BPF interacts with kernel structures, so it makes sense to focus on it. And `bpf_check_attach_target` is relevant because it's where the BPF program attachment itself is verified, which is clearly important to the process. Both of those look like solid candidates for the analysis.

Alright, let me now take a look at `bpf_check_attach_btf_id_multi`, see what insights it can provide as well.



18/2 2026/07/11 19:33 tool grepper
0m Args:
{
  "Expression": "bpf_check_attach_btf_id_multi"
}

Results:
{
  "Output": "include/linux/bpf_verifier.h=1592=int bpf_fixup_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn,\n--\ninclude/linux/bpf_verifier.h-1595-/* Functions exported from verifier.c, used by trampoline.c */\ninclude/linux/bpf_verifier.h:1596:int bpf_check_attach_btf_id_multi(struct btf *btf, struct bpf_prog *prog, u32 btf_id,\ninclude/linux/bpf_verifier.h-1597-\t\t\t\t  struct bpf_attach_target_info *tgt_info);\n--\nkernel/bpf/trampoline.c=1611=int bpf_trampoline_multi_attach(struct bpf_prog *prog, u32 *ids,\n--\nkernel/bpf/trampoline.c-1624-\nkernel/bpf/trampoline.c:1625:\t\terr = bpf_check_attach_btf_id_multi(btf, prog, ids[i], \u0026tgt_info);\nkernel/bpf/trampoline.c-1626-\t\tif (err)\n--\nkernel/bpf/verifier.c=19303=static int check_attach_btf_id(struct bpf_verifier_env *env)\n--\nkernel/bpf/verifier.c-19402-\nkernel/bpf/verifier.c:19403:int bpf_check_attach_btf_id_multi(struct btf *btf, struct bpf_prog *prog, u32 btf_id,\nkernel/bpf/verifier.c-19404-\t\t\t\t  struct bpf_attach_target_info *tgt_info)\n"
}

19/2 2026/07/11 19:33 llm patch-evaluator
0m Model:
gemini-3.1-pro-preview

Args:
null

Results:
null

Tokens:
							input: 18469
							output: 189
							thoughts: 503
						

Thoughts:
**Analyzing the BPF Trampoline and Large Argument Fix**

Okay, so I'm digging into this BPF trampoline issue. First, I confirmed that `bpf_check_attach_btf_id_multi` is indeed called from `bpf_trampoline_multi_attach`. That's the entry point. Now, let's trace this back to the core fix, which seems to reside in `__arch_prepare_bpf_trampoline`. That's architecture-specific, specifically within `arch/x86/net/bpf_jit_comp.c`. It's static, but that's fine; it doesn't prevent inclusion. Actually, I also need to include `arch_prepare_bpf_trampoline` because it calls `__arch_prepare_bpf_trampoline` and `arch_bpf_trampoline_size`, so I should include it for completeness.

Essentially, this patch is about correctly handling arguments and return values that are larger than 8 bytes, like `__int128`. The bug was that the trampoline wasn't allocating enough registers. This was causing issues attaching to functions that have return values > 8 bytes. The fix addresses this problem.

I've got three configurations that are important to note: `BPF_SYSCALL`, `BPF_JIT`, and `DEBUG_INFO_BTF`.

From a functional standpoint, the modifications are reachable from userspace through BPF program loading and attachment. So, this is a real-world fix, not just an academic one.

My focus symbols are:
*   `bpf_struct_ops_desc_init`
*   `bpf_check_attach_target`
*   `bpf_check_attach_btf_id_multi`
*   `arch_prepare_bpf_trampoline`

`arch_prepare_bpf_trampoline` seems like a good target because it's the function called when a BPF trampoline is created, so it's a good entry point for the changes. `bpf_struct_ops_desc_init` is also relevant since it is called from `btf_add_struct_ops`, which is called when BTF is loaded. It is also an important symbol.

Time to call `set-results`.



20/2 2026/07/11 19:33 tool set-results
0m Args:
{
  "EnableConfigs": [
    "BPF_SYSCALL",
    "BPF_JIT",
    "DEBUG_INFO_BTF"
  ],
  "FocusSymbols": [
    "bpf_struct_ops_desc_init",
    "bpf_check_attach_target",
    "bpf_check_attach_btf_id_multi",
    "arch_prepare_bpf_trampoline"
  ],
  "Reasoning": "The patch modifies BPF trampoline and struct_ops logic to correctly handle arguments and return values larger than 8 bytes (e.g., __int128). It fixes a bug where the trampoline did not allocate enough registers for large arguments and rejects attaching to functions with \u003e8 byte return values for certain attach types. The changes are functional and reachable from userspace via BPF program loading and attachment.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "BPF_SYSCALL",
    "BPF_JIT",
    "DEBUG_INFO_BTF"
  ],
  "FocusSymbols": [
    "bpf_struct_ops_desc_init",
    "bpf_check_attach_target",
    "bpf_check_attach_btf_id_multi",
    "arch_prepare_bpf_trampoline"
  ],
  "Reasoning": "The patch modifies BPF trampoline and struct_ops logic to correctly handle arguments and return values larger than 8 bytes (e.g., __int128). It fixes a bug where the trampoline did not allocate enough registers for large arguments and rejects attaching to functions with \u003e8 byte return values for certain attach types. The changes are functional and reachable from userspace via BPF program loading and attachment.",
  "WorthFuzzing": true
}

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)