This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH RFA]: Look for /proc/sys/kernel/randomize_va_space


Mark Mitchell <mark@codesourcery.com> writes:

> Ian Lance Taylor wrote:
> 
> > This patch was tested with bootstrap and testsuite run on
> > i686-pc-linux-gnu.  OK for mainline and 4.0?
> 
> OK, with the change Andreas suggested.
> 
> I think this is a reasonable change for 4.0, in that users will
> perceive this as a regression, if they upgrade kernels.

Committed as shown to mainline and 4.0 branch.

Ian


2005-08-01  Ian Lance Taylor  <ian@airs.com>

	* config/host-linux.c (linux_gt_pch_get_address): Add new name
	randomize_va_space for virtual address randomization control.


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	1 Aug 2005 17:28:50 -0000
@@ -114,8 +114,13 @@ linux_gt_pch_get_address (size_t size, i
   if (TRY_EMPTY_VM_SPACE && addr == (void *) TRY_EMPTY_VM_SPACE)
     return addr;
 
-  /* 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 we didn't, then we need to look to see if virtual address
+     randomization is on.  That is recorded in
+     kernel.randomize_va_space.  An older implementation used
+     kernel.exec-shield-randomize.  */
+  f = fopen ("/proc/sys/kernel/randomize_va_space", "r");
+  if (f == NULL)
+    f = fopen ("/proc/sys/kernel/exec-shield-randomize", "r");
   randomize_on = false;
   if (f != NULL)
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]