Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80433
b: refs/heads/master
c: 0c42f39
h: refs/heads/master
i:
  80431: 49ffdf0
v: v3
  • Loading branch information
Andi Kleen authored and Ingo Molnar committed Jan 30, 2008
1 parent 151e6da commit fc4ea58
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b4416a1be86b0c7bdde4e6ba526715c1a055746f
refs/heads/master: 0c42f392767d3592e1cf676857d398ef69be7c9c
5 changes: 5 additions & 0 deletions trunk/arch/x86/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,9 @@ config DEBUG_BOOT_PARAMS
help
This option will cause struct boot_params to be exported via debugfs.

config CPA_DEBUG
bool "CPA self test code"
help
Do change_page_attr self tests at boot.

endmenu
26 changes: 26 additions & 0 deletions trunk/arch/x86/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,20 @@ void mark_rodata_ro(void)
change_page_attr(virt_to_page(start),
size >> PAGE_SHIFT, PAGE_KERNEL_RX);
printk("Write protecting the kernel text: %luk\n", size >> 10);

#ifdef CONFIG_CPA_DEBUG
global_flush_tlb();

printk("Testing CPA: Reverting %lx-%lx\n", start, start+size);
change_page_attr(virt_to_page(start), size>>PAGE_SHIFT,
PAGE_KERNEL_EXEC);
global_flush_tlb();

printk("Testing CPA: write protecting again\n");
change_page_attr(virt_to_page(start), size>>PAGE_SHIFT,
PAGE_KERNEL_RX);
global_flush_tlb();
#endif
}
#endif
start += size;
Expand All @@ -815,6 +829,18 @@ void mark_rodata_ro(void)
* of who is the culprit.
*/
global_flush_tlb();

#ifdef CONFIG_CPA_DEBUG
printk("Testing CPA: undo %lx-%lx\n", start, start + size);
change_page_attr(virt_to_page(start), size >> PAGE_SHIFT,
PAGE_KERNEL);
global_flush_tlb();

printk("Testing CPA: write protecting again\n");
change_page_attr(virt_to_page(start), size >> PAGE_SHIFT,
PAGE_KERNEL_RO);
global_flush_tlb();
#endif
}
#endif

Expand Down
10 changes: 10 additions & 0 deletions trunk/arch/x86/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,16 @@ void mark_rodata_ro(void)
* of who is the culprit.
*/
global_flush_tlb();

#ifdef CONFIG_CPA_DEBUG
printk("Testing CPA: undo %lx-%lx\n", start, end);
change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL);
global_flush_tlb();

printk("Testing CPA: again\n");
change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, PAGE_KERNEL_RO);
global_flush_tlb();
#endif
}
#endif

Expand Down

0 comments on commit fc4ea58

Please sign in to comment.