Skip to contentSkip to conversation

Patch "powerpc/mm: Fix crash in page table dump with huge pages" has been added to the 4.11-stable tree

PATCH [email protected] 1 participant 1 message May 23, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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

powerpc/mm: Fix crash in page table dump with huge pages

to the 4.11-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:
powerpc-mm-fix-crash-in-page-table-dump-with-huge-pages.patch
and it can be found in the queue-4.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From bfb9956ab4d8242f4594b5f4bee534b935384fd9 Mon Sep 17 00:00:00 2001

From: Michael Ellerman <[email protected]>
Date: Tue, 16 May 2017 20:42:53 +1000
Subject: powerpc/mm: Fix crash in page table dump with huge pages

From: Michael Ellerman <[email protected]>

commit bfb9956ab4d8242f4594b5f4bee534b935384fd9 upstream.

The page table dump code doesn't know about huge pages, so currently it crashes (or walks random memory, usually leading to a crash), if it finds a huge page. On Book3S we only see huge pages in the Linux page tables when we're using the P9 Radix MMU.

Teaching the code to properly handle huge pages is a bit more involved, so for now just prevent the crash.

Fixes 8eb07b187000 ("powerpc/mm: Dump linux pagetables")
---
 arch/powerpc/mm/dump_linuxpagetables.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/powerpc/mm/dump_linuxpagetables.c +4 -3
@@ -16,6 +16,7 @@
  */
 #include <linux/debugfs.h>
 #include <linux/fs.h>
+#include <linux/hugetlb.h>
 #include <linux/io.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
@@ -331,7 +332,7 @@ static void walk_pmd(struct pg_state *st
 
 	for (i = 0; i < PTRS_PER_PMD; i++, pmd++) {
 		addr = start + i * PMD_SIZE;
-		if (!pmd_none(*pmd))
+		if (!pmd_none(*pmd) && !pmd_huge(*pmd))
 			/* pmd exists */
 			walk_pte(st, pmd, addr);
 		else
@@ -347,7 +348,7 @@ static void walk_pud(struct pg_state *st
 
 	for (i = 0; i < PTRS_PER_PUD; i++, pud++) {
 		addr = start + i * PUD_SIZE;
-		if (!pud_none(*pud))
+		if (!pud_none(*pud) && !pud_huge(*pud))
 			/* pud exists */
 			walk_pmd(st, pud, addr);
 		else
@@ -367,7 +368,7 @@ static void walk_pagetables(struct pg_st
 	 */
 	for (i = 0; i < PTRS_PER_PGD; i++, pgd++) {
 		addr = KERN_VIRT_START + i * PGDIR_SIZE;
-		if (!pgd_none(*pgd))
+		if (!pgd_none(*pgd) && !pgd_huge(*pgd))
 			/* pgd exists */
 			walk_pud(st, pgd, addr);
 		else

Patches currently in stable-queue which might be from [email protected] are

queue-4.11/powerpc-book3s-mce-move-add_taint-later-in-virtual-mode.patch queue-4.11/powerpc-mm-fix-crash-in-page-table-dump-with-huge-pages.patch queue-4.11/powerpc-tm-fix-fp-and-vmx-register-corruption.patch queue-4.11/powerpc-sysfs-fix-reference-leak-of-cpu-device_nodes-present-at-boot.patch queue-4.11/powerpc-powernv-fix-tce-kill-on-nvlink2.patch queue-4.11/cxl-force-context-lock-during-eeh-flow.patch queue-4.11/cxl-route-eeh-events-to-all-drivers-in-cxl_pci_error_detected.patch queue-4.11/powerpc-pseries-fix-of_node_put-underflow-during-dlpar-remove.patch queue-4.11/powerpc-iommu-do-not-call-pagetranshuge-on-tail-pages.patch queue-4.11/powerpc-mm-ensure-irqs-are-off-in-switch_mm.patch queue-4.11/powerpc-eeh-avoid-use-after-free-in-eeh_handle_special_event.patch