diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2012-12-12 16:50:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 20:38:31 -0500 |
commit | cad7f613c4d010e1d0f05c9a4fb33c7ae40ba115 (patch) | |
tree | 9d3f13bfbec1215e2427bb1ef74d8471d4e0b995 /mm/huge_memory.c | |
parent | 93b4796dede916de74b21fbd637588da6a99a7ec (diff) |
thp: change_huge_pmd(): make sure we don't try to make a page writable
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 <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r-- | mm/huge_memory.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a959b3a4ddd5..7742fb36eb4d 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1273,6 +1273,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, | |||
1273 | pmd_t entry; | 1273 | pmd_t entry; |
1274 | entry = pmdp_get_and_clear(mm, addr, pmd); | 1274 | entry = pmdp_get_and_clear(mm, addr, pmd); |
1275 | entry = pmd_modify(entry, newprot); | 1275 | entry = pmd_modify(entry, newprot); |
1276 | BUG_ON(pmd_write(entry)); | ||
1276 | set_pmd_at(mm, addr, pmd, entry); | 1277 | set_pmd_at(mm, addr, pmd, entry); |
1277 | spin_unlock(&vma->vm_mm->page_table_lock); | 1278 | spin_unlock(&vma->vm_mm->page_table_lock); |
1278 | ret = 1; | 1279 | ret = 1; |