All of
 help / color / mirror / Atom feed
From: Andy Lutomirski <>
To: X86 ML <>, LKML <>
Cc: Andy Lutomirski <>,
	Thorsten Glaser <>,
Subject: [PATCH] Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long"
Date: Fri,  8 May 2020 17:25:32 -0700	[thread overview]
Message-ID: <> (raw)

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:

Reported-by: Thorsten Glaser <>
Fixes: 45e29d119e99 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long")
Signed-off-by: Andy Lutomirski <>
 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__

             reply	other threads:[~2020-05-09  0:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  0:25 Andy Lutomirski [this message]
2020-05-26 14:52 ` [tip: x86/urgent] x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long" tip-bot2 for Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.