Public bug reported:
In Ubuntu 8.10 (gcc 4.3.2-1ubuntu12) and Ubuntu 7.10 there is a problem with thread cancellation, stack unwinding and shared libraries. If pthread_cancel is called in the library, a segmentation fault occurs. For static linkage the problem does not occur and the thread is canceled as expected. In the attachment you can find a demo application reproducing the problem. It consists of an Makefile and the source files: main.cpp thread_test_lib.h - library interface thread_test_lib.cpp - library source If you invoke make the shared library libthread_test_lib.so and the application thread_test are built. Make also generates thread_test_static which is the same application, but statically linked. The library provides the functions thread_setup() to create an internal task and thread_cleanup() to cancel the task. When thread_test is executed a segmentation fault occurs: ./thread_test thread_setup() run_thread::task() started thread_cleanup() Segmentation fault (core dumped) According to the core dump the segmentation fault is inside task(). It can be observed that no segmentation fault occurs when - ./thread_test_static is called instead of ./thread_test - the line "std::string s..." inside task() (see thread_test_lib.cpp) is commented out - usleep() in task() is replaced by sleep() or pthread_testcancel - usleep() in task() is called indirectly via a wrapper function Any help is appreciated. Franz Hollerer ProblemType: Bug Architecture: i386 DistroRelease: Ubuntu 8.10 Package: firefox 3.0.14+build2+nobinonly-0ubuntu0.8.10.1 PackageArchitecture: all ProcEnviron: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games LANG=de_AT.UTF-8 SHELL=/bin/bash SourcePackage: firefox-3.0 Uname: Linux 2.6.27-14-generic i686 ** Affects: ubuntu Importance: Undecided Status: New -- pthread_cancel segfault when used in shared library https://bugs.launchpad.net/bugs/455808 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs