public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hubert Tonneau <hubert.tonneau@fullpliant.org>
To: Arjan van de Ven <arjanv@redhat.com>, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6.12-rc3 mmap lack of consistency among runs
Date: Fri, 29 Apr 2005 18:36:16 GMT	[thread overview]
Message-ID: <0563YCG12@server5.heliogroup.fr> (raw)

Hubert Tonneau wrote:
>
> I even tried adding the following instruction at the very beginning of my
> C program, with no more success:
> personality(0x0040000); // ADDR_NO_RANDOMIZE
> 
> Basically, the behaviour is not changed, as opposed to if I do:
> echo 0 >/proc/sys/kernel/randomize_va_space

I believe that I understand why calling 'personality' does not work:
it has to be called before the process is loaded as far as I could understand
the Linux source code.

So, at the moment, the only two effective workarounds I'm awared of are:
. switch to calling 'mmap' with specified requested address right from the
  beginning (also I find it very dangerous over the long run)
. call 'mmap' to allocate (waste) 1 MB of address space when the process
  runs for the first time, so that I'm granted that subsequente 'mmap'
  will allocate from a memory area that is always available from run to run

Also about the second solution (the one that I've included in Pliant)
I have two concernes:
. first it's ugly (should I include it in Posix OS agnostic version of
  Pliant or just declare that Linux cannot run the generic version anymore)
. second, and most important one, I have experimentaly determined that 1 MB
  is the minimum address space to allocate (waste), but I could not understand
  where it comes from reading the Kernel source, and I don't understand how
  stable will this value be over time:

unsigned long arch_align_stack(unsigned long sp)
{
  if (randomize_va_space)
    sp -= get_random_int() % 8192;
  return sp & ~0xf;
}


             reply	other threads:[~2005-04-29 19:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-29 18:36 Hubert Tonneau [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-04-29 14:25 2.6.12-rc3 mmap lack of consistency among runs Hubert Tonneau
2005-04-29 12:44 Hubert Tonneau
2005-04-29 13:20 ` Andrew Morton
2005-04-29 13:34   ` Arjan van de Ven
2005-04-29 13:29 ` Arjan van de Ven
2005-04-28  9:59 Hubert Tonneau
2005-04-29 12:47 ` Andrew Morton

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=0563YCG12@server5.heliogroup.fr \
    --to=hubert.tonneau@fullpliant.org \
    --cc=akpm@osdl.org \
    --cc=arjanv@redhat.com \
    --cc=linux-kernel@vger.kernel.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