]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.103/sparc64-do-not-insert-non-valid-ptes-into-the-tsb-hash-table.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.103 / sparc64-do-not-insert-non-valid-ptes-into-the-tsb-hash-table.patch
1 From foo@baz Thu Aug 7 22:33:35 PDT 2014
2 From: "David S. Miller" <davem@davemloft.net>
3 Date: Mon, 4 Aug 2014 16:34:01 -0700
4 Subject: sparc64: Do not insert non-valid PTEs into the TSB hash table.
5
6 From: "David S. Miller" <davem@davemloft.net>
7
8 [ Upstream commit 18f38132528c3e603c66ea464727b29e9bbcb91b ]
9
10 The assumption was that update_mmu_cache() (and the equivalent for PMDs) would
11 only be called when the PTE being installed will be accessible by the user.
12
13 This is not true for code paths originating from remove_migration_pte().
14
15 There are dire consequences for placing a non-valid PTE into the TSB. The TLB
16 miss frramework assumes thatwhen a TSB entry matches we can just load it into
17 the TLB and return from the TLB miss trap.
18
19 So if a non-valid PTE is in there, we will deadlock taking the TLB miss over
20 and over, never satisfying the miss.
21
22 Just exit early from update_mmu_cache() and friends in this situation.
23
24 Based upon a report and patch from Christopher Alexander Tobias Schulze.
25
26 Signed-off-by: David S. Miller <davem@davemloft.net>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28 ---
29 arch/sparc/mm/init_64.c | 4 ++++
30 1 file changed, 4 insertions(+)
31
32 --- a/arch/sparc/mm/init_64.c
33 +++ b/arch/sparc/mm/init_64.c
34 @@ -308,6 +308,10 @@ void update_mmu_cache(struct vm_area_str
35 tsb_index = MM_TSB_BASE;
36 tsb_hash_shift = PAGE_SHIFT;
37
38 + /* Don't insert a non-valid PTE into the TSB, we'll deadlock. */
39 + if (!(pte_val(pte) & _PAGE_VALID))
40 + return;
41 +
42 spin_lock_irqsave(&mm->context.lock, flags);
43
44 #ifdef CONFIG_HUGETLB_PAGE