Re: mremap() use is racy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 23 Aug 2005, Ulrich Drepper wrote:
> 
> Using mmap with a too-large size for the underlying file and then hoping
> that future file growth is magically handled when those pages are
> accessed is not valid.

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.

I think that works correctly for any half-way modern kernel - anything 
that has mremap() should do the right thing (I think older kernels would 
map zero pages past the end of the file mapping, and then if you touched 
the page first, you'd lose the coherency).

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux