From patchwork Sat Sep 12 11:08:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 11771787 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 4BD3A112E for ; Sat, 12 Sep 2020 11:10:27 +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 1D0B621548 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="pTbkR0Or"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="derYVmOC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D0B621548 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=GVTFriahZoiKzpePSxaD0veePP2h7E294qH962Ij4bU=; b=pTbkR0OrXshY/TZf3Zahkzg0d 6x3t7c2OOlH32I54RUe8J/xOW95BrtBMz9Cv7MZlzpZW0CD8YrcdMePj642tunutmxXkzxuR4NWjQ ACrjOVBZyEn9OJ716Tnc5kCeLN2M0twKYxt1uRoE2UV8O0bFWO389GP8QOiZpQTJfGgHk6BhY2N7U NkAcyFOc/0bIFLxBNJm1lK93fN3AzbsgpTAQ6lgomUL58dDiSA1ztYXDnqIXT7HqpUjNEc3ZLFCR8 GFZIHTJkIf5bocGTxJIl9Ktis56z8bgm2pSnBDjR6H/tZ/1v9kwZ4vg8gwqFH33F6WgG57GQu0fGZ 7ZyDTM3Bg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH3Of-0004s1-Gj; Sat, 12 Sep 2020 11:08:45 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kH3OP-0004lb-5B for linux-arm-kernel@lists.infradead.org; Sat, 12 Sep 2020 11:08:30 +0000 Received: by mail-pj1-x1042.google.com with SMTP id t7so2986312pjd.3 for ; Sat, 12 Sep 2020 04:08:28 -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=QKhJot8+to6qKu+kMYm4kysaXKnRZz6+eVc9HFtoAC0=; b=derYVmOCJvHNh5vXBTIqRN639+QYp2Ima9wlNPyQ9WhsVt6z+ujiUK93WRnZUcsgJa 56K/8/zjGpnrL9kAoptHwuckPAButJImWrCCwyiO9DiDVHsrbxalUoEMQIqQZVyppWc6 Ee+YDqjRz8veoXRbQfqxsgmDU3EojdbmbMZp8= 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=QKhJot8+to6qKu+kMYm4kysaXKnRZz6+eVc9HFtoAC0=; b=dP/PWbnj01Kp6/GH8541kdRSStXgWlAzIPevr6SlDULrm0ahPbKzQnC6LhR63E5Ijj gaRmjlQ33m/QxC3DAb8hDNavMM3hHJ16DbgSppIPPmdA6QW9bikuY+slqvlR1qn3mX2p vs0oy+OKjYnEG5w+EWc2KvqiIsC7oeoR8ZtdjViJFTnsLQ9gC1HrCXlqq88FUSG2ZVpS OklypbbDL/P5+T42AYN+DXksrcj3enZS4EXtPfCf3aHHfY/7b2oJPPbhKpl+DlwfXb50 IZHWTR9fgaA/+tNiuYfVk+psvFaMgdOQzn31zpb5oeVq2/iWN0RRWm7elvQ/7yhVOR6h 6IIg== X-Gm-Message-State: AOAM530HHimvndJ5uMi1BeQt3icNfWS+DVk2EO8CuxY4QanccpGHFG9V HBnOUn5T487DbuO3A/dI/bF09Q== X-Google-Smtp-Source: ABdhPJy+dZm2QFai7sfR0m9YcZtzGf7C5BX6vbAvfQk3QaGiefAxnuL3yTjBJPD1CaoCvlCi+ojigA== X-Received: by 2002:a17:90b:3241:: with SMTP id jy1mr6101351pjb.10.1599908907078; Sat, 12 Sep 2020 04:08:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id s8sm5388984pfd.153.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 04/15] selftests/seccomp: arm: Define SYSCALL_NUM_SET macro Date: Sat, 12 Sep 2020 04:08:09 -0700 Message-Id: <20200912110820.597135-5-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_070829_225376_62FE192A X-CRM114-Status: GOOD ( 12.67 ) 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 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1042 listed in] [list.dnswl.org] 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 arm special-case in change_syscall(). Signed-off-by: Kees Cook Acked-by: Christian Brauner --- tools/testing/selftests/seccomp/seccomp_bpf.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 02a9a6599746..610fc036e374 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -1708,6 +1708,11 @@ TEST_F(TRACE_poke, getpid_runs_normally) #elif defined(__arm__) # define ARCH_REGS struct pt_regs # define SYSCALL_NUM(_regs) (_regs).ARM_r7 +# ifndef PTRACE_SET_SYSCALL +# define PTRACE_SET_SYSCALL 23 +# endif +# define SYSCALL_NUM_SET(_regs, _nr) \ + EXPECT_EQ(0, ptrace(PTRACE_SET_SYSCALL, tracee, NULL, _nr)) # define SYSCALL_RET(_regs) (_regs).ARM_r0 #elif defined(__aarch64__) # define ARCH_REGS struct user_pt_regs @@ -1847,20 +1852,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(__mips__) + defined(__mips__) || defined(__arm__) { SYSCALL_NUM_SET(regs, syscall); } -#elif defined(__arm__) -# ifndef PTRACE_SET_SYSCALL -# define PTRACE_SET_SYSCALL 23 -# endif - { - ret = ptrace(PTRACE_SET_SYSCALL, tracee, NULL, syscall); - EXPECT_EQ(0, ret); - } - #elif defined(__aarch64__) # ifndef NT_ARM_SYSTEM_CALL # define NT_ARM_SYSTEM_CALL 0x404