> For ordinary files the only way the VMA_MAYWRITE_BIT flag is cleared is if
> the underlying file is itself read-only.
> 
> This means that mprotect() cannot mark a shared mapping of a read-only file
> as read/write, as doing so would violate the read only attribute, and
> permit writes.
> 
> In general, we do not want file systems to be able to do this for
> read/write files.
> 
> Doing so would violate fundamental user expectation of file attributes and
> likely break userspace.
> 
> However, drivers pose a tricky problem here - the /dev/xxx file may be
> read/write but provide access to a resource which is fundamentally
> [ ... ]
> As no driver which clears VMA_MAYWRITE_BIT establishes an mm-managed
> mapping, no functional change is intended.
> 
> Acked-by: Zi Yan <[email protected]>
> Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/20261003-b4-mmap-prepare-vma-flag-sanify-v4-0-a1f052500...@kernel.org?part=15


Reply via email to