x86/ipc: Fix x32 version of shmid64_ds and msqid64_ds
A bugfix broke the x32 shmid64_ds and msqid64_ds data structure layout
(as seen from user space) a few years ago: Originally, __BITS_PER_LONG
was defined as 64 on x32, so we did not have padding after the 64-bit
__kernel_time_t fields, After __BITS_PER_LONG got changed to 32,
applications would observe extra padding.
In other parts of the uapi headers we seem to have a mix of those
expecting either 32 or 64 on x32 applications, so we can't easily revert
the path that broke these two structures.
Instead, this patch decouples x32 from the other architectures and moves
it back into arch specific headers, partially reverting the even older
commit 73a2d096fdf2 ("x86: remove all now-duplicate header files").
It's not clear whether this ever made any difference, since at least
glibc carries its own (correct) copy of both of these header files,
so possibly no application has ever observed the definitions here.
Based on a suggestion from H.J. Lu, I tried out the tool from
https://github.com/hjl-tools/linux-header to find other such
bugs, which pointed out the same bug in statfs(), which also has
a separate (correct) copy in glibc.
Fixes: f4b4aae18288 ("x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "H . J . Lu" <hjl.tools@gmail.com>
Cc: Jeffrey Walton <noloader@gmail.com>
Cc: stable@vger.kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lkml.kernel.org/r/20180424212013.3967461-1-arnd@arndb.de
2018-04-25 05:19:51 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
|
|
#ifndef __ASM_X86_SHMBUF_H
|
|
|
|
#define __ASM_X86_SHMBUF_H
|
|
|
|
|
|
|
|
#if !defined(__x86_64__) || !defined(__ILP32__)
|
2009-06-19 03:48:20 +08:00
|
|
|
#include <asm-generic/shmbuf.h>
|
x86/ipc: Fix x32 version of shmid64_ds and msqid64_ds
A bugfix broke the x32 shmid64_ds and msqid64_ds data structure layout
(as seen from user space) a few years ago: Originally, __BITS_PER_LONG
was defined as 64 on x32, so we did not have padding after the 64-bit
__kernel_time_t fields, After __BITS_PER_LONG got changed to 32,
applications would observe extra padding.
In other parts of the uapi headers we seem to have a mix of those
expecting either 32 or 64 on x32 applications, so we can't easily revert
the path that broke these two structures.
Instead, this patch decouples x32 from the other architectures and moves
it back into arch specific headers, partially reverting the even older
commit 73a2d096fdf2 ("x86: remove all now-duplicate header files").
It's not clear whether this ever made any difference, since at least
glibc carries its own (correct) copy of both of these header files,
so possibly no application has ever observed the definitions here.
Based on a suggestion from H.J. Lu, I tried out the tool from
https://github.com/hjl-tools/linux-header to find other such
bugs, which pointed out the same bug in statfs(), which also has
a separate (correct) copy in glibc.
Fixes: f4b4aae18288 ("x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "H . J . Lu" <hjl.tools@gmail.com>
Cc: Jeffrey Walton <noloader@gmail.com>
Cc: stable@vger.kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lkml.kernel.org/r/20180424212013.3967461-1-arnd@arndb.de
2018-04-25 05:19:51 +08:00
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* The shmid64_ds structure for x86 architecture with x32 ABI.
|
|
|
|
*
|
|
|
|
* On x86-32 and x86-64 we can just use the generic definition, but
|
|
|
|
* x32 uses the same binary layout as x86_64, which is differnet
|
|
|
|
* from other 32-bit architectures.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct shmid64_ds {
|
|
|
|
struct ipc64_perm shm_perm; /* operation perms */
|
|
|
|
size_t shm_segsz; /* size of segment (bytes) */
|
2019-11-05 04:17:26 +08:00
|
|
|
__kernel_long_t shm_atime; /* last attach time */
|
|
|
|
__kernel_long_t shm_dtime; /* last detach time */
|
|
|
|
__kernel_long_t shm_ctime; /* last change time */
|
x86/ipc: Fix x32 version of shmid64_ds and msqid64_ds
A bugfix broke the x32 shmid64_ds and msqid64_ds data structure layout
(as seen from user space) a few years ago: Originally, __BITS_PER_LONG
was defined as 64 on x32, so we did not have padding after the 64-bit
__kernel_time_t fields, After __BITS_PER_LONG got changed to 32,
applications would observe extra padding.
In other parts of the uapi headers we seem to have a mix of those
expecting either 32 or 64 on x32 applications, so we can't easily revert
the path that broke these two structures.
Instead, this patch decouples x32 from the other architectures and moves
it back into arch specific headers, partially reverting the even older
commit 73a2d096fdf2 ("x86: remove all now-duplicate header files").
It's not clear whether this ever made any difference, since at least
glibc carries its own (correct) copy of both of these header files,
so possibly no application has ever observed the definitions here.
Based on a suggestion from H.J. Lu, I tried out the tool from
https://github.com/hjl-tools/linux-header to find other such
bugs, which pointed out the same bug in statfs(), which also has
a separate (correct) copy in glibc.
Fixes: f4b4aae18288 ("x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "H . J . Lu" <hjl.tools@gmail.com>
Cc: Jeffrey Walton <noloader@gmail.com>
Cc: stable@vger.kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lkml.kernel.org/r/20180424212013.3967461-1-arnd@arndb.de
2018-04-25 05:19:51 +08:00
|
|
|
__kernel_pid_t shm_cpid; /* pid of creator */
|
|
|
|
__kernel_pid_t shm_lpid; /* pid of last operator */
|
|
|
|
__kernel_ulong_t shm_nattch; /* no. of current attaches */
|
|
|
|
__kernel_ulong_t __unused4;
|
|
|
|
__kernel_ulong_t __unused5;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct shminfo64 {
|
|
|
|
__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
|
|
|
|
|
|
|
|
#endif /* __ASM_X86_SHMBUF_H */
|