Skip to contentSkip to conversation

ARM: mm: report both sections from PMD

PATCH In review Kees Cook 4 participants 6 messages Feb 13, 2014 – Feb 14, 2014 Arm (32-bit)

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH v3 1/1 ARM: mm: report both sections from PMD

On 2-level page table systems, the PMD has 2 section entries. Report these, otherwise ARM_PTDUMP will miss reporting permission changes on odd section boundaries.

---
v3:
- re-reorganize, drop use of pmd_sect; suggested by Catalin Marinas.
v2:
- reorganize, suggested by Catalin Marinas.

---
 arch/arm/mm/dump.c |    3 +++
 1 file changed, 3 insertions(+)
arch/arm/mm/dump.c +3 -0
index 2b342177f5de..61cc78ae9f21 100644
@@ -264,6 +264,9 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
 			note_page(st, addr, 3, pmd_val(*pmd));
 		else
 			walk_pte(st, pmd, addr);
+
+		if (SECTION_SIZE < PMD_SIZE && pmd_large(pmd[1]))
+			note_page(st, addr + SECTION_SIZE, 3, pmd_val(pmd[1]));
 	}
 }
 
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
author
#2 lore raw
Quoted 8 lines · Catalin Marinas
Quoted 5 lines · Kees Cook

On 2-level page table systems, the PMD has 2 section entries. Report these, otherwise ARM_PTDUMP will miss reporting permission changes on odd section boundaries.

Quoted 1 line · Steve Capper

Thanks to both of you! If you have a moment can you check this other patch which has additional fixes for the dump code?

https://lkml.org/lkml/2014/2/12/662

Thanks,

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
#3 lore raw
Quoted 11 lines · Kees Cook
Quoted 8 lines · Catalin Marinas
Quoted 5 lines · Kees Cook

On 2-level page table systems, the PMD has 2 section entries. Report these, otherwise ARM_PTDUMP will miss reporting permission changes on odd section boundaries.

Quoted 7 lines
Quoted 1 line · Steve Capper

Thanks to both of you! If you have a moment can you check this other patch which has additional fixes for the dump code?

https://lkml.org/lkml/2014/2/12/662

It's not that simple, because APX in section descriptors doesn't exist on pre-v6 ARMs. This needs to be conditional upon the CPU arch.

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
author
#4 lore raw
Quoted 4 lines · Russell King - ARM Linux
Quoted 1 line

https://lkml.org/lkml/2014/2/12/662

It's not that simple, because APX in section descriptors doesn't exist on pre-v6 ARMs. This needs to be conditional upon the CPU arch.

Ah! Okay, do we need a single #define to describe the expected masks and values? What should it look like for pre-v6 ARMs?

-Kees

Signature · 2 lines
Kees Cook
Chrome OS Security
Tested-by on v3 1/1
#5 lore raw
In reply to Kees Cook
Quoted 30 lines · Kees Cook

On 2-level page table systems, the PMD has 2 section entries. Report these, otherwise ARM_PTDUMP will miss reporting permission changes on odd section boundaries.

---
v3:
- re-reorganize, drop use of pmd_sect; suggested by Catalin Marinas.
v2:
- reorganize, suggested by Catalin Marinas.

---
 arch/arm/mm/dump.c |    3 +++
 1 file changed, 3 insertions(+)
arch/arm/mm/dump.c +3 -0
index 2b342177f5de..61cc78ae9f21 100644
@@ -264,6 +264,9 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
 			note_page(st, addr, 3, pmd_val(*pmd));
 		else
 			walk_pte(st, pmd, addr);
+
+		if (SECTION_SIZE < PMD_SIZE && pmd_large(pmd[1]))
+			note_page(st, addr + SECTION_SIZE, 3, pmd_val(pmd[1]));
 	}
 }
 
Signature · 1 line
1.7.9.5

This picks up an odd megabyte aligned section on my Arndale board with short descriptors on 3.14-rc2. Behaves as expected with long descriptors too (does nothing).

FWIW:

Cheers,

Signature · 1 line
Steve
Quoted 10 lines
Signature · 8 lines
-- 
Kees Cook
Chrome OS Security

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel