[3.11.y.z extended stable] Patch "sparc64: Do not insert non-valid PTEs into the TSB hash table." has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Mon Aug 18 09:23:28 UTC 2014


This is a note to let you know that I have just added a patch titled

    sparc64: Do not insert non-valid PTEs into the TSB hash table.

to the linux-3.11.y-queue branch of the 3.11.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.11.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

>From da242588a11cd4f971f0241ba8ffaff8bd6f8d17 Mon Sep 17 00:00:00 2001
From: "David S. Miller" <davem at davemloft.net>
Date: Mon, 4 Aug 2014 16:34:01 -0700
Subject: sparc64: Do not insert non-valid PTEs into the TSB hash table.

commit 18f38132528c3e603c66ea464727b29e9bbcb91b upstream.

The assumption was that update_mmu_cache() (and the equivalent for PMDs) would
only be called when the PTE being installed will be accessible by the user.

This is not true for code paths originating from remove_migration_pte().

There are dire consequences for placing a non-valid PTE into the TSB.  The TLB
miss frramework assumes thatwhen a TSB entry matches we can just load it into
the TLB and return from the TLB miss trap.

So if a non-valid PTE is in there, we will deadlock taking the TLB miss over
and over, never satisfying the miss.

Just exit early from update_mmu_cache() and friends in this situation.

Based upon a report and patch from Christopher Alexander Tobias Schulze.

Signed-off-by: David S. Miller <davem at davemloft.net>
[ luis: backported to 3.11: used davem's backport to 3.10 and 3.12 ]
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
---
 arch/sparc/mm/init_64.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index ed82edad1a39..774ba41dba4d 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -350,6 +350,10 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *

 	mm = vma->vm_mm;

+	/* Don't insert a non-valid PTE into the TSB, we'll deadlock.  */
+	if (!pte_accessible(mm, pte))
+		return;
+
 	spin_lock_irqsave(&mm->context.lock, flags);

 #if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
--
1.9.1





More information about the kernel-team mailing list