Changeset View
Changeset View
Standalone View
Standalone View
stand/common/load_elf.c
| Show First 20 Lines • Show All 629 Lines • ▼ Show 20 Lines | #endif | ||||
| for (i = 0; i < ehdr->e_phnum; i++) { | for (i = 0; i < ehdr->e_phnum; i++) { | ||||
| if (elf_program_header_convert(ehdr, phdr)) | if (elf_program_header_convert(ehdr, phdr)) | ||||
| continue; | continue; | ||||
| /* We want to load PT_LOAD segments only.. */ | /* We want to load PT_LOAD segments only.. */ | ||||
| if (phdr[i].p_type != PT_LOAD) | if (phdr[i].p_type != PT_LOAD) | ||||
| continue; | continue; | ||||
| if (phdr[i].p_memsz < phdr[i].p_filesz) { | |||||
| printf("elf" __XSTRING(__ELF_WORD_SIZE) | |||||
| "_loadimage: invalid PT_LOAD segment\n"); | |||||
| goto out; | |||||
| } | |||||
| if (module_verbose >= MODULE_VERBOSE_FULL) { | if (module_verbose >= MODULE_VERBOSE_FULL) { | ||||
| printf("Segment: 0x%lx@0x%lx -> 0x%lx-0x%lx", | printf("Segment: 0x%lx@0x%lx -> 0x%lx-0x%lx", | ||||
| (long)phdr[i].p_filesz, (long)phdr[i].p_offset, | (long)phdr[i].p_filesz, (long)phdr[i].p_offset, | ||||
| (long)(phdr[i].p_vaddr + off), | (long)(phdr[i].p_vaddr + off), | ||||
| (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); | (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); | ||||
| } else if (module_verbose > MODULE_VERBOSE_SILENT) { | } else if (module_verbose > MODULE_VERBOSE_SILENT) { | ||||
| if ((phdr[i].p_flags & PF_W) == 0) { | if ((phdr[i].p_flags & PF_W) == 0) { | ||||
| ▲ Show 20 Lines • Show All 673 Lines • Show Last 20 Lines | |||||