Commit d62c9ced authored by David Daney's avatar David Daney Committed by Ralf Baechle

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: default avatarDavid 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: default avatarRalf Baechle <ralf@linux-mips.org>
parent 1c0d52b9
...@@ -251,14 +251,15 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz, ...@@ -251,14 +251,15 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
SYSCALL_DEFINE1(32_personality, unsigned long, personality) SYSCALL_DEFINE1(32_personality, unsigned long, personality)
{ {
unsigned int p = personality & 0xffffffff;
int ret; int ret;
personality &= 0xffffffff;
if (personality(current->personality) == PER_LINUX32 && if (personality(current->personality) == PER_LINUX32 &&
personality == PER_LINUX) personality(p) == PER_LINUX)
personality = PER_LINUX32; p = (p & ~PER_MASK) | PER_LINUX32;
ret = sys_personality(personality); ret = sys_personality(p);
if (ret == PER_LINUX32) if (ret != -1 && personality(ret) == PER_LINUX32)
ret = PER_LINUX; ret = (ret & ~PER_MASK) | PER_LINUX;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment