Lines Matching refs:vma

41 static pte_t *lock_pte_protection(struct vm_area_struct *vma, pmd_t *pmd,  in lock_pte_protection()  argument
49 return pte_offset_map_lock(vma->vm_mm, pmd, addr, ptl); in lock_pte_protection()
51 pmdl = pmd_lock(vma->vm_mm, pmd); in lock_pte_protection()
57 pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, ptl); in lock_pte_protection()
62 static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, in change_pte_range() argument
66 struct mm_struct *mm = vma->vm_mm; in change_pte_range()
71 pte = lock_pte_protection(vma, pmd, addr, prot_numa, &ptl); in change_pte_range()
89 page = vm_normal_page(vma, addr, oldpte); in change_pte_range()
106 !(vma->vm_flags & VM_SOFTDIRTY))) { in change_pte_range()
136 static inline unsigned long change_pmd_range(struct vm_area_struct *vma, in change_pmd_range() argument
141 struct mm_struct *mm = vma->vm_mm; in change_pmd_range()
163 split_huge_page_pmd(vma, addr, pmd); in change_pmd_range()
165 int nr_ptes = change_huge_pmd(vma, pmd, addr, in change_pmd_range()
180 this_pages = change_pte_range(vma, pmd, addr, next, newprot, in change_pmd_range()
193 static inline unsigned long change_pud_range(struct vm_area_struct *vma, in change_pud_range() argument
206 pages += change_pmd_range(vma, pud, addr, next, newprot, in change_pud_range()
213 static unsigned long change_protection_range(struct vm_area_struct *vma, in change_protection_range() argument
217 struct mm_struct *mm = vma->vm_mm; in change_protection_range()
225 flush_cache_range(vma, addr, end); in change_protection_range()
231 pages += change_pud_range(vma, pgd, addr, next, newprot, in change_protection_range()
237 flush_tlb_range(vma, start, end); in change_protection_range()
243 unsigned long change_protection(struct vm_area_struct *vma, unsigned long start, in change_protection() argument
249 if (is_vm_hugetlb_page(vma)) in change_protection()
250 pages = hugetlb_change_protection(vma, start, end, newprot); in change_protection()
252 pages = change_protection_range(vma, start, end, newprot, dirty_accountable, prot_numa); in change_protection()
258 mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, in mprotect_fixup() argument
261 struct mm_struct *mm = vma->vm_mm; in mprotect_fixup()
262 unsigned long oldflags = vma->vm_flags; in mprotect_fixup()
270 *pprev = vma; in mprotect_fixup()
293 pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); in mprotect_fixup()
295 vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma), in mprotect_fixup()
296 vma->vm_userfaultfd_ctx); in mprotect_fixup()
298 vma = *pprev; in mprotect_fixup()
302 *pprev = vma; in mprotect_fixup()
304 if (start != vma->vm_start) { in mprotect_fixup()
305 error = split_vma(mm, vma, start, 1); in mprotect_fixup()
310 if (end != vma->vm_end) { in mprotect_fixup()
311 error = split_vma(mm, vma, end, 0); in mprotect_fixup()
321 vma->vm_flags = newflags; in mprotect_fixup()
322 dirty_accountable = vma_wants_writenotify(vma); in mprotect_fixup()
323 vma_set_page_prot(vma); in mprotect_fixup()
325 change_protection(vma, start, end, vma->vm_page_prot, in mprotect_fixup()
334 populate_vma_page_range(vma, start, end, NULL); in mprotect_fixup()
337 vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); in mprotect_fixup()
338 vm_stat_account(mm, newflags, vma->vm_file, nrpages); in mprotect_fixup()
339 perf_event_mmap(vma); in mprotect_fixup()
351 struct vm_area_struct *vma, *prev; in SYSCALL_DEFINE3() local
380 vma = find_vma(current->mm, start); in SYSCALL_DEFINE3()
382 if (!vma) in SYSCALL_DEFINE3()
384 prev = vma->vm_prev; in SYSCALL_DEFINE3()
386 if (vma->vm_start >= end) in SYSCALL_DEFINE3()
388 start = vma->vm_start; in SYSCALL_DEFINE3()
390 if (!(vma->vm_flags & VM_GROWSDOWN)) in SYSCALL_DEFINE3()
393 if (vma->vm_start > start) in SYSCALL_DEFINE3()
396 end = vma->vm_end; in SYSCALL_DEFINE3()
398 if (!(vma->vm_flags & VM_GROWSUP)) in SYSCALL_DEFINE3()
402 if (start > vma->vm_start) in SYSCALL_DEFINE3()
403 prev = vma; in SYSCALL_DEFINE3()
411 newflags |= (vma->vm_flags & ~(VM_READ | VM_WRITE | VM_EXEC)); in SYSCALL_DEFINE3()
419 error = security_file_mprotect(vma, reqprot, prot); in SYSCALL_DEFINE3()
423 tmp = vma->vm_end; in SYSCALL_DEFINE3()
426 error = mprotect_fixup(vma, &prev, nstart, tmp, newflags); in SYSCALL_DEFINE3()
436 vma = prev->vm_next; in SYSCALL_DEFINE3()
437 if (!vma || vma->vm_start != nstart) { in SYSCALL_DEFINE3()