Lines Matching refs:vma

39 static pte_t *lock_pte_protection(struct vm_area_struct *vma, pmd_t *pmd,  in lock_pte_protection()  argument
47 return pte_offset_map_lock(vma->vm_mm, pmd, addr, ptl); in lock_pte_protection()
49 pmdl = pmd_lock(vma->vm_mm, pmd); in lock_pte_protection()
55 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, ptl); in lock_pte_protection()
60 static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, in change_pte_range() argument
64 struct mm_struct *mm = vma->vm_mm; in change_pte_range()
69 pte = lock_pte_protection(vma, pmd, addr, prot_numa, &ptl); in change_pte_range()
87 page = vm_normal_page(vma, addr, oldpte); in change_pte_range()
104 !(vma->vm_flags & VM_SOFTDIRTY))) { in change_pte_range()
134 static inline unsigned long change_pmd_range(struct vm_area_struct *vma, in change_pmd_range() argument
139 struct mm_struct *mm = vma->vm_mm; in change_pmd_range()
161 split_huge_page_pmd(vma, addr, pmd); in change_pmd_range()
163 int nr_ptes = change_huge_pmd(vma, pmd, addr, in change_pmd_range()
178 this_pages = change_pte_range(vma, pmd, addr, next, newprot, in change_pmd_range()
191 static inline unsigned long change_pud_range(struct vm_area_struct *vma, in change_pud_range() argument
204 pages += change_pmd_range(vma, pud, addr, next, newprot, in change_pud_range()
211 static unsigned long change_protection_range(struct vm_area_struct *vma, in change_protection_range() argument
215 struct mm_struct *mm = vma->vm_mm; in change_protection_range()
223 flush_cache_range(vma, addr, end); in change_protection_range()
229 pages += change_pud_range(vma, pgd, addr, next, newprot, in change_protection_range()
235 flush_tlb_range(vma, start, end); in change_protection_range()
241 unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, in change_protection() argument
247 if (is_vm_hugetlb_page(vma)) in change_protection()
248 pages = hugetlb_change_protection(vma, start, end, newprot); in change_protection()
250 pages = change_protection_range(vma, start, end, newprot, dirty_accountable, prot_numa); in change_protection()
256 mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, in mprotect_fixup() argument
259 struct mm_struct *mm = vma->vm_mm; in mprotect_fixup()
260 unsigned long oldflags = vma->vm_flags; in mprotect_fixup()
268 *pprev = vma; in mprotect_fixup()
291 pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); in mprotect_fixup()
293 vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma)); in mprotect_fixup()
295 vma = *pprev; in mprotect_fixup()
299 *pprev = vma; in mprotect_fixup()
301 if (start != vma->vm_start) { in mprotect_fixup()
302 error = split_vma(mm, vma, start, 1); in mprotect_fixup()
307 if (end != vma->vm_end) { in mprotect_fixup()
308 error = split_vma(mm, vma, end, 0); in mprotect_fixup()
318 vma->vm_flags = newflags; in mprotect_fixup()
319 dirty_accountable = vma_wants_writenotify(vma); in mprotect_fixup()
320 vma_set_page_prot(vma); in mprotect_fixup()
322 change_protection(vma, start, end, vma->vm_page_prot, in mprotect_fixup()
325 vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); in mprotect_fixup()
326 vm_stat_account(mm, newflags, vma->vm_file, nrpages); in mprotect_fixup()
327 perf_event_mmap(vma); in mprotect_fixup()
339 struct vm_area_struct *vma, *prev; in SYSCALL_DEFINE3() local
368 vma = find_vma(current->mm, start); in SYSCALL_DEFINE3()
370 if (!vma) in SYSCALL_DEFINE3()
372 prev = vma->vm_prev; in SYSCALL_DEFINE3()
374 if (vma->vm_start >= end) in SYSCALL_DEFINE3()
376 start = vma->vm_start; in SYSCALL_DEFINE3()
378 if (!(vma->vm_flags & VM_GROWSDOWN)) in SYSCALL_DEFINE3()
381 if (vma->vm_start > start) in SYSCALL_DEFINE3()
384 end = vma->vm_end; in SYSCALL_DEFINE3()
386 if (!(vma->vm_flags & VM_GROWSUP)) in SYSCALL_DEFINE3()
390 if (start > vma->vm_start) in SYSCALL_DEFINE3()
391 prev = vma; in SYSCALL_DEFINE3()
399 newflags |= (vma->vm_flags & ~(VM_READ | VM_WRITE | VM_EXEC)); in SYSCALL_DEFINE3()
407 error = security_file_mprotect(vma, reqprot, prot); in SYSCALL_DEFINE3()
411 tmp = vma->vm_end; in SYSCALL_DEFINE3()
414 error = mprotect_fixup(vma, &prev, nstart, tmp, newflags); in SYSCALL_DEFINE3()
424 vma = prev->vm_next; in SYSCALL_DEFINE3()
425 if (!vma || vma->vm_start != nstart) { in SYSCALL_DEFINE3()