linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: elf_set_personality()
Date: Mon, 27 Feb 2012 13:04:53 +0000	[thread overview]
Message-ID: <20120227130453.GV22562@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20120227123612.GD12917@tbergstrom-lnx.Nvidia.com>

On Mon, Feb 27, 2012 at 02:36:12PM +0200, Peter De Schrijver wrote:
> Commit ID 5e143436d04465c937c1a242808a99c46393af3e
> (fix personality flag propagation across an exec) makes a child process
> inherit a number of personality flags from its parent. This includes the
> READ_IMPLIES_EXEC flag.

So, READ_IMPLIES_EXEC will only be leaked if it's already set.

> Unfortunately this causes problems when debugging
> android applications using gdbserver. It appears that gdbserver on android
> has an executable stack. This causes the kernel to set the READ_IMPLIES_EXEC
> flag on the gdbserver process.

Ok.

> So the child android process will also get this flag.

And that means that attempting to mmap() stuff will also get executable
protections in addition.

> As soon as the android tries to mmap a readonly android shmem segment
> (using the ashmem driver), ashmem will return EPERM, because the segment has
> been exposed as readonly without exec permissions and the kernel will modify
> any readonly mmap request into read and execute.

This sounds like a problem.  If you have two applications trying to use
the ashmem driver, one without READ_IMPLIES_EXEC and one with
READ_IMPLIES_EXEC, then it seems that ashmem will prevent the
READ_IMPLIES_EXEC one from using such regions.  That sounds like a
(different) bug to me.

> Why does the READ_IMPLIES_EXEC flag need to be propagated? Would it be
> acceptable to not propagate it to child processes?

It shouldn't propagate.  But I think it's uncovered a separate problem
in the ashmem driver.

  reply	other threads:[~2012-02-27 13:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 12:36 elf_set_personality() Peter De Schrijver
2012-02-27 13:04 ` Russell King - ARM Linux [this message]
2012-02-27 15:03   ` elf_set_personality() Peter De Schrijver
2012-02-27 15:20     ` elf_set_personality() Robert Love
2012-02-27 16:41       ` elf_set_personality() Russell King - ARM Linux
2012-02-27 17:09         ` elf_set_personality() Robert Love
2012-02-27 17:16           ` elf_set_personality() Russell King - ARM Linux
2012-02-27 17:18             ` elf_set_personality() Robert Love

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=20120227130453.GV22562@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).