Re: [PATCH mm-hotfixes] mm/vma: remove __vma_check_mmap_hook()
From: Lorenzo Stoakes
Date: Mon Apr 13 2026 - 10:03:13 EST
On Mon, Apr 13, 2026 at 12:28:46PM +0000, Shinichiro Kawasaki wrote:
> On Apr 13, 2026 / 11:57, Lorenzo Stoakes wrote:
> > Commit c50ca15dd496 ("mm: add vm_ops->mapped hook") introduced
> > __vma_check_mmap_hook() in order to assert that a driver doesn't
> > incorrectly implement both an f_op->mmap() and a vm_ops->mapped hook, the
> > latter of which would not ultimately get invoked.
> >
> > However, this did not correctly account for stacked drivers (or drivers
> > that otherwise use the compatibility layer) which might recursively call
> > an mmap_prepare hook via the compatibility layer.
> >
> > Thus the nested mmap_prepare() invocation might result in a VMA which has
> > vm_ops->mapped set with an overlaying mmap() hook, causing the
> > __vma_check_mmap_hook() to fail in vfs_mmap(), wrongly failing the
> > operation.
> >
> > This patch resolves this by simply removing the check, as we can't be
> > certain that an mmap() hook doesn't at some point invoke the compatibility
> > layer, and it's not worth trying to track it.
> >
> > Fixes: c50ca15dd496 ("mm: add vm_ops->mapped hook")
> > Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
> > Closes: https://lore.kernel.org/all/adx2ws5z0NMIe5Yj@shinmob/
> > Signed-off-by: Lorenzo Stoakes <ljs@xxxxxxxxxx>
>
> Lorenzo, thank you for the swift fix. I applied this patch on top of the
> next-20260410 kernel, and confirmed the failure disappeared. Good.
>
> Tested-by: Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
Thanks! :)
Cheers, Lorenzo