>From 928dabe66cc5992587eb70410208ca9885c64a5c Mon Sep 17 00:00:00 2001 From: Matthieu CASTET Date: Thu, 20 Jan 2011 21:11:45 +0100 Subject: [PATCH] NX protection for kernel data : support xen Xen want page table pages read only. But the initial page table (from head_*.S) live in .data or .bss. Don't make static_protections enforce rw for .data/.bss in xen case. Signed-off-by: Matthieu CASTET --- arch/x86/mm/pageattr.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 8b830ca..8698521 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -283,11 +283,14 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address, __pa((unsigned long)__end_rodata) >> PAGE_SHIFT)) pgprot_val(forbidden) |= _PAGE_RW; /* - * .data and .bss should always be writable. + * .data and .bss should always be writable, but xen won't like + * if we make page table rw (that live in .data or .bss) */ +#ifndef CONFIG_XEN if (within(address, (unsigned long)_sdata, (unsigned long)_edata) || within(address, (unsigned long)__bss_start, (unsigned long)__bss_stop)) pgprot_val(required) |= _PAGE_RW; +#endif #if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA) /* -- 1.7.2.3