Re: [PATCH bpf-next 2/8] bpf: Disallow !kprobe_write_ctx progs tail-calling kprobe_write_ctx progs
From: Alexei Starovoitov <hidden>
Date: 2026-02-24 16:57:49
Also in:
bpf, linux-kselftest, lkml
On Tue, Feb 24, 2026 at 7:41 AM Leon Hwang [off-list ref] wrote:
quoted hunk ↗ jump to hunk
uprobe programs that can modify pt_regs require different runtime assumptions than pt_regs-read-only uprobe programs. Mixing both in one prog_array can make owner expectations diverge from callee behavior. Reject the combination of !kprobe_write_ctx progs with kprobe_write_ctx progs in __bpf_prog_map_compatible() to address the issue. Fixes: 7384893d970e ("bpf: Allow uprobe program to change context registers") Signed-off-by: Leon Hwang <redacted> --- include/linux/bpf.h | 7 ++++--- kernel/bpf/core.c | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-)diff --git a/include/linux/bpf.h b/include/linux/bpf.h index b78b53198a2e..2a2f6448a5fb 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h@@ -285,9 +285,10 @@ struct bpf_list_node_kern { */ struct bpf_map_owner { enum bpf_prog_type type; - bool jited; - bool xdp_has_frags; - bool sleepable; + u32 jited:1, + xdp_has_frags:1, + sleepable:1, + kprobe_write_ctx:1;
Don't you see how much churn you're adding this way? Every patch has to touch two lines instead of one. Use u32 jited:1; u32 xdp_has_frags:1; also the bot is correct on patch 2 and 3. Don't be fancy. Require strict conformance both ways in *all* patches. And your codex selftests are garbage. I don't have other words to describe it. They are not testing the actual bug that your patches are fixing. Think of what you're doing. Asking LLM to write a test for your other patch is not what you should be asking it to do. The selftest should be such that it proves the unsafety/crash before the fix. pw-bot: cr