From: Andrew Morton <akpm@osdl.org>
To: Kurt Garloff <garloff@suse.de>
Cc: linux-kernel@vger.kernel.org, mingo@redhat.com
Subject: Re: Non-Exec stack patches
Date: Tue, 23 Mar 2004 16:41:04 -0800 [thread overview]
Message-ID: <20040323164104.11d79f32.akpm@osdl.org> (raw)
In-Reply-To: <20040324002149.GT4677@tpkurt.garloff.de>
Kurt Garloff <garloff@suse.de> wrote:
>
> > Which architectures are currently making their pre-page execute permissions
> > depend upon VM_EXEC? Would additional arch patches be needed for this?
>
> It works on AMD64 (not ia32e), both for 64bit and 32bit binaries.
> I have not yet tested other archs.
>
> If the values in the protection_map are different depending on bit 2,
> the patch will be effecitve. (OK, the CPU/MMU needs to honour the
> setting of course.) Most likely, the values for
> protection_map[7] is PAGE_COPY_EXEC and of protection_map[3] is
> PAGE_COPY.
OK.
> > This may not get past Linus of course. It doesn't even get past me with
> > that magical undocumented -1/0/+1 value of the executable_stack argument.
> > Please replace that with a proper, commented, #defined-or-enumerated value,
>
> As you wish, master.
> Slightly edited and untested patch attached.
It gets rejects in arch/x86_64/ia32/ia32_binfmt.c and
arch/ia64/ia32/binfmt_elf32.c - someone has been dinking with your
put_dirty_page() prototype. I dropped those bits.
And I added the missing bit:
--- 25/include/linux/binfmts.h~noexec-stack-comments Tue Mar 23 16:35:50 2004
+++ 25-akpm/include/linux/binfmts.h Tue Mar 23 16:37:11 2004
@@ -62,9 +62,12 @@ extern int prepare_binprm(struct linux_b
extern void remove_arg_zero(struct linux_binprm *);
extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
extern int flush_old_exec(struct linux_binprm * bprm);
-#define EXSTACK_DEFAULT 0
-#define EXSTACK_DISABLE_X 1
-#define EXSTACK_ENABLE_X 2
+
+/* Stack area protections */
+#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */
+#define EXSTACK_DISABLE_X 1 /* Disable executable stacks */
+#define EXSTACK_ENABLE_X 2 /* Enable executable stacks */
+
extern int setup_arg_pages(struct linux_binprm * bprm, int executable_stack);
extern int copy_strings(int argc,char __user * __user * argv,struct linux_binprm *bprm);
extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
Now, what should the kernel do if the executable requests EXSTACK_DISABLE_X
but the kernel cannot do that? Is it not a bit misleading/dangerous to
permit the executable to run anyway?
next prev parent reply other threads:[~2004-03-24 0:38 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-23 23:12 Non-Exec stack patches Kurt Garloff
2004-03-23 23:22 ` Ingo Molnar
2004-03-23 23:49 ` Andrew Morton
2004-03-24 0:21 ` Kurt Garloff
2004-03-24 0:38 ` David Mosberger
2004-03-24 1:20 ` Ulrich Drepper
2004-03-24 1:41 ` David Mosberger
2004-03-24 2:01 ` Ulrich Drepper
2004-03-24 7:09 ` David Mosberger
2004-03-24 7:00 ` Jakub Jelinek
2004-03-24 7:16 ` David Mosberger
2004-03-24 7:28 ` Jakub Jelinek
2004-03-24 7:45 ` David Mosberger
2004-03-24 16:29 ` John Reiser
2004-03-24 17:12 ` David Mosberger
2004-03-24 17:24 ` Jakub Jelinek
2004-03-24 18:01 ` David Mosberger
2004-03-24 19:02 ` John Reiser
2004-03-24 19:18 ` David Mosberger
2004-03-24 0:41 ` Andrew Morton [this message]
2004-03-24 0:41 ` Ingo Molnar
2004-03-24 10:53 ` Kurt Garloff
[not found] <1D3lO-3dh-13@gated-at.bofh.it>
[not found] ` <1D3YZ-3Gl-1@gated-at.bofh.it>
2004-03-24 6:01 ` Andi Kleen
2004-03-24 10:23 ` Stefan Smietanowski
2004-03-24 11:27 ` Andi Kleen
2004-03-24 22:03 ` Kurt Garloff
[not found] <20040324002149.GT4677@tpkurt.garloff.de.suse.lists.linux.kernel>
[not found] ` <16480.55450.730214.175997@napali.hpl.hp.com.suse.lists.linux.kernel>
[not found] ` <4060E24C.9000507@redhat.com.suse.lists.linux.kernel>
[not found] ` <16480.59229.808025.231875@napali.hpl.hp.com.suse.lists.linux.kernel>
[not found] ` <20040324070020.GI31589@devserv.devel.redhat.com.suse.lists.linux.kernel>
[not found] ` <16481.13780.673796.20976@napali.hpl.hp.com.suse.lists.linux.kernel>
[not found] ` <20040324072840.GK31589@devserv.devel.redhat.com.suse.lists.linux.kernel>
[not found] ` <16481.15493.591464.867776@napali.hpl.hp.com.suse.lists.linux.kernel>
[not found] ` <4061B764.5070008@BitWagon.com.suse.lists.linux.kernel>
[not found] ` <16481.49534.124281.434663@napali.hpl.hp.com.suse.lists.linux.kernel>
[not found] ` <20040324172454.GP31589@devserv.devel.redhat.com.suse.lists.linux.kernel>
2004-03-24 17:49 ` Andi Kleen
2004-03-24 17:54 ` Jakub Jelinek
-- strict thread matches above, loose matches on Subject: below --
2004-04-14 7:28 Siddha, Suresh B
2004-04-14 8:23 ` Jamie Lokier
2004-04-14 9:47 ` Jamie Lokier
2004-04-14 18:30 ` Kurt Garloff
2004-04-14 20:54 ` Jeff Dike
2004-04-14 8:45 Siddha, Suresh B
2004-04-14 9:38 ` Jamie Lokier
2004-04-14 19:14 Siddha, Suresh B
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=20040323164104.11d79f32.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=garloff@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/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