Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C56741C695 for ; Sat, 18 Apr 2026 07:47:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776498452; cv=none; b=GIcnO5xiCWbi6001DrlAOangp9OpAtF22gtiiGOyHzkhvCUfeVcf1EIq3GsHpnAYEmIBAHyxZNwOL8cNh+4pargQL1NIl6d8gXos9GmGW7HbW2vT/5YzDT12b+rKzlaxtEciAn+qIlKjnlcj1oUe7g9gmCmXsnb5R1y7H3VI9NY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776498452; c=relaxed/simple; bh=+WqKsb3tU/xAPJ6v6ZerXg9u05tC6gcyWnt+NVOR/q0=; h=Date:To:From:Subject:Message-Id; b=HE8FYnHAZvgYtyHoA+6evmqKZjckGN6y8u3xCn6oqffLXNN5nAcBwVE+NP9XP1RR+0RxwONooDAFSQ26AVUVl2UKqvE6fY/wDap8kwPwU4uIU7IYwZukQHv8k+5zkHfWUMO/TA3QPAQts1CXjpBOOf4VeheYibOMBrZ753qlmf0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=mkA60M3R; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="mkA60M3R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18D92C19424; Sat, 18 Apr 2026 07:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1776498452; bh=+WqKsb3tU/xAPJ6v6ZerXg9u05tC6gcyWnt+NVOR/q0=; h=Date:To:From:Subject:From; b=mkA60M3R5aQK8VHstvdBLq+80VChwNsx2X+nN+0cBXxe4Gd70p/ESws7dbfN9cYw0 85qVHYNonETlv2GJv3TdKYdZx2VEdj+UoEIp8eaBR3wMy5jTH3eilVkBK3JwgxRs6P hFz0bV9A5LLY2aVvgZtErAcYOgYcefvCftFMVM/8= Date: Sat, 18 Apr 2026 00:47:25 -0700 To: mm-commits@vger.kernel.org,viro@zeniv.linux.org.uk,vbabka@kernel.org,surenb@google.com,shinichiro.kawasaki@wdc.com,rppt@kernel.org,mhocko@suse.com,liam.howlett@oracle.com,jack@suse.cz,david@kernel.org,brauner@kernel.org,ljs@kernel.org,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-stable] mm-vma-remove-__vma_check_mmap_hook.patch removed from -mm tree Message-Id: <20260418074731.18D92C19424@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: mm/vma: remove __vma_check_mmap_hook() has been removed from the -mm tree. Its filename was mm-vma-remove-__vma_check_mmap_hook.patch This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Lorenzo Stoakes Subject: mm/vma: remove __vma_check_mmap_hook() Date: Mon, 13 Apr 2026 11:57:13 +0100 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. Link: https://lore.kernel.org/20260413105713.92625-1-ljs@kernel.org Fixes: c50ca15dd496 ("mm: add vm_ops->mapped hook") Reported-by: Shinichiro Kawasaki Closes: https://lore.kernel.org/all/adx2ws5z0NMIe5Yj@shinmob/ Signed-off-by: Lorenzo Stoakes Acked-by: Vlastimil Babka (SUSE) Tested-by: Shinichiro Kawasaki Cc: Al Viro Cc: Christian Brauner Cc: David Hildenbrand Cc: Jan Kara Cc: Liam Howlett Cc: Michal Hocko Cc: Mike Rapoport Cc: Suren Baghdasaryan Signed-off-by: Andrew Morton --- include/linux/fs.h | 9 +-------- mm/util.c | 10 ---------- 2 files changed, 1 insertion(+), 18 deletions(-) --- a/include/linux/fs.h~mm-vma-remove-__vma_check_mmap_hook +++ a/include/linux/fs.h @@ -2062,20 +2062,13 @@ void compat_set_desc_from_vma(struct vm_ const struct vm_area_struct *vma); int __compat_vma_mmap(struct vm_area_desc *desc, struct vm_area_struct *vma); int compat_vma_mmap(struct file *file, struct vm_area_struct *vma); -int __vma_check_mmap_hook(struct vm_area_struct *vma); static inline int vfs_mmap(struct file *file, struct vm_area_struct *vma) { - int err; - if (file->f_op->mmap_prepare) return compat_vma_mmap(file, vma); - err = file->f_op->mmap(file, vma); - if (err) - return err; - - return __vma_check_mmap_hook(vma); + return file->f_op->mmap(file, vma); } static inline int vfs_mmap_prepare(struct file *file, struct vm_area_desc *desc) --- a/mm/util.c~mm-vma-remove-__vma_check_mmap_hook +++ a/mm/util.c @@ -1281,16 +1281,6 @@ int compat_vma_mmap(struct file *file, s } EXPORT_SYMBOL(compat_vma_mmap); -int __vma_check_mmap_hook(struct vm_area_struct *vma) -{ - /* vm_ops->mapped is not valid if mmap() is specified. */ - if (vma->vm_ops && WARN_ON_ONCE(vma->vm_ops->mapped)) - return -EINVAL; - - return 0; -} -EXPORT_SYMBOL(__vma_check_mmap_hook); - static void set_ps_flags(struct page_snapshot *ps, const struct folio *folio, const struct page *page) { _ Patches currently in -mm which might be from ljs@kernel.org are