Function report |
Source Code:kernel\sys.c |
Create Date:2022-07-28 09:21:12 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:prctl_set_mm
Proto:static int prctl_set_mm(int opt, unsigned long addr, unsigned long arg4, unsigned long arg5)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| int | opt | |
| unsigned long | addr | |
| unsigned long | arg4 | |
| unsigned long | arg5 |
| 2090 | struct prctl_mm_map prctl_map = {auxiliary vector = NULL, vector size = 0, /proc/$pid/exe link file = - 1, } |
| 2098 | If arg5 || arg4 && opt != PR_SET_MM_AUXV && opt != PR_SET_MM_MAP && opt != PR_SET_MM_MAP_SIZE Then Return -EINVAL |
| 2108 | If Not Check operation authority Then Return -EPERM |
| 2111 | If opt == PR_SET_MM_EXE_FILE Then Return prctl_set_mm_exe_file(mm, (unsignedint)addr) |
| 2114 | If opt == PR_SET_MM_AUXV Then Return prctl_set_auxv(mm, addr, arg4) |
| 2117 | If addr >= TASK_SIZE || addr < mmap_min_addr Then Return -EINVAL |
| 2127 | lock for reading |
| 2130 | spin_lock( & protect the below fields ) |
| 2131 | code section bounds = start_code |
| 2133 | data section bounds = start_data |
| 2135 | heap for brk() syscall = start_brk |
| 2137 | stack starts at = start_stack |
| 2144 | Case opt == PR_SET_MM_START_CODE |
| 2145 | code section bounds = addr |
| 2146 | Break |
| 2147 | Case opt == PR_SET_MM_END_CODE |
| 2150 | Case opt == PR_SET_MM_START_DATA |
| 2151 | data section bounds = addr |
| 2152 | Break |
| 2153 | Case opt == PR_SET_MM_END_DATA |
| 2156 | Case opt == PR_SET_MM_START_STACK |
| 2157 | stack starts at = addr |
| 2158 | Break |
| 2159 | Case opt == PR_SET_MM_START_BRK |
| 2160 | heap for brk() syscall = addr |
| 2161 | Break |
| 2162 | Case opt == PR_SET_MM_BRK |
| 2165 | Case opt == PR_SET_MM_ARG_START |
| 2167 | Break |
| 2168 | Case opt == PR_SET_MM_ARG_END |
| 2171 | Case opt == PR_SET_MM_ENV_START |
| 2172 | vironment variables bounds = addr |
| 2173 | Break |
| 2174 | Case opt == PR_SET_MM_ENV_END |
| 2177 | Default |
| 2178 | Go to out |
| 2181 | error = Check arithmetic relations of passed addresses.* WARNING: we don't require any capability here so be very careful* in what is allowed for modification from userspace. |
| 2193 | Case opt == PR_SET_MM_START_STACK |
| 2194 | Case opt == PR_SET_MM_ARG_START |
| 2195 | Case opt == PR_SET_MM_ARG_END |
| 2196 | Case opt == PR_SET_MM_ENV_START |
| 2197 | Case opt == PR_SET_MM_ENV_END |
| 2204 | start_code = code section bounds |
| 2206 | start_data = data section bounds |
| 2208 | start_brk = heap for brk() syscall |
| 2210 | start_stack = stack starts at |
| 2216 | error = 0 |
| 2217 | out : |
| 2218 | spin_unlock( & protect the below fields ) |
| 2219 | lease a read lock |
| 2220 | Return error |
| Name | Describe |
|---|---|
| SYSCALL_DEFINE5 |
| 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 |