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


Ian Lance Taylor <ian@airs.com> writes:

> 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

In that case we should try the official name first and then the old
one.  I propose to change the order of files to access in your patch
and add a note about the above.

> 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)
>      {

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


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