aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/pageattr-test.c
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2008-01-30 07:34:07 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:07 -0500
commit488fd99588bf23da951b524a806e44feaa1aa366 (patch)
treea4ff5c8ddf932920fc2700e261f92c08b293d040 /arch/x86/mm/pageattr-test.c
parent5398f9854f60d670e8ef1ea08c0e0310f253eeb1 (diff)
x86: fix pageattr-selftest
In Ingo's testing, he found a bug in the CPA selftest code. What would happen is that the test would call change_page_attr_addr on a range of memory, part of which was read only, part of which was writable. The only thing the test wanted to change was the global bit... What actually happened was that the selftest would take the permissions of the first page, and then the change_page_attr_addr call would then set the permissions of the entire range to this first page. In the rodata section case, this resulted in pages after the .rodata becoming read only... which made the kernel rather unhappy in many interesting ways. This is just another example of how dangerous the cpa API is (was); this patch changes the test to use the incremental clear/set APIs instead, and it changes the clear/set implementation to work on a 1 page at a time basis. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/pageattr-test.c')
-rw-r--r--arch/x86/mm/pageattr-test.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index 6a41a0f0c149..fe73905d075e 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -162,8 +162,8 @@ static __init int exercise_pageattr(void)
162 continue; 162 continue;
163 } 163 }
164 164
165 err = change_page_attr_addr(addr[i], len[i], 165 err = change_page_attr_clear(addr[i], len[i],
166 pte_pgprot(pte_clrhuge(pte_clrglobal(pte0)))); 166 __pgprot(_PAGE_GLOBAL));
167 if (err < 0) { 167 if (err < 0) {
168 printk(KERN_ERR "CPA %d failed %d\n", i, err); 168 printk(KERN_ERR "CPA %d failed %d\n", i, err);
169 failed++; 169 failed++;
@@ -197,8 +197,8 @@ static __init int exercise_pageattr(void)
197 failed++; 197 failed++;
198 continue; 198 continue;
199 } 199 }
200 err = change_page_attr_addr(addr[i], len[i], 200 err = change_page_attr_set(addr[i], len[i],
201 pte_pgprot(pte_mkglobal(*pte))); 201 __pgprot(_PAGE_GLOBAL));
202 if (err < 0) { 202 if (err < 0) {
203 printk(KERN_ERR "CPA reverting failed: %d\n", err); 203 printk(KERN_ERR "CPA reverting failed: %d\n", err);
204 failed++; 204 failed++;