From: James Hogan <jhogan@kernel.org>
To: Miodrag Dinic <Miodrag.Dinic@mips.com>
Cc: Paul Burton <Paul.Burton@mips.com>,
Maciej Rozycki <Maciej.Rozycki@mips.com>,
Aleksandar Markovic <aleksandar.markovic@rt-rk.com>,
Aleksandar Markovic <Aleksandar.Markovic@mips.com>,
David Daney <ddaney@caviumnetworks.com>,
"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
Andrew Morton <akpm@linux-foundation.org>,
DengCheng Zhu <DengCheng.Zhu@mips.com>,
Ding Tianhong <dingtianhong@huawei.com>,
Douglas Leung <Douglas.Leung@mips.com>,
Frederic Weisbecker <frederic@kernel.org>,
Goran Ferenc <Goran.Ferenc@mips.com>,
Ingo Molnar <mingo@kernel.org>,
James Cowgill <James.Cowgill@imgtec.com>,
Jonathan Corbet <corbet@lwn.net>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Marc Zyngier <marc.zyngier@arm.com>,
Matt Redfearn <Matt.Redfearn@mips.com>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Petar Jovanovic <Petar.Jovanovic@mips.com>,
Raghu Gandham <Raghu.Gandham@mips.com>,
Ralf Baechle <ralf@linux-mips.org>,
Thomas Gleixner <tglx@linutronix.de>,
Tom Saeger <tom.saeger@oracle.com>
Subject: Re: [PATCH v2] MIPS: Add nonxstack=on|off kernel parameter
Date: Thu, 8 Feb 2018 11:55:59 +0000 [thread overview]
Message-ID: <20180208115559.GA31316@saruman> (raw)
In-Reply-To: <48924BBB91ABDE4D9335632A6B179DD6A8E6B2@MIPSMAIL01.mipstec.com>
[-- Attachment #1: Type: text/plain, Size: 2109 bytes --]
Hi,
On Thu, Dec 07, 2017 at 11:33:47AM +0000, Miodrag Dinic wrote:
> > On Wed, Dec 06, 2017 at 05:50:52PM +0000, Maciej W. Rozycki wrote:
> > > What problem are you trying to solve anyway? Is it not something that
> > > can be handled with the `execstack' utility?
> >
> > The commit message states that for Android "non-exec stack is required".
> > Is Android checking that then Aleksandar? If so, how?
>
> Android is using SELinux configured to disallow NX mappings by handling
> the following sepolicy rules :
> * Executable stack (execstack)
> * Executable heap (execheap)
> * File-based executable code which has been modified (execmod)
> * All other executable memory (execmem)
...
> The effect of not having some workaround like this in the kernel, would
> be to run Android only in SELinux permissive mode.
So you want to override the lack of RIXI so that SELinux sees an
RX->RW->RX transition as execmod instead of execmem (since without RIXI
its effectively RX->RWX->RX which is execmem)?
Looking at file_map_prot_check(), it does the execmem check on this
condition:
if (default_noexec &&
(prot & PROT_EXEC) && (!file || IS_PRIVATE(file_inode(file)) ||
(!shared && (prot & PROT_WRITE)))) {
/*
* We are making executable an anonymous mapping or a
* private file mapping that will also be writable.
* This has an additional check.
*/
default_noexec is set if VM_DATA_DEFAULT_FLAGS doesn't have the exec
flag set, and that flag depends on current->personality &
READ_IMPLIES_EXEC, which depends on elf_read_implies_exec(), i.e.
mips_elf_read_implies_exec(), and that should already return 1 if RIXI
is unavailable.
I.e.
mips_elf_read_implies_exec() == 1
elf_read_implies_exec() == 1
READ_IMPLIES_EXEC will be set in current->personality
VM_DATA_DEFAULT_FLAGS will have VM_EXEC set
default_noexec will be set to 0 in selinux_init()
none of the execmem, execheap, execstack, execmod permission
checks should take place.
So whats the problem exactly? Perhaps I misinterpreted something.
Cheers
James
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-02-08 11:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 13:56 [PATCH v2] MIPS: Add nonxstack=on|off kernel parameter Aleksandar Markovic
2017-11-21 16:50 ` Randy Dunlap
2017-11-21 20:53 ` David Daney
2017-11-30 9:34 ` Miodrag Dinic
2017-11-30 10:09 ` James Hogan
2017-11-30 13:06 ` Miodrag Dinic
2017-12-01 11:35 ` Miodrag Dinic
2017-12-01 17:38 ` David Daney
2017-12-06 17:50 ` Maciej W. Rozycki
2017-12-06 18:24 ` Paul Burton
2017-12-07 11:33 ` Miodrag Dinic
2018-01-02 18:35 ` Maciej W. Rozycki
2018-02-08 11:55 ` James Hogan [this message]
2018-02-13 16:06 ` Aleksandar Markovic
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=20180208115559.GA31316@saruman \
--to=jhogan@kernel.org \
--cc=Aleksandar.Markovic@mips.com \
--cc=DengCheng.Zhu@mips.com \
--cc=Douglas.Leung@mips.com \
--cc=Goran.Ferenc@mips.com \
--cc=James.Cowgill@imgtec.com \
--cc=Maciej.Rozycki@mips.com \
--cc=Matt.Redfearn@mips.com \
--cc=Miodrag.Dinic@mips.com \
--cc=Paul.Burton@mips.com \
--cc=Petar.Jovanovic@mips.com \
--cc=Raghu.Gandham@mips.com \
--cc=akpm@linux-foundation.org \
--cc=aleksandar.markovic@rt-rk.com \
--cc=corbet@lwn.net \
--cc=ddaney@caviumnetworks.com \
--cc=dingtianhong@huawei.com \
--cc=frederic@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=marc.zyngier@arm.com \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=ralf@linux-mips.org \
--cc=tglx@linutronix.de \
--cc=tom.saeger@oracle.com \
--cc=zohar@linux.vnet.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