[4.0] f4b2cb9 Remove assert in shared memory

Martin Blix Grydeland martin at varnish-software.com
Thu Mar 10 17:47:04 CET 2016


commit f4b2cb9c29052bab1b55afb53555ee2e46732229
Author: Pål Hermunn Johansen <hermunn at varnish-software.com>
Date:   Tue Mar 8 16:14:08 2016 +0100

    Remove assert in shared memory
    
    Even though the shared memory log should always have only one writer,
    the varnish process, this is not enforced by the kernel through access
    rights. For this reason, the line
    
         assert(b->vsc->vcls > 0);
    
    could crash Varnish if a process decided to write to the shared memory
    log. Now this bad behavior will just affect other readers of the
    shared memory log, and not the varnish process itself.

diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c
index 5b122d0..7173dd4 100644
--- a/bin/varnishd/cache/cache_backend_cfg.c
+++ b/bin/varnishd/cache/cache_backend_cfg.c
@@ -138,7 +138,6 @@ VBE_DropRefVcl(struct backend *b)
 
 	ASSERT_CLI();
 	Lck_Lock(&b->mtx);
-	assert(b->vsc->vcls > 0);
 	b->vsc->vcls--;
 	VBE_DropRefLocked(b, NULL);
 }



More information about the varnish-commit mailing list