RE: [RFC PATCH V2 09/12] fs: Prevent mode change if file is mmap'ed

From: David Laight
Date: Wed Jan 15 2020 - 05:21:50 EST


>From ira.weiny@xxxxxxxxx
> Sent: 10 January 2020 19:30
>
> Page faults need to ensure the inode mode is correct and consistent with
> the vmf information at the time of the fault. There is no easy way to
> ensure the vmf information is correct if a mode change is in progress.
> Furthermore, there is no good use case to require a mode change while
> the file is mmap'ed.
>
> Track mmap's of the file and fail the mode change if the file is
> mmap'ed.

This seems wrong to me.
I presume the 'mode changes' are from things like 'chmod -w ...'.
mmap() should be no different to open().
Only the permissions set when the file is opened count.

Next you'll be stopping unlink() when a file is open :-)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)