Patch "parisc: Don't use BITS_PER_LONG in userspace-exported swab.h header" has been added to the 4.4-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
parisc: Don't use BITS_PER_LONG in userspace-exported swab.h header
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
parisc-don-t-use-bits_per_long-in-userspace-exported-swab.h-header.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
2ad5d52d42810bed95100a3d912679d8864421ecMon Sep 17 00:00:00 2001
From: Helge Deller <[email protected]>
Date: Sat, 28 Jan 2017 11:52:02 +0100
Subject: parisc: Don't use BITS_PER_LONG in userspace-exported swab.h header
From: Helge Deller <[email protected]>
commit 2ad5d52d42810bed95100a3d912679d8864421ec upstream.
In swab.h the "#if BITS_PER_LONG > 32" breaks compiling userspace programs if BITS_PER_LONG is #defined by userspace with the sizeof() compiler builtin.
Solve this problem by using __BITS_PER_LONG instead. Since we now #include asm/bitsperlong.h avoid further potential userspace pollution by moving the #define of SHIFT_PER_LONG to bitops.h which is not exported to userspace.
This patch unbreaks compiling qemu on hppa/parisc.
--- arch/parisc/include/asm/bitops.h | 8 +++++++- arch/parisc/include/uapi/asm/bitsperlong.h | 2 -- arch/parisc/include/uapi/asm/swab.h | 5 +++-- 3 files changed, 10 insertions(+), 5 deletions(-)
arch/parisc/include/asm/bitops.h +7 -1
@@ -6,7 +6,7 @@#endif #include <linux/compiler.h> -#include <asm/types.h> /* for BITS_PER_LONG/SHIFT_PER_LONG */ +#include <asm/types.h> #include <asm/byteorder.h> #include <asm/barrier.h> #include <linux/atomic.h>
@@ -17,6 +17,12 @@* to include/asm-i386/bitops.h or kerneldoc */ +#if __BITS_PER_LONG ==64 +#define SHIFT_PER_LONG 6 +#else +#define SHIFT_PER_LONG 5 +#endif +#define CHOP_SHIFTCOUNT (x) (((unsigned long) (x)) & (BITS_PER_LONG - 1))
arch/parisc/include/uapi/asm/bitsperlong.h +0 -2
@@ -3,10 +3,8 @@#if defined(__LP64__)#define __BITS_PER_LONG 64 -#define SHIFT_PER_LONG 6#else #define __BITS_PER_LONG 32 -#define SHIFT_PER_LONG 5#endif #include <asm-generic/bitsperlong.h>
arch/parisc/include/uapi/asm/swab.h +3 -2
@@ -1,6 +1,7 @@#ifndef _PARISC_SWAB_H#define _PARISC_SWAB_H +#include <asm/bitsperlong.h> #include <linux/types.h> #include <linux/compiler.h>
@@ -38,7 +39,7 @@ static inline __attribute_const__ __u32 }#define __arch_swab32 __arch_swab32 -#if BITS_PER_LONG >32 +#if __BITS_PER_LONG >32 /* ** From "PA-RISC 2.0 Architecture", HP Professional Books. ** See Appendix I page 8 , "Endian Byte Swapping".
@@ -61,6 +62,6 @@ static inline __attribute_const__ __u64return x; }#define __arch_swab64 __arch_swab64 -#endif /* BITS_PER_LONG > 32 */ +#endif /* __BITS_PER_LONG > 32 */ #endif /* _PARISC_SWAB_H */
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/parisc-don-t-use-bits_per_long-in-userspace-exported-swab.h-header.patch