public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* nptl/tst-execstack on AMD64/kernel 2.9.0-test9
@ 2003-11-18  9:28 Thorsten Kukuk
  2003-11-26 10:01 ` Andreas Jaeger
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Kukuk @ 2003-11-18  9:28 UTC (permalink / raw)
  To: libc-hacker


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?

  Thanks,
   Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Deutschherrnstr. 15-19        D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: nptl/tst-execstack on AMD64/kernel 2.9.0-test9
  2003-11-18  9:28 nptl/tst-execstack on AMD64/kernel 2.9.0-test9 Thorsten Kukuk
@ 2003-11-26 10:01 ` Andreas Jaeger
  2003-11-26 14:59   ` Andreas Jaeger
  2003-11-27  5:32   ` Ulrich Drepper
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Jaeger @ 2003-11-26 10:01 UTC (permalink / raw)
  To: Thorsten Kukuk; +Cc: libc-hacker

[-- Attachment #1: Type: text/plain, Size: 2107 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: nptl/tst-execstack on AMD64/kernel 2.9.0-test9
  2003-11-26 10:01 ` Andreas Jaeger
@ 2003-11-26 14:59   ` Andreas Jaeger
  2003-11-27  5:32   ` Ulrich Drepper
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Jaeger @ 2003-11-26 14:59 UTC (permalink / raw)
  To: Thorsten Kukuk; +Cc: libc-hacker

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

Andreas Jaeger <aj@suse.de> writes:

> 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?

There's one more question to consider: Should _dl_stack_flags be set
in any errors - therefore also in case of errros?  So far this does
not happen...

Andreas
-- 
 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

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: nptl/tst-execstack on AMD64/kernel 2.9.0-test9
  2003-11-26 10:01 ` Andreas Jaeger
  2003-11-26 14:59   ` Andreas Jaeger
@ 2003-11-27  5:32   ` Ulrich Drepper
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2003-11-27  5:32 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: libc-hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jaeger wrote:

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

Done that, thanks.


> There's one more question to consider: Should _dl_stack_flags be set
> in any errors - therefore also in case of errros?  So far this does
> not happen...

There is no need for the flag not to reflect reality.  If it fails the
flag should stay as it is.  This way one could determine the stack state
post-mortem by looking at the variable.

- -- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/xYp72ijCOnn/RHQRAq0eAJ96IvPMvKzOAZntzlKTyBQPY9ECZQCeOuim
gO47YDYZLvu5voJUbM39W6s=
=MtI+
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-11-27  5:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-18  9:28 nptl/tst-execstack on AMD64/kernel 2.9.0-test9 Thorsten Kukuk
2003-11-26 10:01 ` Andreas Jaeger
2003-11-26 14:59   ` Andreas Jaeger
2003-11-27  5:32   ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).