]> git.baikalelectronics.ru Git - kernel.git/commit
mm: Force TLB flush for PFNMAP mappings before unlink_file_vma()
authorJann Horn <jannh@google.com>
Wed, 31 Aug 2022 19:13:48 +0000 (21:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Sep 2022 08:27:44 +0000 (10:27 +0200)
commit169c00c374a8e2191287fd6c59b510ef5e1db726
treeed52fbf729bfd3de4a161a814a24ec5c567fd8c0
parentd5646a3e1c6a139ea6e541a2515615b73644c7d5
mm: Force TLB flush for PFNMAP mappings before unlink_file_vma()

commit ab18087539e86d86b6801486106a2e1ea8afecb3 upstream.

Some drivers rely on having all VMAs through which a PFN might be
accessible listed in the rmap for correctness.
However, on X86, it was possible for a VMA with stale TLB entries
to not be listed in the rmap.

This was fixed in mainline with
commit ab18087539e8 ("mmu_gather: Force tlb-flush VM_PFNMAP vmas"),
but that commit relies on preceding refactoring in
commit 35167b29df348 ("mmu_gather: Let there be one tlb_{start,end}_vma()
implementation") and commit a31d3b9463867 ("mmu_gather: Remove per arch
tlb_{start,end}_vma()").

This patch provides equivalent protection without needing that
refactoring, by forcing a TLB flush between removing PTEs in
unmap_vmas() and the call to unlink_file_vma() in free_pgtables().

[This is a stable-specific rewrite of the upstream commit!]
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/mmap.c