about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-25 03:31:59 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-25 03:31:59 +0000
commit69c9fa045bce5e125e2e4525eb62ec58965e92f5 (patch)
tree82128d16507f4f4a92caec8e3e5ae248b1f23c7c
parent279f1143afdb06e263dfab510a3e2cbb022014fe (diff)
downloadglibc-69c9fa045bce5e125e2e4525eb62ec58965e92f5.tar.gz
glibc-69c9fa045bce5e125e2e4525eb62ec58965e92f5.tar.xz
glibc-69c9fa045bce5e125e2e4525eb62ec58965e92f5.zip
Update.
	* sysdeps/unix/sysv/linux/dl-execstack.c
	(_dl_make_stack_executable): Remember that we changed the permission.
-rw-r--r--ChangeLog3
-rw-r--r--nptl/ChangeLog3
-rw-r--r--nptl/allocatestack.c14
-rw-r--r--sysdeps/unix/sysv/linux/dl-execstack.c3
4 files changed, 23 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 98435be439..2b0b36f10f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2003-09-24  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/unix/sysv/linux/dl-execstack.c
+	(_dl_make_stack_executable): Remember that we changed the permission.
+
 	* sysdeps/ia64/dl-machine.h (RTLD_START): Remove setting of
 	__libc_stack_end.  Patch by David Mosberger.
 
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index e18c9cac21..30b7d9eb1d 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,8 @@
 2003-09-24  Ulrich Drepper  <drepper@redhat.com>
 
+	* allocatestack.c (__make_stacks_executable): Also change
+	permission of the currently unused stacks.
+
 	* allocatestack.c (change_stack_perm): Split out from
 	__make_stacks_executable.
 	(allocate_stack): If the required permission changed between the time
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 24292e7295..c82b36ede0 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -684,6 +684,20 @@ __make_stacks_executable (void)
 	break;
     }
 
+  /* Also change the permission for the currently unused stacks.  This
+     might be wasted time but better spend it here than adding a check
+     in the fast path.  */
+  list_for_each (runp, &stack_cache)
+    {
+      err = change_stack_perm (list_entry (runp, struct pthread, list)
+#ifdef NEED_SEPARATE_REGISTER_STACK
+			       , pagemask
+#endif
+			       );
+      if (err != 0)
+	break;
+    }
+
   lll_unlock (stack_cache_lock);
 
   if (err == 0)
diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c
index 42300b0f4d..c840f61031 100644
--- a/sysdeps/unix/sysv/linux/dl-execstack.c
+++ b/sysdeps/unix/sysv/linux/dl-execstack.c
@@ -110,6 +110,9 @@ _dl_make_stack_executable (void)
 # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
 #endif
 
+  /* Remember that we changed the permission.  */
+  GL(dl_stack_flags) |= PF_X;
+
   return 0;
 }
 rtld_hidden_def (_dl_make_stack_executable)