[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <92e55442b744a5951fdc9cfee10badd0a5f7f828.1588983892.git.luto@kernel.org>
Date: Fri, 8 May 2020 17:25:32 -0700
From: Andy Lutomirski <luto@...nel.org>
To: X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Cc: Andy Lutomirski <luto@...nel.org>,
Thorsten Glaser <t.glaser@...ent.de>, stable@...nel.org
Subject: [PATCH] Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long"
This reverts commit 45e29d119e9923ff14dfb840e3482bef1667bbfb and
adds a comment to discourage someone else from making the same
mistake again.
It turns out that some user code fails to compile if
__X32_SYSCALL_BIT is unsigned long. See, for example:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954294
Reported-by: Thorsten Glaser <t.glaser@...ent.de>
Fixes: 45e29d119e99 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long")
Cc: stable@...nel.org
Signed-off-by: Andy Lutomirski <luto@...nel.org>
---
arch/x86/include/uapi/asm/unistd.h | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/uapi/asm/unistd.h b/arch/x86/include/uapi/asm/unistd.h
index 196fdd02b8b1..be5e2e747f50 100644
--- a/arch/x86/include/uapi/asm/unistd.h
+++ b/arch/x86/include/uapi/asm/unistd.h
@@ -2,8 +2,15 @@
#ifndef _UAPI_ASM_X86_UNISTD_H
#define _UAPI_ASM_X86_UNISTD_H
-/* x32 syscall flag bit */
-#define __X32_SYSCALL_BIT 0x40000000UL
+/*
+ * x32 syscall flag bit. Some user programs expect syscall NR macros
+ * and __X32_SYSCALL_BIT to have type int, even though syscall numbers
+ * are, for practical purposes, unsigned long.
+ *
+ * Fortunately, expressions like (nr & ~__X32_SYSCALL_BIT) do the right
+ * thing regardless.
+ */
+#define __X32_SYSCALL_BIT 0x40000000
#ifndef __KERNEL__
# ifdef __i386__
--
2.25.4
Powered by blists - more mailing lists