Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp898127pxk; Sat, 12 Sep 2020 04:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ2UN55/8E+MU391+LnwwjDeaqszy3Wj6oNnwOtmnBmwUJc6C2uXGCLaSAySKWmszcRjta X-Received: by 2002:a50:fa88:: with SMTP id w8mr7700861edr.179.1599909167944; Sat, 12 Sep 2020 04:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599909167; cv=none; d=google.com; s=arc-20160816; b=b6Ow/NKWywV4xEk4WNvCyAQpAKBj676h4CMDE8dRl8rA0tuHVTjxzpWun6nQdMdmiE 3BqKZ6nnSC45AnDNw8bO2qEDmyf8zfmsPiM0g0H3F1+PX78E4SpAbvK4HGi0LBnhY6sh pCieRexuW0pJRuBxU2SRzm086XsSttidjZSp0J5WGSOAI1mRv6Lb3H+cAyVlq98Ke/UP NeZzQASeXMDyZGfM364j59A59NljLxeAztgUQv6QoM0NWqeeQ7vEfHuIMrz5+nQMyWRH DAUicKpvybY1iEb9TlpMkCfCLzaMa/PnuJHvLTqt6oOw8B7qJ0AjnBldn8YP1gUQ79s9 X1ug== 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=92Q8oZHyAg95yaZcgBPqYzJZs65e2ppMcBco02q7zS4=; b=S7RdtuujUJz/qevWTQEDAoOWoDUjYdZ8b0yz/gjsWlxz+2Pd+08GZ3VfcVggjV8c+W fGPCySnX/7IfM8fg1+2z9EqR2LFIqynmjkokmANgc95zS2HHq3brh9TSNo8t/SBktQmm El/JbewxbGvJ8+ZwvkngFvxaIamvTXmBro/mtkNgh+6hGIGDwl9GHE8AG0A5svJu33RQ FPO7b5oYzLwU+/1kTLO5I6mfjlk+JaCDafV9975a2aTJs86+1GOLoTuwt5wX7RdooVt0 ebJJW55OUc0wACQPNqwHvzoa5Ff6AGNjmqW91iuovIJZ/lna4vNirJW+hYSmu29LQHrg Z35w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oKxTswLt; 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 rl11si989825ejb.701.2020.09.12.04.12.25; Sat, 12 Sep 2020 04:12:47 -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=oKxTswLt; 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 S1725992AbgILLLP (ORCPT + 99 others); Sat, 12 Sep 2020 07:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbgILLJA (ORCPT ); Sat, 12 Sep 2020 07:09:00 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93923C0617BC for ; Sat, 12 Sep 2020 04:08:31 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id q4so2984040pjh.5 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=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=hW2KLvPFcqHyb8gBSdEWd57l0Ph9HKiskpUi9nK5NtG3CRb3LYvovElZggJKEm49E0 qWrJkNFNY5cTyjWxT7/7tgiJ1PXbvK2QkHEVeR3iG4IOlicotKUVbF07Q/qxlbEabT8S M9fALkID1aoqStTJWTiksdQezoFmobR7Zbhj8OIxHq5zJu22ZsZxFYvQgnXCfyPmPG0r +poU3xO472TYX8CKm3GEIPVzy5u44Mho9VFmkWDeF6bZgjus7gxITsrqquC+YZ0wWF8o fRNFCm/XcgHb7bo/dKkRlbV3RyBwNwY/6Tkr0pcHQD5AZZZqb/nr8edsHXWm1hBZLl+9 DVUw== X-Gm-Message-State: AOAM532JtufkFIifeVovFzVeLN/EfNRueS8+bYXoWaRe3A+Yd7ZtEXgC x5+jrUkzuynZOiQaAj/r6SLaUw== 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 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 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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 -- 2.25.1