Skip to content

Commit

Permalink
thp: change_huge_pmd(): make sure we don't try to make a page writable
Browse files Browse the repository at this point in the history
mprotect core never tries to make page writable using change_huge_pmd().
Let's add an assert that the assumption is true.  It's important to be
sure we will not make huge zero page writable.

Signed-off-by: Kirill A. Shutemov <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: David Rientjes <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kiryl authored and torvalds committed Dec 13, 2012
1 parent 93b4796 commit cad7f61
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/huge_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
pmd_t entry;
entry = pmdp_get_and_clear(mm, addr, pmd);
entry = pmd_modify(entry, newprot);
BUG_ON(pmd_write(entry));
set_pmd_at(mm, addr, pmd, entry);
spin_unlock(&vma->vm_mm->page_table_lock);
ret = 1;
Expand Down

0 comments on commit cad7f61

Please sign in to comment.