From nobody Sun Feb 8 05:41:56 2026 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CA5731D750; Fri, 19 Dec 2025 13:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766151111; cv=none; b=rfSnvnZpJXVz/f9pg308fwRkxo3qSR0OfXj19xHU3USKrDCzHDCEG8NzwF4dHLjw9bxLWDdMJ4+PV+feXFul+8UTrdFmk5C9gmGeYK45Kb36nEKKGvWTJcosDfVXtbqSMiwJBNLZBUTqZws1NGu7VieXA/0X/7PHoylWVR/0dSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766151111; c=relaxed/simple; bh=tVCX/0y7pTBmvJVcF5r4t0TRtimwIkKr9upSKAD6ZSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OIqBaKPR1QfO9L46akpgergUs8vcB6EBxkYK+K9wVb7SNn08wxL0Ix6eITh9qLXbMEuUfTRfFfbsjr5Fc08RdP9PpVoOuW786Py1ihmJ6ZxJ9ADcPSOPB1ngcN1hr5BCfaon6hSo0IK0S2OxM7cWig0OgfWgRzrJE9sil6kngNs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Oj+jYrIf; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Oj+jYrIf" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1766151091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xzagi6miXzd7e3OGU5ATRhbk9IjjwnMd+L1LSEqQQXY=; b=Oj+jYrIfLYRp1HI4kxh6Bw2BVLKLb02cZW5Ufy9/+AIbsgRgQ4adW/UrkTkxG81DFMc7wh 3D3uy4Rmy24ThRL8sfgZipaqe0NCA+mHGozG7IvAjyx0PaJRSduBzCJoEz/quzVzyCyD2W LAgsXsscB7zaUq9Z2UOWACzx2UgajH4= From: Menglong Dong To: ast@kernel.org Cc: Andreas Schwab , Menglong Dong , rostedt@goodmis.org, daniel@iogearbox.net, john.fastabend@gmail.com, andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, mhiramat@kernel.org, mark.rutland@arm.com, mathieu.desnoyers@efficios.com, jiang.biao@linux.dev, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH bpf-next v3 3/6] bpf: fix the usage of BPF_TRAMP_F_SKIP_FRAME Date: Fri, 19 Dec 2025 21:31:13 +0800 Message-ID: <1948844.tdWV9SEqCh@7950hx> In-Reply-To: <5070743.31r3eYUQgx@7950hx> References: <20251118123639.688444-1-dongml2@chinatelecom.cn> <875xa2g0m0.fsf@igel.home> <5070743.31r3eYUQgx@7950hx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Migadu-Flow: FLOW_OUT On 2025/12/19 20:27, Menglong Dong wrote: > On 2025/12/19 19:41, Andreas Schwab wrote: > > On Dez 19 2025, Menglong Dong wrote: > >=20 > > > BPF_TRAMP_F_ORIG_STACK > >=20 > > How can that ever be set? >=20 > Oops, my bad! It should be BPF_TRAMP_F_CALL_ORIG here. I think > it is some kind of copy-paste mistake. I'll send a fix for it. I sent the following patch twice, but I didn't see it in the mail list. I suspect there is something wrong with my gmail. Hi, Alexei. Can you see my patch? -->patch<-- From 5dbae5dcba3aa7fa10e506e9fd1a28a6802d9b00 Mon Sep 17 00:00:00 2001 From: Menglong Dong Date: Fri, 19 Dec 2025 20:33:10 +0800 Subject: [PATCH RESEND bpf] riscv, bpf: fix incorrect usage of BPF_TRAMP_F_= ORIG_STACK The usage of BPF_TRAMP_F_ORIG_STACK in __arch_prepare_bpf_trampoline() is wrong, and it should be BPF_TRAMP_F_CALL_ORIG, which caused crash as Andreas reported: Insufficient stack space to handle exception! Task stack: [0xff20000000010000..0xff20000000014000] Overflow stack: [0xff600000ffdad070..0xff600000ffdae070] CPU: 1 UID: 0 PID: 1 Comm: systemd Not tainted 6.18.0-rc5+ #15 PREEMPT(vo= luntary) Hardware name: riscv-virtio qemu/qemu, BIOS 2025.10 10/01/2025 epc : copy_from_kernel_nofault+0xa/0x198 ra : bpf_probe_read_kernel+0x20/0x60 epc : ffffffff802b732a ra : ffffffff801e6070 sp : ff2000000000ffe0 gp : ffffffff82262ed0 tp : 0000000000000000 t0 : ffffffff80022320 t1 : ffffffff801e6056 t2 : 0000000000000000 s0 : ff20000000010040 s1 : 0000000000000008 a0 : ff20000000010050 a1 : ff60000083b3d320 a2 : 0000000000000008 a3 : 0000000000000097 a4 : 0000000000000000 a5 : 0000000000000000 a6 : 0000000000000021 a7 : 0000000000000003 s2 : ff20000000010050 s3 : ff6000008459fc18 s4 : ff60000083b3d340 s5 : ff20000000010060 s6 : 0000000000000000 s7 : ff20000000013aa8 s8 : 0000000000000000 s9 : 0000000000008000 s10: 000000000058dcb0 s11: 000000000058dca7 t3 : 000000006925116d t4 : ff6000008090f026 t5 : 00007fff9b0cbaa8 t6 : 0000000000000016 status: 0000000200000120 badaddr: 0000000000000000 cause: 8000000000000005 Kernel panic - not syncing: Kernel stack overflow CPU: 1 UID: 0 PID: 1 Comm: systemd Not tainted 6.18.0-rc5+ #15 PREEMPT(vo= luntary) Hardware name: riscv-virtio qemu/qemu, BIOS 2025.10 10/01/2025 Call Trace: [] dump_backtrace+0x28/0x38 [] show_stack+0x3a/0x50 [] dump_stack_lvl+0x56/0x80 [] dump_stack+0x18/0x22 [] vpanic+0xf6/0x328 [] panic+0x3e/0x40 [] handle_bad_stack+0x98/0xa0 [] bpf_probe_read_kernel+0x20/0x60 Just fix it. Fixes: 47c9214dcbea ("bpf: fix the usage of BPF_TRAMP_F_SKIP_FRAME") Reported-by: Andreas Schwab Closes: https://lore.kernel.org/bpf/874ipnkfvt.fsf@igel.home/ Signed-off-by: Menglong Dong --- arch/riscv/net/bpf_jit_comp64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp6= 4.c index 5f9457e910e8..09b70bf362d3 100644 --- a/arch/riscv/net/bpf_jit_comp64.c +++ b/arch/riscv/net/bpf_jit_comp64.c @@ -1134,7 +1134,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_t= ramp_image *im, store_args(nr_arg_slots, args_off, ctx); =20 /* skip to actual body of traced function */ - if (flags & BPF_TRAMP_F_ORIG_STACK) + if (flags & BPF_TRAMP_F_CALL_ORIG) orig_call +=3D RV_FENTRY_NINSNS * 4; =20 if (flags & BPF_TRAMP_F_CALL_ORIG) { --=20 2.52.0 ---- >=20 > Thanks! > Menglong Dong >=20 > >=20 > > if (flags & (BPF_TRAMP_F_ORIG_STACK | BPF_TRAMP_F_SHARE_IPMODIFY)) > > return -ENOTSUPP; > >=20 > >=20 >=20 >=20 >=20 >=20 >=20 >