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()
747 struct elf32_phdr *phdr; in elf_fdpic_map_file() local
809 phdr = params->phdrs; in elf_fdpic_map_file()
811 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file()
812 if (phdr->p_type != PT_LOAD) in elf_fdpic_map_file()
815 if (phdr->p_offset > params->hdr.e_phoff || in elf_fdpic_map_file()
816 phdr->p_offset + phdr->p_filesz < stop) in elf_fdpic_map_file()
821 if (phdr->p_vaddr >= seg->p_vaddr && in elf_fdpic_map_file()
822 phdr->p_vaddr + phdr->p_filesz <= in elf_fdpic_map_file()
825 (phdr->p_vaddr - seg->p_vaddr) + in elf_fdpic_map_file()
827 params->hdr.e_phoff - phdr->p_offset; in elf_fdpic_map_file()
835 phdr = params->phdrs; in elf_fdpic_map_file()
836 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file()
837 if (phdr->p_type != PT_DYNAMIC) in elf_fdpic_map_file()
842 if (phdr->p_vaddr >= seg->p_vaddr && in elf_fdpic_map_file()
843 phdr->p_vaddr + phdr->p_memsz <= in elf_fdpic_map_file()
849 (phdr->p_vaddr - seg->p_vaddr) + in elf_fdpic_map_file()
855 if (phdr->p_memsz == 0 || in elf_fdpic_map_file()
856 phdr->p_memsz % sizeof(Elf32_Dyn) != 0) in elf_fdpic_map_file()
859 tmp = phdr->p_memsz / sizeof(Elf32_Dyn); in elf_fdpic_map_file()
930 struct elf32_phdr *phdr; in elf_fdpic_map_file_constdisp_on_uclinux() local
939 phdr = params->phdrs; in elf_fdpic_map_file_constdisp_on_uclinux()
940 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file_constdisp_on_uclinux()
944 if (base > phdr->p_vaddr) in elf_fdpic_map_file_constdisp_on_uclinux()
945 base = phdr->p_vaddr; in elf_fdpic_map_file_constdisp_on_uclinux()
946 if (top < phdr->p_vaddr + phdr->p_memsz) in elf_fdpic_map_file_constdisp_on_uclinux()
947 top = phdr->p_vaddr + phdr->p_memsz; in elf_fdpic_map_file_constdisp_on_uclinux()
960 phdr = params->phdrs; in elf_fdpic_map_file_constdisp_on_uclinux()
961 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file_constdisp_on_uclinux()
965 seg->addr = maddr + (phdr->p_vaddr - base); in elf_fdpic_map_file_constdisp_on_uclinux()
966 seg->p_vaddr = phdr->p_vaddr; in elf_fdpic_map_file_constdisp_on_uclinux()
967 seg->p_memsz = phdr->p_memsz; in elf_fdpic_map_file_constdisp_on_uclinux()
969 ret = read_code(file, seg->addr, phdr->p_offset, in elf_fdpic_map_file_constdisp_on_uclinux()
970 phdr->p_filesz); in elf_fdpic_map_file_constdisp_on_uclinux()
975 if (phdr->p_offset == 0) in elf_fdpic_map_file_constdisp_on_uclinux()
979 if (phdr->p_filesz < phdr->p_memsz) { in elf_fdpic_map_file_constdisp_on_uclinux()
980 if (clear_user((void *) (seg->addr + phdr->p_filesz), in elf_fdpic_map_file_constdisp_on_uclinux()
981 phdr->p_memsz - phdr->p_filesz)) in elf_fdpic_map_file_constdisp_on_uclinux()
986 if (phdr->p_flags & PF_X) { in elf_fdpic_map_file_constdisp_on_uclinux()
990 phdr->p_memsz; in elf_fdpic_map_file_constdisp_on_uclinux()
994 mm->end_data = seg->addr + phdr->p_memsz; in elf_fdpic_map_file_constdisp_on_uclinux()
1014 struct elf32_phdr *phdr; in elf_fdpic_map_file_by_direct_mmap() local
1025 phdr = params->phdrs; in elf_fdpic_map_file_by_direct_mmap()
1026 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) { in elf_fdpic_map_file_by_direct_mmap()
1030 if (phdr->p_type != PT_LOAD) in elf_fdpic_map_file_by_direct_mmap()
1034 (unsigned long) phdr->p_vaddr, in elf_fdpic_map_file_by_direct_mmap()
1035 (unsigned long) phdr->p_offset, in elf_fdpic_map_file_by_direct_mmap()
1036 (unsigned long) phdr->p_filesz, in elf_fdpic_map_file_by_direct_mmap()
1037 (unsigned long) phdr->p_memsz); in elf_fdpic_map_file_by_direct_mmap()
1040 if (phdr->p_flags & PF_R) prot |= PROT_READ; in elf_fdpic_map_file_by_direct_mmap()
1041 if (phdr->p_flags & PF_W) prot |= PROT_WRITE; in elf_fdpic_map_file_by_direct_mmap()
1042 if (phdr->p_flags & PF_X) prot |= PROT_EXEC; in elf_fdpic_map_file_by_direct_mmap()
1054 maddr = phdr->p_vaddr; in elf_fdpic_map_file_by_direct_mmap()
1065 delta_vaddr = phdr->p_vaddr; in elf_fdpic_map_file_by_direct_mmap()
1068 maddr = load_addr + phdr->p_vaddr - delta_vaddr; in elf_fdpic_map_file_by_direct_mmap()
1084 disp = phdr->p_vaddr & ~PAGE_MASK; in elf_fdpic_map_file_by_direct_mmap()
1085 maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, in elf_fdpic_map_file_by_direct_mmap()
1086 phdr->p_offset - disp); in elf_fdpic_map_file_by_direct_mmap()
1089 loop, phdr->p_memsz + disp, prot, flags, in elf_fdpic_map_file_by_direct_mmap()
1090 phdr->p_offset - disp, maddr); in elf_fdpic_map_file_by_direct_mmap()
1097 load_addr += PAGE_ALIGN(phdr->p_memsz + disp); in elf_fdpic_map_file_by_direct_mmap()
1100 seg->p_vaddr = phdr->p_vaddr; in elf_fdpic_map_file_by_direct_mmap()
1101 seg->p_memsz = phdr->p_memsz; in elf_fdpic_map_file_by_direct_mmap()
1104 if (phdr->p_offset == 0) in elf_fdpic_map_file_by_direct_mmap()
1121 excess = phdr->p_memsz - phdr->p_filesz; in elf_fdpic_map_file_by_direct_mmap()
1122 excess1 = PAGE_SIZE - ((maddr + phdr->p_filesz) & ~PAGE_MASK); in elf_fdpic_map_file_by_direct_mmap()
1126 unsigned long xaddr = maddr + phdr->p_filesz + excess1; in elf_fdpic_map_file_by_direct_mmap()
1144 loop, maddr + phdr->p_filesz, excess1); in elf_fdpic_map_file_by_direct_mmap()
1145 if (clear_user((void __user *) maddr + phdr->p_filesz, in elf_fdpic_map_file_by_direct_mmap()
1153 loop, maddr + phdr->p_filesz, excess); in elf_fdpic_map_file_by_direct_mmap()
1154 if (clear_user((void *) maddr + phdr->p_filesz, excess)) in elf_fdpic_map_file_by_direct_mmap()
1160 if (phdr->p_flags & PF_X) { in elf_fdpic_map_file_by_direct_mmap()
1163 mm->end_code = maddr + phdr->p_memsz; in elf_fdpic_map_file_by_direct_mmap()
1167 mm->end_data = maddr + phdr->p_memsz; in elf_fdpic_map_file_by_direct_mmap()
1262 static inline void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, loff_t offset) in fill_elf_note_phdr() argument
1264 phdr->p_type = PT_NOTE; in fill_elf_note_phdr()
1265 phdr->p_offset = offset; in fill_elf_note_phdr()
1266 phdr->p_vaddr = 0; in fill_elf_note_phdr()
1267 phdr->p_paddr = 0; in fill_elf_note_phdr()
1268 phdr->p_filesz = sz; in fill_elf_note_phdr()
1269 phdr->p_memsz = 0; in fill_elf_note_phdr()
1270 phdr->p_flags = 0; in fill_elf_note_phdr()
1271 phdr->p_align = 0; in fill_elf_note_phdr()
1583 struct elf_phdr phdr; in elf_fdpic_core_dump() local
1588 phdr.p_type = PT_LOAD; in elf_fdpic_core_dump()
1589 phdr.p_offset = offset; in elf_fdpic_core_dump()
1590 phdr.p_vaddr = meta->start; in elf_fdpic_core_dump()
1591 phdr.p_paddr = 0; in elf_fdpic_core_dump()
1592 phdr.p_filesz = meta->dump_size; in elf_fdpic_core_dump()
1593 phdr.p_memsz = sz; in elf_fdpic_core_dump()
1594 offset += phdr.p_filesz; in elf_fdpic_core_dump()
1595 phdr.p_flags = 0; in elf_fdpic_core_dump()
1597 phdr.p_flags |= PF_R; in elf_fdpic_core_dump()
1599 phdr.p_flags |= PF_W; in elf_fdpic_core_dump()
1601 phdr.p_flags |= PF_X; in elf_fdpic_core_dump()
1602 phdr.p_align = ELF_EXEC_PAGESIZE; in elf_fdpic_core_dump()
1604 if (!dump_emit(cprm, &phdr, sizeof(phdr))) in elf_fdpic_core_dump()