From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Helge Deller <deller@gmx.de>,
linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] parisc: fix personality flag check in copy_thread()
Date: Thu, 02 Aug 2012 14:06:58 +0100 [thread overview]
Message-ID: <1343912818.5073.48.camel@dabdike.int.hansenpartnership.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1208021342120.4820@pobox.suse.cz>
On Thu, 2012-08-02 at 13:45 +0200, Jiri Kosina wrote:
> On Thu, 2 Aug 2012, James Bottomley wrote:
>
> > > Directly comparing task_struct->personality against PER_* is not fully
> > > correct, as it doesn't take flags potentially stored in top three bytes
> > > into account.
> > >
> > > Analogically, directly forcefully setting personality to PER_LINUX32 or
> > > PER_LINUX discards any flags stored in the top three bytes.
> > >
> > > Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> > > ---
> > >
> > > changed since v1: fix the bit ops to reflect the fact that PER_LINUX is
> > > actually 0
> >
> > Tell me what you're trying to achieve (or what problem you're trying to
> > solve), because personality is notoriously tricky.
>
> Long story short -- I was debugging a problem where 'setarch --uname-2.6'
> would not work on s390 on (older) 3.x kernel. Turned out to be a
> corruption of top bytes of personality across exec() on s390.
>
> I was doing quite some over-the-tree grepping during this, and found out
> that at least parisc, powerpc and sparc64 (davem already queued my patch
> for this) would under some silently ignore discard the top bytes of
> personality flags passed to sys_personality().
>
> In case of parsic, let's take a process with current->personality ==
> PER_LINUX32 callling personality(PER_LINUX | UNAME26). The
>
> if (personality(current->personality) == PER_LINUX32
> && personality == PER_LINUX)
> personality = PER_LINUX32;
>
> would that have no effect, and sys_personality() would be called with
> (PER_LINUX | UNAME26) instead of PER_LINUX32, just because of UNAME26
> being set as well. That doesn't seem really correct. Is it?
Heh, no. This is a nasty mess. Our assumption was that we own the
flags ... hence the code. There are some flags we can't allow to be set
or reset ... but that's only for the mythical 64 bit userspace, so I
suppose we just ignore that for now and fix it if this ever appears.
I don't like the hidden assumption that PER_LINUX == 0, but otherwise
the code looks fine.
How about
personality = (personality & ~PER_MASK) | PER_LINUX32;
and
err = (personality & ~PER_MASK) | PER_LINUX;
James
next prev parent reply other threads:[~2012-08-02 13:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-01 19:57 [PATCH] " Jiri Kosina
2012-08-02 7:12 ` [PATCH v2] " Jiri Kosina
2012-08-02 8:47 ` James Bottomley
2012-08-02 11:45 ` Jiri Kosina
2012-08-02 13:06 ` James Bottomley [this message]
2012-08-02 13:33 ` Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343912818.5073.48.camel@dabdike.int.hansenpartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=deller@gmx.de \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®