函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:pkey==-1 when doing a legacy mprotect()

函数原型:static int do_mprotect_pkey(unsigned long start, size_t len, unsigned long prot, int pkey)

返回类型:int

参数:

类型参数名称
unsigned longstart
size_tlen
unsigned longprot
intpkey
491  error等于负EINVAL
492  grows等于prot按位与mprotect flag: extend change to start of growsdown vma 按位或mprotect flag: extend change to end of growsup vma 的值
493  rier等于personality按位与READ_IMPLIES_EXECprot按位与page can be read
496  start等于Architectures that support memory tagging (assigning tags to memory regions,* embedding these tags into addresses that point to these memory regions, and* checking that the memory and the pointer tags match on memory accesses)(start)
498  prot与等于mprotect flag: extend change to start of growsdown vma 按位或mprotect flag: extend change to end of growsup vma 的值的反
499  如果grows恒等于mprotect flag: extend change to start of growsdown vma 按位或mprotect flag: extend change to end of growsup vma 的值则返回:负EINVAL
502  如果start按位与PAGE_MASK的反则返回:负EINVAL
504  如果非len则返回:0
506  len等于 align the pointer to the (next) page boundary (len)
507  end等于startlen
508  如果end小于等于start则返回:负ENOMEM
510  如果非This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have* already been masked out.* Returns true if the prot flags are valid则返回:负EINVAL
513  reqprot等于prot
515  如果lock for writing则返回:负EINTR
522  error等于负EINVAL
523  如果pkey不等于负1且非mm_pkey_is_allocated(mm, pkey)则转到:out
526  vma等于Look up the first VMA which satisfies addr < vm_end, NULL if none.
527  error等于负ENOMEM
528  如果非vma则转到:out
530  prev等于linked list of VM areas per task, sorted by address
531  如果此条件成立可能性小(为编译器优化)(grows & mprotect flag: extend change to start of growsdown vma )则
532  如果Our start address within vm_mm. 大于等于end则转到:out
534  start等于Our start address within vm_mm.
535  error等于负EINVAL
536  如果非Flags, see mm.h. 按位与general info on the segment 的值则转到:out
538  否则
539  如果Our start address within vm_mm. 大于start则转到:out
543  error等于负EINVAL
544  如果非Flags, see mm.h. 按位与VM_GROWSUP的值则转到:out
548  如果start大于Our start address within vm_mm. prev等于vma
551  循环
559  如果rierFlags, see mm.h. 按位与VM_MAYEXECprot或等于page can be executed
567  mask_off_old_flags等于currently active flags 按位或VM_WRITE按位或VM_EXEC按位或VM_FLAGS_CLEAR
570  new_vma_pkey等于arch_override_mprotect_pkey(vma, prot, pkey)
571  newflags等于Combine the mmap "prot" argument into "vm_flags" used internally.
572  newflags或等于Flags, see mm.h. 按位与mask_off_old_flags的反
575  如果newflags按位与newflags右移4位的值的反按位与currently active flags 按位或VM_WRITE按位或VM_EXEC的值则
576  error等于负EACCES
577  转到:out
580  error等于security_file_mprotect(vma, reqprot, prot)
581  如果error则转到:out
584  tmp等于The first byte after our end addresswithin vm_mm.
585  如果tmp大于endtmp等于end
587  error等于mprotect_fixup(vma, & prev, nstart, tmp, newflags)
588  如果error则转到:out
590  nstart等于tmp
592  如果nstart小于The first byte after our end addresswithin vm_mm. nstart等于The first byte after our end addresswithin vm_mm.
594  如果nstart大于等于end则转到:out
597  vma等于linked list of VM areas per task, sorted by address
598  如果非vmaOur start address within vm_mm. 不等于nstart
599  error等于负ENOMEM
600  转到:out
602  prot等于reqprot
604  out :
605  lease a write lock
606  返回:error
调用者
名称描述
SYSCALL_DEFINE3