/linux/kernel/ |
A D | kexec_elf.c | 78 if (ehdr->e_phoff > 0 && ehdr->e_phnum > 0) { in elf_is_ehdr_sane() 88 if (ehdr->e_phoff + phdr_size < ehdr->e_phoff) { in elf_is_ehdr_sane() 97 if (ehdr->e_shoff > 0 && ehdr->e_shnum > 0) { in elf_is_ehdr_sane() 107 if (ehdr->e_shoff + shdr_size < ehdr->e_shoff) { in elf_is_ehdr_sane() 128 memset(ehdr, 0, sizeof(*ehdr)); in elf_read_ehdr() 129 memcpy(ehdr->e_ident, buf, sizeof(ehdr->e_ident)); in elf_read_ehdr() 162 ehdr->e_entry = elf64_to_cpu(ehdr, buf_ehdr->e_entry); in elf_read_ehdr() 208 const struct elfhdr *ehdr = elf_info->ehdr; in elf_read_phdr() local 255 const struct elfhdr *ehdr = elf_info->ehdr; in elf_read_phdrs() local 307 elf_info->ehdr = ehdr; in elf_read_from_buffer() [all …]
|
A D | kexec_file.c | 852 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in kexec_purgatory_setup_kbuf() 919 memcpy(sechdrs, (void *)pi->ehdr + pi->ehdr->e_shoff, in kexec_purgatory_setup_sechdrs() 969 sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; in kexec_apply_relocations() 1082 if (!pi->ehdr) in kexec_purgatory_find_symbol() 1085 ehdr = pi->ehdr; in kexec_purgatory_find_symbol() 1086 sechdrs = (void *)ehdr + ehdr->e_shoff; in kexec_purgatory_find_symbol() 1266 Elf64_Ehdr *ehdr; in crash_prepare_elf64_headers() local 1315 (ehdr->e_phnum)++; in crash_prepare_elf64_headers() 1323 (ehdr->e_phnum)++; in crash_prepare_elf64_headers() 1333 ehdr->e_phnum++; in crash_prepare_elf64_headers() [all …]
|
/linux/arch/s390/kernel/ |
A D | kexec_elf.c | 20 const Elf_Ehdr *ehdr; in kexec_file_add_kernel_elf() local 27 ehdr = (Elf_Ehdr *)kernel; in kexec_file_add_kernel_elf() 32 entry = ehdr->e_entry; in kexec_file_add_kernel_elf() 34 phdr = (void *)ehdr + ehdr->e_phoff; in kexec_file_add_kernel_elf() 71 const Elf_Ehdr *ehdr; in s390_elf_load() local 84 if (!ehdr->e_phnum || ehdr->e_phentsize != sizeof(Elf_Phdr)) in s390_elf_load() 87 size = ehdr->e_ehsize + ehdr->e_phoff; in s390_elf_load() 88 size += ehdr->e_phentsize * ehdr->e_phnum; in s390_elf_load() 92 phdr = (void *)ehdr + ehdr->e_phoff; in s390_elf_load() 112 const Elf_Ehdr *ehdr; in s390_elf_probe() local [all …]
|
/linux/arch/mips/boot/tools/ |
A D | relocs.c | 207 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in read_ehdr() 224 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr() 225 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine); in read_ehdr() 227 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry); in read_ehdr() 228 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff); in read_ehdr() 229 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff); in read_ehdr() 230 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags); in read_ehdr() 231 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize); in read_ehdr() 233 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum); in read_ehdr() 235 ehdr.e_shnum = elf_half_to_cpu(ehdr.e_shnum); in read_ehdr() [all …]
|
/linux/tools/perf/util/ |
A D | symbol-minimal.c | 119 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in filename__read_build_id() 123 ehdr.e_phoff = bswap_32(ehdr.e_phoff); in filename__read_build_id() 124 ehdr.e_phentsize = bswap_16(ehdr.e_phentsize); in filename__read_build_id() 125 ehdr.e_phnum = bswap_16(ehdr.e_phnum); in filename__read_build_id() 128 buf_size = ehdr.e_phentsize * ehdr.e_phnum; in filename__read_build_id() 170 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) in filename__read_build_id() 174 ehdr.e_phoff = bswap_64(ehdr.e_phoff); in filename__read_build_id() 175 ehdr.e_phentsize = bswap_16(ehdr.e_phentsize); in filename__read_build_id() 176 ehdr.e_phnum = bswap_16(ehdr.e_phnum); in filename__read_build_id() 179 buf_size = ehdr.e_phentsize * ehdr.e_phnum; in filename__read_build_id() [all …]
|
A D | symbol-elf.c | 81 GElf_Ehdr *ehdr; in elf_getphdrnum() local 84 if (!ehdr) in elf_getphdrnum() 299 GElf_Ehdr ehdr; in dso__synthesize_plt_symbols() local 308 ehdr = ss->ehdr; in dso__synthesize_plt_symbols() 464 GElf_Ehdr ehdr; in elf_read_build_id() local 829 return ehdr.e_type == ET_EXEC || ehdr.e_type == ET_REL || in elf__needs_adjust_symbols() 924 ss->ehdr = ehdr; in symsrc__init() 1103 ehdr = syms_ss->ehdr; in dso__load_sym_internal() 1500 ehdr = gelf_getehdr(kcore->elf, &kcore->ehdr); in kcore__open() 1501 if (!ehdr) in kcore__open() [all …]
|
/linux/scripts/ |
A D | recordmcount.h | 216 return w2(ehdr->e_shnum); in get_shnum() 222 ehdr->e_shnum = 0; in set_shnum() 345 if (uwrite(ehdr, sizeof(*ehdr)) < 0) in append_func() 379 + (void *)ehdr); in get_sym_str_and_relp() 384 + (void *)ehdr); in get_sym_str_and_relp() 387 + (void *)ehdr); in get_sym_str_and_relp() 456 + (void *)ehdr); in nop_mcount() 526 + (void *)ehdr); in find_secsym_ndx() 610 + (void *)ehdr); in do_func() 614 + (void *)ehdr); in do_func() [all …]
|
A D | sorttable.c | 332 Elf32_Ehdr *ehdr = addr; in do_file() local 335 switch (ehdr->e_ident[EI_DATA]) { in do_file() 354 ehdr->e_ident[EI_DATA], fname); in do_file() 359 (r2(&ehdr->e_type) != ET_EXEC && r2(&ehdr->e_type) != ET_DYN) || in do_file() 360 ehdr->e_ident[EI_VERSION] != EV_CURRENT) { in do_file() 365 switch (r2(&ehdr->e_machine)) { in do_file() 391 r2(&ehdr->e_machine), fname); in do_file() 395 switch (ehdr->e_ident[EI_CLASS]) { in do_file() 403 rc = do_sort_32(ehdr, fname, custom_sort); in do_file() 407 Elf64_Ehdr *const ghdr = (Elf64_Ehdr *)ehdr; in do_file() [all …]
|
A D | sorttable.h | 195 static int do_sort(Elf_Ehdr *ehdr, in do_sort() argument 200 Elf_Shdr *s, *shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); in do_sort() 226 shstrndx = r2(&ehdr->e_shstrndx); in do_sort() 231 shnum = r2(&ehdr->e_shnum); in do_sort() 249 relocs = (void *)ehdr + _r(&s->sh_offset); in do_sort() 253 symtab_shndx = (Elf32_Word *)((const char *)ehdr + in do_sort() 260 g_orc_ip_table = (int *)((void *)ehdr + in do_sort() 265 g_orc_table = (struct orc_entry *)((void *)ehdr + in do_sort() 314 symtab = (const Elf_Sym *)((const char *)ehdr + in do_sort() 330 for (sym = (void *)ehdr + _r(&symtab_sec->sh_offset); in do_sort() [all …]
|
A D | recordmcount.c | 480 Elf32_Ehdr *ehdr; in do_file() local 483 ehdr = mmap_file(fname); in do_file() 484 if (!ehdr) in do_file() 490 switch (ehdr->e_ident[EI_DATA]) { in do_file() 494 ehdr->e_ident[EI_DATA], fname); in do_file() 524 w2(ehdr->e_type) != ET_REL || in do_file() 531 switch (w2(ehdr->e_machine)) { in do_file() 534 w2(ehdr->e_machine), fname); in do_file() 576 switch (ehdr->e_ident[EI_CLASS]) { in do_file() 579 ehdr->e_ident[EI_CLASS], fname); in do_file() [all …]
|
/linux/drivers/remoteproc/ |
A D | remoteproc_coredump.c | 238 void *ehdr; in rproc_coredump() local 274 ehdr = data; in rproc_coredump() 276 memset(ehdr, 0, elf_size_of_hdr(class)); in rproc_coredump() 278 elf_hdr_init_ident(ehdr, class); in rproc_coredump() 287 elf_hdr_set_e_phnum(class, ehdr, phnum); in rproc_coredump() 347 void *ehdr; in rproc_coredump_using_sections() local 393 ehdr = data; in rproc_coredump_using_sections() 394 memset(ehdr, 0, elf_size_of_hdr(class)); in rproc_coredump_using_sections() 396 elf_hdr_init_ident(ehdr, class); in rproc_coredump_using_sections() 405 elf_hdr_set_e_shnum(class, ehdr, shnum); in rproc_coredump_using_sections() [all …]
|
A D | remoteproc_elf_loader.c | 46 struct elf32_hdr *ehdr; local 62 ehdr = (struct elf32_hdr *)fw->data; 64 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) { 69 class = ehdr->e_ident[EI_CLASS]; 82 if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) { 84 if (ehdr->e_ident[EI_DATA] != ELFDATA2MSB) { 163 const void *ehdr, *phdr; local 170 ehdr = elf_data; 171 phnum = elf_hdr_get_e_phnum(class, ehdr); 257 const void *ehdr = elf_data; local [all …]
|
/linux/lib/ |
A D | buildid.c | 72 Elf32_Ehdr *ehdr = (Elf32_Ehdr *)page_addr; in get_build_id_32() local 77 if (ehdr->e_phnum > in get_build_id_32() 83 for (i = 0; i < ehdr->e_phnum; ++i) { in get_build_id_32() 97 Elf64_Ehdr *ehdr = (Elf64_Ehdr *)page_addr; in get_build_id_64() local 102 if (ehdr->e_phnum > in get_build_id_64() 108 for (i = 0; i < ehdr->e_phnum; ++i) { in get_build_id_64() 129 Elf32_Ehdr *ehdr; in build_id_parse() local 144 ehdr = (Elf32_Ehdr *)page_addr; in build_id_parse() 151 if (ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN) in build_id_parse() 154 if (ehdr->e_ident[EI_CLASS] == ELFCLASS32) in build_id_parse() [all …]
|
/linux/arch/x86/tools/ |
A D | relocs.c | 367 if (fread(&ehdr, sizeof(ehdr), 1, fp) != 1) { in read_ehdr() 384 ehdr.e_type = elf_half_to_cpu(ehdr.e_type); in read_ehdr() 385 ehdr.e_machine = elf_half_to_cpu(ehdr.e_machine); in read_ehdr() 386 ehdr.e_version = elf_word_to_cpu(ehdr.e_version); in read_ehdr() 387 ehdr.e_entry = elf_addr_to_cpu(ehdr.e_entry); in read_ehdr() 388 ehdr.e_phoff = elf_off_to_cpu(ehdr.e_phoff); in read_ehdr() 389 ehdr.e_shoff = elf_off_to_cpu(ehdr.e_shoff); in read_ehdr() 390 ehdr.e_flags = elf_word_to_cpu(ehdr.e_flags); in read_ehdr() 391 ehdr.e_ehsize = elf_half_to_cpu(ehdr.e_ehsize); in read_ehdr() 393 ehdr.e_phnum = elf_half_to_cpu(ehdr.e_phnum); in read_ehdr() [all …]
|
/linux/arch/mips/vdso/ |
A D | genvdso.h | 9 const ELF(Ehdr) *ehdr = vdso; in FUNC() 15 shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff); in FUNC() 16 sh_count = swap_uint16(ehdr->e_shnum); in FUNC() 17 sh_entsize = swap_uint16(ehdr->e_shentsize); in FUNC() 19 shdr = shdrs + (sh_entsize * swap_uint16(ehdr->e_shstrndx)); in FUNC() 60 const ELF(Ehdr) *ehdr = vdso; in FUNC() 69 shdrs = vdso + FUNC(swap_uint)(ehdr->e_shoff); in FUNC() 70 sh_count = swap_uint16(ehdr->e_shnum); in FUNC() 71 sh_entsize = swap_uint16(ehdr->e_shentsize); in FUNC() 87 flags = swap_uint32(ehdr->e_flags); in FUNC()
|
A D | genvdso.c | 113 const Elf32_Ehdr *ehdr; in map_vdso() local 139 ehdr = addr; in map_vdso() 141 if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) { in map_vdso() 148 elf_class = ehdr->e_ident[EI_CLASS]; in map_vdso() 160 switch (ehdr->e_ident[EI_DATA]) { in map_vdso() 163 need_swap = ehdr->e_ident[EI_DATA] != HOST_ORDER; in map_vdso() 172 if (swap_uint16(ehdr->e_machine) != EM_MIPS) { in map_vdso() 178 } else if (swap_uint16(ehdr->e_type) != ET_DYN) { in map_vdso()
|
/linux/drivers/s390/crypto/ |
A D | zcrypt_error.h | 81 struct error_hdr *ehdr = reply->msg; in convert_error() local 85 switch (ehdr->reply_code) { in convert_error() 102 __func__, card, queue, ehdr->reply_code); in convert_error() 113 if (ehdr->reply_code == REP82_ERROR_TRANSPORT_FAIL && in convert_error() 114 ehdr->type == TYPE86_RSP_CODE) { in convert_error() 123 __func__, card, queue, ehdr->reply_code, apfs); in convert_error() 127 ehdr->reply_code); in convert_error() 132 __func__, card, queue, ehdr->reply_code); in convert_error()
|
/linux/arch/arm64/kvm/hyp/nvhe/ |
A D | gen-hyprel.c | 134 Elf64_Ehdr *ehdr; member 276 assert_ge(stat.st_size, sizeof(*elf.ehdr), "%lu"); in init_elf() 277 elf.ehdr = elf_ptr(Elf64_Ehdr, 0); in init_elf() 280 assert_eq(elf.ehdr->e_ident[EI_MAG0], ELFMAG0, "0x%x"); in init_elf() 281 assert_eq(elf.ehdr->e_ident[EI_MAG1], ELFMAG1, "0x%x"); in init_elf() 282 assert_eq(elf.ehdr->e_ident[EI_MAG2], ELFMAG2, "0x%x"); in init_elf() 283 assert_eq(elf.ehdr->e_ident[EI_MAG3], ELFMAG3, "0x%x"); in init_elf() 286 assert_eq(elf.ehdr->e_ident[EI_CLASS], ELFCLASS64, "%u"); in init_elf() 287 assert_eq(elf.ehdr->e_ident[EI_DATA], ELFENDIAN, "%u"); in init_elf() 288 assert_eq(elf16toh(elf.ehdr->e_type), ET_REL, "%u"); in init_elf() [all …]
|
/linux/arch/parisc/boot/compressed/ |
A D | misc.c | 236 Elf64_Ehdr ehdr; in parse_elf() local 239 Elf32_Ehdr ehdr; in parse_elf() 245 memcpy(&ehdr, output, sizeof(ehdr)); in parse_elf() 246 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || in parse_elf() 247 ehdr.e_ident[EI_MAG1] != ELFMAG1 || in parse_elf() 248 ehdr.e_ident[EI_MAG2] != ELFMAG2 || in parse_elf() 249 ehdr.e_ident[EI_MAG3] != ELFMAG3) { in parse_elf() 258 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 262 memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 264 for (i = 0; i < ehdr.e_phnum; i++) { in parse_elf()
|
/linux/drivers/soc/qcom/ |
A D | mdt_loader.c | 44 const struct elf32_hdr *ehdr; in qcom_mdt_get_size() local 49 ehdr = (struct elf32_hdr *)fw->data; in qcom_mdt_get_size() 50 phdrs = (struct elf32_phdr *)(ehdr + 1); in qcom_mdt_get_size() 52 for (i = 0; i < ehdr->e_phnum; i++) { in qcom_mdt_get_size() 89 const struct elf32_hdr *ehdr; in qcom_mdt_read_metadata() local 95 ehdr = (struct elf32_hdr *)fw->data; in qcom_mdt_read_metadata() 98 if (ehdr->e_phnum < 2) in qcom_mdt_read_metadata() 136 const struct elf32_hdr *ehdr; in __qcom_mdt_load() local 154 ehdr = (struct elf32_hdr *)fw->data; in __qcom_mdt_load() 185 for (i = 0; i < ehdr->e_phnum; i++) { in __qcom_mdt_load() [all …]
|
/linux/tools/testing/selftests/powerpc/ptrace/ |
A D | core-pkey.c | 202 void *p = ehdr, *note; in check_core_file() 205 ret = memcmp(ehdr->e_ident, ELFMAG, SELFMAG); in check_core_file() 208 FAIL_IF(ehdr->e_type != ET_CORE); in check_core_file() 209 FAIL_IF(ehdr->e_machine != EM_PPC64); in check_core_file() 210 FAIL_IF(ehdr->e_phoff == 0 || ehdr->e_phnum == 0); in check_core_file() 216 phdr_size = sizeof(*phdr) * ehdr->e_phnum; in check_core_file() 219 FAIL_IF(ehdr->e_phoff + phdr_size < ehdr->e_phoff); in check_core_file() 220 FAIL_IF(ehdr->e_phoff + phdr_size > core_size); in check_core_file() 223 for (phdr = p + ehdr->e_phoff; in check_core_file() 224 (void *) phdr < p + ehdr->e_phoff + phdr_size; in check_core_file() [all …]
|
/linux/arch/x86/boot/compressed/ |
A D | misc.c | 277 Elf64_Ehdr ehdr; in parse_elf() local 280 Elf32_Ehdr ehdr; in parse_elf() 286 memcpy(&ehdr, output, sizeof(ehdr)); in parse_elf() 287 if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || in parse_elf() 288 ehdr.e_ident[EI_MAG1] != ELFMAG1 || in parse_elf() 289 ehdr.e_ident[EI_MAG2] != ELFMAG2 || in parse_elf() 290 ehdr.e_ident[EI_MAG3] != ELFMAG3) { in parse_elf() 297 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 301 memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); in parse_elf() 303 for (i = 0; i < ehdr.e_phnum; i++) { in parse_elf()
|
/linux/arch/arm/kernel/ |
A D | vdso.c | 104 static void * __init find_section(Elf32_Ehdr *ehdr, const char *name, in find_section() argument 112 sechdrs = (void *)ehdr + ehdr->e_shoff; in find_section() 113 secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset; in find_section() 116 for (i = 1; i < ehdr->e_shnum; i++) { in find_section() 120 return (void *)ehdr + sechdrs[i].sh_offset; in find_section() 160 static void __init patch_vdso(void *ehdr) in patch_vdso() argument 165 .hdr = ehdr, in patch_vdso()
|
/linux/net/core/ |
A D | selftests.c | 61 struct ethhdr *ehdr; in net_test_get_skb() local 81 ehdr = skb_push(skb, ETH_HLEN); in net_test_get_skb() 93 eth_zero_addr(ehdr->h_dest); in net_test_get_skb() 96 ether_addr_copy(ehdr->h_source, attr->src); in net_test_get_skb() 98 ether_addr_copy(ehdr->h_dest, attr->dst); in net_test_get_skb() 100 ehdr->h_proto = htons(ETH_P_IP); in net_test_get_skb() 113 (sizeof(*ihdr) + sizeof(*ehdr))); in net_test_get_skb() 131 iplen = attr->max_size - sizeof(*ehdr); in net_test_get_skb() 179 struct ethhdr *ehdr; in net_test_loopback_validate() local 193 ehdr = (struct ethhdr *)skb_mac_header(skb); in net_test_loopback_validate() [all …]
|
/linux/net/tipc/ |
A D | crypto.c | 742 struct tipc_ehdr *ehdr; in tipc_aead_encrypt() local 896 struct tipc_ehdr *ehdr; in tipc_aead_decrypt() local 1013 struct tipc_ehdr *ehdr; in tipc_ehdr_validate() local 1046 struct tipc_ehdr *ehdr; in tipc_ehdr_build() local 1074 ehdr->user = 0; in tipc_ehdr_build() 1075 ehdr->keepalive = 0; in tipc_ehdr_build() 1076 ehdr->tx_key = tx_key; in tipc_ehdr_build() 1081 ehdr->reserved_1 = 0; in tipc_ehdr_build() 1082 ehdr->reserved_2 = 0; in tipc_ehdr_build() 1413 if (ehdr->rx_nokey) { in tipc_crypto_key_synch() [all …]
|