Patch "sparc64: Fix huge PMD invalidation." has been added to the 3.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sparc64: Fix huge PMD invalidation.

to the 3.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sparc64-fix-huge-pmd-invalidation.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From foo@baz Fri Aug  8 08:54:13 PDT 2014
From: "David S. Miller" <davem@xxxxxxxxxxxxx>
Date: Thu, 24 Apr 2014 13:58:02 -0700
Subject: sparc64: Fix huge PMD invalidation.

From: "David S. Miller" <davem@xxxxxxxxxxxxx>

[ Upstream commit 51e5ef1bb7ab0e5fa7de4e802da5ab22fe35f0bf ]

On sparc64 "present" and "valid" are seperate PTE bits, this allows us to
naturally distinguish between the user explicitly asking for PROT_NONE
with mprotect() and other situations.

However we weren't handling this properly in the huge PMD paths.

First of all, the page table walker in the TSB miss path only checks
for _PAGE_PMD_HUGE.  So the generic pmdp_invalidate() would clear
_PAGE_PRESENT but the TLB miss paths would still load it into the TLB
as a valid huge PMD.

Fix this by clearing the valid bit in pmdp_invalidate(), and also
checking the valid bit in USER_PGTABLE_CHECK_PMD_HUGE using "brgez"
since _PAGE_VALID is bit 63 in both the sun4u and sun4v pte layouts.

Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/sparc/include/asm/pgtable_64.h |   18 ++++--------------
 arch/sparc/include/asm/tsb.h        |    3 ++-
 arch/sparc/mm/tlb.c                 |   11 +++++++++++
 3 files changed, 17 insertions(+), 15 deletions(-)

--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -719,20 +719,6 @@ static inline pmd_t pmd_mkwrite(pmd_t pm
 	return __pmd(pte_val(pte));
 }
 
-static inline pmd_t pmd_mknotpresent(pmd_t pmd)
-{
-	unsigned long mask;
-
-	if (tlb_type == hypervisor)
-		mask = _PAGE_PRESENT_4V;
-	else
-		mask = _PAGE_PRESENT_4U;
-
-	pmd_val(pmd) &= ~mask;
-
-	return pmd;
-}
-
 static inline pmd_t pmd_mksplitting(pmd_t pmd)
 {
 	pte_t pte = __pte(pmd_val(pmd));
@@ -893,6 +879,10 @@ extern void update_mmu_cache(struct vm_a
 extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
 				 pmd_t *pmd);
 
+#define __HAVE_ARCH_PMDP_INVALIDATE
+extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
+			    pmd_t *pmdp);
+
 #define __HAVE_ARCH_PGTABLE_DEPOSIT
 extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
 				       pgtable_t pgtable);
--- a/arch/sparc/include/asm/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
@@ -171,7 +171,8 @@ extern struct tsb_phys_patch_entry __tsb
 	andcc		REG1, REG2, %g0;		\
 	be,pt		%xcc, 700f;			\
 	 sethi		%hi(4 * 1024 * 1024), REG2;	\
-	andn		REG1, REG2, REG1;		\
+	brgez,pn	REG1, FAIL_LABEL;		\
+	 andn		REG1, REG2, REG1;		\
 	and		VADDR, REG2, REG2;		\
 	brlz,pt		REG1, PTE_LABEL;		\
 	 or		REG1, REG2, REG1;		\
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -193,6 +193,17 @@ void set_pmd_at(struct mm_struct *mm, un
 	}
 }
 
+void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
+		     pmd_t *pmdp)
+{
+	pmd_t entry = *pmdp;
+
+	pmd_val(entry) &= ~_PAGE_VALID;
+
+	set_pmd_at(vma->vm_mm, address, pmdp, entry);
+	flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
+}
+
 void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
 				pgtable_t pgtable)
 {


Patches currently in stable-queue which might be from davem@xxxxxxxxxxxxx are

queue-3.14/sctp-fix-possible-seqlock-seadlock-in-sctp_packet_transmit.patch
queue-3.14/sparc64-add-basic-validations-to-pud-pmd-_bad.patch
queue-3.14/net-sendmsg-fix-null-pointer-dereference.patch
queue-3.14/sparc64-ldc_connect-should-not-return-einval-when-handshake-is-in-progress.patch
queue-3.14/sparc64-do-not-insert-non-valid-ptes-into-the-tsb-hash-table.patch
queue-3.14/iovec-make-sure-the-caller-actually-wants-anything-in-memcpy_fromiovecend.patch
queue-3.14/net-phy-re-apply-phy-fixups-during-phy_register_device.patch
queue-3.14/sparc64-fix-hex-values-in-comment-above-pte_modify.patch
queue-3.14/sparc64-don-t-bark-so-loudly-about-32-bit-tasks-generating-64-bit-fault-addresses.patch
queue-3.14/sparc64-fix-argument-sign-extension-for-compat_sys_futex.patch
queue-3.14/arch-sparc-math-emu-math_32.c-drop-stray-break-operator.patch
queue-3.14/net-correctly-set-segment-mac_len-in-skb_segment.patch
queue-3.14/sparc64-fix-executable-bit-testing-in-set_pmd_at-paths.patch
queue-3.14/ip-make-ip-identifiers-less-predictable.patch
queue-3.14/sparc64-fix-top-level-fault-handling-bugs.patch
queue-3.14/sparc64-fix-huge-tsb-mapping-on-pre-ultrasparc-iii-cpus.patch
queue-3.14/sparc64-give-more-detailed-information-in-pgd-pmd-_error-and-kill-pte_error.patch
queue-3.14/bnx2x-fix-crash-during-tso-tunneling.patch
queue-3.14/sparc64-don-t-use-_page_present-in-pte_modify-mask.patch
queue-3.14/sparc64-make-itc_sync_lock-raw.patch
queue-3.14/bbc-i2c-fix-bbc-i2c-envctrl-on-sunblade-2000.patch
queue-3.14/sparc64-handle-32-bit-tasks-properly-in-compute_effective_address.patch
queue-3.14/sunsab-fix-detection-of-break-on-sunsab-serial-console.patch
queue-3.14/ip_tunnel-ipv4-fix-tunnels-with-local-any-remote-remote_ip.patch
queue-3.14/net-sctp-inherit-auth_capable-on-init-collisions.patch
queue-3.14/sparc64-fix-bugs-in-get_user_pages_fast-wrt.-thp.patch
queue-3.14/sparc64-fix-huge-pmd-invalidation.patch
queue-3.14/macvlan-initialize-vlan_features-to-turn-on-offload-support.patch
queue-3.14/tcp-fix-integer-overflow-in-tcp-vegas.patch
queue-3.14/inetpeer-get-rid-of-ip_id_count.patch
queue-3.14/sparc64-use-ilog2_4mb-instead-of-constant-22.patch
queue-3.14/bna-fix-performance-regression.patch
queue-3.14/sparc64-add-membar-to-niagara2-memcpy-code.patch
queue-3.14/sparc64-fix-range-check-in-kern_addr_valid.patch
queue-3.14/sparc64-guard-against-flushing-openfirmware-mappings.patch
queue-3.14/tcp-fix-integer-overflows-in-tcp-veno.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]