exec stack and pthread_exit () problem
H. J. Lu
hjl@lucon.org
Thu Apr 1 22:47:00 GMT 2004
When I used --as-needed -lgcc_s --no-as-needed to replace -lgcc_eh,
I got random segfault on nptl/tst-execstack. I noticed that the main
thread changed the stack to executable and then called pthread_exit. It
seems that depending on the timing, the waiter thread would segfault.
The following patch fixes the segfault. Does pthread_exit in nptl do
anything to stack permission?
H.J.
-------------- next part --------------
2004-04-01 H.J. Lu <hongjiu.lu@intel.com>
* elf/tst-execstack.c (do_test): Call pthread_join.
--- elf/tst-execstack.c.timing 2003-09-23 05:07:02.000000000 -0700
+++ elf/tst-execstack.c 2004-04-01 14:38:33.000000000 -0800
@@ -106,6 +106,8 @@ do_test (void)
int rc = pthread_create (&th, NULL, &tryme_thread, f);
if (rc)
error (1, rc, "pthread_create");
+
+ pthread_join (th, NULL);
}
puts ("threads go");
@@ -113,6 +115,9 @@ do_test (void)
Let them run to test it. */
pthread_barrier_wait (&go_barrier);
+ for (int i = 0; i < N; i++)
+ pthread_join (thr[i], NULL);
+
pthread_exit (0);
#endif
More information about the Libc-alpha
mailing list