Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Bugs

#962: Persistent storage don't work on Linux with Address space layout randomization

 

 

Varnish bugs RSS feed   Index | Next | Previous | View Threaded


varnish-bugs at varnish-cache

Jul 15, 2011, 4:02 AM

Post #1 of 4 (380 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


varnish-bugs at varnish-cache

Jul 18, 2011, 3:29 AM

Post #2 of 4 (381 views)
Permalink
Re: #962: Persistent storage don't work on Linux with Address space layout randomization [In reply to]

#962: Persistent storage don't work on Linux with Address space layout
randomization
----------------------+-----------------------------------------------------
Reporter: pmialon | Owner: phk
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishd | Version: 3.0.0
Severity: normal | Keywords:
----------------------+-----------------------------------------------------
Changes (by phk):

* owner: => phk
* component: build => varnishd


Comment:

I need to add some code which attempts to remap to right address for this
(and other cases)

--
Ticket URL: <http://varnish-cache.org/trac/ticket/962#comment:1>
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


varnish-bugs at varnish-cache

Aug 11, 2011, 7:12 AM

Post #3 of 4 (324 views)
Permalink
Re: #962: Persistent storage don't work on Linux with Address space layout randomization [In reply to]

#962: Persistent storage don't work on Linux with Address space layout
randomization
----------------------+-----------------------------------------------------
Reporter: pmialon | Owner: phk
Type: defect | Status: closed
Priority: normal | Milestone:
Component: varnishd | Version: 3.0.0
Severity: normal | Resolution: fixed
Keywords: |
----------------------+-----------------------------------------------------
Changes (by Poul-Henning Kamp <phk@…>):

* status: new => closed
* resolution: => fixed


Comment:

(In [e8a63f4d5e687cf3a04d34f696c661446d6c8d25]) Try to read the silo
signature to find the correct address to map
the silo into VM. If this fails or we get garbage, the silo will
be cleared.

Fixes #962

--
Ticket URL: </ticket/962#comment:2>
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


varnish-bugs at varnish-cache

Apr 22, 2014, 2:22 PM

Post #4 of 4 (76 views)
Permalink
Re: #962: Persistent storage don't work on Linux with Address space layout randomization [In reply to]

#962: Persistent storage don't work on Linux with Address space layout
randomization
----------------------+---------------------
Reporter: pmialon | Owner: phk
Type: defect | Status: closed
Priority: normal | Milestone:
Component: varnishd | Version: 3.0.0
Severity: normal | Resolution: fixed
Keywords: |
----------------------+---------------------

Comment (by keretamalam):

I am about to leave and cannot look into this further right now, but I do
want to mention that relying on pkg-config itself is not a problem (as you
said, we also use it later), the problem is that on some systems, the .pc
file for pkg-config is supplying wrong information (whereas on yours, it's
botan-config that is wrong), so that's why I'm trying to make it work with
both (while one of them is bad).
[http://maskodoq.blogspot.com/2014/03/unit-link-terbaik-di-indonesia.html
Unit Link Terbaik di Indonesia Commonwealth Life Investra Link]
[http://maskodoq.blogspot.com/2013/07/CiptoJunaedy.html Cipto Junaedy]
[http://etnisjawa.blogspot.com/2013/08/apakah-cipto-junaedy-bohong.html
Cipto Junaedy]

--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/962#comment:3>
Varnish <https://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

Varnish bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.