linux-mips
[Top] [All Lists]

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

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH 2/2] MIPS: Don't clobber personality bits in 32-bit sys_personality().
From: Sergei Shtylyov <sshtylyov@mvista.com>
Date: Tue, 02 Nov 2010 19:11:03 +0300
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org, Camm Maguire <camm@maguirefamily.org>
In-reply-to: <1288658588-26801-2-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1288658588-26801-1-git-send-email-ddaney@caviumnetworks.com> <1288658588-26801-2-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Thunderbird 2.0.0.21 (X11/20090320)
Hello.

David Daney wrote:

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;

   I'd have inserted an empty line here...

        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;
 }

WBR, Sergei

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