/linux-6.12.1/drivers/soc/qcom/ |
D | mdt_loader.c | 21 static bool mdt_phdr_valid(const struct elf32_phdr *phdr) in mdt_phdr_valid() argument 23 if (phdr->p_type != PT_LOAD) in mdt_phdr_valid() 26 if ((phdr->p_flags & QCOM_MDT_TYPE_MASK) == QCOM_MDT_TYPE_HASH) in mdt_phdr_valid() 29 if (!phdr->p_memsz) in mdt_phdr_valid() 39 const struct elf32_phdr *phdr = &phdrs[segment]; in mdt_load_split_segment() local 52 ptr, phdr->p_filesz); in mdt_load_split_segment() 58 if (seg_fw->size != phdr->p_filesz) { in mdt_load_split_segment() 79 const struct elf32_phdr *phdr; in qcom_mdt_get_size() local 89 phdr = &phdrs[i]; in qcom_mdt_get_size() 91 if (!mdt_phdr_valid(phdr)) in qcom_mdt_get_size() [all …]
|
D | smem.c | 292 phdr_to_last_uncached_entry(struct smem_partition_header *phdr) in phdr_to_last_uncached_entry() argument 294 void *p = phdr; in phdr_to_last_uncached_entry() 296 return p + le32_to_cpu(phdr->offset_free_uncached); in phdr_to_last_uncached_entry() 300 phdr_to_first_cached_entry(struct smem_partition_header *phdr, in phdr_to_first_cached_entry() argument 303 void *p = phdr; in phdr_to_first_cached_entry() 306 return p + le32_to_cpu(phdr->size) - ALIGN(sizeof(*e), cacheline); in phdr_to_first_cached_entry() 310 phdr_to_last_cached_entry(struct smem_partition_header *phdr) in phdr_to_last_cached_entry() argument 312 void *p = phdr; in phdr_to_last_cached_entry() 314 return p + le32_to_cpu(phdr->offset_free_cached); in phdr_to_last_cached_entry() 318 phdr_to_first_uncached_entry(struct smem_partition_header *phdr) in phdr_to_first_uncached_entry() argument [all …]
|
/linux-6.12.1/arch/s390/kernel/ |
D | kexec_elf.c | 21 const Elf_Phdr *phdr; in kexec_file_add_kernel_elf() local 34 phdr = (void *)ehdr + ehdr->e_phoff; in kexec_file_add_kernel_elf() 35 for (i = 0; i < ehdr->e_phnum; i++, phdr++) { in kexec_file_add_kernel_elf() 36 if (phdr->p_type != PT_LOAD) in kexec_file_add_kernel_elf() 39 buf.buffer = kernel + phdr->p_offset; in kexec_file_add_kernel_elf() 40 buf.bufsz = phdr->p_filesz; in kexec_file_add_kernel_elf() 42 buf.mem = ALIGN(phdr->p_paddr, phdr->p_align); in kexec_file_add_kernel_elf() 47 buf.memsz = phdr->p_memsz; in kexec_file_add_kernel_elf() 48 data->memsz = ALIGN(data->memsz, phdr->p_align) + buf.memsz; in kexec_file_add_kernel_elf() 50 if (entry - phdr->p_paddr < phdr->p_memsz) { in kexec_file_add_kernel_elf() [all …]
|
D | crash_dump.c | 503 static void loads_init(Elf64_Phdr *phdr, bool os_info_has_vm) in loads_init() argument 512 phdr->p_type = PT_LOAD; in loads_init() 513 phdr->p_vaddr = old_identity_base + start; in loads_init() 514 phdr->p_offset = start; in loads_init() 515 phdr->p_paddr = start; in loads_init() 516 phdr->p_filesz = end - start; in loads_init() 517 phdr->p_memsz = end - start; in loads_init() 518 phdr->p_flags = PF_R | PF_W | PF_X; in loads_init() 519 phdr->p_align = PAGE_SIZE; in loads_init() 520 phdr++; in loads_init() [all …]
|
/linux-6.12.1/fs/ |
D | binfmt_elf_fdpic.c | 141 struct elf_phdr *phdr; in elf_fdpic_fetch_phdrs() local 161 phdr = params->phdrs; in elf_fdpic_fetch_phdrs() 162 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_fetch_phdrs() 163 if (phdr->p_type != PT_GNU_STACK) in elf_fdpic_fetch_phdrs() 166 if (phdr->p_flags & PF_X) in elf_fdpic_fetch_phdrs() 171 params->stack_size = phdr->p_memsz; in elf_fdpic_fetch_phdrs() 186 struct elf_phdr *phdr; in load_elf_fdpic_binary() local 229 phdr = exec_params.phdrs; in load_elf_fdpic_binary() 231 for (i = 0; i < exec_params.hdr.e_phnum; i++, phdr++) { in load_elf_fdpic_binary() 232 switch (phdr->p_type) { in load_elf_fdpic_binary() [all …]
|
/linux-6.12.1/kernel/ |
D | kexec_elf.c | 185 static bool elf_is_phdr_sane(const struct elf_phdr *phdr, size_t buf_len) in elf_is_phdr_sane() argument 188 if (phdr->p_offset + phdr->p_filesz < phdr->p_offset) { in elf_is_phdr_sane() 191 } else if (phdr->p_offset + phdr->p_filesz > buf_len) { in elf_is_phdr_sane() 194 } else if (phdr->p_paddr + phdr->p_memsz < phdr->p_paddr) { in elf_is_phdr_sane() 207 struct elf_phdr *phdr = (struct elf_phdr *) &elf_info->proghdrs[idx]; in elf_read_phdr() local 215 phdr->p_type = elf32_to_cpu(elf_info->ehdr, buf_phdr->p_type); in elf_read_phdr() 216 phdr->p_flags = elf32_to_cpu(elf_info->ehdr, buf_phdr->p_flags); in elf_read_phdr() 220 phdr->p_offset = elf64_to_cpu(ehdr, buf_phdr->p_offset); in elf_read_phdr() 221 phdr->p_paddr = elf64_to_cpu(ehdr, buf_phdr->p_paddr); in elf_read_phdr() 222 phdr->p_vaddr = elf64_to_cpu(ehdr, buf_phdr->p_vaddr); in elf_read_phdr() [all …]
|
D | crash_core.c | 165 Elf64_Phdr *phdr; in crash_prepare_elf64_headers() local 193 phdr = (Elf64_Phdr *)(ehdr + 1); in crash_prepare_elf64_headers() 209 phdr->p_type = PT_NOTE; in crash_prepare_elf64_headers() 211 phdr->p_offset = phdr->p_paddr = notes_addr; in crash_prepare_elf64_headers() 212 phdr->p_filesz = phdr->p_memsz = sizeof(note_buf_t); in crash_prepare_elf64_headers() 214 phdr++; in crash_prepare_elf64_headers() 218 phdr->p_type = PT_NOTE; in crash_prepare_elf64_headers() 219 phdr->p_offset = phdr->p_paddr = paddr_vmcoreinfo_note(); in crash_prepare_elf64_headers() 220 phdr->p_filesz = phdr->p_memsz = VMCOREINFO_NOTE_SIZE; in crash_prepare_elf64_headers() 222 phdr++; in crash_prepare_elf64_headers() [all …]
|
/linux-6.12.1/tools/testing/selftests/kvm/lib/ |
D | elf.c | 148 Elf64_Phdr phdr; in kvm_vm_elf_load() local 149 test_read(fd, &phdr, sizeof(phdr)); in kvm_vm_elf_load() 152 if (phdr.p_type != PT_LOAD) in kvm_vm_elf_load() 156 TEST_ASSERT(phdr.p_memsz > 0, "Unexpected loadable segment " in kvm_vm_elf_load() 159 n1, (uint64_t) phdr.p_memsz); in kvm_vm_elf_load() 160 vm_vaddr_t seg_vstart = align_down(phdr.p_vaddr, vm->page_size); in kvm_vm_elf_load() 161 vm_vaddr_t seg_vend = phdr.p_vaddr + phdr.p_memsz - 1; in kvm_vm_elf_load() 181 if (phdr.p_filesz) { in kvm_vm_elf_load() 182 offset_rv = lseek(fd, phdr.p_offset, SEEK_SET); in kvm_vm_elf_load() 183 TEST_ASSERT(offset_rv == phdr.p_offset, in kvm_vm_elf_load() [all …]
|
/linux-6.12.1/arch/arm64/kernel/ |
D | elfcore.c | 96 struct elf_phdr phdr; in elf_core_write_extra_phdrs() local 98 phdr.p_type = PT_AARCH64_MEMTAG_MTE; in elf_core_write_extra_phdrs() 99 phdr.p_offset = offset; in elf_core_write_extra_phdrs() 100 phdr.p_vaddr = m->start; in elf_core_write_extra_phdrs() 101 phdr.p_paddr = 0; in elf_core_write_extra_phdrs() 102 phdr.p_filesz = mte_vma_tag_dump_size(m); in elf_core_write_extra_phdrs() 103 phdr.p_memsz = m->end - m->start; in elf_core_write_extra_phdrs() 104 offset += phdr.p_filesz; in elf_core_write_extra_phdrs() 105 phdr.p_flags = 0; in elf_core_write_extra_phdrs() 106 phdr.p_align = 0; in elf_core_write_extra_phdrs() [all …]
|
/linux-6.12.1/tools/perf/util/ |
D | symbol-minimal.c | 117 Elf32_Phdr *phdr; in filename__read_build_id() local 137 for (i = 0, phdr = buf; i < ehdr.e_phnum; i++, phdr++) { in filename__read_build_id() 142 phdr->p_type = bswap_32(phdr->p_type); in filename__read_build_id() 143 phdr->p_offset = bswap_32(phdr->p_offset); in filename__read_build_id() 144 phdr->p_filesz = bswap_32(phdr->p_filesz); in filename__read_build_id() 147 if (phdr->p_type != PT_NOTE) in filename__read_build_id() 150 buf_size = phdr->p_filesz; in filename__read_build_id() 151 offset = phdr->p_offset; in filename__read_build_id() 169 Elf64_Phdr *phdr; in filename__read_build_id() local 189 for (i = 0, phdr = buf; i < ehdr.e_phnum; i++, phdr++) { in filename__read_build_id() [all …]
|
/linux-6.12.1/arch/x86/um/ |
D | elfcore.c | 27 struct elf_phdr phdr = phdrp[i]; in elf_core_write_extra_phdrs() local 29 if (phdr.p_type == PT_LOAD) { in elf_core_write_extra_phdrs() 30 ofs = phdr.p_offset = offset; in elf_core_write_extra_phdrs() 31 offset += phdr.p_filesz; in elf_core_write_extra_phdrs() 33 phdr.p_offset += ofs; in elf_core_write_extra_phdrs() 35 phdr.p_paddr = 0; /* match other core phdrs */ in elf_core_write_extra_phdrs() 36 if (!dump_emit(cprm, &phdr, sizeof(phdr))) in elf_core_write_extra_phdrs()
|
/linux-6.12.1/fs/proc/ |
D | vmcore.c | 853 Elf64_Phdr phdr; in merge_note_headers_elf64() local 876 phdr.p_type = PT_NOTE; in merge_note_headers_elf64() 877 phdr.p_flags = 0; in merge_note_headers_elf64() 880 phdr.p_offset = roundup(note_off, PAGE_SIZE); in merge_note_headers_elf64() 881 phdr.p_vaddr = phdr.p_paddr = 0; in merge_note_headers_elf64() 882 phdr.p_filesz = phdr.p_memsz = phdr_sz; in merge_note_headers_elf64() 883 phdr.p_align = 4; in merge_note_headers_elf64() 887 memcpy(tmp, &phdr, sizeof(phdr)); in merge_note_headers_elf64() 888 tmp += sizeof(phdr); in merge_note_headers_elf64() 903 elfnotes_orig_sz = phdr.p_memsz; in merge_note_headers_elf64() [all …]
|
/linux-6.12.1/arch/powerpc/kernel/ |
D | fadump.c | 760 struct elf_phdr *phdr; in fadump_update_elfcore_header() local 765 phdr = (struct elf_phdr *)bufp; in fadump_update_elfcore_header() 767 if (phdr->p_type == PT_NOTE) { in fadump_update_elfcore_header() 768 phdr->p_paddr = __pa(fw_dump.cpu_notes_buf_vaddr); in fadump_update_elfcore_header() 769 phdr->p_offset = phdr->p_paddr; in fadump_update_elfcore_header() 770 phdr->p_filesz = fw_dump.cpu_notes_buf_size; in fadump_update_elfcore_header() 771 phdr->p_memsz = fw_dump.cpu_notes_buf_size; in fadump_update_elfcore_header() 990 static void __init populate_elf_pt_load(struct elf_phdr *phdr, u64 start, in populate_elf_pt_load() argument 993 phdr->p_align = 0; in populate_elf_pt_load() 994 phdr->p_memsz = size; in populate_elf_pt_load() [all …]
|
/linux-6.12.1/drivers/media/common/siano/ |
D | smsendian.c | 87 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)msg; in smsendian_handle_message_header() local 89 phdr->msg_type = le16_to_cpu((__force __le16)phdr->msg_type); in smsendian_handle_message_header() 90 phdr->msg_length = le16_to_cpu((__force __le16)phdr->msg_length); in smsendian_handle_message_header() 91 phdr->msg_flags = le16_to_cpu((__force __le16)phdr->msg_flags); in smsendian_handle_message_header()
|
/linux-6.12.1/drivers/media/usb/siano/ |
D | smsusb.c | 98 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)surb->cb->p; in smsusb_onresponse() local 100 smsendian_handle_message_header(phdr); in smsusb_onresponse() 101 if (urb->actual_length >= phdr->msg_length) { in smsusb_onresponse() 102 surb->cb->size = phdr->msg_length; in smsusb_onresponse() 105 (phdr->msg_flags & MSG_HDR_FLAG_SPLIT_MSG)) { in smsusb_onresponse() 109 ((phdr->msg_flags >> 8) & 3); in smsusb_onresponse() 112 if (((int) phdr->msg_length + in smsusb_onresponse() 115 phdr->msg_length, in smsusb_onresponse() 123 memcpy((char *) phdr + surb->cb->offset, in smsusb_onresponse() 124 phdr, sizeof(struct sms_msg_hdr)); in smsusb_onresponse() [all …]
|
/linux-6.12.1/drivers/remoteproc/ |
D | remoteproc_elf_helpers.h | 70 ELF_GEN_FIELD_GET_SET(phdr, p_paddr, u64) in ELF_GEN_FIELD_GET_SET() 71 ELF_GEN_FIELD_GET_SET(phdr, p_vaddr, u64) in ELF_GEN_FIELD_GET_SET() 72 ELF_GEN_FIELD_GET_SET(phdr, p_filesz, u64) in ELF_GEN_FIELD_GET_SET() 73 ELF_GEN_FIELD_GET_SET(phdr, p_memsz, u64) in ELF_GEN_FIELD_GET_SET() 74 ELF_GEN_FIELD_GET_SET(phdr, p_type, u32) in ELF_GEN_FIELD_GET_SET() 75 ELF_GEN_FIELD_GET_SET(phdr, p_offset, u64) in ELF_GEN_FIELD_GET_SET() 76 ELF_GEN_FIELD_GET_SET(phdr, p_flags, u32) in ELF_GEN_FIELD_GET_SET() 77 ELF_GEN_FIELD_GET_SET(phdr, p_align, u64) in ELF_GEN_FIELD_GET_SET() 97 ELF_STRUCT_SIZE(phdr)
|
D | remoteproc_coredump.c | 238 void *phdr; in rproc_coredump() local 290 phdr = data + elf_hdr_get_e_phoff(class, ehdr); in rproc_coredump() 295 memset(phdr, 0, elf_size_of_phdr(class)); in rproc_coredump() 296 elf_phdr_set_p_type(class, phdr, PT_LOAD); in rproc_coredump() 297 elf_phdr_set_p_offset(class, phdr, offset); in rproc_coredump() 298 elf_phdr_set_p_vaddr(class, phdr, segment->da); in rproc_coredump() 299 elf_phdr_set_p_paddr(class, phdr, segment->da); in rproc_coredump() 300 elf_phdr_set_p_filesz(class, phdr, segment->size); in rproc_coredump() 301 elf_phdr_set_p_memsz(class, phdr, segment->size); in rproc_coredump() 302 elf_phdr_set_p_flags(class, phdr, PF_R | PF_W | PF_X); in rproc_coredump() [all …]
|
/linux-6.12.1/arch/riscv/kernel/ |
D | elf_kexec.c | 45 const struct elf_phdr *phdr; in riscv_kexec_elf_load() local 50 phdr = &elf_info->proghdrs[i]; in riscv_kexec_elf_load() 51 if (phdr->p_type != PT_LOAD) in riscv_kexec_elf_load() 54 size = phdr->p_filesz; in riscv_kexec_elf_load() 55 if (size > phdr->p_memsz) in riscv_kexec_elf_load() 56 size = phdr->p_memsz; in riscv_kexec_elf_load() 58 kbuf.buffer = (void *) elf_info->buffer + phdr->p_offset; in riscv_kexec_elf_load() 60 kbuf.buf_align = phdr->p_align; in riscv_kexec_elf_load() 61 kbuf.mem = phdr->p_paddr - old_pbase + new_pbase; in riscv_kexec_elf_load() 62 kbuf.memsz = phdr->p_memsz; in riscv_kexec_elf_load() [all …]
|
/linux-6.12.1/arch/powerpc/platforms/powernv/ |
D | opal-core.c | 307 Elf64_Phdr *phdr; in create_opalcore() local 380 phdr = (Elf64_Phdr *)bufp; in create_opalcore() 382 phdr->p_type = cpu_to_be32(PT_NOTE); in create_opalcore() 383 phdr->p_flags = 0; in create_opalcore() 384 phdr->p_align = 0; in create_opalcore() 385 phdr->p_paddr = phdr->p_vaddr = 0; in create_opalcore() 386 phdr->p_offset = cpu_to_be64(hdr_size); in create_opalcore() 387 phdr->p_filesz = phdr->p_memsz = cpu_to_be64(cpu_notes_size); in create_opalcore() 394 phdr = (Elf64_Phdr *)bufp; in create_opalcore() 396 phdr->p_type = cpu_to_be32(PT_LOAD); in create_opalcore() [all …]
|
/linux-6.12.1/tools/testing/selftests/sgx/ |
D | load.c | 235 Elf64_Phdr *phdr = &phdr_tbl[i]; in encl_load() local 237 if (phdr->p_type == PT_LOAD) in encl_load() 247 Elf64_Phdr *phdr = &phdr_tbl[i]; in encl_load() local 248 unsigned int flags = phdr->p_flags; in encl_load() 250 if (phdr->p_type != PT_LOAD) in encl_load() 258 phdr->p_flags); in encl_load() 265 phdr->p_flags); in encl_load() 270 src_offset = phdr->p_offset & PAGE_MASK; in encl_load() 276 seg->prot = (phdr->p_flags & PF_R) ? PROT_READ : 0; in encl_load() 277 seg->prot |= (phdr->p_flags & PF_W) ? PROT_WRITE : 0; in encl_load() [all …]
|
/linux-6.12.1/net/dsa/ |
D | tag_qca.c | 18 __be16 *phdr; in qca_tag_xmit() local 24 phdr = dsa_etype_header_pos_tx(skb); in qca_tag_xmit() 31 *phdr = htons(hdr); in qca_tag_xmit() 42 __be16 *phdr; in qca_tag_rcv() local 53 phdr = dsa_etype_header_pos_rx(skb); in qca_tag_rcv() 54 hdr = ntohs(*phdr); in qca_tag_rcv()
|
/linux-6.12.1/lib/ |
D | buildid.c | 217 const Elf32_Phdr *phdr; in get_build_id_32() local 237 phdr = freader_fetch(r, phoff + i * sizeof(Elf32_Phdr), sizeof(Elf32_Phdr)); in get_build_id_32() 238 if (!phdr) in get_build_id_32() 241 if (phdr->p_type == PT_NOTE && in get_build_id_32() 242 !parse_build_id(r, build_id, size, READ_ONCE(phdr->p_offset), in get_build_id_32() 243 READ_ONCE(phdr->p_filesz))) in get_build_id_32() 253 const Elf64_Phdr *phdr; in get_build_id_64() local 274 phdr = freader_fetch(r, phoff + i * sizeof(Elf64_Phdr), sizeof(Elf64_Phdr)); in get_build_id_64() 275 if (!phdr) in get_build_id_64() 278 if (phdr->p_type == PT_NOTE && in get_build_id_64() [all …]
|
/linux-6.12.1/tools/testing/selftests/powerpc/ptrace/ |
D | core-pkey.c | 199 Elf64_Phdr *phdr; in check_core_file() local 216 phdr_size = sizeof(*phdr) * ehdr->e_phnum; 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() 225 phdr += ehdr->e_phentsize) in check_core_file() 226 if (phdr->p_type == PT_NOTE) in check_core_file() 229 FAIL_IF((void *) phdr >= p + ehdr->e_phoff + phdr_size); in check_core_file() 232 for (nhdr = p + phdr->p_offset; in check_core_file() 233 (void *) nhdr < p + phdr->p_offset + phdr->p_filesz; in check_core_file() 238 FAIL_IF((void *) nhdr >= p + phdr->p_offset + phdr->p_filesz); in check_core_file()
|
/linux-6.12.1/drivers/media/platform/st/sti/c8sectpfe/ |
D | c8sectpfe-core.c | 989 static void load_imem_segment(struct c8sectpfei *fei, Elf32_Phdr *phdr, in load_imem_segment() argument 993 const u8 *imem_src = fw->data + phdr->p_offset; in load_imem_segment() 1005 seg_num, phdr->p_paddr, phdr->p_filesz, dest, in load_imem_segment() 1006 phdr->p_memsz + phdr->p_memsz / 3); in load_imem_segment() 1008 for (i = 0; i < phdr->p_filesz; i++) { in load_imem_segment() 1024 static void load_dmem_segment(struct c8sectpfei *fei, Elf32_Phdr *phdr, in load_dmem_segment() argument 1034 seg_num, phdr->p_paddr, phdr->p_filesz, in load_dmem_segment() 1035 dst, phdr->p_memsz); in load_dmem_segment() 1037 memcpy((void __force *)dst, (void *)fw->data + phdr->p_offset, in load_dmem_segment() 1038 phdr->p_filesz); in load_dmem_segment() [all …]
|
/linux-6.12.1/arch/x86/boot/compressed/ |
D | misc.c | 298 Elf64_Phdr *phdrs, *phdr; in parse_elf() local 301 Elf32_Phdr *phdrs, *phdr; in parse_elf() 322 phdr = &phdrs[i]; in parse_elf() 324 switch (phdr->p_type) { in parse_elf() 327 if ((phdr->p_align % 0x200000) != 0) in parse_elf() 332 dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR); in parse_elf() 334 dest = (void *)(phdr->p_paddr); in parse_elf() 336 memmove(dest, output + phdr->p_offset, phdr->p_filesz); in parse_elf()
|