From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: SET_PERSONALITY and TASK_SIZE
Date: Sun, 18 Jan 2009 12:18:31 +0100 [thread overview]
Message-ID: <20090118111831.GA4818@osiris.boeblingen.de.ibm.com> (raw)
Hi Andrew,
while debugging I noticed the following comment in fs/binfmt_elf.c:
/*
* The early SET_PERSONALITY here is so that the lookup
* for the interpreter happens in the namespace of the
* to-be-execed image. SET_PERSONALITY can select an
* alternate root.
*
* However, SET_PERSONALITY is NOT allowed to switch
* this task into the new images's memory mapping
* policy - that is, TASK_SIZE must still evaluate to
* that which is appropriate to the execing application.
* This is because exit_mmap() needs to have TASK_SIZE
* evaluate to the size of the old image.
*
* So if (say) a 64-bit application is execing a 32-bit
* application it is the architecture's responsibility
* to defer changing the value of TASK_SIZE until the
* switch really is going to happen - do this in
* flush_thread(). - akpm
*/
At least s390 isn't doing the deferred TASK_SIZE switch. Also it seems like
MIPS, PARISC and IA64 don't do it either. However from a quick a view I
couldn't see that exit_mmap depends on TASK_SIZE. So is this still necessary?
And the bug I was looking for is this one: in SET_PERSONALITY we do this:
if (current->personality != PER_LINUX32)
set_personality(PER_LINUX);
However we should use the PER_MASK if we want to check for PER_LINUX32,
since there are more bits in the personality flags. In case any of the
'extra' bits is set we may incorrectly set personality to PER_LINUX even
when we want PER_LINUX32.
Looks like more architectures should do something like:
if (personality(current->personality) != PER_LINUX32)
...
next reply other threads:[~2009-01-18 11:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-18 11:18 Heiko Carstens [this message]
2009-01-20 16:08 ` SET_PERSONALITY and TASK_SIZE Andrew Morton
2009-01-22 3:28 ` Benjamin Herrenschmidt
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=20090118111831.GA4818@osiris.boeblingen.de.ibm.com \
--to=heiko.carstens@de.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
/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