stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: [PATCH 3.15 20/26] sparc64: Do not insert non-valid PTEs into the TSB hash table.
Date: Fri,  8 Aug 2014 14:35:27 -0700	[thread overview]
Message-ID: <20140808213414.508845392@linuxfoundation.org> (raw)
In-Reply-To: <20140808213413.648794968@linuxfoundation.org>

3.15-stable review patch.  If anyone has any objections, please let me know.

------------------

From: "David S. Miller" <davem@davemloft.net>

[ Upstream commit 18f38132528c3e603c66ea464727b29e9bbcb91b ]

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@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/sparc/mm/init_64.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- 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_str
 
 	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)
@@ -2614,6 +2618,10 @@ void update_mmu_cache_pmd(struct vm_area
 
 	pte = pmd_val(entry);
 
+	/* Don't insert a non-valid PMD into the TSB, we'll deadlock.  */
+	if (!(pte & _PAGE_VALID))
+		return;
+
 	/* We are fabricating 8MB pages using 4MB real hw pages.  */
 	pte |= (addr & (1UL << REAL_HPAGE_SHIFT));
 



  parent reply	other threads:[~2014-08-08 21:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 21:35 [PATCH 3.15 00/26] 3.15.10-stable review Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 01/26] net: bcmgenet: correctly pad short packets Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 02/26] xfrm: Fix refcount imbalance in xfrm_lookup Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 03/26] xfrm: Fix installation of AH IPsec SAs Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 04/26] bnx2x: fix crash during TSO tunneling Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 05/26] net: sendmsg: fix NULL pointer dereference Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 06/26] net: phy: re-apply PHY fixups during phy_register_device Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 07/26] ip_tunnel(ipv4): fix tunnels with "local any remote $remote_ip" Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 08/26] tcp: Fix integer-overflows in TCP veno Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 09/26] inetpeer: get rid of ip_id_count Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 10/26] ip: make IP identifiers less predictable Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 11/26] tcp: Fix integer-overflow in TCP vegas Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 12/26] bna: fix performance regression Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 13/26] net: sctp: inherit auth_capable on INIT collisions Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 14/26] macvlan: Initialize vlan_features to turn on offload support Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 15/26] net: Correctly set segment mac_len in skb_segment() Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 16/26] iovec: make sure the caller actually wants anything in memcpy_fromiovecend Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 17/26] batman-adv: Fix out-of-order fragmentation support Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 18/26] sctp: fix possible seqlock seadlock in sctp_packet_transmit() Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 19/26] sparc: Hook up renameat2 syscall Greg Kroah-Hartman
2014-08-08 21:35 ` Greg Kroah-Hartman [this message]
2014-08-08 21:35 ` [PATCH 3.15 21/26] sparc64: Guard against flushing openfirmware mappings Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 22/26] bbc-i2c: Fix BBC I2C envctrl on SunBlade 2000 Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 23/26] sunsab: Fix detection of BREAK on sunsab serial console Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 24/26] sparc64: ldc_connect() should not return EINVAL when handshake is in progress Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 25/26] arch/sparc/math-emu/math_32.c: drop stray break operator Greg Kroah-Hartman
2014-08-08 21:35 ` [PATCH 3.15 26/26] xfs: log vector rounding leaks log space Greg Kroah-Hartman
2014-08-09  3:02 ` [PATCH 3.15 00/26] 3.15.10-stable review Guenter Roeck
2014-08-09 14:42 ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140808213414.508845392@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).