Function report |
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 activity | Download SCCT | Chinese |
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:
Type | Parameter | Name |
---|---|---|
struct file * | file | |
unsigned long | addr | |
unsigned long | len | |
unsigned long | prot | |
unsigned long | flags | |
unsigned long | pgoff | |
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 |
813 | If pgoff + (rlen >> PAGE_SHIFT determines the page size ) < pgoff Then Return -EOVERFLOW |
816 | If file Then |
825 | If mmap_capabilities Then |
826 | capabilities = mmap_capabilities(file) |
827 | Else |
831 | Case & == S_IFREG |
832 | Case & == S_IFBLK |
834 | Break |
836 | Case & == S_IFCHR |
837 | capabilities = Can be mapped directly (MAP_SHARED) | Can be mapped for reading | Can be mapped for writing |
841 | Break |
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 |
865 | If IS_APPEND(file_inode(file)) && f_mode & le is open for writing Then Return -EACCES |
869 | If locks_verify_locked(file) Then Return -EAGAIN |
872 | If Not (capabilities & Can be mapped directly (MAP_SHARED)) Then Return -ENODEV |
877 | Else |
880 | If Not (capabilities & Copy can be mapped (MAP_PRIVATE)) Then Return -ENODEV |
885 | If prot & page can be written Then capabilities &= ~Can be mapped directly (MAP_SHARED) |
889 | If capabilities & Can be mapped directly (MAP_SHARED) Then |
890 | If prot & page can be read && Not (capabilities & Can be mapped for reading) || prot & page can be written && Not (capabilities & Can be mapped for writing) || prot & page can be executed && Not (capabilities & Can be mapped for execution) Then |
895 | If flags & Share changes Then |
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 |
910 | If capabilities & Can be mapped for execution Then prot |= page can be executed |
913 | Else if prot & page can be read && prot & page can be executed && Not (capabilities & Can be mapped for execution) Then |
920 | Else |
927 | If prot & page can be read && personality & READ_IMPLIES_EXEC Then prot |= page can be executed |
933 | ret = security_mmap_addr(addr) |
938 | _capabilities = capabilities |
939 | Return 0 |
Name | Describe |
---|---|
do_mmap | handle mapping creation for uClinux |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |