Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp898510pxk; Sat, 12 Sep 2020 04:13:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjT+Sh89cEodQSC4jG4NLwv4SEUGpCU1lhqvtT/pbRY58NEZo89TfTYWJJ0dc88jiAt+Cr X-Received: by 2002:a50:d78e:: with SMTP id w14mr7747289edi.229.1599909207853; Sat, 12 Sep 2020 04:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599909207; cv=none; d=google.com; s=arc-20160816; b=d69rYPW2gj3T1ygjtO08ASvDLWPkn3O418aFSyhPWAjoIUIVaaAwezzjCYarz1IynD J0hTaxxChVzLy+Sur5cdq6WxEwlo5RS4aYKbhNdl6hZFaEQ1f0qlIvY3l0VjRvAgEjLS ksyejM5fzFizLP1ftlF3mMwgXCc2+gkPi7xu3LeA1QVkHzDzwowXVHzRC96pTmI/PL92 O0EsX2YzFoFmdAf5Pg71MjwDHks9DZWKw6ggHEC3vmwB4WcfdhYGQ8Y9KM7slAFO3QS2 0Se9UTHLafrVxgXH879A4ZFBtOke2OWnCv1C2E1BFJDO9xW5+9P75MXyOTs7/4bQKV1W o52w== 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=OInAC9GW/Qn15XLBfoA31qdN7XBIGKQcBMz86oeUNCI=; b=FoVm9DBWb7wmhADDPasgZw+j99eYZQG6JeRmC3AYhE6PNZkURSSzlgqsqPl+9qA2FM o7pyk5XneF2hstxQMBGNlJtwbkNI/faRcjYHJQKCeXXbsJeXJb2aVvPxNtkTm2HtQ9Kc 2KwUmd7fgeA010+C0Gq8vuiAqn+F6ITYbeU8mJDwEjEELP4S5Eo2Jnk+hC3bIFGnpLKz wXK33aaeEkwpnhIBrAeY9Fz7nMzw5IGls36oBhhPPaDe7G9UU1wmkAehHegvBD/IFop5 jht+sRZOAMIAIbDNY2YNUv95RxEGPw1u0KqIB/92vuB30utDgHDaAkL/BR/pI5sLC3Ef yedw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=d1mnMUse; 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 i19si3174304edy.150.2020.09.12.04.13.05; Sat, 12 Sep 2020 04:13:27 -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=d1mnMUse; 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 S1725974AbgILLLu (ORCPT + 99 others); Sat, 12 Sep 2020 07:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbgILLIg (ORCPT ); Sat, 12 Sep 2020 07:08:36 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54CB1C061796 for ; Sat, 12 Sep 2020 04:08:26 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id v15so8207599pgh.6 for ; Sat, 12 Sep 2020 04:08:26 -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=I2682zCfb8/vVg1QhfXHZfcFLVJuxHEKRd8wg+jgYFpcr4r9rq+qD8ZWYsfPGO7XVE QPBXE3ycqt6jRUyyd2pptv3cGjV6Yfi26uZvufgi90xe7NWB5JBYurA6swISWs1lUc9c iv0tjuE+JjbChq3yw9Mc9zMiA9lgIHfgM9mpfATMJZBtCTBbCnQBkuUDFlAIR3Ci22wS gtaISJSNs2XVHmMW/S0f1+iDwK1Sd9NTyMck6Rg3DbhdZ/JAv2DxXCuOQJcHqS3a4711 Hha8rP6XHhgSZRMLOJdXmlMM9MQYfkH3lEG/79BC0hSQhl5q2XYfLcMK/qQJxsj6CmjM 15gA== X-Gm-Message-State: AOAM532FaOP7X6z2KAYIHJZAeYFy+Cx/qxSuRueLAF/UxRbaYqUd4efC /uuhqC65eHTupYNZ1QjgVZFsGA== 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 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 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 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 mips special-case in change_syscall(). Signed-off-by: Kees Cook --- 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 -- 2.25.1