[6.0] 9bf03910b Handle sigbus like sigsegv

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:53:06 UTC 2018


commit 9bf03910bf1a10d6a186427dfbd689e68e8502f4
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Jun 4 14:01:15 2018 +0200

    Handle sigbus like sigsegv
    
    For the purpose of our signal handler (and, in particular, the stack
    overflow detection heuristic) they are identical.
    
    Fixes #2695 (as confirmed by @lkarsten)

diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index c77cca91b..8262e1e5e 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -243,9 +243,10 @@ child_signal_handler(int s, siginfo_t *si, void *c)
 	memset(&sa, 0, sizeof sa);
 	sa.sa_handler = SIG_DFL;
 	(void)sigaction(SIGSEGV, &sa, NULL);
+	(void)sigaction(SIGBUS, &sa, NULL);
 	(void)sigaction(SIGABRT, &sa, NULL);
 
-	while (s == SIGSEGV) {
+	while (s == SIGSEGV || s == SIGBUS) {
 		req = THR_GetRequest();
 		if (req == NULL || req->wrk == NULL)
 			break;
diff --git a/bin/varnishtest/tests/c00057.vtc b/bin/varnishtest/tests/c00057.vtc
index f33a8bde6..09a9c1cd0 100644
--- a/bin/varnishtest/tests/c00057.vtc
+++ b/bin/varnishtest/tests/c00057.vtc
@@ -76,7 +76,7 @@ client c2 -connect ${v2_sock} {
 	expect_close
 } -run
 
-varnish v2 -cliexpect "Segmentation [fF]ault" "panic.show"
+varnish v2 -cliexpect "[bB]us error|Segmentation [fF]ault" "panic.show"
 
 varnish v2 -cliok "panic.clear"
 


More information about the varnish-commit mailing list