Skip to content

Commit 700d3a5

Browse files
amlutosuryasaimadhu
authored andcommitted
x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long"
Revert 45e29d1 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long") and add 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 [1] below. [ bp: Massage and do the same thing in the respective tools/ header. ] Fixes: 45e29d1 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long") Reported-by: Thorsten Glaser <[email protected]> Signed-off-by: Andy Lutomirski <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: [email protected] Link: [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954294 Link: https://lkml.kernel.org/r/92e55442b744a5951fdc9cfee10badd0a5f7f828.1588983892.git.luto@kernel.org
1 parent 9cb1fd0 commit 700d3a5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

arch/x86/include/uapi/asm/unistd.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
#ifndef _UAPI_ASM_X86_UNISTD_H
33
#define _UAPI_ASM_X86_UNISTD_H
44

5-
/* x32 syscall flag bit */
6-
#define __X32_SYSCALL_BIT 0x40000000UL
5+
/*
6+
* x32 syscall flag bit. Some user programs expect syscall NR macros
7+
* and __X32_SYSCALL_BIT to have type int, even though syscall numbers
8+
* are, for practical purposes, unsigned long.
9+
*
10+
* Fortunately, expressions like (nr & ~__X32_SYSCALL_BIT) do the right
11+
* thing regardless.
12+
*/
13+
#define __X32_SYSCALL_BIT 0x40000000
714

815
#ifndef __KERNEL__
916
# ifdef __i386__

tools/arch/x86/include/uapi/asm/unistd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define _UAPI_ASM_X86_UNISTD_H
44

55
/* x32 syscall flag bit */
6-
#define __X32_SYSCALL_BIT 0x40000000UL
6+
#define __X32_SYSCALL_BIT 0x40000000
77

88
#ifndef __KERNEL__
99
# ifdef __i386__

0 commit comments

Comments
 (0)