All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm: fix dump pagetables for 4 levels of page tables
@ 2017-04-12 14:36 Juergen Gross
  2017-04-12 15:28 ` Kirill A. Shutemov
  2017-04-12 22:31 ` [tip:x86/mm] x86/mm: Fix " tip-bot for Juergen Gross
  0 siblings, 2 replies; 3+ messages in thread
From: Juergen Gross @ 2017-04-12 14:36 UTC (permalink / raw)
  To: linux-kernel, x86; +Cc: mingo, hpa, tglx, kirill.shutemov, Juergen Gross

Commit fdd3d8ce0ea62 ("x86/dump_pagetables: Add support for 5-level
paging") introduced an error for dumping with only 4 levels by setting
PGD_LEVEL_MULT to a wrong value.

This is leading to e.g. addresses printed as "(null)" for ranges:

x86/mm: Found insecure W+X mapping at address (null)/(null)

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/mm/dump_pagetables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 9f305be71a72..bce6990b1d81 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -111,7 +111,7 @@ static struct addr_marker address_markers[] = {
 #define PMD_LEVEL_MULT (PTRS_PER_PTE * PTE_LEVEL_MULT)
 #define PUD_LEVEL_MULT (PTRS_PER_PMD * PMD_LEVEL_MULT)
 #define P4D_LEVEL_MULT (PTRS_PER_PUD * PUD_LEVEL_MULT)
-#define PGD_LEVEL_MULT (PTRS_PER_PUD * P4D_LEVEL_MULT)
+#define PGD_LEVEL_MULT (PTRS_PER_P4D * P4D_LEVEL_MULT)
 
 #define pt_dump_seq_printf(m, to_dmesg, fmt, args...)		\
 ({								\
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/mm: fix dump pagetables for 4 levels of page tables
  2017-04-12 14:36 [PATCH] x86/mm: fix dump pagetables for 4 levels of page tables Juergen Gross
@ 2017-04-12 15:28 ` Kirill A. Shutemov
  2017-04-12 22:31 ` [tip:x86/mm] x86/mm: Fix " tip-bot for Juergen Gross
  1 sibling, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2017-04-12 15:28 UTC (permalink / raw)
  To: Juergen Gross; +Cc: linux-kernel, x86, mingo, hpa, tglx, kirill.shutemov

On Wed, Apr 12, 2017 at 04:36:34PM +0200, Juergen Gross wrote:
> Commit fdd3d8ce0ea62 ("x86/dump_pagetables: Add support for 5-level
> paging") introduced an error for dumping with only 4 levels by setting
> PGD_LEVEL_MULT to a wrong value.
> 
> This is leading to e.g. addresses printed as "(null)" for ranges:
> 
> x86/mm: Found insecure W+X mapping at address (null)/(null)
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Sorry for this.

Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:x86/mm] x86/mm: Fix dump pagetables for 4 levels of page tables
  2017-04-12 14:36 [PATCH] x86/mm: fix dump pagetables for 4 levels of page tables Juergen Gross
  2017-04-12 15:28 ` Kirill A. Shutemov
@ 2017-04-12 22:31 ` tip-bot for Juergen Gross
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Juergen Gross @ 2017-04-12 22:31 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: hpa, kirill.shutemov, mingo, jgross, tglx, linux-kernel

Commit-ID:  84bbabc3a452e8085cfbd745ff0bff2b89074417
Gitweb:     http://git.kernel.org/tip/84bbabc3a452e8085cfbd745ff0bff2b89074417
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed, 12 Apr 2017 16:36:34 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 13 Apr 2017 00:26:30 +0200

x86/mm: Fix dump pagetables for 4 levels of page tables

Commit fdd3d8ce0ea62 ("x86/dump_pagetables: Add support for 5-level
paging") introduced an error for dumping with only 4 levels by setting
PGD_LEVEL_MULT to a wrong value.

This is leading to e.g. addresses printed as "(null)" for ranges:

  x86/mm: Found insecure W+X mapping at address (null)/(null)

Make PGD_LEVEL_MULT a multiple of PTRS_PER_P4D instead of PTRS_PER_PUD

Fixes: fdd3d8ce0ea62 ("x86/dump_pagetables: Add support for 5-level paging")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Link: http://lkml.kernel.org/r/20170412143634.6846-1-jgross@suse.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/x86/mm/dump_pagetables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 9f305be..bce6990 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -111,7 +111,7 @@ static struct addr_marker address_markers[] = {
 #define PMD_LEVEL_MULT (PTRS_PER_PTE * PTE_LEVEL_MULT)
 #define PUD_LEVEL_MULT (PTRS_PER_PMD * PMD_LEVEL_MULT)
 #define P4D_LEVEL_MULT (PTRS_PER_PUD * PUD_LEVEL_MULT)
-#define PGD_LEVEL_MULT (PTRS_PER_PUD * P4D_LEVEL_MULT)
+#define PGD_LEVEL_MULT (PTRS_PER_P4D * P4D_LEVEL_MULT)
 
 #define pt_dump_seq_printf(m, to_dmesg, fmt, args...)		\
 ({								\

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-12 22:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12 14:36 [PATCH] x86/mm: fix dump pagetables for 4 levels of page tables Juergen Gross
2017-04-12 15:28 ` Kirill A. Shutemov
2017-04-12 22:31 ` [tip:x86/mm] x86/mm: Fix " tip-bot for Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.