Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Persist Elf information about a module. Copy the Elf header,* section header table, section string table, and symtab section* index from info to mod->klp_info.

Proto:static int copy_module_elf(struct module *mod, struct load_info *info)

Type:int

Parameter:

TypeParameterName
struct module *mod
struct load_info *info
2107  size = size of Elf information
2108  Elf information = Allocation memory
2109  If ( Elf information == NULL) Then Return -ENOMEM
2113  size = size of hdr
2114  No 3D Now!( & hdr, hdr, size)
2117  size = size of sechdrs * e_shnum
2118  sechdrs = kmemdup(sechdrs, size, GFP_KERNEL)
2119  If (sechdrs == NULL) Then
2120  ret = -ENOMEM
2121  Go to free_info
2125  size = sh_size
2126  secstrings = kmemdup(secstrings, size, GFP_KERNEL)
2127  If (secstrings == NULL) Then
2128  ret = -ENOMEM
2129  Go to free_sechdrs
2133  symndx = sym
2134  symndx = symndx
2143  sh_addr = symtab
2145  Return 0
2147  free_sechdrs :
2148  kfree(sechdrs)
2149  free_info :
2150  kfree( Elf information )
2151  Return ret
Caller
NameDescribe
load_moduleAllocate and load the module: note that size of section 0 is alwayszero, and we rely on this for optional sections.