diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 3 | ||||
-rw-r--r-- | mm/mprotect.c | 6 |
2 files changed, 5 insertions, 4 deletions
@@ -1110,6 +1110,9 @@ munmap_back: | |||
1110 | if (!may_expand_vm(mm, len >> PAGE_SHIFT)) | 1110 | if (!may_expand_vm(mm, len >> PAGE_SHIFT)) |
1111 | return -ENOMEM; | 1111 | return -ENOMEM; |
1112 | 1112 | ||
1113 | if (flags & MAP_NORESERVE) | ||
1114 | vm_flags |= VM_NORESERVE; | ||
1115 | |||
1113 | if (accountable && (!(flags & MAP_NORESERVE) || | 1116 | if (accountable && (!(flags & MAP_NORESERVE) || |
1114 | sysctl_overcommit_memory == OVERCOMMIT_NEVER)) { | 1117 | sysctl_overcommit_memory == OVERCOMMIT_NEVER)) { |
1115 | if (vm_flags & VM_SHARED) { | 1118 | if (vm_flags & VM_SHARED) { |
diff --git a/mm/mprotect.c b/mm/mprotect.c index 360d9cc8b38c..abd645a3b0a0 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
@@ -153,12 +153,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; | 153 | * If we make a private mapping writable we increase our commit; |
154 | * but (without finer accounting) cannot reduce our commit if we | 154 | * but (without finer accounting) cannot reduce our commit if we |
155 | * make it unwritable again. | 155 | * 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 | */ | 156 | */ |
160 | if (newflags & VM_WRITE) { | 157 | if (newflags & VM_WRITE) { |
161 | if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_SHARED))) { | 158 | if (!(oldflags & (VM_ACCOUNT|VM_WRITE| |
159 | VM_SHARED|VM_NORESERVE))) { | ||
162 | charged = nrpages; | 160 | charged = nrpages; |
163 | if (security_vm_enough_memory(charged)) | 161 | if (security_vm_enough_memory(charged)) |
164 | return -ENOMEM; | 162 | return -ENOMEM; |