The patch titled Subject: mm: perform the mapping_map_writable() check after call_mmap() has been added to the -mm mm-unstable branch. Its filename is mm-perform-the-mapping_map_writable-check-after-call_mmap-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-perform-the-mapping_map_writable-check-after-call_mmap-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Lorenzo Stoakes <lstoakes@xxxxxxxxx> Subject: mm: perform the mapping_map_writable() check after call_mmap() Date: Mon, 16 Oct 2023 17:17:13 +0100 Do not set writable_file_mapping in an instance where it is not appropriate to do so. Link: https://lkml.kernel.org/r/c9eb4cc6-7db4-4c2b-838d-43a0b319a4f0@lucifer.local Signed-off-by: Lorenzo Stoakes <lstoakes@xxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Andy Lutomirski <luto@xxxxxxxxxx> Cc: Christian Brauner <brauner@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Jan Kara <jack@xxxxxxx> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Muchun Song <muchun.song@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/mmap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/mm/mmap.c~mm-perform-the-mapping_map_writable-check-after-call_mmap-fix +++ a/mm/mmap.c @@ -2923,10 +2923,8 @@ cannot_expand: mm->map_count++; if (vma->vm_file) { i_mmap_lock_write(vma->vm_file->f_mapping); - if (vma_is_shared_maywrite(vma)) { + if (vma_is_shared_maywrite(vma)) mapping_allow_writable(vma->vm_file->f_mapping); - writable_file_mapping = true; - } flush_dcache_mmap_lock(vma->vm_file->f_mapping); vma_interval_tree_insert(vma, &vma->vm_file->f_mapping->i_mmap); _ Patches currently in -mm which might be from lstoakes@xxxxxxxxx are mm-filemap-clarify-filemap_fault-comments-for-not-uptodate-case.patch mm-filemap-clarify-filemap_fault-comments-for-not-uptodate-case-fix.patch mm-make-__access_remote_vm-static.patch mm-gup-explicitly-define-and-check-internal-gup-flags-disallow-foll_touch.patch mm-gup-make-failure-to-pin-an-error-if-foll_nowait-not-specified.patch mm-gup-adapt-get_user_page_vma_remote-to-never-return-null.patch mm-mprotect-allow-unfaulted-vmas-to-be-unaccounted-on-mprotect.patch mm-move-vma_policy-and-anon_vma_name-decls-to-mm_typesh.patch mm-abstract-the-vma_merge-split_vma-pattern-for-mprotect-et-al.patch mm-make-vma_merge-and-split_vma-internal.patch mm-abstract-merge-for-new-vmas-into-vma_merge_new_vma.patch mm-abstract-vma-merge-and-extend-into-vma_merge_extend-helper.patch mm-drop-the-assumption-that-vm_shared-always-implies-writable.patch mm-update-memfd-seal-write-check-to-include-f_seal_write.patch mm-perform-the-mapping_map_writable-check-after-call_mmap.patch mm-perform-the-mapping_map_writable-check-after-call_mmap-fix.patch