fix mprotect vma_wants_writenotify prot
Fix mprotect bug in recent commit 3ed75eb8f1
(setup vma->vm_page_prot by vm_get_page_prot()): the vma_wants_writenotify
case was setting the same prot as when not.
Nothing wrong with the use of protection_map[] in mmap_region(),
but use vm_get_page_prot() there too in the same ~VM_SHARED way.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: Coly Li <coyli@suse.de>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4ae3f847e4
commit
1ddd439ef9
|
@ -1171,8 +1171,7 @@ munmap_back:
|
||||||
vm_flags = vma->vm_flags;
|
vm_flags = vma->vm_flags;
|
||||||
|
|
||||||
if (vma_wants_writenotify(vma))
|
if (vma_wants_writenotify(vma))
|
||||||
vma->vm_page_prot =
|
vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED);
|
||||||
protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC)];
|
|
||||||
|
|
||||||
if (!file || !vma_merge(mm, prev, addr, vma->vm_end,
|
if (!file || !vma_merge(mm, prev, addr, vma->vm_end,
|
||||||
vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) {
|
vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) {
|
||||||
|
|
|
@ -194,7 +194,7 @@ success:
|
||||||
vma->vm_flags = newflags;
|
vma->vm_flags = newflags;
|
||||||
vma->vm_page_prot = vm_get_page_prot(newflags);
|
vma->vm_page_prot = vm_get_page_prot(newflags);
|
||||||
if (vma_wants_writenotify(vma)) {
|
if (vma_wants_writenotify(vma)) {
|
||||||
vma->vm_page_prot = vm_get_page_prot(newflags);
|
vma->vm_page_prot = vm_get_page_prot(newflags & ~VM_SHARED);
|
||||||
dirty_accountable = 1;
|
dirty_accountable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue