mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: pageexec@freemail.hu
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Hugh Dickins <hugh@veritas.com>
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>,
	stable@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Bug 11063][PATCH] exec: fix stack excutability without PT_GNU_STACK
Date: Thu, 10 Jul 2008 23:21:31 +0200	[thread overview]
Message-ID: <4876997B.15434.250C736@pageexec.freemail.hu> (raw)
In-Reply-To: <Pine.LNX.4.64.0807102110130.16171@blonde.site>

On 10 Jul 2008 at 21:19, Hugh Dickins wrote:

> 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.

alternatively, if there's a concern of stack_vma->vm_flags manipulation
during execve (maybe not now, but in the future or in non-ELF formats
that also want to rely on personality bits), you could opt for a safer

	vm_flags = vma->vm_flags | (VM_STACK_FLAGS & (VM_EXEC | VM_MAYEXEC));

to just recompute the exec rights related bits.

> 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
> 




  reply	other threads:[~2008-07-11  9:19 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   ` [Bug 11063][PATCH] exec: fix stack excutability without PT_GNU_STACK Hugh Dickins
2008-07-10 21:21     ` pageexec [this message]
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=4876997B.15434.250C736@pageexec.freemail.hu \
    --to=pageexec@freemail.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=aaw@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.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®