From nobody Fri Jul 24 05:24:31 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 6FE903A5445; Thu, 23 Jul 2026 05:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784785323; cv=none; b=pw06EVx+pyQnI2Lb3wRiIp3OAUo+BaiQ1kowmxzGE8YJGwZ9Z7X5RhcK/PhGNRHe6E5hNufIxhBav/+q9IyOcQ4krO10+x18pY0HY1RCxbn2Jg7OsrtQltNqEnciHRlvM1rBAHGqXOIlROi0cQYfEm2BrsnAfDfyEo1moVoRzr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784785323; c=relaxed/simple; bh=sNbBrbNgL1DCvUesbsN84M4eYHPRqBcR/E53/mGivWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dT2QnILSck5dIQVcc40vOSscDCffRI45YKalsilWOB6Uf/RsU6NDXy/nZd7kaMjqd0+Em7cIYNwKNbaqUGSjZDyAnc4/ynMKu9OwKNM036PEwoQZV+K5ysdN1Aydh1CMf4u4o4cKf4MvSIRMDWN1mwfp+B3WhzI1nkiXvaZG76s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 2e012e52865911f1aa26b74ffac11d73-20260723 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:acf894eb-d1fa-4853-9153-903f1dea7d32,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e7bac3a,CLOUDID:5a4cc073e97d43289fcbe7c6e710344a,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|136|850|865|898,TC:nil,Content :0|15|50,EDM:-3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 2e012e52865911f1aa26b74ffac11d73-20260723 X-User: jiangfeng@kylinos.cn Received: from [127.0.0.1] [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1905472986; Thu, 23 Jul 2026 13:41:40 +0800 From: Feng Jiang Date: Thu, 23 Jul 2026 05:41:32 +0000 Subject: [PATCH bpf-next v5 1/3] bpf, riscv: add support for timed may_goto Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260723-riscv-bpf-timed-may-goto-v5-1-86acb54e5642@kylinos.cn> References: <20260723-riscv-bpf-timed-may-goto-v5-0-86acb54e5642@kylinos.cn> In-Reply-To: <20260723-riscv-bpf-timed-may-goto-v5-0-86acb54e5642@kylinos.cn> To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Luke Nelson , Xi Wang , =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , Pu Lehui , Puranjay Mohan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Shuah Khan , Ihor Solodrai Cc: bpf@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Feng Jiang X-Mailer: b4 0.14.3 Implement arch_bpf_timed_may_goto() for the RV64 JIT. The argument and return value are carried in BPF_REG_AX, and BPF R0-R5 are preserved across the call to the generic bpf_check_timed_may_goto(). Enable bpf_jit_supports_timed_may_goto() so the verifier uses the timed expansion path. Signed-off-by: Feng Jiang Reviewed-by: Pu Lehui Tested-by: Pu Lehui --- arch/riscv/net/Makefile | 2 +- arch/riscv/net/bpf_jit_comp64.c | 12 +++++++++- arch/riscv/net/bpf_timed_may_goto.S | 47 +++++++++++++++++++++++++++++++++= ++++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/arch/riscv/net/Makefile b/arch/riscv/net/Makefile index 9a1e5f0a94e5..6458d4d51990 100644 --- a/arch/riscv/net/Makefile +++ b/arch/riscv/net/Makefile @@ -3,7 +3,7 @@ obj-$(CONFIG_BPF_JIT) +=3D bpf_jit_core.o =20 ifeq ($(CONFIG_ARCH_RV64I),y) - obj-$(CONFIG_BPF_JIT) +=3D bpf_jit_comp64.o + obj-$(CONFIG_BPF_JIT) +=3D bpf_jit_comp64.o bpf_timed_may_goto.o else obj-$(CONFIG_BPF_JIT) +=3D bpf_jit_comp32.o endif diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp6= 4.c index ad089a9a4ea9..8fe8969fb8a0 100644 --- a/arch/riscv/net/bpf_jit_comp64.c +++ b/arch/riscv/net/bpf_jit_comp64.c @@ -1841,7 +1841,12 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, s= truct rv_jit_context *ctx, if (aux->tail_call_reachable && insn->src_reg =3D=3D BPF_PSEUDO_CALL) emit_sd(RV_REG_SP, ctx->tcc_offset, RV_REG_TCC, ctx); =20 - if (insn->src_reg !=3D BPF_PSEUDO_CALL) + /* + * arch_bpf_timed_may_goto() is emitted by the verifier and + * returns its result in BPF_REG_AX instead of BPF_REG_0, so + * skip the normal "move return register into R0". + */ + if (insn->src_reg !=3D BPF_PSEUDO_CALL && addr !=3D (u64)arch_bpf_timed_= may_goto) emit_mv(bpf_to_rv_reg(BPF_REG_0, ctx), RV_REG_A0, ctx); break; } @@ -2161,3 +2166,8 @@ bool bpf_jit_supports_subprog_tailcalls(void) { return true; } + +bool bpf_jit_supports_timed_may_goto(void) +{ + return true; +} diff --git a/arch/riscv/net/bpf_timed_may_goto.S b/arch/riscv/net/bpf_timed= _may_goto.S new file mode 100644 index 000000000000..02c637d87420 --- /dev/null +++ b/arch/riscv/net/bpf_timed_may_goto.S @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2026 Feng Jiang */ + +#include +#include + +/* + * Trampoline for the BPF timed may_goto loop bound. Custom calling conven= tion: + * - input: stack offset in BPF_REG_AX (t0) + * - output: updated count in BPF_REG_AX (t0) + * + * Calls bpf_check_timed_may_goto(ptr) with the standard RISC-V ABI, where + * ptr =3D BPF_REG_FP (s5) + BPF_REG_AX (t0). BPF R0-R5 (a5, a0-a4) are sa= ved + * across the call; BPF_REG_FP (s5) is callee-saved and needs no saving. + */ + +SYM_FUNC_START(arch_bpf_timed_may_goto) + addi sp, sp, -(8*SZREG) + REG_S ra, 7*SZREG(sp) + REG_S s0, 6*SZREG(sp) + addi s0, sp, 8*SZREG + + /* Save BPF registers R0-R5 (a5, a0-a4) */ + REG_S a5, 5*SZREG(sp) + REG_S a0, 4*SZREG(sp) + REG_S a1, 3*SZREG(sp) + REG_S a2, 2*SZREG(sp) + REG_S a3, 1*SZREG(sp) + REG_S a4, 0*SZREG(sp) + + add a0, t0, s5 + call bpf_check_timed_may_goto + mv t0, a0 + + /* Restore BPF registers R0-R5 */ + REG_L a4, 0*SZREG(sp) + REG_L a3, 1*SZREG(sp) + REG_L a2, 2*SZREG(sp) + REG_L a1, 3*SZREG(sp) + REG_L a0, 4*SZREG(sp) + REG_L a5, 5*SZREG(sp) + + REG_L s0, 6*SZREG(sp) + REG_L ra, 7*SZREG(sp) + addi sp, sp, 8*SZREG + ret +SYM_FUNC_END(arch_bpf_timed_may_goto) --=20 2.53.0 From nobody Fri Jul 24 05:24:31 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 2F8D53A875E; Thu, 23 Jul 2026 05:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784785311; cv=none; b=XZ1TBead+dV3yUa8YXARFqES/xn83ZQt/kTORJ03v7KdVSO5efN4LvJxGOfxWlEvpLS1gaQBLb8Waf8MjmetsSl1QVvRVnyvLosVHQwqWXU4bF+Usy/h7lj3TzpzrK8HA6vYTYCWIeNdJfOnHZaOPFuzVQowgwpQilx6mMWWbtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784785311; c=relaxed/simple; bh=QXGUUwr8r7UuDcNGIxEhO0ZUdlwKcgzeI+2RxnKctVg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Kv6eDFFYmz9dy+GJ1J16OyZNnFIFjTu3pp+BbVkFn3+jXwBwJyK4gEFnYYQj31gX8tph6PNoEzNOgkQpgT8GYLaGvhIcQForu+j+9WuJ1MoH6tauJKZwlhAKlvyEZElIO49V4bvhx9MM0ZRFfbOtYdc/5b0TTdQyOcVxShVt3mo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 2e9d4558865911f1aa26b74ffac11d73-20260723 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:d549539a-596e-4b32-8d4f-e5554912d50c,IP:0,U RL:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:e7bac3a,CLOUDID:28fd9810108bc453a4ed04c95b0e54a7,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850|865|898,TC:nil,Content:0|1 5|50,EDM:2,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI: 0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 2e9d4558865911f1aa26b74ffac11d73-20260723 X-User: jiangfeng@kylinos.cn Received: from [127.0.0.1] [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 653154881; Thu, 23 Jul 2026 13:41:41 +0800 From: Feng Jiang Date: Thu, 23 Jul 2026 05:41:33 +0000 Subject: [PATCH bpf-next v5 2/3] selftests/bpf: test timed may_goto preserves R0-R5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260723-riscv-bpf-timed-may-goto-v5-2-86acb54e5642@kylinos.cn> References: <20260723-riscv-bpf-timed-may-goto-v5-0-86acb54e5642@kylinos.cn> In-Reply-To: <20260723-riscv-bpf-timed-may-goto-v5-0-86acb54e5642@kylinos.cn> To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Luke Nelson , Xi Wang , =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , Pu Lehui , Puranjay Mohan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Shuah Khan , Ihor Solodrai Cc: bpf@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Feng Jiang X-Mailer: b4 0.14.3 Add a test that checks R0-R5 are preserved across arch_bpf_timed_may_goto() calls. Use bpf_get_prandom_u32() to avoid the verifier removing the checks via DCE. Suggested-by: Bj=C3=B6rn T=C3=B6pel Signed-off-by: Feng Jiang Reviewed-by: Pu Lehui Tested-by: Pu Lehui --- .../selftests/bpf/progs/verifier_may_goto_1.c | 58 ++++++++++++++++++= ++++ 1 file changed, 58 insertions(+) diff --git a/tools/testing/selftests/bpf/progs/verifier_may_goto_1.c b/tool= s/testing/selftests/bpf/progs/verifier_may_goto_1.c index 4bdf4256a41e..cb1ce4d13cfc 100644 --- a/tools/testing/selftests/bpf/progs/verifier_may_goto_1.c +++ b/tools/testing/selftests/bpf/progs/verifier_may_goto_1.c @@ -106,4 +106,62 @@ __naked void may_goto_batch_2(void) : __clobber_all); } =20 +/* + * Use bpf_get_prandom_u32() to prevent DCE from removing the checks. + * retval: 0=3Dall ok, 1-6=3DR0-R5 clobbered. + */ +SEC("syscall") +__description("timed may_goto preserves R0-R5") +__arch_x86_64 +__arch_s390x +__arch_arm64 +__arch_riscv64 +__success +__retval(0) +__naked void timed_may_goto_preserves_regs(void) +{ + asm volatile ( + "call %[bpf_get_prandom_u32];" + "r6 =3D r0;" + "r0 =3D 0x1111;" + "r0 +=3D r6;" + "r1 =3D 0x2222;" + "r1 +=3D r6;" + "r2 =3D 0x3333;" + "r2 +=3D r6;" + "r3 =3D 0x4444;" + "r3 +=3D r6;" + "r4 =3D 0x5555;" + "r4 +=3D r6;" + "r5 =3D 0x6666;" + "r5 +=3D r6;" + ".8byte %[may_goto];" + ".8byte %[loop];" + "r0 -=3D r6;" + "r1 -=3D r6;" + "r2 -=3D r6;" + "r3 -=3D r6;" + "r4 -=3D r6;" + "r5 -=3D r6;" + "if r0 !=3D 0x1111 goto 1f;" + "if r1 !=3D 0x2222 goto 2f;" + "if r2 !=3D 0x3333 goto 3f;" + "if r3 !=3D 0x4444 goto 4f;" + "if r4 !=3D 0x5555 goto 5f;" + "if r5 !=3D 0x6666 goto 6f;" + "r0 =3D 0;" + "exit;" + "1: r0 =3D 1; exit;" + "2: r0 =3D 2; exit;" + "3: r0 =3D 3; exit;" + "4: r0 =3D 4; exit;" + "5: r0 =3D 5; exit;" + "6: r0 =3D 6; exit;" + : + : __imm(bpf_get_prandom_u32), + __imm_insn(may_goto, BPF_RAW_INSN(BPF_JMP | BPF_JCOND, 0, 0, 1, 0)), + __imm_insn(loop, BPF_RAW_INSN(BPF_JMP | BPF_JA, 0, 0, -2, 0)) + : __clobber_all); +} + char _license[] SEC("license") =3D "GPL"; --=20 2.53.0 From nobody Fri Jul 24 05:24:31 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 4226D3909A4; Thu, 23 Jul 2026 05:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784785319; cv=none; b=b73JiycIFFR1bso+UZaNqQO8B2TrmPJUziOK95Me69yW5s5sZO15rjGKL/iHXz7JSwd6bTgOjqSP37T/aAjPv+1AxkgP9ELIEYDVSSjxOcWcurulJBG0SVeIMiMplExrNJ0RxarrJjvIXrs8kK5x3uM7EjNO9zzw1T0FfiJMGJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784785319; c=relaxed/simple; bh=uDd5tNYduRkYXRqylKmtFKkryYiwk3mUXyQHhCo29zc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hdc0lMJBuKFAVKZXIWHYD9kwIgNzR14f/NEwBO1UroPWGNrA7PtB0aroj/jyxds/Hy3rfKXwxuwivAKcOLtRFyU/715qRm+VI/N9QxJL2YTJzUoNhsgOajJiJjK5pKXer8WFHvw3E3eMuGCHe+mWJz8PnjTRzVPhmtIqfl5ejRo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 2f3b94d8865911f1aa26b74ffac11d73-20260723 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:8b73f118-e106-4292-9956-820ddf859940,IP:0,U RL:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:e7bac3a,CLOUDID:98fb09498250e5c02ee766237887bfaf,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850|865|898,TC:nil,Content:0|1 5|50,EDM:2,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI: 0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 2f3b94d8865911f1aa26b74ffac11d73-20260723 X-User: jiangfeng@kylinos.cn Received: from [127.0.0.1] [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 774362690; Thu, 23 Jul 2026 13:41:42 +0800 From: Feng Jiang Date: Thu, 23 Jul 2026 05:41:34 +0000 Subject: [PATCH bpf-next v5 3/3] selftests/bpf: enable timed may_goto tests for riscv64 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260723-riscv-bpf-timed-may-goto-v5-3-86acb54e5642@kylinos.cn> References: <20260723-riscv-bpf-timed-may-goto-v5-0-86acb54e5642@kylinos.cn> In-Reply-To: <20260723-riscv-bpf-timed-may-goto-v5-0-86acb54e5642@kylinos.cn> To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Luke Nelson , Xi Wang , =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , Pu Lehui , Puranjay Mohan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Shuah Khan , Ihor Solodrai Cc: bpf@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Feng Jiang X-Mailer: b4 0.14.3 Enable verifier_may_goto_1 (raw instruction tests), stream_cond_break (250ms timeout path), and the may_goto_interaction fastcall test on riscv64 now that the JIT supports timed may_goto. Reviewed-by: Pu Lehui Signed-off-by: Feng Jiang Tested-by: Pu Lehui --- tools/testing/selftests/bpf/progs/stream.c | 1 + tools/testing/selftests/bpf/progs/verifier_bpf_fastcall.c | 3 ++- tools/testing/selftests/bpf/progs/verifier_may_goto_1.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/progs/stream.c b/tools/testing/sel= ftests/bpf/progs/stream.c index 92ba1d72e0ec..8d8e53d37266 100644 --- a/tools/testing/selftests/bpf/progs/stream.c +++ b/tools/testing/selftests/bpf/progs/stream.c @@ -64,6 +64,7 @@ SEC("syscall") __arch_x86_64 __arch_arm64 __arch_s390x +__arch_riscv64 __success __retval(0) __stderr("ERROR: Timeout detected for may_goto instruction") __stderr("CPU: {{[0-9]+}} UID: 0 PID: {{[0-9]+}} Comm: {{.*}}") diff --git a/tools/testing/selftests/bpf/progs/verifier_bpf_fastcall.c b/to= ols/testing/selftests/bpf/progs/verifier_bpf_fastcall.c index 8d7ff38e4c06..83707faea049 100644 --- a/tools/testing/selftests/bpf/progs/verifier_bpf_fastcall.c +++ b/tools/testing/selftests/bpf/progs/verifier_bpf_fastcall.c @@ -660,6 +660,7 @@ __naked void may_goto_interaction_x86_64(void) =20 SEC("raw_tp") __arch_arm64 +__arch_riscv64 __log_level(4) __msg("stack depth 24") /* may_goto counter at -24 */ __xlated("0: *(u64 *)(r10 -24) =3D") @@ -679,7 +680,7 @@ __xlated("10: *(u64 *)(r10 -24) =3D r12") __xlated("11: *(u64 *)(r10 -8) =3D r1") __xlated("12: exit") __success -__naked void may_goto_interaction_arm64(void) +__naked void may_goto_interaction(void) { asm volatile ( "r1 =3D 1;" diff --git a/tools/testing/selftests/bpf/progs/verifier_may_goto_1.c b/tool= s/testing/selftests/bpf/progs/verifier_may_goto_1.c index cb1ce4d13cfc..0e211f030d0d 100644 --- a/tools/testing/selftests/bpf/progs/verifier_may_goto_1.c +++ b/tools/testing/selftests/bpf/progs/verifier_may_goto_1.c @@ -11,6 +11,7 @@ __description("may_goto 0") __arch_x86_64 __arch_s390x __arch_arm64 +__arch_riscv64 __xlated("0: r0 =3D 1") __xlated("1: exit") __success @@ -31,6 +32,7 @@ __description("batch 2 of may_goto 0") __arch_x86_64 __arch_s390x __arch_arm64 +__arch_riscv64 __xlated("0: r0 =3D 1") __xlated("1: exit") __success @@ -53,6 +55,7 @@ __description("may_goto batch with offsets 2/1/0") __arch_x86_64 __arch_s390x __arch_arm64 +__arch_riscv64 __xlated("0: r0 =3D 1") __xlated("1: exit") __success @@ -79,6 +82,7 @@ __description("may_goto batch with offsets 2/0") __arch_x86_64 __arch_s390x __arch_arm64 +__arch_riscv64 __xlated("0: *(u64 *)(r10 -16) =3D 65535") __xlated("1: *(u64 *)(r10 -8) =3D 0") __xlated("2: r12 =3D *(u64 *)(r10 -16)") --=20 2.53.0