
varnish-bugs at varnish-cache
Jul 15, 2011, 4:02 AM
Post #1 of 3
(268 views)
Permalink
|
|
#962: Persistent storage don't work on Linux with Address space layout randomization
|
|
#962: Persistent storage don't work on Linux with Address space layout randomization ---------------------+------------------------------------------------------ Reporter: pmialon | Type: defect Status: new | Priority: normal Milestone: | Component: build Version: 3.0.0 | Severity: normal Keywords: | ---------------------+------------------------------------------------------ Debian Squeeze, Fedora 15 and RHEL 6 uses Adress space layout randomization by default: {{{ # sysctl kernel.randomize_va_space kernel.randomize_va_space = 2 }}} This breaks persistent storage: {{{ # varnishd -d -a :80 -f /etc/varnish/default.vcl -s persistent,/var/lib/varnish/instance/A.shm,10M ... CHK(0x7fbfcc1330a0 SILO 0x7fbfcb0e1000 SILO) = 3 ... Platform: Linux,2.6.32-5-amd64,x86_64,-spersistent,-smalloc,-hcritbit ... }}} By disabling ASLR (sysctl kernel.randomize_va_space=0), it works again. In source:bin/varnishd/storage_persistent_mgt.c, smp_mgt_init(): {{{ sc->base = mmap(NULL, sc->mediasize, PROT_READ|PROT_WRITE, MAP_NOCORE | MAP_NOSYNC | MAP_SHARED, sc->fd, 0); ... smp_def_sign(sc, &sc->idn, 0, "SILO"); ... i = smp_valid_silo(sc); }}} mmap(2) may return a random address. This address is stored in sc->idn->ss and written to the mmap()'d file in smp_reset_sign(): {{{ ctx->ss->mapped = (uintptr_t)ctx->ss; }}} This is ok with the very first run because the file is created and the mmap address stored. But with following run, smp_valid_silo() calls smp_chk_sign() (source:bin/varnishd/storage_persistent_subr.c) which compares addresses from mmap(2) and the file: {{{ if ((uintptr_t)ctx->ss != ctx->ss->mapped) r = 3 }}} This causes the silo to be reset. -- Ticket URL: <http://www.varnish-cache.org/trac/ticket/962> Varnish <http://varnish-cache.org/> The Varnish HTTP Accelerator _______________________________________________ varnish-bugs mailing list varnish-bugs [at] varnish-cache https://www.varnish-cache.org/lists/mailman/listinfo/varnish-bugs
|