From patchwork Mon May 17 07:38:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 1479277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=OEcuBqQY; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ITl7+uD9; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.a=rsa-sha256 header.s=dec2015msa header.b=sv+el2cv; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fk9zs3hvmz9sSs for ; Mon, 17 May 2021 17:41:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6BOuBLnBShn84qHPy0k8TXG6AEDpk0rfDNlxjkDeKTE=; b=OEcuBqQY70+JJaTYyQ9sFvxjz d3OTcyxfFqfEZ+D2Cyw4D8IxxZKaLjsX1U5VpIhxmXfzP9H+6F3HgL3holnlPnlV640I1dnfIl2Ha 13iIxUrt7oCSGsrTsEREgPD4pKZhrUb59QIOBMh0YYORu7ejIpn1AvV7yvz0hN9PLMJuqAjaBeY5N mMRVqfpUcBmzXpVnMhUkpu04qrrI+3n8QtO/d77EQtqZdfpgeikrsFvUPER3t5+HoKt4nFfQAF3E7 UEG97KfcH5PJ5VL57BMpOkDnZwkv6hB3JYOt/et1yApAJ7dHS9Rf1no4AneQmnjuB+j11rmg6LQs3 PXO7nKzrA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liXs6-00E4NF-3x; Mon, 17 May 2021 07:41:02 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liXq3-00E47X-DS for linux-um@desiato.infradead.org; Mon, 17 May 2021 07:39:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=s1wiLTH91EKAgG1RLCAKeMhWZ7J2zh+/Hi2ne1w2pKY=; b=ITl7+uD9QWqIN0B6Nl60ApjYvK DdsRzmPZt0lMRORi3bAERSyvDerm7shvUwVmUxTNTgG1q7JGLzNoEWU7tPALL9LYw6qpNfKuOQjzF QBwKVyHTMoYQAN6WR4X8OGF+zOTqEC+qEnD4Eg1pBa+fq9tzSIh4k4/IAn+gHvoT1txQmjrf7eCyT smG18jT7yt3gm5vfli9Ybwv7DeZlp2SJiLDZWZ1xou+EYGV6uU2wjqCdsoy2xkmPyODtdHvEbufLv d3K/ntMUAoBJGoHXxwBFsuCYLAr6tLLauAiQLK/PnNbYVvOraw4BSYQoFNj/ehtlvVWnuahh61HXh uzDb1j7A==; Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liXq0-00DYGI-MK for linux-um@lists.infradead.org; Mon, 17 May 2021 07:38:54 +0000 Received: from localhost.localdomain (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-09.nifty.com with ESMTP id 14H7cLoN027919; Mon, 17 May 2021 16:38:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com 14H7cLoN027919 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1621237106; bh=s1wiLTH91EKAgG1RLCAKeMhWZ7J2zh+/Hi2ne1w2pKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sv+el2cvTNsB2UE/y1bR2Nv/6xXovT+yaJJ0lqqrtyUv7mCzCrW9y/UNlK+gwuQ14 5Hhg3AiedFt81jV3on2INOupe9dxM7aiH449AZ7faA6A/TMxg1iIfWph1SSxhrR8aD j9wwQ1vjghIA+EzJgE95LjevIVcr0j6+lHChf1qeZbyjQauXnJmOU7yXw26yZV8W9f Mxj2hVdXvw8WEH+wXi86LVj3DvcwINAdh/F0yGXkAkksmGQJ36KVC0qu2Z+U+Oeef3 XqSBBpvpmW4ZgBVdNpaCBk6TTiv3bFhtYC+ZzVGBG7Apo96Tj7z0AFjGhq6keFrrBU erDhbS02giVRA== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov Cc: Masahiro Yamada , Andy Lutomirski , Anton Ivanov , "H. Peter Anvin" , Jeff Dike , Richard Weinberger , linux-kernel@vger.kernel.org, linux-um@lists.infradead.org Subject: [RESEND PATCH 5/6] x86/syscalls: use __NR_syscalls instead of __NR_syscall_max Date: Mon, 17 May 2021 16:38:13 +0900 Message-Id: <20210517073815.97426-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210517073815.97426-1-masahiroy@kernel.org> References: <20210517073815.97426-1-masahiroy@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_003852_968923_3119C7E3 X-CRM114-Status: GOOD ( 11.61 ) X-Spam-Score: 1.0 (+) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: __NR_syscall_max is only used by x86 and UML in the following two files: - arch/um/kernel/skas/syscall.c - arch/x86/include/asm/unistd.h In contrast, __NR_syscalls is widely used by all the architectures. Content analysis details: (1.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.76 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org __NR_syscall_max is only used by x86 and UML in the following two files: - arch/um/kernel/skas/syscall.c - arch/x86/include/asm/unistd.h In contrast, __NR_syscalls is widely used by all the architectures. Let's convert __NR_syscall_max to __NR_syscalls by adding one. This makes arch/x86/include/asm/unistd.h look cleaner, and also prepares x86 to switch to the generic scripts/syscallhdr.sh from arch/x86/entry/syscalls/syscallhdr.sh. Signed-off-by: Masahiro Yamada --- arch/um/kernel/skas/syscall.c | 2 +- arch/x86/entry/syscalls/syscallhdr.sh | 2 +- arch/x86/include/asm/unistd.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c index 3d91f89fd852..9ee19e566da3 100644 --- a/arch/um/kernel/skas/syscall.c +++ b/arch/um/kernel/skas/syscall.c @@ -41,7 +41,7 @@ void handle_syscall(struct uml_pt_regs *r) goto out; syscall = UPT_SYSCALL_NR(r); - if (syscall >= 0 && syscall <= __NR_syscall_max) + if (syscall >= 0 && syscall < __NR_syscalls) PT_REGS_SET_SYSCALL_RETURN(regs, EXECUTE_SYSCALL(syscall, regs)); diff --git a/arch/x86/entry/syscalls/syscallhdr.sh b/arch/x86/entry/syscalls/syscallhdr.sh index cc1e63857427..75e66af06773 100644 --- a/arch/x86/entry/syscalls/syscallhdr.sh +++ b/arch/x86/entry/syscalls/syscallhdr.sh @@ -28,7 +28,7 @@ grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( echo "" echo "#ifdef __KERNEL__" - echo "#define __NR_${prefix}syscall_max $max" + echo "#define __NR_${prefix}syscalls $(($max + 1))" echo "#endif" echo "" echo "#endif /* ${fileguard} */" diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h index 1bc6020bc58d..80e9d5206a71 100644 --- a/arch/x86/include/asm/unistd.h +++ b/arch/x86/include/asm/unistd.h @@ -13,7 +13,7 @@ # define __ARCH_WANT_SYS_OLD_MMAP # define __ARCH_WANT_SYS_OLD_SELECT -# define __NR_ia32_syscall_max __NR_syscall_max +# define IA32_NR_syscalls (__NR_syscalls) # else @@ -26,12 +26,12 @@ # define __ARCH_WANT_COMPAT_SYS_PWRITEV64 # define __ARCH_WANT_COMPAT_SYS_PREADV64V2 # define __ARCH_WANT_COMPAT_SYS_PWRITEV64V2 -# define X32_NR_syscalls (__NR_x32_syscall_max + 1) +# define X32_NR_syscalls (__NR_x32_syscalls) +# define IA32_NR_syscalls (__NR_ia32_syscalls) # endif -# define NR_syscalls (__NR_syscall_max + 1) -# define IA32_NR_syscalls (__NR_ia32_syscall_max + 1) +# define NR_syscalls (__NR_syscalls) # define __ARCH_WANT_NEW_STAT # define __ARCH_WANT_OLD_READDIR