From patchwork Sat Sep 12 11:08:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11771833 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 3655B112E for ; Sat, 12 Sep 2020 11:11:39 +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 0A23B21548 for ; Sat, 12 Sep 2020 11:11:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="c3rKFsBM"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="oKxTswLt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A23B21548 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=Vs0IXS07VaKxu0Lyu2NoK+izqjeUineAoTwP2Lgc/Dc=; b=c3rKFsBMZ4DqBJLw8UOtF+leo S+NBHnAlcaAYOmWEINwi0EzZ6MhoAI6uJTcciawt3mHJlQS4ejtjVC+XccZL3jqnCpfuqf6WC9uaa iUE79rm644PDbtkaJTFUuZyPvXNwdvZgF8nt0EFzuhWEoLdhWXvMR/uK+iGKAd+Cu0jKBqp8Z3VAP 2h2DQIXZZGg3iWqu8eMroqG4hhoR1Knn3w4GaYUseSyxBKYH/j96AGjle+eu7iVbDB34gleTylcxg U8GOifXJkR9RwMgjGAXKydvFteOo16y4+s0r7B9v1sxT2tl22kiFI4N4Gvc81jByGOzNCMvooaTok WGa1Y23xw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH3PS-00059P-6C; Sat, 12 Sep 2020 11:09:34 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH3OU-0004ni-Hi for linux-arm-kernel@lists.infradead.org; Sat, 12 Sep 2020 11:08:36 +0000 Received: by mail-pj1-x1043.google.com with SMTP id o16so2992471pjr.2 for ; Sat, 12 Sep 2020 04:08:32 -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=92Q8oZHyAg95yaZcgBPqYzJZs65e2ppMcBco02q7zS4=; b=oKxTswLtIOK07XsveENLHZWzEqRRWXa47NwfzGG/t34zibm0+Q5y6KxKGUyKdfoQJm WcOstLYJHtY8SjcIiE3lEzI8GfTXVy2Q+3Wr6si7RPVCGD9IY0lOI6Bzu+EU1MuOCBr+ vwWMsIRYqobBaUwMudq9qDyqwr6DmrbuVMorM= 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=92Q8oZHyAg95yaZcgBPqYzJZs65e2ppMcBco02q7zS4=; b=qRPqALXzVSi+ui8JvCPMjpZiy2znUGiTP9sMTviW+ePDcRrkFo1k1iydVpUXLYyXQ7 Pgu8JvPcW3GfIrBtvRjnDuEUSiKSOd2ksR6wzzdsOZ/Z9q17I4fs1YO3jO8gttBPZ3+V t61z3kUBSAPT9H8cM94Mwt1S0geRpC5sVJIzAJ1kXYRWLSfJhYfWfteSAwdizevZqd5H YY3fCN3NiqGL8D1T1vP8RlarAs479lcPFtuIQGFndT2NPLcmbcCAZdWyRFNCIE1RMuwI 6W7ym54/DJt4nIIeJMITQj36yQ8/2pZh28ooz6ueZbrP7CioFV+R4IDxA3mYvFm+QCEC iqwQ== X-Gm-Message-State: AOAM5323+u0ovnnTRTz9eNMFyi2bgaBdMmHfEQl3WXLmnn86tYWFsubp +3RYhbmlp9Y+lVgJMtKfEtjx2Q== X-Google-Smtp-Source: ABdhPJweZZl3gQqRJfY1jLrAEz5YsIr84x1nX2bdgki+nYDKxKRM+1q2OEofassUExMJ/pEA6/fMaQ== X-Received: by 2002:a17:90a:ea0a:: with SMTP id w10mr5837835pjy.165.1599908910885; Sat, 12 Sep 2020 04:08:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id nl10sm3907425pjb.11.2020.09.12.04.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Sep 2020 04:08:27 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Subject: [PATCH 07/15] selftests/seccomp: Remove syscall setting #ifdefs Date: Sat, 12 Sep 2020 04:08:12 -0700 Message-Id: <20200912110820.597135-8-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_070834_639285_BDD8BD5C X-CRM114-Status: GOOD ( 13.08 ) 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:1043 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 With all architectures now using the common SYSCALL_NUM_SET() macro, the arch-specific #ifdef can be removed from change_syscall() itself. Signed-off-by: Kees Cook Acked-by: Christian Brauner --- tools/testing/selftests/seccomp/seccomp_bpf.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index aa1c224371d1..3b77bdbe7125 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -1865,20 +1865,9 @@ void change_syscall(struct __test_metadata *_metadata, iov.iov_len = sizeof(regs); ret = ptrace(PTRACE_GETREGSET, tracee, NT_PRSTATUS, &iov); #endif - EXPECT_EQ(0, ret) {} + EXPECT_EQ(0, ret); -#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \ - defined(__s390__) || defined(__hppa__) || defined(__riscv) || \ - defined(__xtensa__) || defined(__csky__) || defined(__sh__) || \ - defined(__mips__) || defined(__arm__) || defined(__aarch64__) - { - SYSCALL_NUM_SET(regs, syscall); - } -#else - ASSERT_EQ(1, 0) { - TH_LOG("How is the syscall changed on this architecture?"); - } -#endif + SYSCALL_NUM_SET(regs, syscall); /* If syscall is skipped, change return value. */ if (syscall == -1) @@ -1888,6 +1877,7 @@ void change_syscall(struct __test_metadata *_metadata, SYSCALL_RET(regs) = result; #endif + /* Flush any register changes made. */ #ifdef HAVE_GETREGS ret = ptrace(PTRACE_SETREGS, tracee, 0, ®s); #else