mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Ebbert <76306.1226@compuserve.com>
To: Andi Kleen <ak@suse.de>
Cc: Linus Torvalds <torvalds@osdl.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>,
	Arjan van de Ven <arjan@infradead.org>
Subject: [PATCH for 2.6.18rc2] [1/7] i386/x86-64: Don't randomize stack top when...
Date: Tue, 25 Jul 2006 03:46:39 -0400	[thread overview]
Message-ID: <200607250348_MC3-1-C5FB-CC80@compuserve.com> (raw)

In-Reply-To: <44c514a8.6HlRR82y133O2bd0%ak@suse.de>

On Mon, 24 Jul 2006 20:42:48 +0200, Andi Kleen wrote:
> 
> --- linux.orig/arch/i386/kernel/process.c
> +++ linux/arch/i386/kernel/process.c
> @@ -37,6 +37,7 @@
>  #include <linux/kallsyms.h>
>  #include <linux/ptrace.h>
>  #include <linux/random.h>
> +#include <linux/personality.h>
>  
>  #include <asm/uaccess.h>
>  #include <asm/pgtable.h>
> @@ -905,7 +906,7 @@ asmlinkage int sys_get_thread_area(struc
>  
>  unsigned long arch_align_stack(unsigned long sp)
>  {
> -     if (randomize_va_space)
> +     if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
>               sp -= get_random_int() % 8192;
>       return sp & ~0xf;
>  }

I think this needs to be done always, at least on P4.  It really isn't
'randomization' at the same high level as the rest -- more like a small
adjustment.  And the offset should be a multiple of 128 and < 7K (not
8K.) Something like this:

        unsigned int r = get_random_int();
        sp &= ~0x7f;
        sp -= 128 * ((r % 32) + (r / 32 % 16));
        return sp;

-- 
Chuck


             reply	other threads:[~2006-07-25  7:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-25  7:46 Chuck Ebbert [this message]
2006-07-25  8:12 ` Arjan van de Ven
2006-07-25  9:06 Chuck Ebbert
2006-07-25 11:38 ` Andi Kleen
2006-07-25 11:48   ` Arjan van de Ven

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=200607250348_MC3-1-C5FB-CC80@compuserve.com \
    --to=76306.1226@compuserve.com \
    --cc=ak@suse.de \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@osdl.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®