lkml.org 
[lkml]   [2008]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mmap: is default non-populating behavior stable?
On Tue, 04 Nov 2008 17:07:00 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> On Tue, 2008-11-04 at 09:56 -0600, Chris Friesen wrote:
> > Rik van Riel wrote:
> > > Peter Zijlstra wrote:
> >
> > >> The exact interaction of mmap() and truncate() I'm not exactly clear on.
> > >
> > > Truncate will reduce the size of the mmaps on the file to
> > > match the new file size, so processes accessing beyond the
> > > end of file will get a segmentation fault (SIGSEGV).
> >
> > I suspect Peter was talking about using truncate() to set the initial
> > file size, effectively increasing rather than reducing it.
>
> I was thinking of truncate() on an already mmap()'ed region, either
> increasing or decreasing the size so that part of the mmap becomes
> (in)valid.
>
> I'm not sure how POSIX speaks of this.
>
> I think Linux does the expected thing.

I believe our behaviour is correct for mmap/mumap/truncate and it
certainly used to be and was tested.

At the point you do anything involving mremap (which is non posix) our
behaviour becomes rather bizarre.

Alan


\
 
 \ /
  Last update: 2008-11-04 17:31    [W:0.056 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site