From patchwork Sat Sep 12 11:08:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11771791 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F751112E for ; Sat, 12 Sep 2020 11:10:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D527F221E3 for ; Sat, 12 Sep 2020 11:10:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PfpnZK6e"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="d1mnMUse" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D527F221E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AoM9xfp4WqJiP/PXi7eF7Y0cc7IEDysjc/rIu/TP51w=; b=PfpnZK6eL6jOdWDRpKBsnOSOS phWR0+kwydsen0g1UbXgxPPCSz3EWgW/Asau4KoegPgrCUmstE7wJekz6m3PvYqOF9yRYQfIxdcKm UjMqJwFYbN5P2kXpUdZD4ZivXGqIcyA7It/l7VymKrcmr8mqGwoy0sZs99YZ35MJpV6H7nSPp+JDe 1Mf4IS6QQytwn2/HjoMMIfc4kNV3CGCrYGZ0JUw0L9OeMHHq6gIGv6orckdvIcuV1cwnUw1ei8vxm BitaZFKcWc5PxI/yAqGqc/TvBvyl4tDEEcPnSSHX/zBs/VV7/w+DmFA7kJHIMqPl+qaq0Ag2uLcga I0CK9qOlw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH3Ob-0004rH-N1; Sat, 12 Sep 2020 11:08:41 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH3ON-0004lZ-Sj for linux-arm-kernel@lists.infradead.org; Sat, 12 Sep 2020 11:08:30 +0000 Received: by mail-pf1-x443.google.com with SMTP id w7so9093746pfi.4 for ; Sat, 12 Sep 2020 04:08:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OInAC9GW/Qn15XLBfoA31qdN7XBIGKQcBMz86oeUNCI=; b=d1mnMUsez3jOBFoeA7qprWEYhqBNscyNUCJRSrHACM1kolvFIIVwE0oTDarfqfRRyt EZVqDdMOBIDrx85v7uTznjrh1+fZH1TRrnXTBVJXU5uxfzDk9SrvZpuEZ3qybLVI/4Vi 38ppObnAfNv4LDTV+R926cyWt9vORTT60LLnc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OInAC9GW/Qn15XLBfoA31qdN7XBIGKQcBMz86oeUNCI=; b=di4YFhpDpmiyoJ3uUybrlUx5GWUdqZsbdBaHNmofMw03WpEsJArkQZi03B7f37U8f9 VfOFhaS3BqFyZy5VpvIjz+MofbGoC3MCYhNHtCE8Rkpe/Y/S338msUb6UircKMamWcWq Fwxb/b42OUkCaKjQV9oVxLyLIixU+qqzlA0FA/SJ+NRKDYHyIurZXvTlqmAxhnTmdMLT S3dRiJH64P0+Mc6Qu20eq8qdQ3JTnYNZxeiE2zzxzUwHQYZdTXjlttF/0Tun1miYWNUw XqGeRzRk7zlwYG1Rv4+0zMyjLDlezi8macWCFDGAlrvuSqjp/WvSwEHMs3pRq3nt1cXq OOAQ== X-Gm-Message-State: AOAM531JDybJppFGx3a4FhQIY1zvMoZgzdlbtNhfri5/3QzZjda09tKM Yq0ZqZNQN55ZUIifTg4Rr9NQoA== X-Google-Smtp-Source: ABdhPJyDPU6BahqLywZ5Wass8ihB9w09WdZMZEJjPIamOh7TwZSYjVn9+opdSDMO1VWUvStVtnivFw== X-Received: by 2002:a65:5a0b:: with SMTP id y11mr4507630pgs.395.1599908905771; Sat, 12 Sep 2020 04:08:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b10sm4811155pff.85.2020.09.12.04.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:08:23 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Subject: [PATCH 03/15] selftests/seccomp: mips: Define SYSCALL_NUM_SET macro Date: Sat, 12 Sep 2020 04:08:08 -0700 Message-Id: <20200912110820.597135-4-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200912110820.597135-1-keescook@chromium.org> References: <20200912110820.597135-1-keescook@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200912_070827_937220_AB4667B8 X-CRM114-Status: GOOD ( 14.69 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thadeu Lima de Souza Cascardo , Will Drewry , Kees Cook , linux-xtensa@linux-xtensa.org, Michael Ellerman , linux-mips@vger.kernel.org, Andy Lutomirski , Max Filippov , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Christian Brauner Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Remove the mips special-case in change_syscall(). Signed-off-by: Kees Cook Acked-by: Christian Brauner --- tools/testing/selftests/seccomp/seccomp_bpf.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 1c83e743bfb1..02a9a6599746 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -1742,6 +1742,13 @@ TEST_F(TRACE_poke, getpid_runs_normally) # define ARCH_REGS struct pt_regs # define SYSCALL_NUM(_regs) (_regs).regs[2] # define SYSCALL_SYSCALL_NUM regs[4] +# define SYSCALL_NUM_SET(_regs, _nr) \ + do { \ + if ((_regs).regs[2] == __NR_O32_Linux) \ + (_regs).regs[4] = _nr; \ + else \ + (_regs).regs[2] = _nr; \ + } while (0) # define SYSCALL_RET(_regs) (_regs).regs[2] # define SYSCALL_NUM_RET_SHARE_REG #elif defined(__xtensa__) @@ -1839,17 +1846,11 @@ void change_syscall(struct __test_metadata *_metadata, #if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \ defined(__s390__) || defined(__hppa__) || defined(__riscv) || \ - defined(__xtensa__) || defined(__csky__) || defined(__sh__) + defined(__xtensa__) || defined(__csky__) || defined(__sh__) || \ + defined(__mips__) { SYSCALL_NUM_SET(regs, syscall); } -#elif defined(__mips__) - { - if (SYSCALL_NUM(regs) == __NR_O32_Linux) - regs.SYSCALL_SYSCALL_NUM = syscall; - else - SYSCALL_NUM_SET(regs, syscall); - } #elif defined(__arm__) # ifndef PTRACE_SET_SYSCALL