Re: mremap() use is racy

From: Ulrich Drepper
Date: Tue Aug 23 2005 - 17:09:39 EST


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.

--
â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â

Attachment: signature.asc
Description: OpenPGP digital signature