Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp899317pxk; Sat, 12 Sep 2020 04:14:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNp+HrCE6lxovziMzcy+DS6KGtkCPOJxuKJSD6p26KSJz/edvrRNmseUgyvgw+0NJ0sygq X-Received: by 2002:a17:906:f4f:: with SMTP id h15mr5552341ejj.17.1599909295869; Sat, 12 Sep 2020 04:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599909295; cv=none; d=google.com; s=arc-20160816; b=c25SCAthjbV08BUN+bLzBkgzxOp5IZmHPdpLXpKjPh1JzYQpBeo/lZN7cVuJlw/BbM B+hCMWMrcXcMLuMvGmjBHBqJ9XwtLG8EiixfN7fMi/Ept3XaRejYczokNXOUQnSJy9Y8 hl0xLJCWVJXJSpwfrJe4a7WaJyM/jwRCGtdYq9IvVq3Q4G3oS9QEFSvyckU7b58va5eU c8OblnNfkpszPu21LtpsAmkrrBAszlyJ/tl8hErbzc7xiap/YWGD4jz2nCmERDZvpTgF gd2AVYrFAkPlxRT1T8AZreYihRnVbERayMFdHGXLgsHMXFBjGX306g8qtFB6/h0SrZhj H9bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jbIVGVeXL3UcD5Zx3+0sHrDQsZkQmD0nziWY3w5+YuI=; b=JK9qexioRSqQ+Tv25rCpEAPDLNfivYstOp0wXMayNSLqcto6qQ8Rla30mS31OUmJB3 QMIj14rpYcJ1m2kpil+PyIs5wxfQksi03dW0AJd/yUmPIDbwIUQWoXyLcnPZtouVrpN0 TOY23XhF97hJBNah/SHuWb1Nbqruj8ZXRQcRGiLyS2BE8BxFA0q286m08hWl85WIqL3E FP26F7/pVA7xnN9h6v13/gszVQjlciGLlfNTLzmwgCLQX7wohGiN/RGDlsJo0rrr38pp sfmzBTeG39tWqrxCaq4f0Hkg/t3jBSLNVtm2tXJ/QAKTego1VXdRItW8Q4M0t8Uk0+Tz pQzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="LqQ/QyMb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si2886543ejo.565.2020.09.12.04.14.33; Sat, 12 Sep 2020 04:14:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="LqQ/QyMb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725995AbgILLLh (ORCPT + 99 others); Sat, 12 Sep 2020 07:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725891AbgILLIs (ORCPT ); Sat, 12 Sep 2020 07:08:48 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48091C0617A4 for ; Sat, 12 Sep 2020 04:08:31 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id z19so9072926pfn.8 for ; Sat, 12 Sep 2020 04:08:31 -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=jbIVGVeXL3UcD5Zx3+0sHrDQsZkQmD0nziWY3w5+YuI=; b=LqQ/QyMbPHbN/COohSTcKyMAKLl5cT78qQitFk8CTTS3dxBKp0xZo1Q2/Pnj7vV2qy RLb83+qRl281SbYQByqtCv58OW/cIMeoQuNZP7O7zHoBXuxMSUgD493bWxSJcqnwYYg9 rLdRfx2N0xOFGRKseP1KmNGFygnsLvdtukIbE= 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=jbIVGVeXL3UcD5Zx3+0sHrDQsZkQmD0nziWY3w5+YuI=; b=EApTorAaMAbyhluS8hX8tOhA4cK/GluPjal3lFMvUFiDSXTJxUxs9FFwq69raiENdD NJ3sjkQ5skDj3ISEkWqhAcjWkXhoFoD51fsNZLphXf9LnaC7DaQCzYNpGzokz+j40SoT UmjamzwEZ4uOU87FS4ekGxQO24UvvXANNzFfj9u4CG+B0+b4rgrFZGxg29QeyE3Yu03Q 9PF2DbiMyAiQG20pvjDPVmDYsE81JqqfDE3NhccRWtQcg2FwLxRduy3CiJvjh9KPQMES JUpDsfJqnuPoZA8+ArC1P5TBtYFanf7HUC9b+76tFgVgl3vPdMrIiUmYzBaJlfFGLQ2L 6eTg== X-Gm-Message-State: AOAM531g+TOZhZozqB6SGuLqc3UTWbQDryjJ69GK/dQlUJBCIcWe4rCq m/4kvI9ZiZ/WxraGK0qm6azoBw== X-Received: by 2002:a05:6a00:1b:b029:13e:d13d:a101 with SMTP id h27-20020a056a00001bb029013ed13da101mr5730307pfk.29.1599908908451; Sat, 12 Sep 2020 04:08:28 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x20sm4980626pfr.190.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 Cc: Kees Cook , Thadeu Lima de Souza Cascardo , Max Filippov , Michael Ellerman , Christian Brauner , Andy Lutomirski , Will Drewry , linux-kselftest@vger.kernel.org, linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 05/15] selftests/seccomp: arm64: Define SYSCALL_NUM_SET macro Date: Sat, 12 Sep 2020 04:08:10 -0700 Message-Id: <20200912110820.597135-6-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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the arm64 special-case in change_syscall(). Signed-off-by: Kees Cook --- tools/testing/selftests/seccomp/seccomp_bpf.c | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 610fc036e374..cfa606d96086 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -1717,6 +1717,18 @@ TEST_F(TRACE_poke, getpid_runs_normally) #elif defined(__aarch64__) # define ARCH_REGS struct user_pt_regs # define SYSCALL_NUM(_regs) (_regs).regs[8] +# ifndef NT_ARM_SYSTEM_CALL +# define NT_ARM_SYSTEM_CALL 0x404 +# endif +# define SYSCALL_NUM_SET(_regs, _nr) \ + do { \ + struct iovec __v; \ + typeof(_nr) __nr = (_nr); \ + __v.iov_base = &__nr; \ + __v.iov_len = sizeof(__nr); \ + EXPECT_EQ(0, ptrace(PTRACE_SETREGSET, tracee, \ + NT_ARM_SYSTEM_CALL, &__v)); \ + } while (0) # define SYSCALL_RET(_regs) (_regs).regs[0] #elif defined(__riscv) && __riscv_xlen == 64 # define ARCH_REGS struct user_regs_struct @@ -1852,23 +1864,10 @@ 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(__arm__) + defined(__mips__) || defined(__arm__) || defined(__aarch64__) { SYSCALL_NUM_SET(regs, syscall); } - -#elif defined(__aarch64__) -# ifndef NT_ARM_SYSTEM_CALL -# define NT_ARM_SYSTEM_CALL 0x404 -# endif - { - iov.iov_base = &syscall; - iov.iov_len = sizeof(syscall); - ret = ptrace(PTRACE_SETREGSET, tracee, NT_ARM_SYSTEM_CALL, - &iov); - EXPECT_EQ(0, ret); - } - #else ASSERT_EQ(1, 0) { TH_LOG("How is the syscall changed on this architecture?"); -- 2.25.1