From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: fix personality flag propagation across an exec
Date: Fri, 8 Apr 2011 21:15:41 +0100 [thread overview]
Message-ID: <20110408201541.GC5573@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <alpine.LFD.2.00.1104081536390.28032@xanadu.home>
On Fri, Apr 08, 2011 at 03:50:21PM -0400, Nicolas Pitre wrote:
> However, if we're only setting the address limit flag here, wouldn't it
> be better to leave the current personality type as is and only set/clear
> the ADDR_LIMIT_32BIT flag? Something like:
>
> unsigned int personality = current->personality;
> if ((eflags & EF_ARM_EABI_MASK) == EF_ARM_EABI_UNKNOWN &&
> (eflags & EF_ARM_APCS_26))
> personality &= ~ADDR_LIMIT_32BIT;
> else
> personality |= ADDR_LIMIT_32BIT;
> set_personality(personality);
>
> Or is the actual personality type not supposed to be inherited?
>
> I also notice that bad_syscall() is broken if extra flags such as
> ADDR_NO_RANDOMIZE are added to the current personality (will send a
> patch for that as well).
Many architectures explicitly set a personality type on exec, so that
seems to be the thing to do. We want it set to a PER_LINUX flavour
as the ELF executables we run tend to be Linux executables.
Also, the ARM kernel doesn't really support anything but PER_LINUX
ELF executables, so it'd be rather meaningless to set it to anything
else here.
So:
unsigned int personality = current->personality & ~PER_MASK;
/*
* We only support Linux ELF executables, so always set the
* personality to LINUX.
*/
personality |= PER_LINUX;
/* APCS-26 is only valid for OABI executables */
if ((eflags & EF_ARM_EABI_MASK) == EF_ARM_EABI_UNKNOWN &&
(eflags & EF_ARM_APCS_26))
personality &= ~ADDR_LIMIT_32BIT;
else
personality |= ADDR_LIMIT_32BIT;
set_personality(personality);
is probably what we want.
next prev parent reply other threads:[~2011-04-08 20:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-08 2:52 [PATCH 2/2] ARM: fix personality flag propagation across an exec Nicolas Pitre
2011-04-08 7:29 ` Russell King - ARM Linux
2011-04-08 13:00 ` Nicolas Pitre
2011-04-08 19:10 ` Russell King - ARM Linux
2011-04-08 19:50 ` Nicolas Pitre
2011-04-08 20:15 ` Russell King - ARM Linux [this message]
2011-04-08 20:44 ` Nicolas Pitre
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=20110408201541.GC5573@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).