public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] FDPIC: respect PT_GNU_STACK exec markings when creating NOMMU stack
@ 2009-11-28 15:24 Mike Frysinger
  2009-11-28 18:47 ` [uClinux-dev] " Mike Frysinger
  2009-12-02 13:44 ` David Howells
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Frysinger @ 2009-11-28 15:24 UTC (permalink / raw)
  To: uclinux-dev, David Howells, David McCullough, Greg Ungerer,
	Paul Mundt
  Cc: uclinux-dist-devel, linux-kernel

The current code will load the stack size and markings, but then only use
the markings in the MMU code path.  The NOMMU code path always passes EXEC
to the mmap() call.  While this doesn't matter to most people during the
run of the code, it causes a pointless icache flush when starting every
FDPIC application and by default, that tends to be 128kB of waste.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
note: this will apply cleanly with the uninitialized flag patch applied,
but otherwise doesn't directly depend on it

 fs/binfmt_elf_fdpic.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 8563a57..3e2507b 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -380,7 +380,8 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
 
 	down_write(&current->mm->mmap_sem);
 	current->mm->start_brk = do_mmap(NULL, 0, stack_size,
-					 PROT_READ | PROT_WRITE | PROT_EXEC,
+					 PROT_READ | PROT_WRITE |
+					 (executable_stack & EXSTACK_ENABLE_X ? PROT_EXEC : 0),
 					 MAP_PRIVATE | MAP_ANONYMOUS |
 					 MAP_UNINITIALIZED | MAP_GROWSDOWN,
 					 0);
-- 
1.6.5.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-12-04 10:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-28 15:24 [PATCH] FDPIC: respect PT_GNU_STACK exec markings when creating NOMMU stack Mike Frysinger
2009-11-28 18:47 ` [uClinux-dev] " Mike Frysinger
2009-12-02 13:44 ` David Howells
2009-12-02 21:29   ` [uClinux-dev] " Mike Frysinger
2009-12-03 17:58     ` David Howells
2009-12-04  7:07       ` Mike Frysinger
2009-12-04  9:40         ` David Howells
2009-12-04 10:26           ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox