[4.0] db1185d Restore the default SIGSEGV handler during pan_ic
Lasse Karstensen
lkarsten at varnish-software.com
Thu Jan 15 16:35:42 CET 2015
commit db1185dc3ee1adee6deb0b2b65bdb9b615395504
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Dec 1 09:28:54 2014 +0100
Restore the default SIGSEGV handler during pan_ic
Leaving it enabled could hide panics.
Fixes #1639
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index c179736..67ba4cf 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <signal.h>
#include "cache.h"
#include "common/heritage.h"
@@ -429,10 +430,21 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
const char *q;
struct req *req;
struct busyobj *bo;
+ struct sigaction sa;
AZ(pthread_mutex_lock(&panicstr_mtx)); /* Won't be released,
we're going to die
anyway */
+
+ /*
+ * should we trigger a SIGSEGV while handling a panic, our sigsegv
+ * handler would hide the panic, so we need to reset the handler to
+ * default
+ */
+ memset(&sa, 0, sizeof sa);
+ sa.sa_handler = SIG_DFL;
+ (void)sigaction(SIGSEGV, &sa, NULL);
+
switch(kind) {
case VAS_WRONG:
VSB_printf(pan_vsp,
More information about the varnish-commit
mailing list