xtensa: flush TLB entries for pages of non-current mm correctly
authorMax Filippov <jcmvbkbc@gmail.com>
Wed, 15 May 2013 15:02:06 +0000 (19:02 +0400)
committerChris Zankel <chris@zankel.net>
Wed, 5 Jun 2013 17:14:19 +0000 (10:14 -0700)
commit87962c4db7f594c377d8b0b5a5f563e5f0b5d5d0
treeede110ec898b37350d60af1e66c4b0b7ddbe7ce8
parent51fc41a90603eaee7b6d03b6027be8f22fcf8ef9
xtensa: flush TLB entries for pages of non-current mm correctly

Sometimes under high memory pressure one process gets a page of another
process, which manifests itself with an invalid instruction exception.

This happens because flush_tlb_page fails to clear TLB entries when
called with vma that does not belong to current mm, because it does not
set RASID appropriately. When page reclaiming mechanism swaps physical
pages out replacing their PTEs with none or swap PTEs, it calls
flush_tlb_page. Later physical page may be reused elsewhere, but the
stale TLB mapping still refers to it, allowing process that owned the
mapping to see the new state of that physical page.

Put ASID of the mm that owns vma to the RASID to fix that issue.
Also replace otherwise meaningless local_save_flags with local_irq_save.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
arch/xtensa/mm/tlb.c