Package: libunwind8 Version: 1.1-4.1 Severity: important Dear Maintainer,
linking c++ Programs with libunwind leads to corruption of the process signal mask as soon as an exception is thrown. Since 1.0.1-3 libunwind is configured with --enable-cxx-exceptions. As soon as one links with libunwind it does get called every exception thrown. Which is Probably not what the user expects. Without rebuilding libunwind cannot be used for any of its other functionality without also handling all c++ exceptions. During exception handling the following problem appears: Without libunwind the sample program works as expected: # g++ -o sigtest visu/sigtest.cpp -lpthread # ./sigtest Signals blocked: 1 (Hangup) 65 (Unknown signal 65) Throw exception Signals blocked: 1 (Hangup) 65 (Unknown signal 65) With libunwind: # g++ -o sigtest visu/sigtest.cpp -lpthread -lunwind # ./sigtest Signals blocked: 1 (Hangup) 65 (Unknown signal 65) Throw exception Signals blocked: 4 (Illegal instruction) 7 (Bus error) 10 (User defined signal 1) 12 (User defined signal 2) 13 (Broken pipe) 14 (Alarm clock) 17 (Child exited) 18 (Continued) 24 (CPU time limit exceeded) 25 (File size limit exceeded) 28 (Window changed) 34 (Real-time signal 0) 37 (Real-time signal 3) 38 (Real-time signal 4) 41 (Real- time signal 7) 42 (Real-time signal 8) 43 (Real-time signal 9) 44 (Real-time signal 10) 45 (Real-time signal 11) 46 (Real-time signal 12) 47 (Real-time signal 13) 65 (Unknown signal 65) -- System Information: Debian Release: stretch/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.5.0-2-amd64 (SMP w/8 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages libunwind8 depends on: ii libc6 2.22-9 ii liblzma5 5.1.1alpha+20120614-2.1 libunwind8 recommends no packages. libunwind8 suggests no packages.
#include <stdexcept> #include <signal.h> #include <string.h> #include <stdio.h> void function_that_throw() { printf("Throw exception\n"); throw std::runtime_error("Exception"); } void printSigMask() { sigset_t currmask; sigprocmask(SIG_BLOCK, NULL, &currmask); printf("Signals blocked: "); for (int sig = 1; sig <= NSIG; sig++) { if (sigismember(&currmask, sig)) { printf("%d (%s)\t", sig, strsignal(sig)); } } printf("\n"); } int main(int ac, char *av[]) { sigset_t sigset; sigemptyset(&sigset); sigaddset(&sigset, SIGHUP); pthread_sigmask(SIG_BLOCK, &sigset, NULL); printSigMask(); try { function_that_throw(); } catch (std::exception &excp) { } printSigMask(); }