Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\binfmt_flat.c Create Date:2022-07-28 20:29:23
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:reate_flat_tables() parses the env- and arg-strings in new user* memory and creates the pointer tables from them, and puts their* addresses on the "stack", recording the new stack pointer value.

Proto:static int create_flat_tables(struct linux_binprm *bprm, unsigned long arg_start)

Type:int

Parameter:

TypeParameterName
struct linux_binprm *bprm
unsigned longarg_start
125  __user * p
126  __user * sp
129  p = arg_start
130  sp = start_stack
132  sp -= envc + 1
133  sp -= argc + 1
134  If IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK) Then sp -= 2
136  sp -= 1
138  start_stack = sp & -User data (stack) also needs to be aligned.* Here we can be a bit looser than the data sections since this* needs to only meet arch ABI requirements.
139  sp = start_stack
141  Write a simple value into user space, with less checking(argc, sp++)
142  If IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK) Then
144  argv = sp + 2
145  envp = sp + 2 + argc + 1
146  Write a simple value into user space, with less checking(argv, sp++)
147  Write a simple value into user space, with less checking(envp, sp++)
150  arg_start = p
151  When i > 0 cycle
152  Write a simple value into user space, with less checking((unsignedlong)p, sp++)
153  len = Get the size of a string in user space
154  If Not len || len > These are the maximum length and maximum number of strings passed to the* execve() system call. MAX_ARG_STRLEN is essentially random but serves to* prevent the kernel from being unduly impacted by misaddressed pointers. Then Return -EINVAL
156  p += len
158  Write a simple value into user space, with less checking(0, sp++)
159  arg_end = p
161  env_start = p
162  When i > 0 cycle
163  Write a simple value into user space, with less checking((unsignedlong)p, sp++)
164  len = Get the size of a string in user space
165  If Not len || len > These are the maximum length and maximum number of strings passed to the* execve() system call. MAX_ARG_STRLEN is essentially random but serves to* prevent the kernel from being unduly impacted by misaddressed pointers. Then Return -EINVAL
167  p += len
169  Write a simple value into user space, with less checking(0, sp++)
170  env_end = p
172  Return 0
Caller
NameDescribe
load_flat_binaryThese are the functions used to load flat style executables and shared* libraries. There is no binary dependent code anywhere else.