From patchwork Thu Aug 29 13:34:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pu Lehui X-Patchwork-Id: 13783275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6BB4BC83F17 for ; Thu, 29 Aug 2024 13:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v5R/7+8R1cZaZegWOY5mw2M1hVmZwUKvVGRKypfHW+0=; b=w96lGGzp42QGil dcQS+AbDSiv0h79HF2uM8j/P8sA1wCdnnwt9oJRcNq4V1qovTRB69cnW3TqNu+j4JX3tGQGf4POxg vXL9khosPV5iLcmcML4zCuLQbptxMues0C8Oahk0XFOpxkZhLgcvlK6Rj86P/HWi8AqHM1sXl3tTD dFQn52srQqVpTY8slvmgGjTkEQQeO7EZdUraUP8oK9WgLsDhAG/ev0l+288vJ2zHAPQ9zicr1zjkl IHAOHIlNSBVI04/GJ+T/RINZJgfLoHTMdCyODMgyNj6061qSluYBal5X8b0nvk/SRf6Un94xGikAh NiUYvXLBvWMr4qtIpQbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjfGC-00000002CPf-1FvZ; Thu, 29 Aug 2024 13:32:24 +0000 Received: from dggsgout12.his.huawei.com ([45.249.212.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjfG8-00000002CJy-0bwt for linux-riscv@lists.infradead.org; Thu, 29 Aug 2024 13:32:23 +0000 Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4Wvhyj1vfmz4f3jdN for ; Thu, 29 Aug 2024 21:31:57 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.252]) by mail.maildlp.com (Postfix) with ESMTP id E23E31A0359 for ; Thu, 29 Aug 2024 21:32:11 +0800 (CST) Received: from ultra.huawei.com (unknown [10.90.53.71]) by APP3 (Coremail) with SMTP id _Ch0CgBXurhbeNBmFVXQCw--.7237S4; Thu, 29 Aug 2024 21:32:11 +0800 (CST) From: Pu Lehui To: bpf@vger.kernel.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Ilya Leoshkevich , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Puranjay Mohan , Palmer Dabbelt , Pu Lehui Subject: [PATCH bpf-next 2/2] selftests/bpf: Skip case involving first arg in bpf_syscall_macro on RV64 Date: Thu, 29 Aug 2024 13:34:53 +0000 Message-Id: <20240829133453.882259-3-pulehui@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829133453.882259-1-pulehui@huaweicloud.com> References: <20240829133453.882259-1-pulehui@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: _Ch0CgBXurhbeNBmFVXQCw--.7237S4 X-Coremail-Antispam: 1UD129KBjvJXoW7KrWrAFyUCF13Jw4fXF18Zrb_yoW8Zr1rp3 48J34jyF1fWr43t34xXr42gF4rXw4kXrW5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CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_063221_825352_060982EB X-CRM114-Status: UNSURE ( 9.12 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Pu Lehui The RV64 architecture accesses the first system call argument only through PT_REGS_PARM1_CORE_SYSCALL(). Signed-off-by: Pu Lehui --- tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c | 2 +- tools/testing/selftests/bpf/progs/bpf_syscall_macro.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c b/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c index 2900c5e9a016..5773ee4ef5ae 100644 --- a/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c +++ b/tools/testing/selftests/bpf/prog_tests/test_bpf_syscall_macro.c @@ -38,7 +38,7 @@ void test_bpf_syscall_macro(void) /* check whether args of syscall are copied correctly */ prctl(exp_arg1, exp_arg2, exp_arg3, exp_arg4, exp_arg5); -#if defined(__aarch64__) || defined(__s390__) +#if defined(__aarch64__) || defined(__s390__) || (defined(__riscv) && __riscv_xlen == 64) ASSERT_NEQ(skel->bss->arg1, exp_arg1, "syscall_arg1"); #else ASSERT_EQ(skel->bss->arg1, exp_arg1, "syscall_arg1"); diff --git a/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c b/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c index 1a476d8ed354..63232832c17a 100644 --- a/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c +++ b/tools/testing/selftests/bpf/progs/bpf_syscall_macro.c @@ -43,7 +43,7 @@ int BPF_KPROBE(handle_sys_prctl) /* test for PT_REGS_PARM */ -#if !defined(bpf_target_arm64) && !defined(bpf_target_s390) +#if !defined(bpf_target_arm64) && !defined(bpf_target_s390) && !defined(bpf_target_riscv) bpf_probe_read_kernel(&tmp, sizeof(tmp), &PT_REGS_PARM1_SYSCALL(real_regs)); #endif arg1 = tmp;