Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531AbcDRAre (ORCPT ); Sun, 17 Apr 2016 20:47:34 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:45297 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbcDRArd (ORCPT ); Sun, 17 Apr 2016 20:47:33 -0400 Date: Mon, 18 Apr 2016 01:47:31 +0100 From: Ben Hutchings To: Andy Lutomirski Cc: X86 ML , LKML Message-ID: <20160418004731.GB3348@decadent.org.uk> References: <1460940317.9121.56.camel@decadent.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bCsyhTFzCvuiizWE" Content-Disposition: inline In-Reply-To: <1460940317.9121.56.camel@decadent.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: ben@decadent.org.uk Subject: [PATCH] x86/entry/x32: Check top 32 bits of syscall number on the fast path X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on shadbolt.decadent.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2095 Lines: 61 --bCsyhTFzCvuiizWE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable We've always masked off the top 32 bits when x32 is enabled, but hopefully no-one relies on that. Now that the slow path is in C, we check all the bits there, regardless of whether x32 is enabled. Let's make the fast path consistent with it. Signed-off-by: Ben Hutchings Cc: Andy Lutomirski --- arch/x86/entry/entry_64.S | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 858b555e274b..17ba2ca9b24d 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -190,12 +190,10 @@ entry_SYSCALL_64_fastpath: */ TRACE_IRQS_ON ENABLE_INTERRUPTS(CLBR_NONE) -#if __SYSCALL_MASK =3D=3D ~0 - cmpq $__NR_syscall_max, %rax -#else - andl $__SYSCALL_MASK, %eax - cmpl $__NR_syscall_max, %eax +#if __SYSCALL_MASK !=3D ~0 + andq $__SYSCALL_MASK, %rax #endif + cmpq $__NR_syscall_max, %rax ja 1f /* return -ENOSYS (already in pt_regs->ax) */ movq %r10, %rcx =20 --bCsyhTFzCvuiizWE Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBVxQuoue/yOyVhhEJAQrSsQ//beToP9lx2+HgvXoibwBDPeCNRUKXky2q Zys/Y7NfxuO7ZuDtOVjvBVHNZo9nILB5BWVtCSJpQL6DmnL+pwvceNvSVfJI6VHP nY6IgcQHti7YV79CD0SW+hmNg0ZXjrLlLB3XKQuHWbSaVPl6LILVZf0R5W2c4+hB CK2NWnCs82SS0Y6cA0RcfVifSxYwGcgeZvqZclYsWv0nR9XT+OUyI5cfSRX9c1Gx ydFT/p+r39D6F6v/ZjPqv1ugdMLlR3ZajUPmgP1sjNZng8vTPJwZh/zMiw2UcbVr e2H9QNWuKJFWD3bkj23nvEInfaQzWqt3AG4bcsDrofeZL64H3AHaLXolNzRMyuqn 9fKZEBUUJsQnGIuQrfp6PA77tMKLtcsDAJfTrL4cRw3Os4Fh6qYw6WIqvAABLW5z WoYgNzs+5GSpg37/gLyURwyhjiK5fg30JP/3mvv6Bu7loSZW/D/1v0k1RlQTle8K VxKynJXYBtr9IrVi8K8mJOzJDmVjt7VCRDEs7KK6J4fVhTnjE5FY7qxWMerMgifE 8bIkCocaqfnPA6p3rLCu6o38WjGrdzB2Xfd/Q5d16wDo8NvpTIkktZMuqkGhcnHc xqfayAPIAp2QQRlrZsPLrUo6TFr5MSERInnL32qiMI70fXGI44pFxGG+1xDElDfj wEuOz8qYGyY= =ZiFQ -----END PGP SIGNATURE----- --bCsyhTFzCvuiizWE--