diff options
Diffstat (limited to 'arch/x86/mm/pageattr.c')
-rw-r--r-- | arch/x86/mm/pageattr.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 8ca0d8566fc8..8253bc97587e 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -482,6 +482,13 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
482 | pbase = (pte_t *)page_address(base); | 482 | pbase = (pte_t *)page_address(base); |
483 | paravirt_alloc_pte(&init_mm, page_to_pfn(base)); | 483 | paravirt_alloc_pte(&init_mm, page_to_pfn(base)); |
484 | ref_prot = pte_pgprot(pte_clrhuge(*kpte)); | 484 | ref_prot = pte_pgprot(pte_clrhuge(*kpte)); |
485 | /* | ||
486 | * If we ever want to utilize the PAT bit, we need to | ||
487 | * update this function to make sure it's converted from | ||
488 | * bit 12 to bit 7 when we cross from the 2MB level to | ||
489 | * the 4K level: | ||
490 | */ | ||
491 | WARN_ON_ONCE(pgprot_val(ref_prot) & _PAGE_PAT_LARGE); | ||
485 | 492 | ||
486 | #ifdef CONFIG_X86_64 | 493 | #ifdef CONFIG_X86_64 |
487 | if (level == PG_LEVEL_1G) { | 494 | if (level == PG_LEVEL_1G) { |
@@ -508,18 +515,13 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
508 | #endif | 515 | #endif |
509 | 516 | ||
510 | /* | 517 | /* |
511 | * Install the new, split up pagetable. Important details here: | 518 | * Install the new, split up pagetable. |
512 | * | ||
513 | * On Intel the NX bit of all levels must be cleared to make a | ||
514 | * page executable. See section 4.13.2 of Intel 64 and IA-32 | ||
515 | * Architectures Software Developer's Manual). | ||
516 | * | 519 | * |
517 | * Mark the entry present. The current mapping might be | 520 | * We use the standard kernel pagetable protections for the new |
518 | * set to not present, which we preserved above. | 521 | * pagetable protections, the actual ptes set above control the |
522 | * primary protection behavior: | ||
519 | */ | 523 | */ |
520 | ref_prot = pte_pgprot(pte_mkexec(pte_clrhuge(*kpte))); | 524 | __set_pmd_pte(kpte, address, mk_pte(base, __pgprot(_KERNPG_TABLE))); |
521 | pgprot_val(ref_prot) |= _PAGE_PRESENT; | ||
522 | __set_pmd_pte(kpte, address, mk_pte(base, ref_prot)); | ||
523 | base = NULL; | 525 | base = NULL; |
524 | 526 | ||
525 | out_unlock: | 527 | out_unlock: |