linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] Update kernel uabi header files for x32
@ 2013-12-27 17:25 H.J. Lu
  0 siblings, 0 replies; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 17:25 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

X32 uses the same kernel system call interface as x86-64 for many
system calls.  However, "long" is 64-bit for x86-64 and is 32-bit for
x32.  Where long or unsigned long are used in struct types for such
system calls, they are wrong for x32.  __kernel_[u]long_t is [unsigned]
long for all ABIs other than x32.  I am submitting 8 patches to replace
long or unsigned long with __kernel_[u]long_t so that those struct types
can be used with x32 system calls.

H.J. Lu (8):
  Use __kernel_long_t in struct timex
  Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>
  Use __kernel_ulong_t in uapi struct ipc64_perm
  Use __kernel_long_t in struct msgbuf
  Use __kernel_ulong_t in struct msqid64_ds
  Use __kernel_ulong_t in x86 struct semid64_ds
  Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info
  Use __kernel_long_t in struct mq_attr

 arch/x86/include/uapi/asm/sembuf.h | 10 ++++-----
 include/uapi/asm-generic/ipcbuf.h  |  5 +++++
 include/uapi/asm-generic/msgbuf.h  | 19 +++++++++++-----
 include/uapi/asm-generic/shmbuf.h  | 36 +++++++++++++++++++++--------
 include/uapi/linux/mqueue.h        | 18 ++++++++++-----
 include/uapi/linux/msg.h           |  8 +++++--
 include/uapi/linux/resource.h      | 26 +++++++++++++++++++--
 include/uapi/linux/shm.h           | 14 +++++++++---
 include/uapi/linux/timex.h         | 46 +++++++++++++++++++++++++++++++-------
 9 files changed, 143 insertions(+), 39 deletions(-)

-- 
1.8.4.2


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 0/8] Update kernel uabi header files for x32
@ 2013-12-27 22:14 H.J. Lu
  2013-12-27 22:14 ` [PATCH 1/8] Use __kernel_long_t in struct timex H.J. Lu
                   ` (9 more replies)
  0 siblings, 10 replies; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

X32 uses the same kernel system call interface as x86-64 for many
system calls.  However, "long" is 64-bit for x86-64 and is 32-bit for
x32.  Where long or unsigned long are used in struct types for such
system calls, they are wrong for x32.  __kernel_[u]long_t is [unsigned]
long for all ABIs other than x32.  I am submitting 8 patches to replace
long or unsigned long with __kernel_[u]long_t so that those struct types
can be used with x32 system calls.

H.J. Lu (8):
  Use __kernel_long_t in struct timex
  Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>
  Use __kernel_ulong_t in uapi struct ipc64_perm
  Use __kernel_long_t in struct msgbuf
  Use __kernel_ulong_t in struct msqid64_ds
  Use __kernel_ulong_t in x86 struct semid64_ds
  Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info
  Use __kernel_long_t in struct mq_attr

 arch/x86/include/uapi/asm/sembuf.h | 10 ++++-----
 include/uapi/asm-generic/ipcbuf.h  |  5 +++++
 include/uapi/asm-generic/msgbuf.h  | 19 +++++++++++-----
 include/uapi/asm-generic/shmbuf.h  | 36 +++++++++++++++++++++--------
 include/uapi/linux/mqueue.h        | 18 ++++++++++-----
 include/uapi/linux/msg.h           |  8 +++++--
 include/uapi/linux/resource.h      | 26 +++++++++++++++++++--
 include/uapi/linux/shm.h           | 14 +++++++++---
 include/uapi/linux/timex.h         | 46 +++++++++++++++++++++++++++++++-------
 9 files changed, 143 insertions(+), 39 deletions(-)

-- 
1.8.4.2


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 1/8] Use __kernel_long_t in struct timex
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
@ 2013-12-27 22:14 ` H.J. Lu
  2014-01-21  5:15   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
  2013-12-27 22:14 ` [PATCH 2/8] Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h> H.J. Lu
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

X32 adjtimex system call is the same as x86-64 adjtimex system call,
which uses 64-bit integer for long in struct timex. But x32 long is
32 bit.  This patch replaces long in struct timex with __kernel_long_t.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/linux/timex.h | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/uapi/linux/timex.h b/include/uapi/linux/timex.h
index a7ea81f..92685d8 100644
--- a/include/uapi/linux/timex.h
+++ b/include/uapi/linux/timex.h
@@ -63,27 +63,27 @@
  */
 struct timex {
 	unsigned int modes;	/* mode selector */
-	long offset;		/* time offset (usec) */
-	long freq;		/* frequency offset (scaled ppm) */
-	long maxerror;		/* maximum error (usec) */
-	long esterror;		/* estimated error (usec) */
+	__kernel_long_t offset;	/* time offset (usec) */
+	__kernel_long_t freq;	/* frequency offset (scaled ppm) */
+	__kernel_long_t maxerror;/* maximum error (usec) */
+	__kernel_long_t esterror;/* estimated error (usec) */
 	int status;		/* clock command/status */
-	long constant;		/* pll time constant */
-	long precision;		/* clock precision (usec) (read only) */
-	long tolerance;		/* clock frequency tolerance (ppm)
-				 * (read only)
-				 */
+	__kernel_long_t constant;/* pll time constant */
+	__kernel_long_t precision;/* clock precision (usec) (read only) */
+	__kernel_long_t tolerance;/* clock frequency tolerance (ppm)
+				   * (read only)
+				   */
 	struct timeval time;	/* (read only, except for ADJ_SETOFFSET) */
-	long tick;		/* (modified) usecs between clock ticks */
+	__kernel_long_t tick;	/* (modified) usecs between clock ticks */
 
-	long ppsfreq;           /* pps frequency (scaled ppm) (ro) */
-	long jitter;            /* pps jitter (us) (ro) */
+	__kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */
+	__kernel_long_t jitter; /* pps jitter (us) (ro) */
 	int shift;              /* interval duration (s) (shift) (ro) */
-	long stabil;            /* pps stability (scaled ppm) (ro) */
-	long jitcnt;            /* jitter limit exceeded (ro) */
-	long calcnt;            /* calibration intervals (ro) */
-	long errcnt;            /* calibration errors (ro) */
-	long stbcnt;            /* stability limit exceeded (ro) */
+	__kernel_long_t stabil;            /* pps stability (scaled ppm) (ro) */
+	__kernel_long_t jitcnt; /* jitter limit exceeded (ro) */
+	__kernel_long_t calcnt; /* calibration intervals (ro) */
+	__kernel_long_t errcnt; /* calibration errors (ro) */
+	__kernel_long_t stbcnt; /* stability limit exceeded (ro) */
 
 	int tai;		/* TAI offset (ro) */
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 2/8] Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
  2013-12-27 22:14 ` [PATCH 1/8] Use __kernel_long_t in struct timex H.J. Lu
@ 2013-12-27 22:14 ` H.J. Lu
  2014-01-21  5:15   ` [tip:x86/x32] uapi: Use __kernel_long_t/__kernel_ulong_t in < linux/resource.h> tip-bot for H.J. Lu
  2013-12-27 22:14 ` [PATCH 3/8] Use __kernel_ulong_t in uapi struct ipc64_perm H.J. Lu
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

Both x32 and x86-64 use the same struct rusage and struct rlimit for
system calls.  But x32 log is 32-bit.  This patch change uapi
<linux/resource.h> to use __kernel_long_t in struct rusage and
__kernel_ulong_t in and struct rlimit.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/linux/resource.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/uapi/linux/resource.h b/include/uapi/linux/resource.h
index e0ed284..36fb3b5 100644
--- a/include/uapi/linux/resource.h
+++ b/include/uapi/linux/resource.h
@@ -23,25 +23,25 @@
 struct	rusage {
 	struct timeval ru_utime;	/* user time used */
 	struct timeval ru_stime;	/* system time used */
-	long	ru_maxrss;		/* maximum resident set size */
-	long	ru_ixrss;		/* integral shared memory size */
-	long	ru_idrss;		/* integral unshared data size */
-	long	ru_isrss;		/* integral unshared stack size */
-	long	ru_minflt;		/* page reclaims */
-	long	ru_majflt;		/* page faults */
-	long	ru_nswap;		/* swaps */
-	long	ru_inblock;		/* block input operations */
-	long	ru_oublock;		/* block output operations */
-	long	ru_msgsnd;		/* messages sent */
-	long	ru_msgrcv;		/* messages received */
-	long	ru_nsignals;		/* signals received */
-	long	ru_nvcsw;		/* voluntary context switches */
-	long	ru_nivcsw;		/* involuntary " */
+	__kernel_long_t	ru_maxrss;	/* maximum resident set size */
+	__kernel_long_t	ru_ixrss;	/* integral shared memory size */
+	__kernel_long_t	ru_idrss;	/* integral unshared data size */
+	__kernel_long_t	ru_isrss;	/* integral unshared stack size */
+	__kernel_long_t	ru_minflt;	/* page reclaims */
+	__kernel_long_t	ru_majflt;	/* page faults */
+	__kernel_long_t	ru_nswap;	/* swaps */
+	__kernel_long_t	ru_inblock;	/* block input operations */
+	__kernel_long_t	ru_oublock;	/* block output operations */
+	__kernel_long_t	ru_msgsnd;	/* messages sent */
+	__kernel_long_t	ru_msgrcv;	/* messages received */
+	__kernel_long_t	ru_nsignals;	/* signals received */
+	__kernel_long_t	ru_nvcsw;	/* voluntary context switches */
+	__kernel_long_t	ru_nivcsw;	/* involuntary " */
 };
 
 struct rlimit {
-	unsigned long	rlim_cur;
-	unsigned long	rlim_max;
+	__kernel_ulong_t	rlim_cur;
+	__kernel_ulong_t	rlim_max;
 };
 
 #define RLIM64_INFINITY		(~0ULL)
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 3/8] Use __kernel_ulong_t in uapi struct ipc64_perm
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
  2013-12-27 22:14 ` [PATCH 1/8] Use __kernel_long_t in struct timex H.J. Lu
  2013-12-27 22:14 ` [PATCH 2/8] Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h> H.J. Lu
@ 2013-12-27 22:14 ` H.J. Lu
  2014-01-21  5:15   ` [tip:x86/x32] uapi, asm-generic: " tip-bot for H.J. Lu
  2013-12-27 22:14 ` [PATCH 4/8] Use __kernel_long_t in struct msgbuf H.J. Lu
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

X32 IPC system call is the same as x86-64 IPC system call, which uses
64-bit integer for unsigned long in struct ipc64_perm.  But x32 long is
32 bit.  This patch replaces unsigned long in uapi struct ipc64_perm with
__kernel_ulong_t.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/asm-generic/ipcbuf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/asm-generic/ipcbuf.h b/include/uapi/asm-generic/ipcbuf.h
index 76982b2..3dbcc1e 100644
--- a/include/uapi/asm-generic/ipcbuf.h
+++ b/include/uapi/asm-generic/ipcbuf.h
@@ -27,8 +27,8 @@ struct ipc64_perm {
 	unsigned char		__pad1[4 - sizeof(__kernel_mode_t)];
 	unsigned short		seq;
 	unsigned short		__pad2;
-	unsigned long		__unused1;
-	unsigned long		__unused2;
+	__kernel_ulong_t	__unused1;
+	__kernel_ulong_t	__unused2;
 };
 
 #endif /* __ASM_GENERIC_IPCBUF_H */
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 4/8] Use __kernel_long_t in struct msgbuf
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
                   ` (2 preceding siblings ...)
  2013-12-27 22:14 ` [PATCH 3/8] Use __kernel_ulong_t in uapi struct ipc64_perm H.J. Lu
@ 2013-12-27 22:14 ` H.J. Lu
  2014-01-21  5:16   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
  2013-12-27 22:14 ` [PATCH 5/8] Use __kernel_ulong_t in struct msqid64_ds H.J. Lu
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

X32 msgsnd/msgrcv system calls are the same as x86-64 msgsnd/msgrcv system
calls, which use 64-bit integer for long in struct msgbuf . But x32 long
is 32 bit.  This patch replaces long in struct msgbuf with __kernel_long_t.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/linux/msg.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h
index 22d95c6..a703755 100644
--- a/include/uapi/linux/msg.h
+++ b/include/uapi/linux/msg.h
@@ -34,8 +34,8 @@ struct msqid_ds {
 
 /* message buffer for msgsnd and msgrcv calls */
 struct msgbuf {
-	long mtype;         /* type of message */
-	char mtext[1];      /* message text */
+	__kernel_long_t mtype;          /* type of message */
+	char mtext[1];                  /* message text */
 };
 
 /* buffer for msgctl calls IPC_INFO, MSG_INFO */
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 5/8] Use __kernel_ulong_t in struct msqid64_ds
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
                   ` (3 preceding siblings ...)
  2013-12-27 22:14 ` [PATCH 4/8] Use __kernel_long_t in struct msgbuf H.J. Lu
@ 2013-12-27 22:14 ` H.J. Lu
  2014-01-21  5:16   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
  2013-12-27 22:14 ` [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds H.J. Lu
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

Both x32 and x86-64 use the same struct msqid64_ds for system calls.
But x32 long is 32-bit. This patch replaces unsigned long with
__kernel_ulong_t in struct msqid64_ds.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/asm-generic/msgbuf.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/uapi/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h
index aec850d..f55ecc4 100644
--- a/include/uapi/asm-generic/msgbuf.h
+++ b/include/uapi/asm-generic/msgbuf.h
@@ -35,13 +35,13 @@ struct msqid64_ds {
 #if __BITS_PER_LONG != 64
 	unsigned long	__unused3;
 #endif
-	unsigned long  msg_cbytes;	/* current number of bytes on queue */
-	unsigned long  msg_qnum;	/* number of messages in queue */
-	unsigned long  msg_qbytes;	/* max number of bytes on queue */
+	__kernel_ulong_t msg_cbytes;	/* current number of bytes on queue */
+	__kernel_ulong_t msg_qnum;	/* number of messages in queue */
+	__kernel_ulong_t msg_qbytes;	/* max number of bytes on queue */
 	__kernel_pid_t msg_lspid;	/* pid of last msgsnd */
 	__kernel_pid_t msg_lrpid;	/* last receive pid */
-	unsigned long  __unused4;
-	unsigned long  __unused5;
+	__kernel_ulong_t __unused4;
+	__kernel_ulong_t __unused5;
 };
 
 #endif /* __ASM_GENERIC_MSGBUF_H */
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
                   ` (4 preceding siblings ...)
  2013-12-27 22:14 ` [PATCH 5/8] Use __kernel_ulong_t in struct msqid64_ds H.J. Lu
@ 2013-12-27 22:14 ` H.J. Lu
  2014-01-21  5:16   ` [tip:x86/x32] x86, uapi, x32: " tip-bot for H.J. Lu
  2013-12-27 22:14 ` [PATCH 7/8] Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info H.J. Lu
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

Both x32 and x86-64 use the same struct semid64_ds for system calls.
But x32 long is 32-bit. This patch replaces unsigned long with
__kernel_ulong_t in x86 struct semid64_ds.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 arch/x86/include/uapi/asm/sembuf.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/uapi/asm/sembuf.h b/arch/x86/include/uapi/asm/sembuf.h
index ee50c80..cc2d6a3 100644
--- a/arch/x86/include/uapi/asm/sembuf.h
+++ b/arch/x86/include/uapi/asm/sembuf.h
@@ -13,12 +13,12 @@
 struct semid64_ds {
 	struct ipc64_perm sem_perm;	/* permissions .. see ipc.h */
 	__kernel_time_t	sem_otime;	/* last semop time */
-	unsigned long	__unused1;
+	__kernel_ulong_t __unused1;
 	__kernel_time_t	sem_ctime;	/* last change time */
-	unsigned long	__unused2;
-	unsigned long	sem_nsems;	/* no. of semaphores in array */
-	unsigned long	__unused3;
-	unsigned long	__unused4;
+	__kernel_ulong_t __unused2;
+	__kernel_ulong_t sem_nsems;	/* no. of semaphores in array */
+	__kernel_ulong_t __unused3;
+	__kernel_ulong_t __unused4;
 };
 
 #endif /* _ASM_X86_SEMBUF_H */
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 7/8] Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
                   ` (5 preceding siblings ...)
  2013-12-27 22:14 ` [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds H.J. Lu
@ 2013-12-27 22:14 ` H.J. Lu
  2014-01-21  5:16   ` [tip:x86/x32] uapi: Use __kernel_ulong_t in shmid64_ds/shminfo64/ shm_info tip-bot for H.J. Lu
  2013-12-27 22:14 ` [PATCH 8/8] Use __kernel_long_t in struct mq_attr H.J. Lu
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

Both x32 and x86-64 use the same struct shmid64_ds/shminfo64/shm_info for
system calls.  But x32 long is 32-bit. This patch replaces unsigned long
with __kernel_ulong_t in struct shmid64_ds/shminfo64/shm_info.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/asm-generic/shmbuf.h | 24 ++++++++++++------------
 include/uapi/linux/shm.h          | 10 +++++-----
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
index 5768fa6..7e9fb2f 100644
--- a/include/uapi/asm-generic/shmbuf.h
+++ b/include/uapi/asm-generic/shmbuf.h
@@ -39,21 +39,21 @@ struct shmid64_ds {
 #endif
 	__kernel_pid_t		shm_cpid;	/* pid of creator */
 	__kernel_pid_t		shm_lpid;	/* pid of last operator */
-	unsigned long		shm_nattch;	/* no. of current attaches */
-	unsigned long		__unused4;
-	unsigned long		__unused5;
+	__kernel_ulong_t	shm_nattch;	/* no. of current attaches */
+	__kernel_ulong_t	__unused4;
+	__kernel_ulong_t	__unused5;
 };
 
 struct shminfo64 {
-	unsigned long	shmmax;
-	unsigned long	shmmin;
-	unsigned long	shmmni;
-	unsigned long	shmseg;
-	unsigned long	shmall;
-	unsigned long	__unused1;
-	unsigned long	__unused2;
-	unsigned long	__unused3;
-	unsigned long	__unused4;
+	__kernel_ulong_t	shmmax;
+	__kernel_ulong_t	shmmin;
+	__kernel_ulong_t	shmmni;
+	__kernel_ulong_t	shmseg;
+	__kernel_ulong_t	shmall;
+	__kernel_ulong_t	__unused1;
+	__kernel_ulong_t	__unused2;
+	__kernel_ulong_t	__unused3;
+	__kernel_ulong_t	__unused4;
 };
 
 #endif /* __ASM_GENERIC_SHMBUF_H */
diff --git a/include/uapi/linux/shm.h b/include/uapi/linux/shm.h
index ec36fa1..78b6941 100644
--- a/include/uapi/linux/shm.h
+++ b/include/uapi/linux/shm.h
@@ -68,11 +68,11 @@ struct	shminfo {
 
 struct shm_info {
 	int used_ids;
-	unsigned long shm_tot;	/* total allocated shm */
-	unsigned long shm_rss;	/* total resident shm */
-	unsigned long shm_swp;	/* total swapped shm */
-	unsigned long swap_attempts;
-	unsigned long swap_successes;
+	__kernel_ulong_t shm_tot;	/* total allocated shm */
+	__kernel_ulong_t shm_rss;	/* total resident shm */
+	__kernel_ulong_t shm_swp;	/* total swapped shm */
+	__kernel_ulong_t swap_attempts;
+	__kernel_ulong_t swap_successes;
 };
 
 
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 8/8] Use __kernel_long_t in struct mq_attr
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
                   ` (6 preceding siblings ...)
  2013-12-27 22:14 ` [PATCH 7/8] Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info H.J. Lu
@ 2013-12-27 22:14 ` H.J. Lu
  2014-01-21  5:16   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
  2015-11-24  4:39   ` [PATCH 8/8] " Dmitry V. Levin
  2013-12-28 16:33 ` [PATCH 0/8] Update kernel uabi header files for x32 Christoph Hellwig
  2014-01-21 17:06 ` H. Peter Anvin
  9 siblings, 2 replies; 32+ messages in thread
From: H.J. Lu @ 2013-12-27 22:14 UTC (permalink / raw)
  To: H. Peter Anvin, LKML; +Cc: H.J. Lu

Both x32 and x86-64 use the same struct mq_attr for system calls.  But
x32 long is 32-bit. This patch replaces long with __kernel_long_t in
struct mq_attr.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/linux/mqueue.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/uapi/linux/mqueue.h b/include/uapi/linux/mqueue.h
index 8b5a796..d0a2b8e 100644
--- a/include/uapi/linux/mqueue.h
+++ b/include/uapi/linux/mqueue.h
@@ -23,11 +23,11 @@
 #define MQ_BYTES_MAX	819200
 
 struct mq_attr {
-	long	mq_flags;	/* message queue flags			*/
-	long	mq_maxmsg;	/* maximum number of messages		*/
-	long	mq_msgsize;	/* maximum message size			*/
-	long	mq_curmsgs;	/* number of messages currently queued	*/
-	long	__reserved[4];	/* ignored for input, zeroed for output */
+	__kernel_long_t	mq_flags;	/* message queue flags			*/
+	__kernel_long_t	mq_maxmsg;	/* maximum number of messages		*/
+	__kernel_long_t	mq_msgsize;	/* maximum message size			*/
+	__kernel_long_t	mq_curmsgs;	/* number of messages currently queued	*/
+	__kernel_long_t	__reserved[4];	/* ignored for input, zeroed for output */
 };
 
 /*
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
                   ` (7 preceding siblings ...)
  2013-12-27 22:14 ` [PATCH 8/8] Use __kernel_long_t in struct mq_attr H.J. Lu
@ 2013-12-28 16:33 ` Christoph Hellwig
  2013-12-28 17:01   ` H. Peter Anvin
  2014-01-20 17:46   ` H. Peter Anvin
  2014-01-21 17:06 ` H. Peter Anvin
  9 siblings, 2 replies; 32+ messages in thread
From: Christoph Hellwig @ 2013-12-28 16:33 UTC (permalink / raw)
  To: H.J. Lu; +Cc: H. Peter Anvin, LKML

On Fri, Dec 27, 2013 at 02:14:16PM -0800, H.J. Lu wrote:
> X32 uses the same kernel system call interface as x86-64 for many
> system calls.  However, "long" is 64-bit for x86-64 and is 32-bit for
> x32.  Where long or unsigned long are used in struct types for such
> system calls, they are wrong for x32.  __kernel_[u]long_t is [unsigned]
> long for all ABIs other than x32.  I am submitting 8 patches to replace
> long or unsigned long with __kernel_[u]long_t so that those struct types
> can be used with x32 system calls.

Independent on how this fixes things, how does the kernel_long_t name
here make any sense?

On x86-64 "kernel" long always is 64 bits wide.  The userspace ABI long
might be 32 or 64bits wide.

Currently kernel_long_t has almost no uses, so it might be a good time
to fix the name, define the rules for it, and last but not least
properly document the intent for thse types.


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2013-12-28 16:33 ` [PATCH 0/8] Update kernel uabi header files for x32 Christoph Hellwig
@ 2013-12-28 17:01   ` H. Peter Anvin
  2014-01-20 17:46   ` H. Peter Anvin
  1 sibling, 0 replies; 32+ messages in thread
From: H. Peter Anvin @ 2013-12-28 17:01 UTC (permalink / raw)
  To: Christoph Hellwig, H.J. Lu; +Cc: LKML

On 12/28/2013 08:33 AM, Christoph Hellwig wrote:
> 
> Independent on how this fixes things, how does the kernel_long_t name
> here make any sense?
> 
> On x86-64 "kernel" long always is 64 bits wide.  The userspace ABI long
> might be 32 or 64bits wide.
> 
> Currently kernel_long_t has almost no uses, so it might be a good time
> to fix the name, define the rules for it, and last but not least
> properly document the intent for thse types.
> 

The definition is "an integer type the same width as 'long' for the
native kernel type for the ABI".  If you have any suggestions for a
better name, or for that matter, a better alternative, that would be
genuinely appreciated...

	-hpa


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2013-12-28 16:33 ` [PATCH 0/8] Update kernel uabi header files for x32 Christoph Hellwig
  2013-12-28 17:01   ` H. Peter Anvin
@ 2014-01-20 17:46   ` H. Peter Anvin
  2014-01-20 17:50     ` Christoph Hellwig
  2014-01-21 12:04     ` Catalin Marinas
  1 sibling, 2 replies; 32+ messages in thread
From: H. Peter Anvin @ 2014-01-20 17:46 UTC (permalink / raw)
  To: Christoph Hellwig, H.J. Lu, linux-arch
  Cc: LKML, Linus Torvalds, Ralf Baechle, Catalin Marinas, Will Deacon

On 12/28/2013 08:33 AM, Christoph Hellwig wrote:
> On Fri, Dec 27, 2013 at 02:14:16PM -0800, H.J. Lu wrote:
>> X32 uses the same kernel system call interface as x86-64 for many
>> system calls.  However, "long" is 64-bit for x86-64 and is 32-bit for
>> x32.  Where long or unsigned long are used in struct types for such
>> system calls, they are wrong for x32.  __kernel_[u]long_t is [unsigned]
>> long for all ABIs other than x32.  I am submitting 8 patches to replace
>> long or unsigned long with __kernel_[u]long_t so that those struct types
>> can be used with x32 system calls.
> 
> Independent on how this fixes things, how does the kernel_long_t name
> here make any sense?
> 
> On x86-64 "kernel" long always is 64 bits wide.  The userspace ABI long
> might be 32 or 64bits wide.
> 
> Currently kernel_long_t has almost no uses, so it might be a good time
> to fix the name, define the rules for it, and last but not least
> properly document the intent for thse types.
> 

This comment by Christoph was literally the only feedback on this
patchset.  The definition of __kernel_[u]long_t is "the size of 'long'
for the native kernel for the ABI".  H.J.'s patchset only affects x86
(specifically x86-64) since on all other platforms __kernel_[u]long_t is
simply defined as long/unsigned long.

That being said, x32 is not the only ABI of this type.  In particular,
if the MIPS N32 and ARM64 ILP32 maintainers have suggestions which would
make this work more applicable to them, it would be highly useful to
receive any such feedback.

	-hpa


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-20 17:46   ` H. Peter Anvin
@ 2014-01-20 17:50     ` Christoph Hellwig
  2014-01-20 17:51       ` H.J. Lu
  2014-01-20 17:52       ` H. Peter Anvin
  2014-01-21 12:04     ` Catalin Marinas
  1 sibling, 2 replies; 32+ messages in thread
From: Christoph Hellwig @ 2014-01-20 17:50 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Christoph Hellwig, H.J. Lu, linux-arch, LKML, Linus Torvalds,
	Ralf Baechle, Catalin Marinas, Will Deacon

On Mon, Jan 20, 2014 at 09:46:41AM -0800, H. Peter Anvin wrote:
> This comment by Christoph was literally the only feedback on this
> patchset.  The definition of __kernel_[u]long_t is "the size of 'long'
> for the native kernel for the ABI".  H.J.'s patchset only affects x86
> (specifically x86-64) since on all other platforms __kernel_[u]long_t is
> simply defined as long/unsigned long.

Btw, sorry for the delay in getting back yo your question.  How about
__abi_long_t or __kabi_long_t instead?


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-20 17:50     ` Christoph Hellwig
@ 2014-01-20 17:51       ` H.J. Lu
  2014-01-20 17:52         ` H.J. Lu
  2014-01-20 17:52         ` H. Peter Anvin
  2014-01-20 17:52       ` H. Peter Anvin
  1 sibling, 2 replies; 32+ messages in thread
From: H.J. Lu @ 2014-01-20 17:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: H. Peter Anvin, linux-arch, LKML, Linus Torvalds, Ralf Baechle,
	Catalin Marinas, Will Deacon

On Mon, Jan 20, 2014 at 9:50 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Mon, Jan 20, 2014 at 09:46:41AM -0800, H. Peter Anvin wrote:
>> This comment by Christoph was literally the only feedback on this
>> patchset.  The definition of __kernel_[u]long_t is "the size of 'long'
>> for the native kernel for the ABI".  H.J.'s patchset only affects x86
>> (specifically x86-64) since on all other platforms __kernel_[u]long_t is
>> simply defined as long/unsigned long.
>
> Btw, sorry for the delay in getting back yo your question.  How about
> __abi_long_t or __kabi_long_t instead?
>

FWIW, in glibc, we use __syscall_ulong_t/__syscall_ulong_t instead of
__kernel_[u]long_t.


-- 
H.J.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-20 17:50     ` Christoph Hellwig
  2014-01-20 17:51       ` H.J. Lu
@ 2014-01-20 17:52       ` H. Peter Anvin
  1 sibling, 0 replies; 32+ messages in thread
From: H. Peter Anvin @ 2014-01-20 17:52 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: H.J. Lu, linux-arch, LKML, Linus Torvalds, Ralf Baechle,
	Catalin Marinas, Will Deacon

On 01/20/2014 09:50 AM, Christoph Hellwig wrote:
> On Mon, Jan 20, 2014 at 09:46:41AM -0800, H. Peter Anvin wrote:
>> This comment by Christoph was literally the only feedback on this
>> patchset.  The definition of __kernel_[u]long_t is "the size of 'long'
>> for the native kernel for the ABI".  H.J.'s patchset only affects x86
>> (specifically x86-64) since on all other platforms __kernel_[u]long_t is
>> simply defined as long/unsigned long.
> 
> Btw, sorry for the delay in getting back yo your question.  How about
> __abi_long_t or __kabi_long_t instead?
> 

__kernel_* is the namespace that we reserve for uabi symbols/types in
user space.  Changing the prefix would break that contract.

	-hpa


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-20 17:51       ` H.J. Lu
@ 2014-01-20 17:52         ` H.J. Lu
  2014-01-20 17:52         ` H. Peter Anvin
  1 sibling, 0 replies; 32+ messages in thread
From: H.J. Lu @ 2014-01-20 17:52 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: H. Peter Anvin, linux-arch, LKML, Linus Torvalds, Ralf Baechle,
	Catalin Marinas, Will Deacon

On Mon, Jan 20, 2014 at 9:51 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jan 20, 2014 at 9:50 AM, Christoph Hellwig <hch@infradead.org> wrote:
>> On Mon, Jan 20, 2014 at 09:46:41AM -0800, H. Peter Anvin wrote:
>>> This comment by Christoph was literally the only feedback on this
>>> patchset.  The definition of __kernel_[u]long_t is "the size of 'long'
>>> for the native kernel for the ABI".  H.J.'s patchset only affects x86
>>> (specifically x86-64) since on all other platforms __kernel_[u]long_t is
>>> simply defined as long/unsigned long.
>>
>> Btw, sorry for the delay in getting back yo your question.  How about
>> __abi_long_t or __kabi_long_t instead?
>>
>
> FWIW, in glibc, we use __syscall_ulong_t/__syscall_ulong_t instead of

It should be __syscall_ulong_t/__syscall_slong_t.

> __kernel_[u]long_t.




-- 
H.J.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-20 17:51       ` H.J. Lu
  2014-01-20 17:52         ` H.J. Lu
@ 2014-01-20 17:52         ` H. Peter Anvin
  1 sibling, 0 replies; 32+ messages in thread
From: H. Peter Anvin @ 2014-01-20 17:52 UTC (permalink / raw)
  To: H.J. Lu, Christoph Hellwig
  Cc: linux-arch, LKML, Linus Torvalds, Ralf Baechle, Catalin Marinas,
	Will Deacon

On 01/20/2014 09:51 AM, H.J. Lu wrote:
> On Mon, Jan 20, 2014 at 9:50 AM, Christoph Hellwig <hch@infradead.org> wrote:
>> On Mon, Jan 20, 2014 at 09:46:41AM -0800, H. Peter Anvin wrote:
>>> This comment by Christoph was literally the only feedback on this
>>> patchset.  The definition of __kernel_[u]long_t is "the size of 'long'
>>> for the native kernel for the ABI".  H.J.'s patchset only affects x86
>>> (specifically x86-64) since on all other platforms __kernel_[u]long_t is
>>> simply defined as long/unsigned long.
>>
>> Btw, sorry for the delay in getting back yo your question.  How about
>> __abi_long_t or __kabi_long_t instead?
>>
> 
> FWIW, in glibc, we use __syscall_ulong_t/__syscall_ulong_t instead of
> __kernel_[u]long_t.
> 

Yes, but glibc defines its own headers and doesn't rely on the types
exported from the kernel.

We could rename them all, but that would *definitely* seem like breaking
the universe for no good reason.

	-hpa



^ permalink raw reply	[flat|nested] 32+ messages in thread

* [tip:x86/x32] uapi: Use __kernel_long_t in struct timex
  2013-12-27 22:14 ` [PATCH 1/8] Use __kernel_long_t in struct timex H.J. Lu
@ 2014-01-21  5:15   ` tip-bot for H.J. Lu
  0 siblings, 0 replies; 32+ messages in thread
From: tip-bot for H.J. Lu @ 2014-01-21  5:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  7fb30128527a4220f181c2867edd9ac178175a87
Gitweb:     http://git.kernel.org/tip/7fb30128527a4220f181c2867edd9ac178175a87
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Fri, 27 Dec 2013 14:14:17 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 20 Jan 2014 14:44:05 -0800

uapi: Use __kernel_long_t in struct timex

x32 adjtimex system call is the same as x86-64 adjtimex system call,
which uses 64-bit integer for long in struct timex. But x32 long is
32 bit.  This patch replaces long in struct timex with __kernel_long_t.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1388182464-28428-2-git-send-email-hjl.tools@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/linux/timex.h | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/uapi/linux/timex.h b/include/uapi/linux/timex.h
index a7ea81f..92685d8 100644
--- a/include/uapi/linux/timex.h
+++ b/include/uapi/linux/timex.h
@@ -63,27 +63,27 @@
  */
 struct timex {
 	unsigned int modes;	/* mode selector */
-	long offset;		/* time offset (usec) */
-	long freq;		/* frequency offset (scaled ppm) */
-	long maxerror;		/* maximum error (usec) */
-	long esterror;		/* estimated error (usec) */
+	__kernel_long_t offset;	/* time offset (usec) */
+	__kernel_long_t freq;	/* frequency offset (scaled ppm) */
+	__kernel_long_t maxerror;/* maximum error (usec) */
+	__kernel_long_t esterror;/* estimated error (usec) */
 	int status;		/* clock command/status */
-	long constant;		/* pll time constant */
-	long precision;		/* clock precision (usec) (read only) */
-	long tolerance;		/* clock frequency tolerance (ppm)
-				 * (read only)
-				 */
+	__kernel_long_t constant;/* pll time constant */
+	__kernel_long_t precision;/* clock precision (usec) (read only) */
+	__kernel_long_t tolerance;/* clock frequency tolerance (ppm)
+				   * (read only)
+				   */
 	struct timeval time;	/* (read only, except for ADJ_SETOFFSET) */
-	long tick;		/* (modified) usecs between clock ticks */
+	__kernel_long_t tick;	/* (modified) usecs between clock ticks */
 
-	long ppsfreq;           /* pps frequency (scaled ppm) (ro) */
-	long jitter;            /* pps jitter (us) (ro) */
+	__kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */
+	__kernel_long_t jitter; /* pps jitter (us) (ro) */
 	int shift;              /* interval duration (s) (shift) (ro) */
-	long stabil;            /* pps stability (scaled ppm) (ro) */
-	long jitcnt;            /* jitter limit exceeded (ro) */
-	long calcnt;            /* calibration intervals (ro) */
-	long errcnt;            /* calibration errors (ro) */
-	long stbcnt;            /* stability limit exceeded (ro) */
+	__kernel_long_t stabil;            /* pps stability (scaled ppm) (ro) */
+	__kernel_long_t jitcnt; /* jitter limit exceeded (ro) */
+	__kernel_long_t calcnt; /* calibration intervals (ro) */
+	__kernel_long_t errcnt; /* calibration errors (ro) */
+	__kernel_long_t stbcnt; /* stability limit exceeded (ro) */
 
 	int tai;		/* TAI offset (ro) */
 

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [tip:x86/x32] uapi: Use __kernel_long_t/__kernel_ulong_t in < linux/resource.h>
  2013-12-27 22:14 ` [PATCH 2/8] Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h> H.J. Lu
@ 2014-01-21  5:15   ` tip-bot for H.J. Lu
  0 siblings, 0 replies; 32+ messages in thread
From: tip-bot for H.J. Lu @ 2014-01-21  5:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  b684bfedc94d4b2efff09dc499a9985321c482f5
Gitweb:     http://git.kernel.org/tip/b684bfedc94d4b2efff09dc499a9985321c482f5
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Fri, 27 Dec 2013 14:14:18 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 20 Jan 2014 14:44:17 -0800

uapi: Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>

Both x32 and x86-64 use the same struct rusage and struct rlimit for
system calls.  But x32 log is 32-bit.  This patch change uapi
<linux/resource.h> to use __kernel_long_t in struct rusage and
__kernel_ulong_t in and struct rlimit.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1388182464-28428-3-git-send-email-hjl.tools@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/linux/resource.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/uapi/linux/resource.h b/include/uapi/linux/resource.h
index e0ed284..36fb3b5 100644
--- a/include/uapi/linux/resource.h
+++ b/include/uapi/linux/resource.h
@@ -23,25 +23,25 @@
 struct	rusage {
 	struct timeval ru_utime;	/* user time used */
 	struct timeval ru_stime;	/* system time used */
-	long	ru_maxrss;		/* maximum resident set size */
-	long	ru_ixrss;		/* integral shared memory size */
-	long	ru_idrss;		/* integral unshared data size */
-	long	ru_isrss;		/* integral unshared stack size */
-	long	ru_minflt;		/* page reclaims */
-	long	ru_majflt;		/* page faults */
-	long	ru_nswap;		/* swaps */
-	long	ru_inblock;		/* block input operations */
-	long	ru_oublock;		/* block output operations */
-	long	ru_msgsnd;		/* messages sent */
-	long	ru_msgrcv;		/* messages received */
-	long	ru_nsignals;		/* signals received */
-	long	ru_nvcsw;		/* voluntary context switches */
-	long	ru_nivcsw;		/* involuntary " */
+	__kernel_long_t	ru_maxrss;	/* maximum resident set size */
+	__kernel_long_t	ru_ixrss;	/* integral shared memory size */
+	__kernel_long_t	ru_idrss;	/* integral unshared data size */
+	__kernel_long_t	ru_isrss;	/* integral unshared stack size */
+	__kernel_long_t	ru_minflt;	/* page reclaims */
+	__kernel_long_t	ru_majflt;	/* page faults */
+	__kernel_long_t	ru_nswap;	/* swaps */
+	__kernel_long_t	ru_inblock;	/* block input operations */
+	__kernel_long_t	ru_oublock;	/* block output operations */
+	__kernel_long_t	ru_msgsnd;	/* messages sent */
+	__kernel_long_t	ru_msgrcv;	/* messages received */
+	__kernel_long_t	ru_nsignals;	/* signals received */
+	__kernel_long_t	ru_nvcsw;	/* voluntary context switches */
+	__kernel_long_t	ru_nivcsw;	/* involuntary " */
 };
 
 struct rlimit {
-	unsigned long	rlim_cur;
-	unsigned long	rlim_max;
+	__kernel_ulong_t	rlim_cur;
+	__kernel_ulong_t	rlim_max;
 };
 
 #define RLIM64_INFINITY		(~0ULL)

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [tip:x86/x32] uapi, asm-generic: Use __kernel_ulong_t in uapi struct ipc64_perm
  2013-12-27 22:14 ` [PATCH 3/8] Use __kernel_ulong_t in uapi struct ipc64_perm H.J. Lu
@ 2014-01-21  5:15   ` tip-bot for H.J. Lu
  0 siblings, 0 replies; 32+ messages in thread
From: tip-bot for H.J. Lu @ 2014-01-21  5:15 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  071ed2456f79722d0a54f51717e66aacbc7a5d26
Gitweb:     http://git.kernel.org/tip/071ed2456f79722d0a54f51717e66aacbc7a5d26
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Fri, 27 Dec 2013 14:14:19 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 20 Jan 2014 14:44:35 -0800

uapi, asm-generic: Use __kernel_ulong_t in uapi struct ipc64_perm

x32 IPC system call is the same as x86-64 IPC system call, which uses
64-bit integer for unsigned long in struct ipc64_perm.  But x32 long is
32 bit.  This patch replaces unsigned long in uapi struct ipc64_perm with
__kernel_ulong_t.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1388182464-28428-4-git-send-email-hjl.tools@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/asm-generic/ipcbuf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/asm-generic/ipcbuf.h b/include/uapi/asm-generic/ipcbuf.h
index 76982b2..3dbcc1e 100644
--- a/include/uapi/asm-generic/ipcbuf.h
+++ b/include/uapi/asm-generic/ipcbuf.h
@@ -27,8 +27,8 @@ struct ipc64_perm {
 	unsigned char		__pad1[4 - sizeof(__kernel_mode_t)];
 	unsigned short		seq;
 	unsigned short		__pad2;
-	unsigned long		__unused1;
-	unsigned long		__unused2;
+	__kernel_ulong_t	__unused1;
+	__kernel_ulong_t	__unused2;
 };
 
 #endif /* __ASM_GENERIC_IPCBUF_H */

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [tip:x86/x32] uapi: Use __kernel_long_t in struct msgbuf
  2013-12-27 22:14 ` [PATCH 4/8] Use __kernel_long_t in struct msgbuf H.J. Lu
@ 2014-01-21  5:16   ` tip-bot for H.J. Lu
  0 siblings, 0 replies; 32+ messages in thread
From: tip-bot for H.J. Lu @ 2014-01-21  5:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  443d5670f77aab121cb95f45da60f0aad390bcb5
Gitweb:     http://git.kernel.org/tip/443d5670f77aab121cb95f45da60f0aad390bcb5
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Fri, 27 Dec 2013 14:14:20 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 20 Jan 2014 14:44:50 -0800

uapi: Use __kernel_long_t in struct msgbuf

x32 msgsnd/msgrcv system calls are the same as x86-64 msgsnd/msgrcv system
calls, which use 64-bit integer for long in struct msgbuf . But x32 long
is 32 bit.  This patch replaces long in struct msgbuf with __kernel_long_t.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1388182464-28428-5-git-send-email-hjl.tools@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/linux/msg.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h
index 22d95c6..a703755 100644
--- a/include/uapi/linux/msg.h
+++ b/include/uapi/linux/msg.h
@@ -34,8 +34,8 @@ struct msqid_ds {
 
 /* message buffer for msgsnd and msgrcv calls */
 struct msgbuf {
-	long mtype;         /* type of message */
-	char mtext[1];      /* message text */
+	__kernel_long_t mtype;          /* type of message */
+	char mtext[1];                  /* message text */
 };
 
 /* buffer for msgctl calls IPC_INFO, MSG_INFO */

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [tip:x86/x32] uapi: Use __kernel_ulong_t in struct msqid64_ds
  2013-12-27 22:14 ` [PATCH 5/8] Use __kernel_ulong_t in struct msqid64_ds H.J. Lu
@ 2014-01-21  5:16   ` tip-bot for H.J. Lu
  0 siblings, 0 replies; 32+ messages in thread
From: tip-bot for H.J. Lu @ 2014-01-21  5:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  b9cd5ca22d6739c61655d4fcf8b29669d5d177a3
Gitweb:     http://git.kernel.org/tip/b9cd5ca22d6739c61655d4fcf8b29669d5d177a3
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Fri, 27 Dec 2013 14:14:21 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 20 Jan 2014 14:45:01 -0800

uapi: Use __kernel_ulong_t in struct msqid64_ds

Both x32 and x86-64 use the same struct msqid64_ds for system calls.
But x32 long is 32-bit. This patch replaces unsigned long with
__kernel_ulong_t in struct msqid64_ds.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1388182464-28428-6-git-send-email-hjl.tools@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/asm-generic/msgbuf.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/uapi/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h
index aec850d..f55ecc4 100644
--- a/include/uapi/asm-generic/msgbuf.h
+++ b/include/uapi/asm-generic/msgbuf.h
@@ -35,13 +35,13 @@ struct msqid64_ds {
 #if __BITS_PER_LONG != 64
 	unsigned long	__unused3;
 #endif
-	unsigned long  msg_cbytes;	/* current number of bytes on queue */
-	unsigned long  msg_qnum;	/* number of messages in queue */
-	unsigned long  msg_qbytes;	/* max number of bytes on queue */
+	__kernel_ulong_t msg_cbytes;	/* current number of bytes on queue */
+	__kernel_ulong_t msg_qnum;	/* number of messages in queue */
+	__kernel_ulong_t msg_qbytes;	/* max number of bytes on queue */
 	__kernel_pid_t msg_lspid;	/* pid of last msgsnd */
 	__kernel_pid_t msg_lrpid;	/* last receive pid */
-	unsigned long  __unused4;
-	unsigned long  __unused5;
+	__kernel_ulong_t __unused4;
+	__kernel_ulong_t __unused5;
 };
 
 #endif /* __ASM_GENERIC_MSGBUF_H */

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [tip:x86/x32] x86, uapi, x32: Use __kernel_ulong_t in x86 struct semid64_ds
  2013-12-27 22:14 ` [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds H.J. Lu
@ 2014-01-21  5:16   ` tip-bot for H.J. Lu
  0 siblings, 0 replies; 32+ messages in thread
From: tip-bot for H.J. Lu @ 2014-01-21  5:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  386916598e901e406c1f1fc801ade2646a1e8137
Gitweb:     http://git.kernel.org/tip/386916598e901e406c1f1fc801ade2646a1e8137
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Fri, 27 Dec 2013 14:14:22 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 20 Jan 2014 14:45:13 -0800

x86, uapi, x32: Use __kernel_ulong_t in x86 struct semid64_ds

Both x32 and x86-64 use the same struct semid64_ds for system calls.
But x32 long is 32-bit. This patch replaces unsigned long with
__kernel_ulong_t in x86 struct semid64_ds.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1388182464-28428-7-git-send-email-hjl.tools@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/include/uapi/asm/sembuf.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/uapi/asm/sembuf.h b/arch/x86/include/uapi/asm/sembuf.h
index ee50c80..cc2d6a3 100644
--- a/arch/x86/include/uapi/asm/sembuf.h
+++ b/arch/x86/include/uapi/asm/sembuf.h
@@ -13,12 +13,12 @@
 struct semid64_ds {
 	struct ipc64_perm sem_perm;	/* permissions .. see ipc.h */
 	__kernel_time_t	sem_otime;	/* last semop time */
-	unsigned long	__unused1;
+	__kernel_ulong_t __unused1;
 	__kernel_time_t	sem_ctime;	/* last change time */
-	unsigned long	__unused2;
-	unsigned long	sem_nsems;	/* no. of semaphores in array */
-	unsigned long	__unused3;
-	unsigned long	__unused4;
+	__kernel_ulong_t __unused2;
+	__kernel_ulong_t sem_nsems;	/* no. of semaphores in array */
+	__kernel_ulong_t __unused3;
+	__kernel_ulong_t __unused4;
 };
 
 #endif /* _ASM_X86_SEMBUF_H */

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [tip:x86/x32] uapi: Use __kernel_ulong_t in shmid64_ds/shminfo64/ shm_info
  2013-12-27 22:14 ` [PATCH 7/8] Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info H.J. Lu
@ 2014-01-21  5:16   ` tip-bot for H.J. Lu
  0 siblings, 0 replies; 32+ messages in thread
From: tip-bot for H.J. Lu @ 2014-01-21  5:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  f8dcdf0130d3ba34f8f7531af7c45616efe1e32e
Gitweb:     http://git.kernel.org/tip/f8dcdf0130d3ba34f8f7531af7c45616efe1e32e
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Fri, 27 Dec 2013 14:14:23 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 20 Jan 2014 14:45:25 -0800

uapi: Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info

Both x32 and x86-64 use the same struct shmid64_ds/shminfo64/shm_info for
system calls.  But x32 long is 32-bit. This patch replaces unsigned long
with __kernel_ulong_t in struct shmid64_ds/shminfo64/shm_info.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1388182464-28428-8-git-send-email-hjl.tools@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/asm-generic/shmbuf.h | 24 ++++++++++++------------
 include/uapi/linux/shm.h          | 10 +++++-----
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/uapi/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
index 5768fa6..7e9fb2f 100644
--- a/include/uapi/asm-generic/shmbuf.h
+++ b/include/uapi/asm-generic/shmbuf.h
@@ -39,21 +39,21 @@ struct shmid64_ds {
 #endif
 	__kernel_pid_t		shm_cpid;	/* pid of creator */
 	__kernel_pid_t		shm_lpid;	/* pid of last operator */
-	unsigned long		shm_nattch;	/* no. of current attaches */
-	unsigned long		__unused4;
-	unsigned long		__unused5;
+	__kernel_ulong_t	shm_nattch;	/* no. of current attaches */
+	__kernel_ulong_t	__unused4;
+	__kernel_ulong_t	__unused5;
 };
 
 struct shminfo64 {
-	unsigned long	shmmax;
-	unsigned long	shmmin;
-	unsigned long	shmmni;
-	unsigned long	shmseg;
-	unsigned long	shmall;
-	unsigned long	__unused1;
-	unsigned long	__unused2;
-	unsigned long	__unused3;
-	unsigned long	__unused4;
+	__kernel_ulong_t	shmmax;
+	__kernel_ulong_t	shmmin;
+	__kernel_ulong_t	shmmni;
+	__kernel_ulong_t	shmseg;
+	__kernel_ulong_t	shmall;
+	__kernel_ulong_t	__unused1;
+	__kernel_ulong_t	__unused2;
+	__kernel_ulong_t	__unused3;
+	__kernel_ulong_t	__unused4;
 };
 
 #endif /* __ASM_GENERIC_SHMBUF_H */
diff --git a/include/uapi/linux/shm.h b/include/uapi/linux/shm.h
index ec36fa1..78b6941 100644
--- a/include/uapi/linux/shm.h
+++ b/include/uapi/linux/shm.h
@@ -68,11 +68,11 @@ struct	shminfo {
 
 struct shm_info {
 	int used_ids;
-	unsigned long shm_tot;	/* total allocated shm */
-	unsigned long shm_rss;	/* total resident shm */
-	unsigned long shm_swp;	/* total swapped shm */
-	unsigned long swap_attempts;
-	unsigned long swap_successes;
+	__kernel_ulong_t shm_tot;	/* total allocated shm */
+	__kernel_ulong_t shm_rss;	/* total resident shm */
+	__kernel_ulong_t shm_swp;	/* total swapped shm */
+	__kernel_ulong_t swap_attempts;
+	__kernel_ulong_t swap_successes;
 };
 
 

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [tip:x86/x32] uapi: Use __kernel_long_t in struct mq_attr
  2013-12-27 22:14 ` [PATCH 8/8] Use __kernel_long_t in struct mq_attr H.J. Lu
@ 2014-01-21  5:16   ` tip-bot for H.J. Lu
  2015-11-24  4:39   ` [PATCH 8/8] " Dmitry V. Levin
  1 sibling, 0 replies; 32+ messages in thread
From: tip-bot for H.J. Lu @ 2014-01-21  5:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, tglx, hjl.tools

Commit-ID:  63159f5dcccb3858d88aaef800c4ee0eb4cc8577
Gitweb:     http://git.kernel.org/tip/63159f5dcccb3858d88aaef800c4ee0eb4cc8577
Author:     H.J. Lu <hjl.tools@gmail.com>
AuthorDate: Fri, 27 Dec 2013 14:14:24 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 20 Jan 2014 14:45:33 -0800

uapi: Use __kernel_long_t in struct mq_attr

Both x32 and x86-64 use the same struct mq_attr for system calls.  But
x32 long is 32-bit. This patch replaces long with __kernel_long_t in
struct mq_attr.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Link: http://lkml.kernel.org/r/1388182464-28428-9-git-send-email-hjl.tools@gmail.com
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 include/uapi/linux/mqueue.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/uapi/linux/mqueue.h b/include/uapi/linux/mqueue.h
index 8b5a796..d0a2b8e 100644
--- a/include/uapi/linux/mqueue.h
+++ b/include/uapi/linux/mqueue.h
@@ -23,11 +23,11 @@
 #define MQ_BYTES_MAX	819200
 
 struct mq_attr {
-	long	mq_flags;	/* message queue flags			*/
-	long	mq_maxmsg;	/* maximum number of messages		*/
-	long	mq_msgsize;	/* maximum message size			*/
-	long	mq_curmsgs;	/* number of messages currently queued	*/
-	long	__reserved[4];	/* ignored for input, zeroed for output */
+	__kernel_long_t	mq_flags;	/* message queue flags			*/
+	__kernel_long_t	mq_maxmsg;	/* maximum number of messages		*/
+	__kernel_long_t	mq_msgsize;	/* maximum message size			*/
+	__kernel_long_t	mq_curmsgs;	/* number of messages currently queued	*/
+	__kernel_long_t	__reserved[4];	/* ignored for input, zeroed for output */
 };
 
 /*

^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-20 17:46   ` H. Peter Anvin
  2014-01-20 17:50     ` Christoph Hellwig
@ 2014-01-21 12:04     ` Catalin Marinas
  2014-01-21 12:22       ` H.J. Lu
  2014-01-21 15:43       ` H. Peter Anvin
  1 sibling, 2 replies; 32+ messages in thread
From: Catalin Marinas @ 2014-01-21 12:04 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Christoph Hellwig, H.J. Lu, linux-arch, LKML, Linus Torvalds,
	Ralf Baechle, Will Deacon

On Mon, Jan 20, 2014 at 05:46:41PM +0000, H. Peter Anvin wrote:
> On 12/28/2013 08:33 AM, Christoph Hellwig wrote:
> > On Fri, Dec 27, 2013 at 02:14:16PM -0800, H.J. Lu wrote:
> >> X32 uses the same kernel system call interface as x86-64 for many
> >> system calls.  However, "long" is 64-bit for x86-64 and is 32-bit for
> >> x32.  Where long or unsigned long are used in struct types for such
> >> system calls, they are wrong for x32.  __kernel_[u]long_t is [unsigned]
> >> long for all ABIs other than x32.  I am submitting 8 patches to replace
> >> long or unsigned long with __kernel_[u]long_t so that those struct types
> >> can be used with x32 system calls.

Does this mean that you are changing the x32 ABI (or it hasn't been
declared stable yet)?

> This comment by Christoph was literally the only feedback on this
> patchset.  The definition of __kernel_[u]long_t is "the size of 'long'
> for the native kernel for the ABI".  H.J.'s patchset only affects x86
> (specifically x86-64) since on all other platforms __kernel_[u]long_t is
> simply defined as long/unsigned long.
> 
> That being said, x32 is not the only ABI of this type.  In particular,
> if the MIPS N32 and ARM64 ILP32 maintainers have suggestions which would
> make this work more applicable to them, it would be highly useful to
> receive any such feedback.

ILP32 for arm64 is still work in progress and subject to change. So far
the preliminary ABI
(http://git.kernel.org/cgit/linux/kernel/git/cmarinas/linux-aarch64.git/log/?h=ilp32)
redefines kernel_(u)long_t is defined as (unsigned) long long. Most of
the syscalls are 64-bit generic with ~23 routed to compat. I would like
to simplify these further and even use native 64-bit signal handling but
it requires some changes to generic structures.

I'll have a look at H.J.'s patches and give comments, they may come in
handy.

-- 
Catalin

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-21 12:04     ` Catalin Marinas
@ 2014-01-21 12:22       ` H.J. Lu
  2014-01-21 15:43       ` H. Peter Anvin
  1 sibling, 0 replies; 32+ messages in thread
From: H.J. Lu @ 2014-01-21 12:22 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: H. Peter Anvin, Christoph Hellwig, linux-arch, LKML,
	Linus Torvalds, Ralf Baechle, Will Deacon

On Tue, Jan 21, 2014 at 4:04 AM, Catalin Marinas
<catalin.marinas@arm.com> wrote:
> On Mon, Jan 20, 2014 at 05:46:41PM +0000, H. Peter Anvin wrote:
>> On 12/28/2013 08:33 AM, Christoph Hellwig wrote:
>> > On Fri, Dec 27, 2013 at 02:14:16PM -0800, H.J. Lu wrote:
>> >> X32 uses the same kernel system call interface as x86-64 for many
>> >> system calls.  However, "long" is 64-bit for x86-64 and is 32-bit for
>> >> x32.  Where long or unsigned long are used in struct types for such
>> >> system calls, they are wrong for x32.  __kernel_[u]long_t is [unsigned]
>> >> long for all ABIs other than x32.  I am submitting 8 patches to replace
>> >> long or unsigned long with __kernel_[u]long_t so that those struct types
>> >> can be used with x32 system calls.
>
> Does this mean that you are changing the x32 ABI (or it hasn't been
> declared stable yet)?

We don't change x32 ABI.  Today kernel uabi header files are
incompatible with x32 ABI in user space.  My patches fix them
so that they can be used in user space.

-- 
H.J.

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-21 12:04     ` Catalin Marinas
  2014-01-21 12:22       ` H.J. Lu
@ 2014-01-21 15:43       ` H. Peter Anvin
  1 sibling, 0 replies; 32+ messages in thread
From: H. Peter Anvin @ 2014-01-21 15:43 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Christoph Hellwig, H.J. Lu, linux-arch, LKML, Linus Torvalds,
	Ralf Baechle, Will Deacon

On 01/21/2014 04:04 AM, Catalin Marinas wrote:
> 
> ILP32 for arm64 is still work in progress and subject to change. So far
> the preliminary ABI
> (http://git.kernel.org/cgit/linux/kernel/git/cmarinas/linux-aarch64.git/log/?h=ilp32)
> redefines kernel_(u)long_t is defined as (unsigned) long long. Most of
> the syscalls are 64-bit generic with ~23 routed to compat. I would like
> to simplify these further and even use native 64-bit signal handling but
> it requires some changes to generic structures.
> 

That would be highly useful feedback.

	-hpa



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
                   ` (8 preceding siblings ...)
  2013-12-28 16:33 ` [PATCH 0/8] Update kernel uabi header files for x32 Christoph Hellwig
@ 2014-01-21 17:06 ` H. Peter Anvin
  2014-01-22 15:10   ` Catalin Marinas
  9 siblings, 1 reply; 32+ messages in thread
From: H. Peter Anvin @ 2014-01-21 17:06 UTC (permalink / raw)
  To: H.J. Lu, LKML
  Cc: linux-arch, Christoph Hellwig, Ralf Baechle, Will Deacon,
	Catalin Marinas, Linus Torvalds

On 12/27/2013 02:14 PM, H.J. Lu wrote:
> X32 uses the same kernel system call interface as x86-64 for many
> system calls.  However, "long" is 64-bit for x86-64 and is 32-bit for
> x32.  Where long or unsigned long are used in struct types for such
> system calls, they are wrong for x32.  __kernel_[u]long_t is [unsigned]
> long for all ABIs other than x32.  I am submitting 8 patches to replace
> long or unsigned long with __kernel_[u]long_t so that those struct types
> can be used with x32 system calls.
> 
> H.J. Lu (8):
>   Use __kernel_long_t in struct timex
>   Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>
>   Use __kernel_ulong_t in uapi struct ipc64_perm
>   Use __kernel_long_t in struct msgbuf
>   Use __kernel_ulong_t in struct msqid64_ds
>   Use __kernel_ulong_t in x86 struct semid64_ds
>   Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info
>   Use __kernel_long_t in struct mq_attr
> 

As Catalin indirectly pointed out, I had made a followup to the wrong
version of the patchset (because I commented to Christoph's feedback.)
This is threaded to the proper version (without unnecessary #if
__BITS_PER_LONG.)

	-hpa

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 0/8] Update kernel uabi header files for x32
  2014-01-21 17:06 ` H. Peter Anvin
@ 2014-01-22 15:10   ` Catalin Marinas
  0 siblings, 0 replies; 32+ messages in thread
From: Catalin Marinas @ 2014-01-22 15:10 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: H.J. Lu, LKML, linux-arch, Christoph Hellwig, Ralf Baechle,
	Will Deacon, Linus Torvalds

On Tue, Jan 21, 2014 at 09:06:59AM -0800, H. Peter Anvin wrote:
> On 12/27/2013 02:14 PM, H.J. Lu wrote:
> > X32 uses the same kernel system call interface as x86-64 for many
> > system calls.  However, "long" is 64-bit for x86-64 and is 32-bit for
> > x32.  Where long or unsigned long are used in struct types for such
> > system calls, they are wrong for x32.  __kernel_[u]long_t is [unsigned]
> > long for all ABIs other than x32.  I am submitting 8 patches to replace
> > long or unsigned long with __kernel_[u]long_t so that those struct types
> > can be used with x32 system calls.
> > 
> > H.J. Lu (8):
> >   Use __kernel_long_t in struct timex
> >   Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>
> >   Use __kernel_ulong_t in uapi struct ipc64_perm
> >   Use __kernel_long_t in struct msgbuf
> >   Use __kernel_ulong_t in struct msqid64_ds
> >   Use __kernel_ulong_t in x86 struct semid64_ds
> >   Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info
> >   Use __kernel_long_t in struct mq_attr
> > 
> 
> As Catalin indirectly pointed out, I had made a followup to the wrong
> version of the patchset (because I commented to Christoph's feedback.)
> This is threaded to the proper version (without unnecessary #if
> __BITS_PER_LONG.)

>From an arm64 ILP32 perspective (though still work in progress), the
patches look fine. We'll continue the trend with similar changes to
generic semid64_ds.

In case the series is not committed yet:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 8/8] Use __kernel_long_t in struct mq_attr
  2013-12-27 22:14 ` [PATCH 8/8] Use __kernel_long_t in struct mq_attr H.J. Lu
  2014-01-21  5:16   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
@ 2015-11-24  4:39   ` Dmitry V. Levin
  1 sibling, 0 replies; 32+ messages in thread
From: Dmitry V. Levin @ 2015-11-24  4:39 UTC (permalink / raw)
  To: H.J. Lu; +Cc: H. Peter Anvin, LKML

[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]

On Fri, Dec 27, 2013 at 02:14:24PM -0800, H.J. Lu wrote:
> Both x32 and x86-64 use the same struct mq_attr for system calls.  But
> x32 long is 32-bit. This patch replaces long with __kernel_long_t in
> struct mq_attr.
> 
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
>  include/uapi/linux/mqueue.h | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/include/uapi/linux/mqueue.h b/include/uapi/linux/mqueue.h
> index 8b5a796..d0a2b8e 100644
> --- a/include/uapi/linux/mqueue.h
> +++ b/include/uapi/linux/mqueue.h
> @@ -23,11 +23,11 @@
>  #define MQ_BYTES_MAX	819200
>  
>  struct mq_attr {
> -	long	mq_flags;	/* message queue flags			*/
> -	long	mq_maxmsg;	/* maximum number of messages		*/
> -	long	mq_msgsize;	/* maximum message size			*/
> -	long	mq_curmsgs;	/* number of messages currently queued	*/
> -	long	__reserved[4];	/* ignored for input, zeroed for output */
> +	__kernel_long_t	mq_flags;	/* message queue flags			*/
> +	__kernel_long_t	mq_maxmsg;	/* maximum number of messages		*/
> +	__kernel_long_t	mq_msgsize;	/* maximum message size			*/
> +	__kernel_long_t	mq_curmsgs;	/* number of messages currently queued	*/
> +	__kernel_long_t	__reserved[4];	/* ignored for input, zeroed for output */
>  };
>  
>  /*

This breaks userspace, please #include <linux/types.h>
before using __kernel_long_t.


-- 
ldv

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2015-11-24  4:39 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-27 22:14 [PATCH 0/8] Update kernel uabi header files for x32 H.J. Lu
2013-12-27 22:14 ` [PATCH 1/8] Use __kernel_long_t in struct timex H.J. Lu
2014-01-21  5:15   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
2013-12-27 22:14 ` [PATCH 2/8] Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h> H.J. Lu
2014-01-21  5:15   ` [tip:x86/x32] uapi: Use __kernel_long_t/__kernel_ulong_t in < linux/resource.h> tip-bot for H.J. Lu
2013-12-27 22:14 ` [PATCH 3/8] Use __kernel_ulong_t in uapi struct ipc64_perm H.J. Lu
2014-01-21  5:15   ` [tip:x86/x32] uapi, asm-generic: " tip-bot for H.J. Lu
2013-12-27 22:14 ` [PATCH 4/8] Use __kernel_long_t in struct msgbuf H.J. Lu
2014-01-21  5:16   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
2013-12-27 22:14 ` [PATCH 5/8] Use __kernel_ulong_t in struct msqid64_ds H.J. Lu
2014-01-21  5:16   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
2013-12-27 22:14 ` [PATCH 6/8] Use __kernel_ulong_t in x86 struct semid64_ds H.J. Lu
2014-01-21  5:16   ` [tip:x86/x32] x86, uapi, x32: " tip-bot for H.J. Lu
2013-12-27 22:14 ` [PATCH 7/8] Use __kernel_ulong_t in shmid64_ds/shminfo64/shm_info H.J. Lu
2014-01-21  5:16   ` [tip:x86/x32] uapi: Use __kernel_ulong_t in shmid64_ds/shminfo64/ shm_info tip-bot for H.J. Lu
2013-12-27 22:14 ` [PATCH 8/8] Use __kernel_long_t in struct mq_attr H.J. Lu
2014-01-21  5:16   ` [tip:x86/x32] uapi: " tip-bot for H.J. Lu
2015-11-24  4:39   ` [PATCH 8/8] " Dmitry V. Levin
2013-12-28 16:33 ` [PATCH 0/8] Update kernel uabi header files for x32 Christoph Hellwig
2013-12-28 17:01   ` H. Peter Anvin
2014-01-20 17:46   ` H. Peter Anvin
2014-01-20 17:50     ` Christoph Hellwig
2014-01-20 17:51       ` H.J. Lu
2014-01-20 17:52         ` H.J. Lu
2014-01-20 17:52         ` H. Peter Anvin
2014-01-20 17:52       ` H. Peter Anvin
2014-01-21 12:04     ` Catalin Marinas
2014-01-21 12:22       ` H.J. Lu
2014-01-21 15:43       ` H. Peter Anvin
2014-01-21 17:06 ` H. Peter Anvin
2014-01-22 15:10   ` Catalin Marinas
  -- strict thread matches above, loose matches on Subject: below --
2013-12-27 17:25 H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).