mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ollie Wild <aaw@google.com>,
	bugme-daemon@bugzilla.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Roland McGrath <roland@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	pageexec@freemail.hu, stable@kernel.org,
	linux-kernel@vger.kernel.org
Subject: [Bug 11063][PATCH] exec: fix stack excutability without PT_GNU_STACK
Date: Thu, 10 Jul 2008 21:19:20 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0807102110130.16171@blonde.site> (raw)
In-Reply-To: <20080709152716.99e9bbe7.akpm@linux-foundation.org>

Kernel Bugzilla #11063 points out that on some architectures (e.g. x86_32)
exec'ing an ELF without a PT_GNU_STACK program header should default to an
executable stack; but this got broken by the unlimited argv feature because
stack vma is now created before the right personality has been established:
so breaking old binaries using nested function trampolines.

Therefore re-evaluate VM_STACK_FLAGS in setup_arg_pages, where stack
vm_flags used to be set, before the mprotect_fixup.  Checking through
our existing VM_flags, none would have changed since insert_vm_struct:
so this seems safer than finding a way through the personality labyrinth.

Reported-by: pageexec@freemail.hu
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: stable@kernel.org
---

 fs/exec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 2.6.26-rc9/fs/exec.c	2008-06-21 08:41:19.000000000 +0100
+++ linux/fs/exec.c	2008-07-10 20:02:25.000000000 +0100
@@ -610,7 +610,7 @@ int setup_arg_pages(struct linux_binprm 
 	bprm->exec -= stack_shift;
 
 	down_write(&mm->mmap_sem);
-	vm_flags = vma->vm_flags;
+	vm_flags = VM_STACK_FLAGS;
 
 	/*
 	 * Adjust stack execute permissions; explicitly enable for

  parent reply	other threads:[~2008-07-10 20:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-11063-27@http.bugzilla.kernel.org/>
2008-07-09 22:28 ` [Bug 11063] New: lack of GNU_STACK header doesn't result in rwx stack on i386 Andrew Morton
     [not found] ` <20080709152716.99e9bbe7.akpm@linux-foundation.org>
2008-07-10 20:19   ` Hugh Dickins [this message]
2008-07-10 21:21     ` [Bug 11063][PATCH] exec: fix stack excutability without PT_GNU_STACK pageexec
2008-07-11 11:15       ` Hugh Dickins

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=Pine.LNX.4.64.0807102110130.16171@blonde.site \
    --to=hugh@veritas.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=aaw@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pageexec@freemail.hu \
    --cc=roland@redhat.com \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®