lkml.org 
[lkml]   [2005]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: mremap() use is racy
On Tue, 23 Aug 2005, Ulrich Drepper wrote:
> Linus Torvalds wrote:
> > Actually, it should be pretty much as valid as using mremap - ie it works
> > on Linux.
> >
> > Especially if you use MAP_SHARED, you don't even need to mprotect
> > anything: you'll get a nice SIGBUS if you ever try to access past the last
> > page that maps the file.
>
> If you guarantee this (and test for this) it's fine with me. The POSIX
> spec explicitly leaves this undefined and requiring to use mremap()
> would be a nice way to work around this without allowing the
> introduction of undefined behavior into programs. I probably would
> prefer to use mremap() since this makes it clear what should happen but
> I can live with using the too-large mapping.

I don't have spec to hand to quote, but at least 10 years ago the SIGBUS
beyond end of file was required behaviour, on both MAP_SHARED and more
surprisingly MAP_PRIVATE mappings of a file. Well, you don't get SIGBUS
on any part of the page that covers the end of the file: perhaps what
you read as undefined in the spec is addressing that tail page issue.

We guarantee it: it's a kernel bug if it doesn't work.

Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-24 01:47    [W:0.795 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site