Hurd: Fix value of __libc_stack_end
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 10 May 2012 21:51:22 +0000 (14:51 -0700)
committerRoland McGrath <roland@hack.frob.com>
Thu, 10 May 2012 22:57:24 +0000 (15:57 -0700)
ChangeLog
sysdeps/generic/ldsodefs.h
sysdeps/mach/hurd/dl-sysdep.h
sysdeps/mach/hurd/i386/init-first.c

index fea15ee..1ae3593 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-05-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+        * sysdeps/generic/ldsodefs.h [LIBC_STACK_END_NOT_RELRO]
+        (__libc_stack_end): Do not use attribute_relro.
+        * sysdeps/mach/hurd/dl-sysdep.h (LIBC_STACK_END_NOT_RELRO): Define.
+        * sysdeps/mach/hurd/i386/init-first.c (init): Update __libc_stack_end
+       to libthread-provided value.
+        * sysdeps/mach/hurd/dl-sysdep.c (__libc_stack_end): Do not use
+        attribute_relro.
+
 2012-05-10  Thomas Schwinge  <thomas@schwinge.name>
 
        [BZ #3748]
index 602b429..e071015 100644 (file)
@@ -717,7 +717,11 @@ rtld_hidden_proto (_dl_make_stack_executable)
    might use the variable which results in copy relocations on some
    platforms.  But this does not matter, ld.so can always use the local
    copy.  */
-extern void *__libc_stack_end attribute_relro;
+extern void *__libc_stack_end
+#ifndef LIBC_STACK_END_NOT_RELRO
+     attribute_relro
+#endif
+     ;
 rtld_hidden_proto (__libc_stack_end)
 
 /* Parameters passed to the dynamic linker.  */
index 671b241..c64a39d 100644 (file)
@@ -1,5 +1,5 @@
 /* System-specific settings for dynamic linker code.  Hurd version.
-   Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +24,8 @@
 #define RTLD_PRIVATE_ERRNO 0
 
 #ifdef SHARED
-/* _dl_argv cannot be attribute_relro, because the stack-switching
+/* _dl_argv and __libc_stack_end cannot be attribute_relro, because the stack-switching
    libc initializer for using cthreads might write into it.  */
 # define DL_ARGV_NOT_RELRO 1
+# define LIBC_STACK_END_NOT_RELRO 1
 #endif
index f4bf624..fa4e3d9 100644 (file)
@@ -214,6 +214,8 @@ init (int *data)
 
       void switch_stacks (void);
 
+      __libc_stack_end = newsp;
+
       /* Copy per-thread variables from that temporary
         area onto the new cthread stack.  */
       memcpy (__hurd_threadvar_location_from_sp (0, newsp),