This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [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: 01 Aug 2005 11:00:33 -0700
- Subject: Re: [PATCH RFA]: Look for /proc/sys/kernel/randomize_va_space
- References: <20050731005638.17427.qmail@gossamer.airs.com><42ED6744.6090902@codesourcery.com>
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)
{