Commit 674d6726 authored by Ingo Molnar's avatar Ingo Molnar

x86: clean up differences between 64-bit and 32-bit

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 6faa4c53
...@@ -126,30 +126,36 @@ static int split_large_page(pte_t *kpte, unsigned long address) ...@@ -126,30 +126,36 @@ static int split_large_page(pte_t *kpte, unsigned long address)
static int static int
__change_page_attr(unsigned long address, struct page *page, pgprot_t prot) __change_page_attr(unsigned long address, struct page *page, pgprot_t prot)
{ {
pgprot_t ref_prot2, oldprot;
struct page *kpte_page; struct page *kpte_page;
int level, err = 0; int level, err = 0;
pte_t *kpte; pte_t *kpte;
BUG_ON(PageHighMem(page));
repeat: repeat:
kpte = lookup_address(address, &level); kpte = lookup_address(address, &level);
if (!kpte) if (!kpte)
return 0; return 0;
kpte_page = virt_to_page(kpte); kpte_page = virt_to_page(kpte);
oldprot = pte_pgprot(*kpte);
BUG_ON(PageLRU(kpte_page)); BUG_ON(PageLRU(kpte_page));
BUG_ON(PageCompound(kpte_page)); BUG_ON(PageCompound(kpte_page));
prot = canon_pgprot(prot);
/*
* Better fail early if someone sets the kernel text to NX.
* Does not cover __inittext
*/
BUG_ON(address >= (unsigned long)&_text &&
address < (unsigned long)&_etext &&
(pgprot_val(prot) & _PAGE_NX));
if (level == 4) { if (level == 4) {
set_pte_atomic(kpte, mk_pte(page, prot)); set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot)));
} else { } else {
err = split_large_page(kpte, address); err = split_large_page(kpte, address);
if (!err) if (!err)
goto repeat; goto repeat;
} }
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment