ANDROID: mm: preserve vma->anon_vma after MREMAP_DONTUNMAP for SPF
The optimizations [1] and [2] to reset vma->anon_vma during MREMAP_DONTUNMAP can affect speculative page fault handler. If vma->anon_vma reset happens after do_anonymous_page verified no changes to the vma and obtained the ptl lock but before it calls page_add_new_anon_rmap() then __page_set_anon_rmap() will stumble on BUG_ON(!anon_vma). Disable these optimizations if SPF is enabled to avoid such situations. As a result the reverse map walk will consider the old VMA as it did before these optimizations were introduced. [1] 1583aa27 ("mm: mremap: unlink anon_vmas when mremap with MREMAP_DONTUNMAP success") [2] ee8ab190 ("mm: rmap: explicitly reset vma->anon_vma in unlink_anon_vmas()") Bug: 257443051 Change-Id: I4e7611137f4a49c94bfe73532b4b06cbb0d2405b Signed-off-by:Suren Baghdasaryan <surenb@google.com> Signed-off-by:
Lee Jones <joneslee@google.com>
Loading
Please sign in to comment