• Arnd Bergmann's avatar
    x86/ipc: Fix x32 version of shmid64_ds and msqid64_ds · 1a512c08
    Arnd Bergmann authored
    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 73a2d096 ("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: f4b4aae1 ("x86/headers/uapi: Fix __BITS_PER_LONG value for x32 builds")
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarThomas 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
    1a512c08
msgbuf.h 1.03 KB