Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

Name:prctl_set_mm

Proto:static int prctl_set_mm(int opt, unsigned long addr, unsigned long arg4, unsigned long arg5)

Type:int

Parameter:

TypeParameterName
intopt
unsigned longaddr
unsigned longarg4
unsigned longarg5
2089  mm = mm
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
2120  error = -EINVAL
2127  lock for reading
2128  vma = Look up the first VMA which satisfies addr < vm_end, NULL if none.
2130  spin_lock( & protect the below fields )
2131  code section bounds = start_code
2132  end_code = end_code
2133  data section bounds = start_data
2134  end_data = end_data
2135  heap for brk() syscall = start_brk
2136  brk = brk
2137  stack starts at = start_stack
2138  command line arguments bounds = arg_start
2139  arg_end = arg_end
2140  vironment variables bounds = env_start
2141  env_end = env_end
2144  Case opt == PR_SET_MM_START_CODE
2145  code section bounds = addr
2146  Break
2147  Case opt == PR_SET_MM_END_CODE
2148  end_code = addr
2149  Break
2150  Case opt == PR_SET_MM_START_DATA
2151  data section bounds = addr
2152  Break
2153  Case opt == PR_SET_MM_END_DATA
2154  end_data = addr
2155  Break
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
2163  brk = addr
2164  Break
2165  Case opt == PR_SET_MM_ARG_START
2166  command line arguments bounds = addr
2167  Break
2168  Case opt == PR_SET_MM_ARG_END
2169  arg_end = addr
2170  Break
2171  Case opt == PR_SET_MM_ENV_START
2172  vironment variables bounds = addr
2173  Break
2174  Case opt == PR_SET_MM_ENV_END
2175  env_end = addr
2176  Break
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.
2182  If error Then Go to out
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
2198  If Not vma Then
2199  error = -EFAULT
2200  Go to out
2204  start_code = code section bounds
2205  end_code = end_code
2206  start_data = data section bounds
2207  end_data = end_data
2208  start_brk = heap for brk() syscall
2209  brk = brk
2210  start_stack = stack starts at
2211  arg_start = command line arguments bounds
2212  arg_end = arg_end
2213  env_start = vironment variables bounds
2214  env_end = env_end
2216  error = 0
2217  out :
2218  spin_unlock( & protect the below fields )
2219  lease a read lock
2220  Return error
Caller
NameDescribe
SYSCALL_DEFINE5