Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80488
b: refs/heads/master
c: 674d672
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Jan 30, 2008
1 parent f601d5e commit 138ad92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6faa4c53b2f06fd271060761ce27f4f53289175c
refs/heads/master: 674d67269e79f6697c3480363b28c9b9934fa60c
16 changes: 11 additions & 5 deletions trunk/arch/x86/mm/pageattr_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,30 +126,36 @@ static int split_large_page(pte_t *kpte, unsigned long address)
static int
__change_page_attr(unsigned long address, struct page *page, pgprot_t prot)
{
pgprot_t ref_prot2, oldprot;
struct page *kpte_page;
int level, err = 0;
pte_t *kpte;

BUG_ON(PageHighMem(page));

repeat:
kpte = lookup_address(address, &level);
if (!kpte)
return 0;

kpte_page = virt_to_page(kpte);
oldprot = pte_pgprot(*kpte);
BUG_ON(PageLRU(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) {
set_pte_atomic(kpte, mk_pte(page, prot));
set_pte_atomic(kpte, mk_pte(page, canon_pgprot(prot)));
} else {
err = split_large_page(kpte, address);
if (!err)
goto repeat;
}

return err;
}

Expand Down

0 comments on commit 138ad92

Please sign in to comment.