• Home
  • Raw
  • Download

Lines Matching refs:phdr

141 	struct elf32_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()
235 if (phdr->p_filesz > PATH_MAX) in load_elf_fdpic_binary()
238 if (phdr->p_filesz < 2) in load_elf_fdpic_binary()
242 interpreter_name = kmalloc(phdr->p_filesz, GFP_KERNEL); in load_elf_fdpic_binary()
246 pos = phdr->p_offset; in load_elf_fdpic_binary()
248 phdr->p_filesz, &pos); in load_elf_fdpic_binary()
249 if (unlikely(retval != phdr->p_filesz)) { in load_elf_fdpic_binary()
256 if (interpreter_name[phdr->p_filesz - 1] != '\0') in load_elf_fdpic_binary()
291 exec_params.load_addr = phdr->p_vaddr; in load_elf_fdpic_binary()
745 struct elf32_phdr *phdr; in elf_fdpic_map_file() local
807 phdr = params->phdrs; in elf_fdpic_map_file()
809 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file()
810 if (phdr->p_type != PT_LOAD) in elf_fdpic_map_file()
813 if (phdr->p_offset > params->hdr.e_phoff || in elf_fdpic_map_file()
814 phdr->p_offset + phdr->p_filesz < stop) in elf_fdpic_map_file()
819 if (phdr->p_vaddr >= seg->p_vaddr && in elf_fdpic_map_file()
820 phdr->p_vaddr + phdr->p_filesz <= in elf_fdpic_map_file()
823 (phdr->p_vaddr - seg->p_vaddr) + in elf_fdpic_map_file()
825 params->hdr.e_phoff - phdr->p_offset; in elf_fdpic_map_file()
833 phdr = params->phdrs; in elf_fdpic_map_file()
834 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file()
835 if (phdr->p_type != PT_DYNAMIC) in elf_fdpic_map_file()
840 if (phdr->p_vaddr >= seg->p_vaddr && in elf_fdpic_map_file()
841 phdr->p_vaddr + phdr->p_memsz <= in elf_fdpic_map_file()
847 (phdr->p_vaddr - seg->p_vaddr) + in elf_fdpic_map_file()
853 if (phdr->p_memsz == 0 || in elf_fdpic_map_file()
854 phdr->p_memsz % sizeof(Elf32_Dyn) != 0) in elf_fdpic_map_file()
857 tmp = phdr->p_memsz / sizeof(Elf32_Dyn); in elf_fdpic_map_file()
928 struct elf32_phdr *phdr; in elf_fdpic_map_file_constdisp_on_uclinux() local
937 phdr = params->phdrs; in elf_fdpic_map_file_constdisp_on_uclinux()
938 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file_constdisp_on_uclinux()
942 if (base > phdr->p_vaddr) in elf_fdpic_map_file_constdisp_on_uclinux()
943 base = phdr->p_vaddr; in elf_fdpic_map_file_constdisp_on_uclinux()
944 if (top < phdr->p_vaddr + phdr->p_memsz) in elf_fdpic_map_file_constdisp_on_uclinux()
945 top = phdr->p_vaddr + phdr->p_memsz; in elf_fdpic_map_file_constdisp_on_uclinux()
962 phdr = params->phdrs; in elf_fdpic_map_file_constdisp_on_uclinux()
963 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file_constdisp_on_uclinux()
967 seg->addr = maddr + (phdr->p_vaddr - base); in elf_fdpic_map_file_constdisp_on_uclinux()
968 seg->p_vaddr = phdr->p_vaddr; in elf_fdpic_map_file_constdisp_on_uclinux()
969 seg->p_memsz = phdr->p_memsz; in elf_fdpic_map_file_constdisp_on_uclinux()
971 ret = read_code(file, seg->addr, phdr->p_offset, in elf_fdpic_map_file_constdisp_on_uclinux()
972 phdr->p_filesz); in elf_fdpic_map_file_constdisp_on_uclinux()
977 if (phdr->p_offset == 0) in elf_fdpic_map_file_constdisp_on_uclinux()
981 if (phdr->p_filesz < phdr->p_memsz) { in elf_fdpic_map_file_constdisp_on_uclinux()
982 if (clear_user((void *) (seg->addr + phdr->p_filesz), in elf_fdpic_map_file_constdisp_on_uclinux()
983 phdr->p_memsz - phdr->p_filesz)) in elf_fdpic_map_file_constdisp_on_uclinux()
988 if (phdr->p_flags & PF_X) { in elf_fdpic_map_file_constdisp_on_uclinux()
992 phdr->p_memsz; in elf_fdpic_map_file_constdisp_on_uclinux()
996 mm->end_data = seg->addr + phdr->p_memsz; in elf_fdpic_map_file_constdisp_on_uclinux()
1016 struct elf32_phdr *phdr; in elf_fdpic_map_file_by_direct_mmap() local
1027 phdr = params->phdrs; in elf_fdpic_map_file_by_direct_mmap()
1028 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file_by_direct_mmap()
1032 if (phdr->p_type != PT_LOAD) in elf_fdpic_map_file_by_direct_mmap()
1036 (unsigned long) phdr->p_vaddr, in elf_fdpic_map_file_by_direct_mmap()
1037 (unsigned long) phdr->p_offset, in elf_fdpic_map_file_by_direct_mmap()
1038 (unsigned long) phdr->p_filesz, in elf_fdpic_map_file_by_direct_mmap()
1039 (unsigned long) phdr->p_memsz); in elf_fdpic_map_file_by_direct_mmap()
1042 if (phdr->p_flags & PF_R) prot |= PROT_READ; in elf_fdpic_map_file_by_direct_mmap()
1043 if (phdr->p_flags & PF_W) prot |= PROT_WRITE; in elf_fdpic_map_file_by_direct_mmap()
1044 if (phdr->p_flags & PF_X) prot |= PROT_EXEC; in elf_fdpic_map_file_by_direct_mmap()
1059 maddr = phdr->p_vaddr; in elf_fdpic_map_file_by_direct_mmap()
1070 delta_vaddr = phdr->p_vaddr; in elf_fdpic_map_file_by_direct_mmap()
1073 maddr = load_addr + phdr->p_vaddr - delta_vaddr; in elf_fdpic_map_file_by_direct_mmap()
1089 disp = phdr->p_vaddr & ~PAGE_MASK; in elf_fdpic_map_file_by_direct_mmap()
1090 maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, in elf_fdpic_map_file_by_direct_mmap()
1091 phdr->p_offset - disp); in elf_fdpic_map_file_by_direct_mmap()
1094 loop, phdr->p_memsz + disp, prot, flags, in elf_fdpic_map_file_by_direct_mmap()
1095 phdr->p_offset - disp, maddr); in elf_fdpic_map_file_by_direct_mmap()
1102 load_addr += PAGE_ALIGN(phdr->p_memsz + disp); in elf_fdpic_map_file_by_direct_mmap()
1105 seg->p_vaddr = phdr->p_vaddr; in elf_fdpic_map_file_by_direct_mmap()
1106 seg->p_memsz = phdr->p_memsz; in elf_fdpic_map_file_by_direct_mmap()
1109 if (phdr->p_offset == 0) in elf_fdpic_map_file_by_direct_mmap()
1126 excess = phdr->p_memsz - phdr->p_filesz; in elf_fdpic_map_file_by_direct_mmap()
1127 excess1 = PAGE_SIZE - ((maddr + phdr->p_filesz) & ~PAGE_MASK); in elf_fdpic_map_file_by_direct_mmap()
1131 unsigned long xaddr = maddr + phdr->p_filesz + excess1; in elf_fdpic_map_file_by_direct_mmap()
1149 loop, maddr + phdr->p_filesz, excess1); in elf_fdpic_map_file_by_direct_mmap()
1150 if (clear_user((void __user *) maddr + phdr->p_filesz, in elf_fdpic_map_file_by_direct_mmap()
1158 loop, maddr + phdr->p_filesz, excess); in elf_fdpic_map_file_by_direct_mmap()
1159 if (clear_user((void *) maddr + phdr->p_filesz, excess)) in elf_fdpic_map_file_by_direct_mmap()
1165 if (phdr->p_flags & PF_X) { in elf_fdpic_map_file_by_direct_mmap()
1168 mm->end_code = maddr + phdr->p_memsz; in elf_fdpic_map_file_by_direct_mmap()
1172 mm->end_data = maddr + phdr->p_memsz; in elf_fdpic_map_file_by_direct_mmap()
1278 static inline void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset) in fill_elf_note_phdr() argument
1280 phdr->p_type = PT_NOTE; in fill_elf_note_phdr()
1281 phdr->p_offset = offset; in fill_elf_note_phdr()
1282 phdr->p_vaddr = 0; in fill_elf_note_phdr()
1283 phdr->p_paddr = 0; in fill_elf_note_phdr()
1284 phdr->p_filesz = sz; in fill_elf_note_phdr()
1285 phdr->p_memsz = 0; in fill_elf_note_phdr()
1286 phdr->p_flags = 0; in fill_elf_note_phdr()
1287 phdr->p_align = 0; in fill_elf_note_phdr()
1593 struct elf_phdr phdr; in elf_fdpic_core_dump() local
1598 phdr.p_type = PT_LOAD; in elf_fdpic_core_dump()
1599 phdr.p_offset = offset; in elf_fdpic_core_dump()
1600 phdr.p_vaddr = meta->start; in elf_fdpic_core_dump()
1601 phdr.p_paddr = 0; in elf_fdpic_core_dump()
1602 phdr.p_filesz = meta->dump_size; in elf_fdpic_core_dump()
1603 phdr.p_memsz = sz; in elf_fdpic_core_dump()
1604 offset += phdr.p_filesz; in elf_fdpic_core_dump()
1605 phdr.p_flags = 0; in elf_fdpic_core_dump()
1607 phdr.p_flags |= PF_R; in elf_fdpic_core_dump()
1609 phdr.p_flags |= PF_W; in elf_fdpic_core_dump()
1611 phdr.p_flags |= PF_X; in elf_fdpic_core_dump()
1612 phdr.p_align = ELF_EXEC_PAGESIZE; in elf_fdpic_core_dump()
1614 if (!dump_emit(cprm, &phdr, sizeof(phdr))) in elf_fdpic_core_dump()