函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:present useful information to the program by shovelling it onto the new* process's stack

函数原型:static int create_elf_fdpic_tables(struct linux_binprm *bprm, struct mm_struct *mm, struct elf_fdpic_params *exec_params, struct elf_fdpic_params *interp_params)

返回类型:int

参数:

类型参数名称
struct linux_binprm *bprm
struct mm_struct *mm
struct elf_fdpic_params *exec_params
struct elf_fdpic_params *interp_params
502  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.()
504  __userargv
505  platform_len等于0
507  __useru_platform
517  sp等于arch_align_stack(p)
533  k_platform等于ELF_PLATFORM
534  u_platform = NULL
536  如果k_platform
537  platform_len等于strlen - Find the length of a string*@s: The string to be sized加1
538  sp减等于platform_len
539  u_platform等于sp
540  如果__copy_to_user(u_platform, k_platform, platform_len)不等于0则返回:负EFAULT
548  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.
549  u_base_platform = NULL
551  如果k_base_platform
552  platform_len等于strlen - Find the length of a string*@s: The string to be sized加1
553  sp减等于platform_len
554  u_base_platform等于sp
555  如果__copy_to_user(u_base_platform, k_base_platform, platform_len)不等于0则返回:负EFAULT
559  sp与等于7UL的反
562  len等于sizeof(structelf32_fdpic_loadmap)
563  len加等于sizeof(structelf32_fdpic_loadseg)乘 number of segments
564  sp等于splen按位与7UL的反
565  mapped loadmap user address 等于sp
567  如果copy_to_user((void__user * )sp, loadmap to be passed to userspace , len)不等于0则返回:负EFAULT
570  exec_fdpic_loadmap等于sp
572  如果loadmap to be passed to userspace
573  len等于sizeof(structelf32_fdpic_loadmap)
574  len加等于sizeof(structelf32_fdpic_loadseg)乘 number of segments
576  sp等于splen按位与7UL的反
577  mapped loadmap user address 等于sp
579  如果copy_to_user((void__user * )sp, loadmap to be passed to userspace , len)不等于0则返回:负EFAULT
583  interp_fdpic_loadmap等于sp
589  nitems等于1加rce 16 byte _final_ alignment here for generality 加如果k_platform则1否则0加如果k_base_platform则1否则0加ries in ARCH_DLINFO:
592  如果interp_flags按位与BINPRM_FLAGS_EXECFDnitems自加
595  csp等于sp
596  sp减等于nitems乘2乘sizeof(unsignedlong)
597  sp减等于envc加1的和乘*的长度
598  sp减等于argc加1的和乘*的长度
599  sp减等于1乘sizeof(unsignedlong)
601  csp减等于sp按位与15UL
602  sp减等于sp按位与15UL
615  nr等于0
616  csp减等于2乘sizeof(unsignedlong)
617  put the ELF interpreter info on the stack (d of vector , 0)
618  如果k_platform
619  nr等于0
620  csp减等于2乘sizeof(unsignedlong)
621  put the ELF interpreter info on the stack (string identifying CPU for optimizations , (elf_addr_t)(unsignedlong)u_platform)
625  如果k_base_platform
626  nr等于0
627  csp减等于2乘sizeof(unsignedlong)
628  put the ELF interpreter info on the stack (string identifying real platform, may* differ from AT_PLATFORM. , (elf_addr_t)(unsignedlong)u_base_platform)
632  如果interp_flags按位与BINPRM_FLAGS_EXECFD
633  nr等于0
634  csp减等于2乘sizeof(unsignedlong)
635  put the ELF interpreter info on the stack (le descriptor of program , interp_data)
638  nr等于0
639  csp减等于rce 16 byte _final_ alignment here for generality 乘2乘sizeof(unsignedlong)
640  put the ELF interpreter info on the stack (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. )
642  put the ELF interpreter info on the stack (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.)
644  put the ELF interpreter info on the stack (system page size , PAGE_SIZE)
645  put the ELF interpreter info on the stack (quency at which times() increments , CLOCKS_PER_SEC)
646  put the ELF interpreter info on the stack (program headers for program , mapped PT_PHDR user address )
647  put the ELF interpreter info on the stack (size of program header entry , elf_phdr的长度)
648  put the ELF interpreter info on the stack (umber of program headers , e_phnum)
649  put the ELF interpreter info on the stack (ase address of interpreter , mapped ELF header user address )
650  put the ELF interpreter info on the stack (lags , 0)
651  put the ELF interpreter info on the stack (ry point of program , mapped entry user address )
652  put the ELF interpreter info on the stack (al uid , (elf_addr_t)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.)
653  put the ELF interpreter info on the stack (ctive uid , (elf_addr_t)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.)
654  put the ELF interpreter info on the stack (al gid , (elf_addr_t)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.)
655  put the ELF interpreter info on the stack (ctive gid , (elf_addr_t)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.)
656  put the ELF interpreter info on the stack (secure mode boolean , secureexec)
657  put the ELF interpreter info on the stack (lename of program , exec)
660  nr等于0
661  csp减等于ries in ARCH_DLINFO: 乘2乘sizeof(unsignedlong)
666  ARCH_DLINFO
671  csp减等于envc加1的和乘sizeof(elf_caddr_t)
672  envp等于csp
673  csp减等于argc加1的和乘sizeof(elf_caddr_t)
674  argv等于csp
677  csp减等于sizeof(unsignedlong)
678  __put_user - Write a simple value into user space, with less checking(argc, (unsignedlong__user * )csp)
680  BUG_ON(csp != sp)
684  arg_start等于p
690  p等于arg_start
691 loop大于0循环
692  __put_user - Write a simple value into user space, with less checking((elf_caddr_t)p, argv++)
693  len等于用户字符串长度
694  如果非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
696  p加等于len
698  __put_user - Write a simple value into user space, with less checking(NULL, argv)
699  arg_end等于p
702  env_start等于p
703 loop大于0循环
704  __put_user - Write a simple value into user space, with less checking((elf_caddr_t)(unsignedlong)p, envp++)
705  len等于用户字符串长度
706  如果非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
708  p加等于len
710  __put_user - Write a simple value into user space, with less checking(NULL, envp)
711  env_end等于p
713  start_stack等于sp
714  返回:0
调用者
名称描述
load_elf_fdpic_binaryload an fdpic binary into various bits of memory