Bug 146 - pthread_testcancel/exit raises SIGABRT on linux 2.6.*
Summary: pthread_testcancel/exit raises SIGABRT on linux 2.6.*
Status: RESOLVED WORKSFORME
Alias: None
Product: glibc
Classification: Unclassified
Component: linuxthreads (show other bugs)
Version: 2.3.2
: P2 critical
Target Milestone: ---
Assignee: GOTO Masanori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-05 08:11 UTC by Tomas Ukkonen
Modified: 2019-04-10 11:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Ukkonen 2004-05-05 08:11:34 UTC
This is either kernel or libc bug.

When calling pthread_cancel() or by telling the other thread to call
pthread_exit(). A to-be-stopped thread almost always raises (stacktrace leads to
libc) SIGABRT
when pthread_testcancelstate() or pthread_exit() is called.
This is delivered to a main thread and causes program crash.

This seems to be linux 2.6.* specific. 
I have tested this in 2.6.5, 2.6.6-rc3 (SIGABRT) and 2.4.26 (no SIGABRT).

This also seems to be hard to work around.
Setting signal blocking and/or signal handlers in a main thread and/or in a
to-be-killed thread doesn't help so I have to switch back to 2.4.* kernels 
until this gets fixed.


System:
Debian
linux 2.6.5/linux 2.6.6-rc3/linux 2.4.26
libc 2.3.2.ds1-12
gcc 3.3.3 (Debian prerelease 20040429)
Comment 1 Jakub Jelinek 2004-06-15 08:13:55 UTC
Can you attach a testcase?
Also, can you reproduce with more recent glibc, 2.3.2 is way to old.
Particularly, aren't you calling these functions from C++ and lack:
2003-04-18  Ulrich Drepper  <drepper@redhat.com>

        * sysdeps/pthread/pthread.h: Don't mark pthread_testcancel,
        pthread_cancel, pthread_setcancelstate, and pthread_setcanceltype with
        __THROW.

2003-12-26  Jakub Jelinek  <jakub@redhat.com>

        * sysdeps/pthread/pthread.h (pthread_setcancelstate,
        pthread_setcanceltype, pthread_cancel, pthread_testcancel): Remove
        __THROW.
        * semaphore.h (sem_wait, sem_timedwait): Likewise.
changes in pthread.h (depending if you build against linuxthreads or NPTL
headers)?
Comment 2 Ulrich Drepper 2004-08-09 07:02:14 UTC
No reply in almost two months.  Closing.