From: Ingo Molnar <mingo@elte.hu>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
Andi Kleen <ak@suse.de>, Arjan van de Ven <arjanv@redhat.com>,
"Siddha, Suresh B" <suresh.b.siddha@intel.com>,
"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: Re: [announce] [patch] NX (No eXecute) support for x86, 2.6.7-rc2-bk2
Date: Thu, 3 Jun 2004 09:21:46 +0200 [thread overview]
Message-ID: <20040603072146.GA14441@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.58.0406021411030.3403@ppc970.osdl.org>
* Linus Torvalds <torvalds@osdl.org> wrote:
> > If the NX feature is supported by the CPU then the patched kernel turns
> > on NX and it will enforce userspace executability constraints such as a
> > no-exec stack and no-exec mmap and data areas. This means less chance
> > for stack overflows and buffer-overflows to cause exploits.
>
> Just out of interest - how many legacy apps are broken by this? I
> assume it's a non-zero number, but wouldn't mind to be happily
> surprised.
in the full install of FC1 and FC2 the number is zero - and Fedora has
exec-shield which does a couple of things more: it makes the heap
non-executable as well [this broke X], it randomizes the address-space
layout and has a 4:4 VM [which broke the Sun JVM].
> And do we have some way of on a per-process basis say "avoid NX
> because this old version of Oracle/flash/whatever-binary-thing doesn't
> run with it"?
we have three mechanisms for this in Fedora:
1) the PT_GNU_STACK flag itself - you can turn executability on/off
compile-time or even after the fact via the execstack(8) utility
Jakub wrote. This only affects the stack's executability - if an
application assumes a non-PROT_EXEC mmap() can be executed it might
still break with NX - but based on experience with Fedora Core i'd
say there's almost no such application.
this method works in 2.6 too, since it supports PT_GNU_STACK. gcc's
PT_GNU_STACK mechanism is very conservative - e.g. if an application
does an asm() then gcc assumes that it might rely on stack executability
and emits the X flag. [applications can then turn this off in the source
if stack executability is not required.] Likewise, if gcc emits
trampolines then the X flag is emitted too. (glibc knows about
PT_GNU_STACK all across - so e.g. if a nonexec stack application
dlopen()s a library that needs stack executability then glibc makes the
stack executable on the fly via PROT_GROWSDOWN/GROWSUP.)
2) via a runtime method: via the i386 personality. So an application can
trigger the 'legacy' Linux VM layout by e.g doing 'i386 java
./test.class'.
this is a hack in Fedora - we wanted to have a finegrained runtime
mechanism just in case. But it would be nice to have this upstream too -
e.g. via a PERSONALITY_3G?
3) via a kernel boot parameter (exec-shield=0)
with the NX patch this becomes noexec=off [the same flag works on x86_64
too]. This method is the most inflexible one, and is a last-resort
thing. (Fedora also has a runtime global switch to turn off the VM
layout changes.)
here's a list of applications that we had to fix/work around in Fedora
when the VM layout changed:
- emacs _rebuild_. (it coredumps itself during build ... xemacs is OK.)
- some JDKs. Since they generate code and try to be as fast as possible
they tend to rely more on VM details than normal applications.
- X's module loader assumed that brk was executable. (fixed)
- Wine. (it implements another OS so it's by definition very sensitive
to layout changes.)
most of the breakages were unclean x86-only code that would have broken
if ported over to 64-bit anyway.
old, legacy applications dont have the PT_GNU_STACK flag so they all
work fine.
Ingo
next prev parent reply other threads:[~2004-06-03 7:20 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-02 20:50 [announce] [patch] NX (No eXecute) support for x86, 2.6.7-rc2-bk2 Ingo Molnar
2004-06-02 21:00 ` Christoph Hellwig
2004-06-02 21:07 ` Ingo Molnar
2004-06-02 21:13 ` Linus Torvalds
2004-06-02 21:17 ` Arjan van de Ven
2004-06-02 21:31 ` Doug McNaught
2004-06-08 8:46 ` Jakub Jelinek
2004-06-03 1:12 ` Joel Becker
2004-06-03 1:27 ` Andi Kleen
2004-06-03 6:24 ` Arjan van de Ven
2004-06-03 20:37 ` jlnance
2004-06-03 7:21 ` Ingo Molnar [this message]
2004-06-03 12:44 ` Ingo Molnar
2004-06-03 15:54 ` Andi Kleen
2004-06-03 23:01 ` Andy Lutomirski
2004-06-03 23:08 ` Andi Kleen
2004-06-03 23:54 ` Andy Lutomirski
2004-06-04 0:05 ` Andy Lutomirski
2004-06-04 9:25 ` Ingo Molnar
2004-06-04 15:26 ` Andy Lutomirski
2004-06-04 15:36 ` Linus Torvalds
2004-06-04 15:41 ` Arjan van de Ven
2004-06-04 15:47 ` Linus Torvalds
2004-06-04 15:51 ` Arjan van de Ven
2004-06-04 16:02 ` Linus Torvalds
2004-06-04 16:13 ` Andi Kleen
2004-06-04 16:37 ` Arjan van de Ven
2004-06-04 16:40 ` Christoph Hellwig
2004-06-04 17:27 ` David Mosberger
2004-06-04 17:30 ` Andi Kleen
2004-06-08 9:07 ` Jakub Jelinek
2004-06-08 9:14 ` Andi Kleen
2004-06-08 9:19 ` Arjan van de Ven
2004-06-04 16:51 ` Ulrich Drepper
2004-06-08 17:15 ` Bill Davidsen
2004-06-04 18:11 ` Gerhard Mack
2004-06-04 18:12 ` Arjan van de Ven
2004-06-04 16:06 ` Ingo Molnar
2004-06-04 17:20 ` Ingo Molnar
2004-06-04 17:22 ` Ingo Molnar
2004-06-04 17:32 ` Ingo Molnar
2004-06-03 19:24 ` Suresh Siddha
2004-06-03 20:37 ` Andi Kleen
2004-06-03 22:58 ` Suresh Siddha
2004-06-03 23:06 ` Andi Kleen
2004-06-04 9:30 ` Ingo Molnar
2004-06-03 12:57 ` Brian Gerst
2004-06-04 9:39 ` Ingo Molnar
2004-06-04 10:41 ` Christoph Hellwig
2004-06-04 10:48 ` William Lee Irwin III
2004-06-03 16:21 ` Ulrich Drepper
2004-06-03 19:30 ` Kurt Garloff
2004-06-02 21:43 ` Andi Kleen
2004-06-03 0:11 ` Rusty Russell
2004-06-03 0:17 ` Jeff Garzik
2004-06-03 7:24 ` Ingo Molnar
2004-06-03 8:47 ` Ingo Molnar
2004-06-03 8:53 ` Ingo Molnar
2004-06-04 0:04 ` Rusty Russell
2004-06-03 9:07 ` Ingo Molnar
2004-06-03 14:36 ` Gerhard Mack
2004-06-03 16:22 ` Arjan van de Ven
2004-06-04 9:36 ` Ingo Molnar
2004-06-04 11:59 ` Stephen Wille Padnos
[not found] <22L0f-5Ci-11@gated-at.bofh.it>
[not found] ` <22O7J-8dw-11@gated-at.bofh.it>
[not found] ` <22Wf4-5Xv-23@gated-at.bofh.it>
2004-06-03 9:43 ` Andi Kleen
-- strict thread matches above, loose matches on Subject: below --
2004-06-04 18:01 Nakajima, Jun
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=20040603072146.GA14441@elte.hu \
--to=mingo@elte.hu \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=arjanv@redhat.com \
--cc=jun.nakajima@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=suresh.b.siddha@intel.com \
--cc=torvalds@osdl.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