Skip to contentSkip to conversation

mark protection_map as __ro_after_init

PATCH Applied Daniel Micay 2 participants 2 messages May 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mark protection_map as __ro_after_init

The protection map is only modified by per-arch init code so it can be protected from writes after the init code runs.

This change was extracted from PaX where it's part of KERNEXEC.

---
 mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mmap.c +1 -1
index f82741e199c0..3bd5ecd20d4d 100644
@@ -94,7 +94,7 @@ static void unmap_region(struct mm_struct *mm,
  *								w: (no) no
  *								x: (yes) yes
  */
-pgprot_t protection_map[16] = {
+pgprot_t protection_map[16] __ro_after_init = {
 	__P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
 	__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
 };
Signature · 1 line
2.12.2
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Daniel Micay

The protection map is only modified by per-arch init code so it can be protected from writes after the init code runs.

This change was extracted from PaX where it's part of KERNEXEC.

Thanks!

-Kees

Quoted 20 lines
---
 mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mmap.c +1 -2
index f82741e199c0..3bd5ecd20d4d 100644
@@ -94,7 +94,7 @@ static void unmap_region(struct mm_struct *mm,
  *                                                             w: (no) no
  *                                                             x: (yes) yes
  */
-pgprot_t protection_map[16] = {
+pgprot_t protection_map[16] __ro_after_init = {
        __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
        __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
 };
--

2.12.2

Signature · 2 lines
Kees Cook
Pixel Security