]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/s390-08-06-personality.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / s390-08-06-personality.patch
CommitLineData
2cb7cef9
BS
1From: Gerald Schaefer <geraldsc@de.ibm.com>
2Subject: kernel: setting 32 bit personality doesn't work
3References: bnc#466462
4
5Symptom: 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.
9Problem: 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.
14Solution: Use the personality() function to mask out bits that shouldn't be
15 taken into account when comparing personality types.
16
17Acked-by: Hannes Reinecke <hare@suse.de>
18---
19 arch/s390/include/asm/elf.h | 20 ++++++++++----------
20 1 file changed, 10 insertions(+), 10 deletions(-)
21
22Index: 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