diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-08-14 06:19:59 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-08-14 06:19:59 -0400 |
| commit | 8d7ccaa545490cdffdfaff0842436a8dd85cf47b (patch) | |
| tree | 8129b5907161bc6ae26deb3645ce1e280c5e1f51 /mm/mprotect.c | |
| parent | b2139aa0eec330c711c5a279db361e5ef1178e78 (diff) | |
| parent | 30a2f3c60a84092c8084dfe788b710f8d0768cd4 (diff) | |
Merge commit 'v2.6.27-rc3' into x86/prototypes
Conflicts:
include/asm-x86/dma-mapping.h
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'mm/mprotect.c')
| -rw-r--r-- | mm/mprotect.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c index 360d9cc8b38c..fded06f923f4 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/syscalls.h> | 21 | #include <linux/syscalls.h> |
| 22 | #include <linux/swap.h> | 22 | #include <linux/swap.h> |
| 23 | #include <linux/swapops.h> | 23 | #include <linux/swapops.h> |
| 24 | #include <linux/mmu_notifier.h> | ||
| 24 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
| 25 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
| 26 | #include <asm/cacheflush.h> | 27 | #include <asm/cacheflush.h> |
| @@ -153,12 +154,10 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, | |||
| 153 | * If we make a private mapping writable we increase our commit; | 154 | * If we make a private mapping writable we increase our commit; |
| 154 | * but (without finer accounting) cannot reduce our commit if we | 155 | * but (without finer accounting) cannot reduce our commit if we |
| 155 | * make it unwritable again. | 156 | * make it unwritable again. |
| 156 | * | ||
| 157 | * FIXME? We haven't defined a VM_NORESERVE flag, so mprotecting | ||
| 158 | * a MAP_NORESERVE private mapping to writable will now reserve. | ||
| 159 | */ | 157 | */ |
| 160 | if (newflags & VM_WRITE) { | 158 | if (newflags & VM_WRITE) { |
| 161 | if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_SHARED))) { | 159 | if (!(oldflags & (VM_ACCOUNT|VM_WRITE| |
| 160 | VM_SHARED|VM_NORESERVE))) { | ||
| 162 | charged = nrpages; | 161 | charged = nrpages; |
| 163 | if (security_vm_enough_memory(charged)) | 162 | if (security_vm_enough_memory(charged)) |
| 164 | return -ENOMEM; | 163 | return -ENOMEM; |
| @@ -205,10 +204,12 @@ success: | |||
| 205 | dirty_accountable = 1; | 204 | dirty_accountable = 1; |
| 206 | } | 205 | } |
| 207 | 206 | ||
| 207 | mmu_notifier_invalidate_range_start(mm, start, end); | ||
| 208 | if (is_vm_hugetlb_page(vma)) | 208 | if (is_vm_hugetlb_page(vma)) |
| 209 | hugetlb_change_protection(vma, start, end, vma->vm_page_prot); | 209 | hugetlb_change_protection(vma, start, end, vma->vm_page_prot); |
| 210 | else | 210 | else |
| 211 | change_protection(vma, start, end, vma->vm_page_prot, dirty_accountable); | 211 | change_protection(vma, start, end, vma->vm_page_prot, dirty_accountable); |
| 212 | mmu_notifier_invalidate_range_end(mm, start, end); | ||
| 212 | vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); | 213 | vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); |
| 213 | vm_stat_account(mm, newflags, vma->vm_file, nrpages); | 214 | vm_stat_account(mm, newflags, vma->vm_file, nrpages); |
| 214 | return 0; | 215 | return 0; |
