Skip to content

Commit f439c42

Browse files
jgross1KAGA-KOKO
authored andcommitted
x86: Support PAT bit in pagetable dump for lower levels
Dumping page table protection bits is not correct for entries on levels 2 and 3 regarding the PAT bit, which is at a different position as on level 4. Based-on-patch-by: Stefan Bader <[email protected]> Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 87ad0b7 commit f439c42

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

arch/x86/mm/dump_pagetables.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static void printk_prot(struct seq_file *m, pgprot_t prot, int level, bool dmsg)
126126

127127
if (!pgprot_val(prot)) {
128128
/* Not present */
129-
pt_dump_cont_printf(m, dmsg, " ");
129+
pt_dump_cont_printf(m, dmsg, " ");
130130
} else {
131131
if (pr & _PAGE_USER)
132132
pt_dump_cont_printf(m, dmsg, "USR ");
@@ -145,18 +145,16 @@ static void printk_prot(struct seq_file *m, pgprot_t prot, int level, bool dmsg)
145145
else
146146
pt_dump_cont_printf(m, dmsg, " ");
147147

148-
/* Bit 9 has a different meaning on level 3 vs 4 */
149-
if (level <= 3) {
150-
if (pr & _PAGE_PSE)
151-
pt_dump_cont_printf(m, dmsg, "PSE ");
152-
else
153-
pt_dump_cont_printf(m, dmsg, " ");
154-
} else {
155-
if (pr & _PAGE_PAT)
156-
pt_dump_cont_printf(m, dmsg, "pat ");
157-
else
158-
pt_dump_cont_printf(m, dmsg, " ");
159-
}
148+
/* Bit 7 has a different meaning on level 3 vs 4 */
149+
if (level <= 3 && pr & _PAGE_PSE)
150+
pt_dump_cont_printf(m, dmsg, "PSE ");
151+
else
152+
pt_dump_cont_printf(m, dmsg, " ");
153+
if ((level == 4 && pr & _PAGE_PAT) ||
154+
((level == 3 || level == 2) && pr & _PAGE_PAT_LARGE))
155+
pt_dump_cont_printf(m, dmsg, "pat ");
156+
else
157+
pt_dump_cont_printf(m, dmsg, " ");
160158
if (pr & _PAGE_GLOBAL)
161159
pt_dump_cont_printf(m, dmsg, "GLB ");
162160
else

0 commit comments

Comments
 (0)