Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to run some programs in Linux where I want to disable Address Space Layout Randomization (ASLR). I know to disable it at system level, which is by setting /proc/sys/kernel/randomize_va_space to 0.

However, I don't have access to change the value of /proc/sys/kernel/randomize_va_space as I don't have the administrator rights and the administrator would also not accept my request to do so. So I want to only disable it for my own processes. Is it possible?

share|improve this question

migrated from stackoverflow.com Jun 30 '11 at 14:26

This question came from our site for professional and enthusiast programmers.

LOL, this was migrated and the SO dupe that was not got more upvotes: stackoverflow.com/questions/11238457/… – Ciro Santilli 巴拿馬文件 六四事件 法轮功 Jul 28 '15 at 13:27

I think you can do it like this:

  • Write a program that forks
  • After the fork you should do something like

    int old, rc;
    old = personality(0xffffffff); /* Fetch old personality. */
    rc = personality(old | ADDR_NO_RANDOMIZE);
    if (-1 == rc) {
  • And then exec your program

share|improve this answer
Or just use setarch – ninjalj Jun 29 '11 at 18:36
@ninjalj Didn't know about setarch :) – cnicutar Jun 29 '11 at 19:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.