linux/arch/mips
Dave Hansen 49cd53bf14 mm/pkeys: Fix siginfo ABI breakage caused by new u64 field
Stephen Rothwell reported this linux-next build failure:

	http://lkml.kernel.org/r/20160226164406.065a1ffc@canb.auug.org.au

... caused by the Memory Protection Keys patches from the tip tree triggering
a newly introduced build-time sanity check on an ARM build, because they changed
the ABI of siginfo in an unexpected way.

If u64 has a natural alignment of 8 bytes (which is the case on most mainstream
platforms, with the notable exception of x86-32), then the leadup to the
_sifields union matters:

typedef struct siginfo {
        int si_signo;
        int si_errno;
        int si_code;

        union {
	...
        } _sifields;
} __ARCH_SI_ATTRIBUTES siginfo_t;

Note how the first 3 fields give us 12 bytes, so _sifields is not 8
naturally bytes aligned.

Before the _pkey field addition the largest element of _sifields (on
32-bit platforms) was 32 bits. With the u64 added, the minimum alignment
requirement increased to 8 bytes on those (rare) 32-bit platforms. Thus
GCC padded the space after si_code with 4 extra bytes, and shifted all
_sifields offsets by 4 bytes - breaking the ABI of all of those
remaining fields.

On 64-bit platforms this problem was hidden due to _sifields already
having numerous fields with natural 8 bytes alignment (pointers).

To fix this, we replace the u64 with an '__u32'.  The __u32 does not
increase the minimum alignment requirement of the union, and it is
also large enough to store the 16-bit pkey we have today on x86.

Reported-by: Stehen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Stehen Rothwell <sfr@canb.auug.org.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Dave Hansen <dave@sr71.net>
Cc: Helge Deller <deller@gmx.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-next@vger.kernel.org
Fixes: cd0ea35ff5 ("signals, pkeys: Notify userspace about protection key faults")
Link: http://lkml.kernel.org/r/20160301125451.02C7426D@viggo.jf.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-03-05 15:00:06 +01:00
..
alchemy Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-01-24 12:50:56 -08:00
ar7 MIPS: ar7: Be sure to clamp return value 2016-01-24 02:21:47 +01:00
ath25
ath79
bcm47xx Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-01-24 12:50:56 -08:00
bcm63xx Revert "MIPS: bcm63xx: nvram: Remove unused bcm63xx_nvram_get_psi_size() function" 2016-01-27 20:51:50 +01:00
bmips
boot regmap: mmio: Revert to v4.4 endianness handling 2016-02-05 11:22:04 +00:00
cavium-octeon
cobalt
configs MIPS: pic32mzda: Add initial PIC32MZDA Starter Kit defconfig 2016-01-24 02:54:32 +01:00
dec
emma
fw
include mm/pkeys: Fix siginfo ABI breakage caused by new u64 field 2016-03-05 15:00:06 +01:00
jazz
jz4740
kernel mips: Differentiate between 32 and 64 bit ELF header 2016-02-11 11:38:22 +01:00
kvm Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-01-24 12:50:56 -08:00
lantiq
lasat
lib MIPS: Cleanup the unused __arch_local_irq_restore() function 2016-01-22 01:58:49 +01:00
loongson32
loongson64 MIPS: hpet: Choose a safe value for the ETIME check 2016-01-22 02:00:49 +01:00
math-emu MIPS: math-emu: dsemul: Reduce `get_isa16_mode' clutter 2016-01-24 01:37:09 +01:00
mm mm/gup: Switch all callers of get_user_pages() to not pass tsk/mm 2016-02-16 10:11:12 +01:00
mti-malta MIPS: Fix early CM probing 2016-02-09 17:18:31 +01:00
mti-sead3
net
netlogic
oprofile
paravirt
pci MIPS: pci-mt7620: Fix return value check in mt7620_pci_probe() 2016-02-10 10:01:44 +01:00
pic32 MIPS: dts: Add initial DTS for the PIC32MZDA Starter Kit 2016-01-24 02:54:00 +01:00
pistachio
pmcs-msp71xx
pnx833x
power
ralink MIPS: pci: Add MT7620a PCIE driver 2016-01-20 00:39:20 +01:00
rb532 Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-01-24 12:50:56 -08:00
sgi-ip22
sgi-ip27
sgi-ip32
sibyte
sni
txx9 MIPS: TXx9: iocled: Be sure to clamp return value 2016-01-24 02:23:08 +01:00
vdso
vr41xx
xilfpga
Kbuild
Kbuild.platforms MIPS: Add support for PIC32MZDA platform 2016-01-24 02:53:28 +01:00
Kconfig MIPS: R6000: Don't allow 64k pages for R6000. 2016-02-03 10:32:22 +01:00
Kconfig.debug
Makefile MIPS: Loongson-3: Improve -march option and move it to Platform 2016-01-22 01:59:18 +01:00