Subject: Re: loaning for read() of regular files
To: Jason Thorpe <thorpej@shagadelic.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 02/16/2005 09:37:08
On Wed, Feb 16, 2005 at 09:31:49AM -0800, Jason Thorpe wrote:
> 
> On Feb 16, 2005, at 9:15 AM, Chuck Silvers wrote:
> 
> >solaris and the BSDs do not allow access to a file past EOF via 
> >mappings,
> >they generate signals (SIGBUS or SIGSEGV, depending on the 
> >implementation).
> 
> They generate signals if the access is regular access.  But if the 
> mmap'd-past-EOF area is pass as a buffer to e.g. write(), then we 
> correctly return EFAULT.

sure, but from the comment in rsync, the issue they were concerned with
was reading from a mapping and racing with some other process truncating
the file, so that a mapping they thought was within the file size ends up
being past EOF, generating a signal they would have to handle somehow.
I believe that this signal-generating race exists on solaris and *BSD but
possibly not on linux.

-Chuck