X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=mm%2Fmprotect.c;h=8bc969d8112d28adb32b3754d339820739e2ba8c;hb=26465d3ea5a62d59efb3796b9e0e2b0656d02cb1;hp=d0f6e7ce09f1ee88beabccff1b4025b585375062;hpb=64cdd548ffe26849d4cd113ac640f60606063b14;p=safe%2Fjmp%2Flinux-2.6 diff --git a/mm/mprotect.c b/mm/mprotect.c index d0f6e7c..8bc969d 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -151,10 +152,11 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, /* * If we make a private mapping writable we increase our commit; * but (without finer accounting) cannot reduce our commit if we - * make it unwritable again. + * make it unwritable again. hugetlb mapping were accounted for + * even if read-only so there is no need to account for them here */ if (newflags & VM_WRITE) { - if (!(oldflags & (VM_ACCOUNT|VM_WRITE| + if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_HUGETLB| VM_SHARED|VM_NORESERVE))) { charged = nrpages; if (security_vm_enough_memory(charged)) @@ -217,8 +219,8 @@ fail: return error; } -asmlinkage long -sys_mprotect(unsigned long start, size_t len, unsigned long prot) +SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len, + unsigned long, prot) { unsigned long vm_flags, nstart, end, tmp, reqprot; struct vm_area_struct *vma, *prev; @@ -298,6 +300,7 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot) error = mprotect_fixup(vma, &prev, nstart, tmp, newflags); if (error) goto out; + perf_event_mmap(vma); nstart = tmp; if (nstart < prev->vm_end)