This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH RFA]: Look for /proc/sys/kernel/randomize_va_space
- From: Ian Lance Taylor <ian at airs dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 30 Jul 2005 17:56:38 -0700
- Subject: [PATCH RFA]: Look for /proc/sys/kernel/randomize_va_space
In Fedora Core 4 the file which used to be named
/proc/sys/kernel/exec-shield-randomize is now called
/proc/sys/kernel/randomize_va_space. Apparently the name changed as
the functionality was taken into the mainline Linux kernel. In
host-linux.c, in some cases, we try to read that file to see if
virtual addresses are randomized on the host system. It's not a
common case any more, because the TRY_EMPTY_VM_SPACE code will
normally work. But as long as we have the case, we should check the
right file.
This patch was tested with bootstrap and testsuite run on
i686-pc-linux-gnu. OK for mainline and 4.0?
This patch will be appropriate for 3.4 after
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01389.html
is tested successfully on Solaris.
:ADDPATCH pch:
Ian
2005-07-30 Ian Lance Taylor <ian@airs.com>
* config/host-linux.c (linux_gt_pch_get_address): If we can't open
exec-shield-randomize, try randomize_va_space.
Index: config/host-linux.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/host-linux.c,v
retrieving revision 1.10
diff -p -u -r1.10 host-linux.c
--- config/host-linux.c 12 Jul 2005 20:59:00 -0000 1.10
+++ config/host-linux.c 31 Jul 2005 00:50:01 -0000
@@ -116,6 +116,8 @@ linux_gt_pch_get_address (size_t size, i
/* If we didn't, then we need to look to see if randomization is on. */
f = fopen ("/proc/sys/kernel/exec-shield-randomize", "r");
+ if (f == NULL)
+ f = fopen ("/proc/sys/kernel/randomize_va_space", "r");
randomize_on = false;
if (f != NULL)
{