Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3297757pxk; Tue, 15 Sep 2020 15:46:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsVOP1lFkMJ84uCXns8ks63q3K5GGKvpEnWdJb3J6YMrSZQ8gU0UZDF6sjvcCPraz/xCYH X-Received: by 2002:a17:906:5611:: with SMTP id f17mr23690411ejq.427.1600210018523; Tue, 15 Sep 2020 15:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600210018; cv=none; d=google.com; s=arc-20160816; b=bRwPLELnRfFq2rKDVfaAByN78cswOJ/gUlK/ZKe1bW/8b4LmNOXnNGdQUmESyXlKtO oSqdmqoYSVLl+jNSK8IpBZbfDD70Ke3XZ1dH/7OO1cfpAqSYjDcQrrztI6ZTO8mrPgoC cZTYE3Aoxt7SUhGR1WRcmorVdxO1ugZGrGLypq2GkMY2SrNuog1ChYrBBAeBncOy0+w6 VbRK8Bkh0tfxpLmFeTDziD3CZH/DgPf67C3xQAxFYYSGGwvfELf9GUsSxzd7Cf9kC4No TdcveHT2pOKgRkhzWwItEw7NbXctkPJytzNNRaScQa/+0x8w9FgIEyx/XeR4oApxNaqR b7zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BS3hXWzOFXwxv5HoGaU9nFnqeyg9h4oyeunzBMHeEZQ=; b=DLGz+rfPLDxC3/SV2SWGw9ivBMnxj5MquVbJ/AU8B2mrnZdA9gmm2oXVC5UZ7yqflE Orrfv4VxOn73wc0r2hDaT7eAQremH2vhIhPZzlRaUVlOjHlxmVmU3ReM8w5NBv8S1GL6 kIVN/Ce5kbT3C7cbbfwNHJu2uKs+tnB/U50Ve8Agn6ayonpNiw08oXGh6PEfPVnkfsIX MsdsyGfvA8vedygALe0Olz6/xkoikvUMMFBJxUUYyRL06fOl74N/voL7icWRCx4FHbDD S8QzzlM63/HwJY5CVPbbq+VtdoTxwDRUORvryYu1DHU8m4OS524berfmqJ3sKiHvuMCo vSMQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh6si10398878ejb.243.2020.09.15.15.46.36; Tue, 15 Sep 2020 15:46:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727736AbgIOWnm (ORCPT + 99 others); Tue, 15 Sep 2020 18:43:42 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:47906 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727374AbgIOPzt (ORCPT ); Tue, 15 Sep 2020 11:55:49 -0400 Received: from ip5f5af089.dynamic.kabel-deutschland.de ([95.90.240.137] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kIDJ4-0005bW-Pu; Tue, 15 Sep 2020 15:55:46 +0000 Date: Tue, 15 Sep 2020 17:55:46 +0200 From: Christian Brauner To: Kees Cook Cc: linux-kernel@vger.kernel.org, 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: Re: [PATCH 03/15] selftests/seccomp: mips: Define SYSCALL_NUM_SET macro Message-ID: <20200915155546.ht4vo7nqswxrgymb@wittgenstein> References: <20200912110820.597135-1-keescook@chromium.org> <20200912110820.597135-4-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200912110820.597135-4-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 12, 2020 at 04:08:08AM -0700, Kees Cook wrote: > 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) I think that # define SYSCALL_NUM_SET(_regs, _nr) \ do { \ if (SYSCALL_NUM(_regs) == __NR_O32_Linux) \ (_regs).regs[4] = _nr; \ else \ (_regs).regs[2] = _nr; \ } while (0) would read better but that's just a matter of taste. :) Looks good! Acked-by: Christian Brauner