nptl/tst-execstack on AMD64/kernel 2.9.0-test9

Andreas Jaeger aj@suse.de
Wed Nov 26 10:01:00 GMT 2003


Thorsten Kukuk <kukuk@suse.de> writes:

> Hi,
>
> On AMD64, the nptl/tst-execstack fails with kernel 2.6.0-test9 in
>   pthread_barrier_wait (&go_barrier);
>
> strace shows, that one process is doing a mmap, while a second 
> process is segfaulting at the same time.
>
> I'm using gcc 3.3.2 and binutils 2.14.90.0.7, all other tests passes.
>
> Does somebody else see this? Is this a kernel problem or a glibc one?

The problem is a bug in dl-execstack.  If the mprotect call succeeds
(it does not succeed on the 2.4 Red Hat kernel), then we do not set
dl_stack_flags.

I propose the following patch, it passes the test now.  Ok to commit?

Andreas


2003-11-26  Andreas Jaeger  <aj@suse.de>

	* sysdeps/unix/sysv/linux/dl-execstack.c
	(_dl_make_stack_executable): Set dl_stack_flags always for
	success.

============================================================
Index: sysdeps/unix/sysv/linux/dl-execstack.c
--- sysdeps/unix/sysv/linux/dl-execstack.c	25 Sep 2003 23:04:12 -0000	1.3
+++ sysdeps/unix/sysv/linux/dl-execstack.c	26 Nov 2003 09:39:20 -0000
@@ -40,7 +40,7 @@ _dl_make_stack_executable (void)
     {
       if (__mprotect ((void *) page, GL(dl_pagesize),
 		      PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) == 0)
-	return 0;
+	goto return_success;
       if (errno != EINVAL)
 	return errno;
       no_growsdown = true;
@@ -91,7 +91,7 @@ _dl_make_stack_executable (void)
     {
       if (__mprotect ((void *) page, GL(dl_pagesize),
 		      PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSUP) == 0)
-	return 0;
+	goto return_success;
       if (errno != EINVAL)
 	return errno;
       no_growsup = true;
@@ -132,6 +132,8 @@ _dl_make_stack_executable (void)
 # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
 #endif
 
+
+ return_success:  
   /* Remember that we changed the permission.  */
   GL(dl_stack_flags) |= PF_X;
 

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20031126/07ea80aa/attachment.sig>


More information about the Libc-hacker mailing list