From: "Andi Kleen" Handle NX correctly in pageattr Second attempt to try to fix an long standing NX bug in change_page_attr. Hopefully this version will be better. The kernel text mapping aliases part of the physical memory and needs its caching attributes changed too. But when doing this one has to be very careful to handle the NX bit correctly. A previous slightly different version of this broke the X server on some RH systems. I hope this version will be better, but if you have X server problems please revert this one. Signed-off-by: Andrew Morton --- 25-akpm/arch/x86_64/mm/pageattr.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff -puN arch/x86_64/mm/pageattr.c~x86_64-handle-nx-correctly-in-pageattr arch/x86_64/mm/pageattr.c --- 25/arch/x86_64/mm/pageattr.c~x86_64-handle-nx-correctly-in-pageattr 2004-11-28 01:54:32.115714776 -0800 +++ 25-akpm/arch/x86_64/mm/pageattr.c 2004-11-28 01:54:32.119714168 -0800 @@ -183,11 +183,12 @@ int change_page_attr_addr(unsigned long break; /* Handle kernel mapping too which aliases part of the * lowmem */ - /* Disabled right now. Fixme */ - if (0 && __pa(address) < KERNEL_TEXT_SIZE) { + if (__pa(address) < KERNEL_TEXT_SIZE) { unsigned long addr2; + pgprot_t prot2 = prot; addr2 = __START_KERNEL_map + __pa(address); - err = __change_page_attr(addr2, pfn, prot, PAGE_KERNEL_EXEC); + pgprot_val(prot2) &= ~_PAGE_NX; + err = __change_page_attr(addr2, pfn, prot2, PAGE_KERNEL_EXEC); } } up_write(&init_mm.mmap_sem); _