strace of the program starting, it starts some pthreads, then this; mprotect(0x40298000, 118784, PROT_READ|PROT_WRITE) = 0 mprotect(0x40298000, 118784, PROT_READ|PROT_EXEC) = 0 rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0 rt_sigsuspend([] and there it stops. In ddd; Dump of assembler code for function sigsuspend: 0x40197050 <sigsuspend>: push %ebp 0x40197051 <sigsuspend+1>: mov %esp,%ebp 0x40197053 <sigsuspend+3>: sub $0x18,%esp 0x40197056 <sigsuspend+6>: mov %ebx,0xfffffff4(%ebp) 0x40197059 <sigsuspend+9>: mov %esi,0xfffffff8(%ebp) 0x4019705c <sigsuspend+12>: mov %edi,0xfffffffc(%ebp) 0x4019705f <sigsuspend+15>: call 0x4018360d <__i686.get_pc_thunk.bx> 0x40197064 <sigsuspend+20>: add $0xfcd7c,%ebx 0x4019706a <sigsuspend+26>: mov 0x2b88(%ebx),%eax 0x40197070 <sigsuspend+32>: test %eax,%eax 0x40197072 <sigsuspend+34>: jne 0x401970ad <sigsuspend+93> 0x40197074 <sigsuspend+36>: mov $0x8,%ecx 0x40197079 <sigsuspend+41>: mov 0x8(%ebp),%eax 0x4019707c <sigsuspend+44>: push %ebx 0x4019707d <sigsuspend+45>: mov %eax,%ebx 0x4019707f <sigsuspend+47>: mov $0xb3,%eax 0x40197084 <sigsuspend+52>: int $0x80 -> 0x40197086 <sigsuspend+54>: pop %ebx This is the instruction which hangs. This is NOT a cnedra problem. See the included test-case. Reproducible: Always Steps to Reproduce: strace will need to be emerged... 1. cat > test.c <<EOF #define _REENTRANT #include <errno.h> #include <pthread.h> #include <stdlib.h> #include <stdio.h> void *null_routine(void *arg) { return(NULL); } int main(int argc,char *argv[]) { pthread_t tid; int rc; errno=0; rc=pthread_create(&tid,NULL,null_routine,NULL); printf("pthread_create - %d : %d\n",rc, errno); pthread_join(tid,NULL); return(0); } 2. gcc -o test -lpthread test.c 3. strace ./test Actual Results: Only relevent strace output included.... rt_sigsuspend([] <unfinished ...> --- SIGRTMIN (Unknown signal 32) @ 0 (0) --- <... rt_sigsuspend resumed> ) = -1 EINTR (Interrupted system call) sigreturn() = ? (mask now [RTMIN]) fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40014000 write(1, "pthread_create - 0 : 4\n", 23pthread_create - 0 : 4 ) = 23 rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0 rt_sigsuspend([] <unfinished ...> --- SIGRTMIN (Unknown signal 32) @ 0 (0) --- <... rt_sigsuspend resumed> ) = -1 EINTR (Interrupted system call) sigreturn() = ? (mask now [RTMIN]) write(4, "\240 \3@\1\0\0\0\2@\0\0\240 \3@\344q\2@\0@\2@\0\0\0\0h"..., 148) = 148 write(4, "\240 \3@\2\0\0\0\0\0\0\0\370J\3@h\367\377\277\250\263\31"..., 148) = 148 rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0 rt_sigsuspend([] <unfinished ...> --- SIGRTMIN (Unknown signal 32) @ 0 (0) --- <... rt_sigsuspend resumed> ) = -1 EINTR (Interrupted system call) sigreturn() = ? (mask now [RTMIN]) wait4(6738, NULL, __WCLONE, NULL) = 6738 munmap(0x40014000, 4096) = 0 _exit(0) = ? Expected Results: rt_sigsuspend should always return 0. gcc -v Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/specs Configured with: /var/tmp/portage/gcc-3.2.3-r1/work/gcc-3.2.3/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.2 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext Thread model: posix gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice) # /lib/libc.so.6 GNU C Library stable release version 2.3.2, by Roland McGrath et al. Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice). Compiled on a Linux 2.4.19 system on 2003-07-28. Available extensions: GNU libio by Per Bothner crypt add-on version 2.1 by Michael Glad and others linuxthreads-0.10 by Xavier Leroy BIND-8.2.3-T5B libthread_db work sponsored by Alpha Processor Inc NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk Report bugs using the `glibcbug' script to <bugs@gnu.org>. #
please tell us what you are talking about ?
The rt_sigsuspend call is not functioning as it should. If it is any consolation, Redhat 7.3 shows the same behaviour, but that behaviour is incorrect) If you run the test case I provided above, you will see. rt_sigsuspend is called from linuxthreads (and therefore libc) The call should never block, even if it gets interrupted, it should continue. This is a guarantee of the API. Therefore I filed the bug report.
I ran your test case on my x86 box and my sparc64 box. My x86 box uses glibc-2.3.2-r6 with nptl-0.60 (2.6.0-test6-mm1 kernel), and the resulting strace output did not even contain a reference to rt_sigsuspend(). My sparc64 box however, runs glibc-2.3.2-r6 (2.4.20 kernel), but still uses linuxthreads, and on that box, I did see output similar to your test case in which rt_sigsuspend() did not return 0. This is obviously a bug that is unrelated to Gentoo and there really isn't anything we can do about it, especially since you see similar behavior in Redhat 7.3. The issue looks to have been fixed or avoided entirely on nptl-0.60, which is due to eventually replace linuxthreads. I recommend that you post a summary about this issue to the libc-alpha mailing list at sources.redhat.com. They are more in a position to assist you in resolving this bug. If this becomes the case and you get some kind of patch that resolves the issue, please inform us so that patch can get included in future glibc ebuilds. Resolving as INVALID.