Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\nommu.c Create Date:2022-07-28 14:37:05
Last Modify:2020-03-17 21:26:27 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:determine whether a mapping should be permitted and, if so, what sort of* mapping we're capable of supporting

Proto:static int validate_mmap_request(struct file *file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long pgoff, unsigned long *_capabilities)

Type:int

Parameter:

TypeParameterName
struct file *file
unsigned longaddr
unsigned longlen
unsigned longprot
unsigned longflags
unsigned longpgoff
unsigned long *_capabilities
797  If flags & Interpret addr exactly Then Return -EINVAL
800  If (flags & Mask for type of mapping ) != Changes are private && (flags & Mask for type of mapping ) != Share changes Then Return -EINVAL
804  If Not len Then Return -EINVAL
808  rlen = align the pointer to the (next) page boundary (len)
809  If Not rlen || rlen > TASK_SIZE Then Return -ENOMEM
813  If pgoff + (rlen >> PAGE_SHIFT determines the page size ) < pgoff Then Return -EOVERFLOW
816  If file Then
818  If Not mmap Then Return -ENODEV
825  If mmap_capabilities Then
827  Else
831  Case & == S_IFREG
832  Case & == S_IFBLK
836  Case & == S_IFCHR
843  Default
844  Return -EINVAL
850  If Not get_unmapped_area Then capabilities &= ~Can be mapped directly (MAP_SHARED)
852  If Not (f_mode & Has read method(s) ) Then capabilities &= ~Copy can be mapped (MAP_PRIVATE)
856  If Not (f_mode & le is open for reading ) Then Return -EACCES
859  If flags & Share changes Then
861  If prot & page can be written && Not (f_mode & le is open for writing ) Then Return -EACCES
869  If locks_verify_locked(file) Then Return -EAGAIN
877  Else
880  If Not (capabilities & Copy can be mapped (MAP_PRIVATE)) Then Return -ENODEV
895  If flags & Share changes Then
896  pr_warn("MAP_SHARED not completely supported on !MMU\n")
897  Return -EINVAL
904  If path_noexec( & f_path) Then
905  If prot & page can be executed Then Return -EPERM
907  Else if prot & page can be read && Not (prot & page can be executed ) Then
909  If personality & READ_IMPLIES_EXEC Then
920  Else
924  capabilities = Copy can be mapped (MAP_PRIVATE)
927  If prot & page can be read && personality & READ_IMPLIES_EXEC Then prot |= page can be executed
933  ret = security_mmap_addr(addr)
934  If ret < 0 Then Return ret
938  _capabilities = capabilities
939  Return 0
Caller
NameDescribe
do_mmaphandle mapping creation for uClinux