diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-11-01 20:43:08 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-12-16 13:10:54 -0500 |
commit | d62c9ced7ca783e64ff4d9d3d1340cfe2284d47b (patch) | |
tree | 6485cecd4bcf8a010cb04198dc2b9bd1d3c8d2fc /arch/mips/kernel | |
parent | 1c0d52b9b5e6ca277c13d6fece9c34ed3159423d (diff) |
MIPS: compat: Don't clobber personality bits in 32-bit sys_personality().
If PER_LINUX32 has been set on a 32-bit kernel, only twiddle with the
low-order personality bits, let the upper bits pass through.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
Cc: Camm Maguire <camm@maguirefamily.org>
Patchwork: https://patchwork.linux-mips.org/patch/1751/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/linux32.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 6343b4a5b835..876a75cc376f 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -251,14 +251,15 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz, | |||
251 | 251 | ||
252 | SYSCALL_DEFINE1(32_personality, unsigned long, personality) | 252 | SYSCALL_DEFINE1(32_personality, unsigned long, personality) |
253 | { | 253 | { |
254 | unsigned int p = personality & 0xffffffff; | ||
254 | int ret; | 255 | int ret; |
255 | personality &= 0xffffffff; | 256 | |
256 | if (personality(current->personality) == PER_LINUX32 && | 257 | if (personality(current->personality) == PER_LINUX32 && |
257 | personality == PER_LINUX) | 258 | personality(p) == PER_LINUX) |
258 | personality = PER_LINUX32; | 259 | p = (p & ~PER_MASK) | PER_LINUX32; |
259 | ret = sys_personality(personality); | 260 | ret = sys_personality(p); |
260 | if (ret == PER_LINUX32) | 261 | if (ret != -1 && personality(ret) == PER_LINUX32) |
261 | ret = PER_LINUX; | 262 | ret = (ret & ~PER_MASK) | PER_LINUX; |
262 | return ret; | 263 | return ret; |
263 | } | 264 | } |
264 | 265 | ||