]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.arch/s390-08-06-personality.patch
Merge branch 'master' of git://git.ipfire.org/ipfire-2.x
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.arch / s390-08-06-personality.patch
1 From: Gerald Schaefer <geraldsc@de.ibm.com>
2 Subject: kernel: setting 32 bit personality doesn't work
3 References: bnc#466462
4
5 Symptom: Setting the personality from 64 bit to 32 bit and afterwards
6 issueing a uname system call will return that the environment
7 is still 64 bit. Some executables that rely on a correct 32 bit
8 environment don't work.
9 Problem: The SET_PERSONALITY macro compares the whole personality field
10 on each execve with PER_LINUX32. If that doesn't match personality
11 is set to PER_LINUX. When some higher order bits in the personality
12 field are set the personality is incorrectly changed from
13 PER_LINUX32 to PER_LINUX on execve.
14 Solution: Use the personality() function to mask out bits that shouldn't be
15 taken into account when comparing personality types.
16
17 Acked-by: Hannes Reinecke <hare@suse.de>
18 ---
19 arch/s390/include/asm/elf.h | 20 ++++++++++----------
20 1 file changed, 10 insertions(+), 10 deletions(-)
21
22 Index: linux-sles11/arch/s390/include/asm/elf.h
23 ===================================================================
24 --- linux-sles11.orig/arch/s390/include/asm/elf.h
25 +++ linux-sles11/arch/s390/include/asm/elf.h
26 @@ -168,16 +168,16 @@ extern char elf_platform[];
27 #ifndef __s390x__
28 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
29 #else /* __s390x__ */
30 -#define SET_PERSONALITY(ex, ibcs2) \
31 -do { \
32 - if (ibcs2) \
33 - set_personality(PER_SVR4); \
34 - else if (current->personality != PER_LINUX32) \
35 - set_personality(PER_LINUX); \
36 - if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
37 - set_thread_flag(TIF_31BIT); \
38 - else \
39 - clear_thread_flag(TIF_31BIT); \
40 +#define SET_PERSONALITY(ex, ibcs2) \
41 + do { \
42 + if (ibcs2) \
43 + set_personality(PER_SVR4); \
44 + else if (personality(current->personality) != PER_LINUX32) \
45 + set_personality(PER_LINUX); \
46 + if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
47 + set_thread_flag(TIF_31BIT); \
48 + else \
49 + clear_thread_flag(TIF_31BIT); \
50 } while (0)
51 #endif /* __s390x__ */
52