public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: akpm@osdl.org, torvalds@osdl.org
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: [PROPOSAL/PATCH] Remove PT_GNU_STACK support before 2.6.11
Date: Sun, 6 Feb 2005 12:36:35 +0100	[thread overview]
Message-ID: <20050206113635.GA30109@wotan.suse.de> (raw)


Hallo,

I'm getting more and more reports that the PT_GNU_STACK change breaks
a lot of programs. In particular it breaks grub which implies that nobody
could have really tested it. Mono seems to break too, there are undoubtedly
others. There are some reports of Wine breaking too, I suspect
they are related to this too. The testing for this was obviously not very 
effective.

PT_GNU_STACK assumes that any program with a PT_GNU_STACK header
always pass correct PROT_EXEC flags to mmap/mprotect etc. before
allocating mappings. 

The problem is that people are recompiling these programs with
new compilers, the new compilers set PT_GNU_STACK and then they
break. Sometimes obviously (like grub), I bet in some other cases
they break only in obscure cases that are hard to catch.

Worse is that even when the program has trampolines and has PT_GNU_STACK
header with an E bit on the stack it still won't get an executable
heap by default  (this is what broke grub) 

This is a major source of source level and binary incompatibility. 

People reporting this to me all the time for x86-64 because few people
run PAE/NX enabled kernels on i386, and without PAE this breakage
is not visible. Also you need a NX capable CPU of course,
and basically all NX capable CPUs are able to run x86-64, so a 
lot of them run 64bit kernels. That is why the full impact of these
changes was not felt on i386.

I'm not really willing to handle all these problems on the x86-64 side, 
for what was ultimatively a half baked change comming from i386. 

My proposal is to turn this all off at least for 2.6.11. 

If it should be reenabled later probably needs a lot of discussion.
IMHO it's not a very good idea in 2.6 because it's an extremly invasive change
in the ABI and the security advantages of using NX are not that great anyways. 

I understand that some people want to have it as part of a marketing
campaign as "answer to Microsoft SP2", but IMHO source & binary compatibility
is too important to be sacrified for such things. If they really
want it they can continue to maintain it as private patches.

I also don't remember a thread on linux-kernel discussion these
trade offs and what significant impact it has on user space.
Before reenabling it I think we would need a lot of discussion
if it's really worth it, and a lot more education of user land
people on what they need to do to cope with this.

One way would be to have special command line flags or sysctls like
x86-64 used to have for this (but they were removed as "too confusing"),
and then only people who know what they are doing or can tolerate
some of their programs breaking can enable it.

But forcing it on all users doesn't seem to work very well.

Here's a patch to disable PT_GNU_STACK parsing for now. I would 
prefer it to be merged before 2.6.11.

Thanks,
-Andi

Remove PT_GNU_STACK support because user land is not ready for it yet.

Signed-off-by: Andi Kleen <ak@suse.de>

diff -u linux-2.6.11rc3/fs/binfmt_elf.c-o linux-2.6.11rc3/fs/binfmt_elf.c
--- linux-2.6.11rc3/fs/binfmt_elf.c-o	2005-02-04 09:13:18.000000000 +0100
+++ linux-2.6.11rc3/fs/binfmt_elf.c	2005-02-06 12:30:59.000000000 +0100
@@ -675,6 +675,13 @@
 		elf_ppnt++;
 	}
 
+#if 1
+	/* 
+	 * The user land is not ready for PT_GNU_STACK yet. Disable
+	 * it for now.
+	 */
+	have_pt_gnu_stack = 0;
+#else
 	elf_ppnt = elf_phdata;
 	for (i = 0; i < loc->elf_ex.e_phnum; i++, elf_ppnt++)
 		if (elf_ppnt->p_type == PT_GNU_STACK) {
@@ -685,6 +692,7 @@
 			break;
 		}
 	have_pt_gnu_stack = (i < loc->elf_ex.e_phnum);
+#endif
 
 	/* Some simple consistency checks for the interpreter */
 	if (elf_interpreter) {



             reply	other threads:[~2005-02-06 11:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-06 11:36 Andi Kleen [this message]
2005-02-06 11:47 ` [PROPOSAL/PATCH] Remove PT_GNU_STACK support before 2.6.11 Arjan van de Ven
2005-02-06 12:02   ` Ingo Molnar
2005-02-06 12:25     ` Ingo Molnar
2005-02-06 12:36     ` Andi Kleen
2005-02-06 12:45     ` Ingo Molnar
2005-02-06 12:50       ` Andi Kleen
2005-02-06 12:59         ` Arjan van de Ven
2005-02-06 13:01           ` Andi Kleen
2005-02-06 13:04             ` Arjan van de Ven
2005-02-06 13:09               ` Andi Kleen
2005-02-06 13:31                 ` Ingo Molnar
2005-02-06 13:43                   ` Andi Kleen
2005-02-06 13:06             ` Christoph Hellwig
2005-02-06 13:11               ` Andi Kleen
2005-02-06 13:32                 ` Ingo Molnar
2005-02-06 13:46                   ` Andi Kleen
2005-02-06 14:08                     ` Ingo Molnar
2005-02-06 14:22                       ` Ingo Molnar
2005-02-06 14:29                       ` Andi Kleen
2005-02-06 17:08                         ` Linus Torvalds
2005-02-06 17:13                           ` Arjan van de Ven
2005-02-06 17:31                             ` Linus Torvalds
2005-02-06 17:39                               ` Arjan van de Ven
2005-02-06 18:04                                 ` Linus Torvalds
2005-02-06 18:08                                   ` Arjan van de Ven
2005-02-06 17:56                           ` Andi Kleen
2005-02-06 12:33   ` Andi Kleen
2005-02-06 12:40     ` Arjan van de Ven
2005-02-06 12:48       ` Andi Kleen
2005-02-06 15:54         ` Andreas Schwab
2005-02-06 17:05     ` Linus Torvalds
2005-02-06 17:58       ` Andi Kleen
2005-02-06 12:11 ` Paweł Sikora
     [not found] ` <200502061303.12377.pluto@pld-linux.org>
     [not found]   ` <20050206124701.GD30109@wotan.suse.de>
2005-02-06 18:07     ` Paweł Sikora
2005-02-06 18:38       ` Andi Kleen

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=20050206113635.GA30109@wotan.suse.de \
    --to=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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