stop using mmap for zip I/O

Christos Zoulas christos at zoulas.com
Fri Feb 27 14:14:42 UTC 2015


On Feb 27,  1:49pm, aph at redhat.com (Andrew Haley) wrote:
-- Subject: Re: stop using mmap for zip I/O

| > The issues I've been looking at are SEGV issues concerning multiple threads
| > operating on the same zip structure. (one freeing, while another is 
| > attempting access)

Yes, I am not referring to the SEGV's from concurrent access or unchecked
buffer limits from corrupt entries in the central directory. These are much
more complicated to fix.

| The issue Christos is referring to is probably the bus error you get
| when a buffer is unmapped.  This is what I was referring to as well.

Yes, but the cause is not the buffer being unmapped. It is because the
buffer gets truncated:

    http://pubs.opengroup.org/onlinepubs/009695399/functions/mmap.html

    "References within the address range starting at pa and continuing
     for len bytes to whole pages following the end of an object shall
     result in delivery of a SIGBUS signal."

Which is what my example program and the bug report I referenced demonstrate.

| Recovering from a crash caused by one thread modifying a structure
| while another reads it is much harder; my apologies, I misunderstood
| you.

Absolutely, I was just advocating turning mmap off since it fixes the
simple case of someone overwriting the zip file loaded which is quite
common.

christos



More information about the core-libs-dev mailing list