> When the f_op->mmap_prepare or deprecated f_op->mmap hooks are invoked, the > driver might have done something crazy that is not permitted by the kernel. > > Currently we check for three such cases in __mmap_new_file_vma(), but only > if the legacy f_op->mmap hook is used: > > * Did sparc ADI result in invalid flags? > > * Did the driver alter vma->vm_start? > > * Did the driver make a file-backed mapping on a read-only file writable? > > Generalise these checks for both mmap_prepare and mmap and apply to all > invocations of mmap_file(), the f_op->mmap and f_op->mmap_prepare handling > in the core VMA code and the mmap_prepare compatibility layer. > [ ... ] > > Reviewed-by: Gregory Price (Meta) <[email protected]> > Reviewed-by: Zi Yan <[email protected]> > Reviewed-by: Suren Baghdasaryan <[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=3
