函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\binfmt_elf.c Create Date:2022-07-29 11:02:57
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:create_elf_tables

函数原型:static int create_elf_tables(struct linux_binprm *bprm, struct elf64_hdr *exec, unsigned long load_addr, unsigned long interp_load_addr)

返回类型:int

参数:

类型参数名称
struct linux_binprm *bprm
struct elf64_hdr *exec
unsigned longload_addr
unsigned longinterp_load_addr
167  p等于p
168  argc等于argc
169  envc等于envc
170  elf_addr_t
170  sp
171  elf_addr_t
171  u_platform
172  elf_addr_t
172  u_base_platform
173  elf_addr_t
173  u_rand_bytes
174  k_platform等于ELF_PLATFORM
175  k_base_platform等于AT_BASE_PLATFORM indicates the "real" hardware/microarchitecture.* If the arch defines ELF_BASE_PLATFORM (in asm/elf.h), the value* will be copied to the user stack in the same manner as AT_PLATFORM.
178  elf_addr_telf_info
179  ei_index等于0
180  cred等于current_cred - Access the current task's subjective credentials* Access the subjective credentials of the current task. RCU-safe,* since nobody else can modify it.()
189  p等于arch_align_stack(p)
197  u_platform = NULL
198  如果k_platform
199  len等于strlen - Find the length of a string*@s: The string to be sized加1
201  u_platform等于STACK_ALLOC(p, len)
202  如果__copy_to_user(u_platform, k_platform, len)则返回:负EFAULT
210  u_base_platform = NULL
211  如果k_base_platform
212  len等于strlen - Find the length of a string*@s: The string to be sized加1
214  u_base_platform等于STACK_ALLOC(p, len)
215  如果__copy_to_user(u_base_platform, k_base_platform, len)则返回:负EFAULT
222  get_random_bytes(k_rand_bytes, k_rand_bytes的长度)
223  u_rand_bytes等于STACK_ALLOC(p, k_rand_bytes的长度)
225  如果__copy_to_user(u_rand_bytes, k_rand_bytes, k_rand_bytes的长度)则返回:负EFAULT
229  elf_info等于saved_auxv
244  ARCH_DLINFO
246  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (arch dependent hints at CPU capabilities , This yields a mask that user programs can use to figure out whatinstruction set this CPU supports. This could be done in user space,but it's not easy, and we've already done it here. )
247  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (system page size , ELF_EXEC_PAGESIZE)
248  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (quency at which times() increments , CLOCKS_PER_SEC)
249  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (program headers for program , load_addr + Program header table file offset )
250  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (size of program header entry , elf_phdr的长度)
251  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (umber of program headers , e_phnum)
252  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (ase address of interpreter , interp_load_addr)
253  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (lags , 0)
254  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (ry point of program , Entry point virtual address )
255  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (al uid , m_kuid_munged - Create a uid from a kuid user-namespace pair.*@targ: The user namespace we want a uid in.*@kuid: The kernel internal uid to start with.* Map @kuid into the user-namespace specified by @targ and* return the resulting uid.)
256  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (ctive uid , m_kuid_munged - Create a uid from a kuid user-namespace pair.*@targ: The user namespace we want a uid in.*@kuid: The kernel internal uid to start with.* Map @kuid into the user-namespace specified by @targ and* return the resulting uid.)
257  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (al gid , m_kgid_munged - Create a gid from a kgid user-namespace pair.*@targ: The user namespace we want a gid in.*@kgid: The kernel internal gid to start with.* Map @kgid into the user-namespace specified by @targ and* return the resulting gid.)
258  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (ctive gid , m_kgid_munged - Create a gid from a kgid user-namespace pair.*@targ: The user namespace we want a gid in.*@kgid: The kernel internal gid to start with.* Map @kgid into the user-namespace specified by @targ and* return the resulting gid.)
259  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (secure mode boolean , secureexec)
260  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (address of 16 random bytes , (elf_addr_t)(unsignedlong)u_rand_bytes)
262  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (xtension of AT_HWCAP , HWCAP2 supplies mask with kernel enabled CPU features, so that* the application can discover that it can safely use them.* The bits are defined in uapi/asm/hwcap2.h.)
264  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (lename of program , exec)
265  如果k_platform
266  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (string identifying CPU for optimizations , (elf_addr_t)(unsignedlong)u_platform)
269  如果k_base_platform
270  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (string identifying real platform, may* differ from AT_PLATFORM. , (elf_addr_t)(unsignedlong)u_base_platform)
273  如果interp_flags按位与BINPRM_FLAGS_EXECFD
274  update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes (le descriptor of program , interp_data)
278  memset( & elf_info[ei_index], 0, sizeofsaved_auxv - ei_index * sizeofelf_info[0])
282  ei_index加等于2
284  sp等于STACK_ADD(p, ei_index)
286  items等于argc加1加envc加1加1
287  p等于STACK_ROUND(sp, items)
294  sp等于p
302  vma等于d a VMA* - we don't extend stack VMAs under NOMMU conditions
303  如果非vma则返回:负EFAULT
307  如果__put_user - Write a simple value into user space, with less checking(argc, sp++)则返回:负EFAULT
311  p等于arg_end等于arg_start
312 argc自减大于0循环
314  如果__put_user - Write a simple value into user space, with less checking((elf_addr_t)p, sp++)则返回:负EFAULT
316  len等于用户字符串长度
317  如果非lenlen大于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.则返回:负EINVAL
319  p加等于len
321  如果__put_user - Write a simple value into user space, with less checking(0, sp++)则返回:负EFAULT
323  arg_end等于p
326  env_end等于env_start等于p
327 envc自减大于0循环
329  如果__put_user - Write a simple value into user space, with less checking((elf_addr_t)p, sp++)则返回:负EFAULT
331  len等于用户字符串长度
332  如果非lenlen大于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.则返回:负EINVAL
334  p加等于len
336  如果__put_user - Write a simple value into user space, with less checking(0, sp++)则返回:负EFAULT
338  env_end等于p
341  如果copy_to_user(sp, elf_info, ei_index * elf_addr_t的长度)则返回:负EFAULT
343  返回:0
调用者
名称描述
load_elf_binary