ARM: mm: Invalid pte for DEBUG_PAGEALLOC
Hiroshi Doyu [Wed, 25 Sep 2013 12:23:40 +0000 (15:23 +0300)]
Invalid pte temporary for debug instead of using read-only page. This
could oops at illegal read too.

Bug 1365298

Change-Id: Ibe3f0f969cb1b1c16cd9fda26d029d8179f2c3b4
Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>
Reviewed-on: http://git-master/r/278900
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
(cherry picked from commit f2a12070ed983b4f2fce1610c59fb86bfc8a57b9)
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>

arch/arm/mm/rodata.c

index 4cc378f..b98458c 100644 (file)
@@ -174,8 +174,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
 
        addr = (unsigned long)phys_to_virt(page_to_phys(page));
        if (enable)
-               set_memory_rw(addr, numpages);
+               set_page_attributes(addr, numpages, pte_mkvalid);
        else
-               set_memory_ro(addr, numpages);
+               set_page_attributes(addr, numpages, pte_mkinvalid);
 }
 #endif