Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

1 Answer 1

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.