xtensa: fix TLB sanity checker
authorMax Filippov <jcmvbkbc@gmail.com>
Wed, 13 Nov 2019 21:18:31 +0000 (13:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 21 Dec 2019 09:47:43 +0000 (10:47 +0100)
commit9d9ee2b7b643c5fa208cc4094cbbe27bee93d5bb
treeecfc28059a25a3bf3307f054a50a840144a9636f
parent2da0e66be5f906e0ffc13f8af80d78de9cde5988
xtensa: fix TLB sanity checker

commit 36de10c4788efc6efe6ff9aa10d38cb7eea4c818 upstream.

Virtual and translated addresses retrieved by the xtensa TLB sanity
checker must be consistent, i.e. correspond to the same state of the
checked TLB entry. KASAN shadow memory is mapped dynamically using
auto-refill TLB entries and thus may change TLB state between the
virtual and translated address retrieval, resulting in false TLB
insanity report.
Move read_xtlb_translation close to read_xtlb_virtual to make sure that
read values are consistent.

Cc: stable@vger.kernel.org
Fixes: a99e07ee5e88 ("xtensa: check TLB sanity on return to userspace")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/xtensa/mm/tlb.c