Function report |
Source Code:kernel\kexec_elf.c |
Create Date:2022-07-28 11:04:49 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name: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.
Proto:static bool elf_is_ehdr_sane(const struct elf64_hdr *ehdr, size_t buf_len)
Type:bool
Parameter:
| Type | Parameter | Name |
|---|---|---|
| const struct elf64_hdr * | ehdr | |
| size_t | buf_len |
| 65 | If e_phnum > 0 && e_phentsize != size of elf_phdr Then |
| 66 | pr_debug("Bad program header size.\n") |
| 67 | Return false |
| 68 | Else if e_shnum > 0 && e_shentsize != size of elf_shdr Then |
| 70 | pr_debug("Bad section header size.\n") |
| 71 | Return false |
| 72 | Else if ELF "magic number" [EI_VERSION] != EV_CURRENT || e_version != EV_CURRENT Then |
| 74 | pr_debug("Unknown ELF version.\n") |
| 75 | Return false |
| 78 | If Program header table file offset > 0 && e_phnum > 0 Then |
| 89 | pr_debug("Program headers at invalid location.\n") |
| 90 | Return false |
| 91 | Else if Program header table file offset + phdr_size > buf_len Then |
| 92 | pr_debug("Program headers truncated.\n") |
| 93 | Return false |
| 97 | If Section header table file offset > 0 && e_shnum > 0 Then |
| 108 | pr_debug("Section headers at invalid location.\n") |
| 109 | Return false |
| 110 | Else if Section header table file offset + shdr_size > buf_len Then |
| 111 | pr_debug("Section headers truncated.\n") |
| 112 | Return false |
| 116 | Return true |
| Name | Describe |
|---|---|
| elf_read_ehdr |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |