linux-mips
[Top] [All Lists]

[PATCH 2/2] MIPS: Don't clobber personality bits in 32-bit sys_personali

To: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: [PATCH 2/2] MIPS: Don't clobber personality bits in 32-bit sys_personality().
From: David Daney <ddaney@caviumnetworks.com>
Date: Mon, 1 Nov 2010 17:43:08 -0700
Cc: David Daney <ddaney@caviumnetworks.com>, Camm Maguire <camm@maguirefamily.org>
In-reply-to: <1288658588-26801-1-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1288658588-26801-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
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>
Cc: Camm Maguire <camm@maguirefamily.org>
---
 arch/mips/kernel/linux32.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 6343b4a..a63f4e2 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -252,13 +252,13 @@ SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, 
size_t, msgsz,
 SYSCALL_DEFINE1(32_personality, unsigned long, personality)
 {
        int ret;
-       personality &= 0xffffffff;
+       unsigned int p = personality & 0xffffffff;
        if (personality(current->personality) == PER_LINUX32 &&
-           personality == PER_LINUX)
-               personality = PER_LINUX32;
-       ret = sys_personality(personality);
-       if (ret == PER_LINUX32)
-               ret = PER_LINUX;
+           personality(p) == PER_LINUX)
+               p = (p & ~PER_MASK) | PER_LINUX32;
+       ret = sys_personality(p);
+       if (ret != -1 && personality(ret) == PER_LINUX32)
+               ret = (ret & ~PER_MASK) | PER_LINUX;
        return ret;
 }
 
-- 
1.7.2.3


<Prev in Thread] Current Thread [Next in Thread>