Some newer systems include address space randomization. This interferes with debugging and reproducibility as gcc at times is dependent upon internal addresses for making code generation decisions, though, that is considered a bug and should be fixed. This page details how to turn off address space randomizations.


To disable randomization for a shell session:

# for i386
setarch i386 -RL bash
# or more generally
setarch $(uname -m) -RL bash

The -R option disables address randomization, -L mandates legacy virtual memory layout. See the setarch man page for more information.

To disable randomization for the whole system, add this to /etc/sysctl.conf:

# Do not randomize memory addresses
kernel.randomize_va_space = 0

After that, run 'sysctl -p' as root to update the kernel without rebooting.

Note that on Red Hat Enterprise Linux 3 systems, the key is named kernel.exec-shield-randomize instead. In addition, you will also have to set kernel.exec-shield to 0.

You may also need to:

/sbin/sysctl -w vm.legacy_va_layout=1

on FC4 and FC5T1 systems, though on (On 2.6.14-1.1653_FC4smp) it didn't seem necessary.

Related non-reproducibilities

Also, one may want to use -frandom-seed=0 to further reduce randomness.

None: Randomization (last edited 2011-05-22 05:37:40 by cpe-66-27-118-59)