linux-mips
[Top] [All Lists]

Re: Bug#380531: linux-2.6: mips and mipsel personality(2) support is bro

To: Martin Michlmayr <tbm@cyrius.com>
Subject: Re: Bug#380531: linux-2.6: mips and mipsel personality(2) support is broken
From: Roger Leigh <rleigh@whinlatter.ukfsn.org>
Date: Mon, 31 Jul 2006 00:20:05 +0100
Cc: linux-mips@linux-mips.org, 380531-silent@bugs.debian.org
In-reply-to: <20060730224137.GP17134@deprecation.cyrius.com> (Martin Michlmayr's message of "Mon, 31 Jul 2006 00:41:37 +0200")
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20060730183939.7119.48747.reportbug@hardknott.home.whinlatter.ukfsn.org> <20060730224137.GP17134@deprecation.cyrius.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)
Martin Michlmayr <tbm@cyrius.com> writes:

> FYI, but report tht "mips and mipsel personality(2) support is broken"
>
> * Roger Leigh <rleigh@debian.org> [2006-07-30 19:39]:
>> personality(2) only works the first time it is called [in the lifetime
>> of a process/program].  All subsequent calls return EPERM, which is
>> not a documented return value; I can see no mention of it in
>> kernel/execdomain.c.  None of the other architectures I have tested
>> (amd64, arm, i386, ia64, powerpc) behave this way: personality(2) is
>> not a privileged call.
>> 
>> This happens no matter what the value of persona is, even if it is
>> just 0xffffffff to query the current personality.

Just a follow up:

There is a twist to the behaviour:

If personality(2) is called with a personality other than 0xffffffff
(query), and it fails, a subsequent call (any persona value) will
succeed.

I can't see any reason for the behaviour looking at the
kernel/execdomain.c or arch/mips/kernel/linux32.c.  ths believes it's
due to a bug in the syscall interface:

<ths> I believe it is related to sign extension.
<ths> o32 queries with 0xffffffff, which is really 0xffffffffffffffff, then the 
kernel compares against 0xffffffff.
<rleigh> I haven't heard of that.  Is it MIPS-specific, or a 64-bit-specific 
thing?
<ths> mips uses sign-extended registers for 32bit values.
<ths> There's no 64bit mode switch.
<ths> (The argument for the sys32_personality should be int, not long.)


-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please sign and encrypt your mail.

Attachment: pgpZ8GJY4AjxX.pgp
Description: PGP signature

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