函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:elf_read_ehdr

函数原型:static int elf_read_ehdr(const char *buf, size_t len, struct elf64_hdr *ehdr)

返回类型:int

参数:

类型参数名称
const char *buf
size_tlen
struct elf64_hdr *ehdr
123  如果len小于buf_ehdr的长度则
124  pr_debug("Buffer is too small to hold ELF header.\n")
125  返回:负ENOEXEC
128  memset(ehdr, 0, ehdr的长度)
129  内存复制( ELF "magic number" , buf, ELF "magic number" 的长度)
130  如果非elf_is_elf_file(ehdr)则
131  pr_debug("No ELF header magic.\n")
132  返回:负ENOEXEC
135  如果 ELF "magic number" [EI_CLASS]不等于These are used to set parameters in the core dumps.
136  pr_debug("Not a supported ELF class.\n")
137  返回:负ENOEXEC
138  否则如果 ELF "magic number" [EI_DATA]不等于ELFDATA2LSB ELF "magic number" [EI_DATA]不等于ELFDATA2MSB
140  pr_debug("Not a supported ELF data format.\n")
141  返回:负ENOEXEC
144  buf_ehdr等于buf
145  如果elf16_to_cpu(ehdr, e_ehsize)不等于buf_ehdr的长度则
146  pr_debug("Bad ELF header size.\n")
147  返回:负ENOEXEC
150  e_type等于elf16_to_cpu(ehdr, e_type)
151  e_machine等于elf16_to_cpu(ehdr, e_machine)
152  e_version等于elf32_to_cpu(ehdr, e_version)
153  e_flags等于elf32_to_cpu(ehdr, e_flags)
154  e_phentsize等于elf16_to_cpu(ehdr, e_phentsize)
155  e_phnum等于elf16_to_cpu(ehdr, e_phnum)
156  e_shentsize等于elf16_to_cpu(ehdr, e_shentsize)
157  e_shnum等于elf16_to_cpu(ehdr, e_shnum)
158  e_shstrndx等于elf16_to_cpu(ehdr, e_shstrndx)
161  : ELF "magic number" [EI_CLASS]恒等于ELFCLASS64
162  Entry point virtual address 等于elf64_to_cpu(ehdr, Entry point virtual address )
163  Program header table file offset 等于elf64_to_cpu(ehdr, Program header table file offset )
164  Section header table file offset 等于elf64_to_cpu(ehdr, Section header table file offset )
165  退出
167  : ELF "magic number" [EI_CLASS]恒等于ELFCLASS32
168  Entry point virtual address 等于elf32_to_cpu(ehdr, Entry point virtual address )
169  Program header table file offset 等于elf32_to_cpu(ehdr, Program header table file offset )
170  Section header table file offset 等于elf32_to_cpu(ehdr, Section header table file offset )
171  退出
173  默认
174  pr_debug("Unknown ELF class.\n")
175  返回:负EINVAL
178  返回:如果lf_is_ehdr_sane - check that it is safe to use the ELF header*@buf_len: size of the buffer in which the ELF file is loaded.则0否则负ENOEXEC
调用者
名称描述
elf_read_from_bufferlf_read_from_buffer - read ELF file and sets up ELF header and ELF info*@buf: Buffer to read ELF file from