diff options
Diffstat (limited to 'mm/mprotect.c')
-rw-r--r-- | mm/mprotect.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c index b426f01c5e9c..672a76fddd5e 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
@@ -125,6 +125,14 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, | |||
125 | * a MAP_NORESERVE private mapping to writable will now reserve. | 125 | * a MAP_NORESERVE private mapping to writable will now reserve. |
126 | */ | 126 | */ |
127 | if (newflags & VM_WRITE) { | 127 | if (newflags & VM_WRITE) { |
128 | if (oldflags & VM_RESERVED) { | ||
129 | BUG_ON(oldflags & VM_WRITE); | ||
130 | printk(KERN_WARNING "program %s is using MAP_PRIVATE, " | ||
131 | "PROT_WRITE mprotect of VM_RESERVED memory, " | ||
132 | "which is deprecated. Please report this to " | ||
133 | "linux-kernel@vger.kernel.org\n",current->comm); | ||
134 | return -EACCES; | ||
135 | } | ||
128 | if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_SHARED|VM_HUGETLB))) { | 136 | if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_SHARED|VM_HUGETLB))) { |
129 | charged = nrpages; | 137 | charged = nrpages; |
130 | if (security_vm_enough_memory(charged)) | 138 | if (security_vm_enough_memory(charged)) |