From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
security@kernel.org, "Luck, Tony" <tony.luck@intel.com>,
James Morris <jmorris@namei.org>,
Mike Waychison <mikew@google.com>,
Michael Davidson <md@google.com>,
linux-mm@kvack.org, Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Mathias Krause <minipli@googlemail.com>,
Roland McGrath <roland@redhat.com>
Subject: Re: [PATCH 1/2] Split 'flush_old_exec' into two functions
Date: Thu, 28 Jan 2010 21:17:26 -0800 [thread overview]
Message-ID: <4B626F66.3080508@zytor.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1001282043300.3768@localhost.localdomain>
On 01/28/2010 08:43 PM, Linus Torvalds wrote:
> --- a/fs/binfmt_elf_fdpic.c
> +++ b/fs/binfmt_elf_fdpic.c
> @@ -318,6 +318,8 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
> /* there's now no turning back... the old userspace image is dead,
> * defunct, deceased, etc. after this point we have to exit via
> * error_kill */
> + setup_new_exec(bprm);
> +
> set_personality(PER_LINUX_FDPIC);
> if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
> current->personality |= READ_IMPLIES_EXEC;
> diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
> index d4a00ea..d6a43eb 100644
> --- a/fs/binfmt_flat.c
> +++ b/fs/binfmt_flat.c
> @@ -518,6 +518,7 @@ static int load_flat_file(struct linux_binprm * bprm,
> }
>
> /* OK, This is the point of no return */
> + setup_new_exec(bprm);
> set_personality(PER_LINUX_32BIT);
> }
For all of these, wouldn't it make more sense to call set_personality()
*before* calling setup_new_exec()? The sequencing that would seem sane
to me is:
flush_old_exec();
set_personality();
setup_new_exec();
... since setup_new_exec() should be able to depend on the target
personality, including TASK_SIZE and arch_pick_mmap_layout().
Similarly, for binfmt_elf the following sequence would seem to make sense:
/* OK, This is the point of no return */
/* Do this immediately, since STACK_TOP as used in setup_arg_pages
may depend on the personality. */
SET_PERSONALITY(loc->elf_ex);
if (elf_read_implies_exec(loc->elf_ex, executable_stack))
current->personality |= READ_IMPLIES_EXEC;
if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
current->flags |= PF_RANDOMIZE;
setup_new_exec(bprm);
current->flags &= ~PF_FORKNOEXEC;
current->mm->def_flags = def_flags;
... then there shouldn't be a need to call SET_PERSONALITY() and
arch_pick_mmap_layout() twice...
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-01-29 5:18 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-28 7:34 DoS on x86_64 Mathias Krause
2010-01-28 8:18 ` [Security] " Andrew Morton
2010-01-28 15:41 ` H. Peter Anvin
2010-01-28 22:33 ` Linus Torvalds
2010-01-28 22:47 ` Mathias Krause
2010-01-28 22:47 ` H. Peter Anvin
2010-01-28 23:09 ` Linus Torvalds
2010-01-28 23:27 ` H. Peter Anvin
2010-01-28 23:46 ` Linus Torvalds
2010-01-29 4:43 ` Linus Torvalds
2010-01-29 4:43 ` [PATCH 1/2] Split 'flush_old_exec' into two functions Linus Torvalds
2010-01-29 4:47 ` [PATCH 2/2] x86: get rid of the insane TIF_ABI_PENDING bit Linus Torvalds
2010-01-29 5:17 ` H. Peter Anvin [this message]
2010-01-29 5:05 ` [Security] DoS on x86_64 H. Peter Anvin
2010-01-29 5:29 ` H. Peter Anvin
2010-01-29 5:34 ` [PATCH 1/2] Split 'flush_old_exec' into two functions H. Peter Anvin
2010-01-29 5:34 ` [PATCH 2/2] x86: get rid of the insane TIF_ABI_PENDING bit H. Peter Anvin
2010-01-29 5:36 ` [PATCH 1/2] Split 'flush_old_exec' into two functions H. Peter Anvin
2010-01-29 5:36 ` [PATCH 2/2] x86: get rid of the insane TIF_ABI_PENDING bit H. Peter Anvin
2010-01-29 5:41 ` [PATCH 1/2] Split 'flush_old_exec' into two functions H. Peter Anvin
2010-01-29 5:41 ` [PATCH 2/2] x86: get rid of the insane TIF_ABI_PENDING bit H. Peter Anvin
2010-01-29 5:44 ` H. Peter Anvin
2010-01-29 6:14 ` [PATCH 1/2] Split 'flush_old_exec' into two functions H. Peter Anvin
2010-01-29 6:14 ` [PATCH 2/2] x86: get rid of the insane TIF_ABI_PENDING bit H. Peter Anvin
2010-01-28 23:06 ` [Security] DoS on x86_64 Linus Torvalds
2010-01-28 23:14 ` H. Peter Anvin
2010-01-28 21:31 ` Mathias Krause
2010-01-28 17:10 ` Linus Torvalds
2010-01-28 21:49 ` Mathias Krause
2010-01-28 21:58 ` Linus Torvalds
2010-01-28 22:08 ` Mathias Krause
2010-01-28 22:18 ` Linus Torvalds
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=4B626F66.3080508@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=jmorris@namei.org \
--cc=linux-mm@kvack.org \
--cc=md@google.com \
--cc=mikew@google.com \
--cc=mingo@redhat.com \
--cc=minipli@googlemail.com \
--cc=roland@redhat.com \
--cc=security@kernel.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--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