Install a signal handler for SIGABRT and SIGSEGV for kwin_wayland

Summary:
kwin_wayland disables ptrace on itself. This has the side effect of
core dumps no longer be created - which we want as DrKonqi doesn't
work for kwin_wayland.

This change introduces a dedicated signal handler for abort and
segfault. The signal handler enables ptrace again, unsets itself as
signal handler and raises the signal again, so that the proper crash,
abort handling can be performed.

Test Plan:
Added a crash, added an abort and verified that coredumpctl
shows the expected coredump.

Reviewers: #plasma_on_wayland, #kwin, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2003
This commit is contained in:
Martin Gräßlin 2016-06-25 14:47:41 +02:00
parent c240755dee
commit b487da02cd

View file

@ -419,6 +419,16 @@ static void disablePtrace()
}
static void unsetDumpable(int sig)
{
#if HAVE_PR_SET_DUMPABLE
prctl(PR_SET_DUMPABLE, 1);
#endif
signal(sig, SIG_IGN);
raise(sig);
return;
}
} // namespace
int main(int argc, char * argv[])
@ -433,6 +443,8 @@ int main(int argc, char * argv[])
signal(SIGINT, SIG_IGN);
if (signal(SIGHUP, KWin::sighandler) == SIG_IGN)
signal(SIGHUP, SIG_IGN);
signal(SIGABRT, KWin::unsetDumpable);
signal(SIGSEGV, KWin::unsetDumpable);
// ensure that no thread takes SIGUSR
sigset_t userSignals;
sigemptyset(&userSignals);