[PATCH 1/4] x86: check __supported_pte_mask in set_memory_x/nx

From: Huang, Ying
Date: Fri Feb 01 2008 - 04:34:48 EST


This patch adds __supported_pte_mask checking to set_memory_x/nx.

Signed-off-by: Huang Ying <ying.huang@xxxxxxxxx>

---
arch/x86/mm/pageattr.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -445,13 +445,21 @@ EXPORT_SYMBOL(set_memory_wb);

int set_memory_x(unsigned long addr, int numpages)
{
- return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_NX));
+ if (__supported_pte_mask & _PAGE_NX)
+ return change_page_attr_clear(addr, numpages,
+ __pgprot(_PAGE_NX));
+ else
+ return 0;
}
EXPORT_SYMBOL(set_memory_x);

int set_memory_nx(unsigned long addr, int numpages)
{
- return change_page_attr_set(addr, numpages, __pgprot(_PAGE_NX));
+ if (__supported_pte_mask & _PAGE_NX)
+ return change_page_attr_set(addr, numpages,
+ __pgprot(_PAGE_NX));
+ else
+ return 0;
}
EXPORT_SYMBOL(set_memory_nx);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/