函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mprotect.c Create Date:2022-07-27 16:20:55
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:mprotect_fixup

函数原型:int mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev, unsigned long start, unsigned long end, unsigned long newflags)

返回类型:int

参数:

类型参数名称
struct vm_area_struct *vma
struct vm_area_struct **pprev
unsigned longstart
unsigned longend
unsigned longnewflags
376  mm等于The address space we belong to.
377  oldflags等于Flags, see mm.h.
378  nrpages等于endstart右移PAGE_SHIFT determines the page size
379  charged等于0
382  dirty_accountable等于0
384  如果newflags恒等于oldflags
385  pprev等于vma
386  返回:0
394  如果arch_has_pfn_modify_check()且Flags, see mm.h. 按位与Page-ranges managed without "struct page", just pure PFN 按位或Can contain "struct page" and pure PFN pages 的值且newflags按位与currently active flags 按位或VM_WRITE按位或VM_EXEC的值的值恒等于0则
397  new_pgprot等于vm_get_page_prot(newflags)
399  error等于walk_page_range - walk page table with caller specific callbacks*@mm: mm_struct representing the target process of page table walk*@start: start address of the virtual address range*@end: end address of the virtual address range*@ops: operation to call
401  如果error则返回:error
411  如果newflags按位与VM_WRITE
413  如果非Return true if the calling process may expand its vm space by the passed* number of pagesReturn true if the calling process may expand its vm space by the passed* number of pages则返回:负ENOMEM
416  如果非oldflags按位与Is a VM accounted object 按位或VM_WRITE按位或Huge TLB Page VM 按位或VM_SHARED按位或should the VM suppress accounting 的值的值则
418  charged等于nrpages
419  如果security_vm_enough_memory_mm(mm, charged)则返回:负ENOMEM
428  pgoff等于Offset (within vm_file) in PAGE_SIZEunits startOur start address within vm_mm. 右移PAGE_SHIFT determines the page size 位的值
429  pprev等于Given a mapping request (addr,end,vm_flags,file,pgoff), figure out* whether that can be merged with its predecessor or its successor
432  如果pprev
433  vma等于pprev
434  VM_WARN_ON((Flags, see mm.h. ^ newflags) & ~VM_SOFTDIRTY)
435  转到:success
438  pprev等于vma
440  如果start不等于Our start address within vm_mm.
441  error等于Split a vma into two pieces at address 'addr', a new vma is allocated* either for the first part or the tail.
442  如果error则转到:fail
446  如果end不等于The first byte after our end addresswithin vm_mm.
447  error等于Split a vma into two pieces at address 'addr', a new vma is allocated* either for the first part or the tail.
448  如果error则转到:fail
452  success :
457  Flags, see mm.h. 等于newflags
458  dirty_accountable等于Some shared mappings will want the pages marked read-only* to track write events. If so, we'll downgrade vm_page_prot* to the private version (using protection_map[] without the* VM_SHARED bit).
459  Update vma->vm_page_prot to reflect vma->vm_flags.
461  change_protection(vma, start, end, Access permissions of this VMA. , dirty_accountable, 0)
468  如果oldflags按位与VM_WRITE按位或VM_SHARED按位或VM_LOCKED的值的值恒等于VM_LOCKEDnewflags按位与VM_WRITE
470  populate_vma_page_range() - populate a range of pages in the vma
473  vm_stat_account(mm, oldflags, - nrpages)
474  vm_stat_account(mm, newflags, nrpages)
475  perf_event_mmap(vma)
476  返回:0
478  fail :
479  vm_unacct_memory(charged)
480  返回:error
调用者
名称描述
do_mprotect_pkeypkey==-1 when doing a legacy mprotect()
setup_arg_pagesFinalizes the stack vm_area_struct. The flags and permissions are updated,* the stack is optionally relocated, and some extra space is added.