Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4c881ca1819da180b047f87eedeb9a5957918705
Commit:     4c881ca1819da180b047f87eedeb9a5957918705
Parent:     8192206df093e8fc607b5072ce71a930d44f8638
Author:     Huang, Ying <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 30 13:34:04 2008 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Wed Jan 30 13:34:04 2008 +0100

    x86: fix NX bit handling in change_page_attr()
    
    This patch fixes a bug of change_page_attr/change_page_attr_addr on
    Intel i386/x86_64 CPUs.  After changing page attribute to be
    executable with these functions, the page remains un-executable on
    Intel i386/x86_64 CPU.  Because on Intel i386/x86_64 CPU, only if the
    "NX" bits of all three level page tables are cleared (PAE is enabled),
    the corresponding page is executable (refer to section 4.13.2 of Intel
    64 and IA-32 Architectures Software Developer's Manual).  So, the bug
    is fixed through clearing the "NX" bit of PMD when splitting the huge
    PMD.
    
    Signed-off-by: Huang Ying <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
---
 arch/x86/mm/pageattr.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index d18c41d..cbe8e92 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -130,8 +130,13 @@ static int split_large_page(pte_t *kpte, unsigned long 
address)
                set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT, ref_prot));
 
        /*
-        * Install the new, split up pagetable:
+        * Install the new, split up pagetable. Important detail here:
+        *
+        * On Intel the NX bit of all levels must be cleared to make a
+        * page executable. See section 4.13.2 of Intel 64 and IA-32
+        * Architectures Software Developer's Manual).
         */
+       ref_prot = pte_pgprot(pte_mkexec(pte_clrhuge(*kpte)));
        __set_pmd_pte(kpte, address, mk_pte(base, ref_prot));
        base = NULL;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to