From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stas Sergeev Subject: Re: Crashes if running WordPerfect 5.1 Date: Tue, 01 Jun 2004 08:25:18 +0400 Sender: linux-msdos-owner@vger.kernel.org Message-ID: <40BC052E.4030402@aknet.ru> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: List-Id: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: linux-msdos@vger.kernel.org Hello. Bart Oldeman wrote: > mremap is behaving consistently (i.e. if you mmap bytes 4096-8191 of a > file with size 4000 you can't expect that file to be extended to 8192 > bytes, the same is true for shm virtual files. I just think kernel must hide that things from userspace and resolve them internally. "man mmap" says: --- MAP_ANONYMOUS The mapping is not backed by any file --- So there should be no considerations about a file resizing on a userspace. For userspace it must behave as if there is no file involved, otherwise it contradicts with docs I think. What I was thinking about a cheap work around, is probably to allocate the new region the way your hack does, but then, instead of memcpy(), still use mremap() MREMAP_FIXED to remap the old region to the beginning of the new one. This will preserve the aliases, but will probably not work reliably... at least that looks extremely risky to do.