mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] x86: check __supported_pte_mask in set_memory_x/nx
@ 2008-02-01  9:34 Huang, Ying
  0 siblings, 0 replies; only message in thread
From: Huang, Ying @ 2008-02-01  9:34 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, Andi Kleen; +Cc: linux-kernel

This patch adds __supported_pte_mask checking to set_memory_x/nx.

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

---
 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);
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-01  9:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-01  9:34 [PATCH 1/4] x86: check __supported_pte_mask in set_memory_x/nx Huang, Ying

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome