summaryrefslogtreecommitdiffstats
path: root/sys/kern/imgact_elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r--sys/kern/imgact_elf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 4ed7382..3841d1f 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -635,7 +635,8 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr,
}
for (i = 0, numsegs = 0; i < hdr->e_phnum; i++) {
- if (phdr[i].p_type == PT_LOAD) { /* Loadable segment */
+ if (phdr[i].p_type == PT_LOAD && phdr[i].p_memsz != 0) {
+ /* Loadable segment */
prot = 0;
if (phdr[i].p_flags & PF_X)
prot |= VM_PROT_EXECUTE;
@@ -764,6 +765,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
for (i = 0; i < hdr->e_phnum; i++) {
switch (phdr[i].p_type) {
case PT_LOAD: /* Loadable segment */
+ if (phdr[i].p_memsz == 0)
+ break;
prot = 0;
if (phdr[i].p_flags & PF_X)
prot |= VM_PROT_EXECUTE;
OpenPOWER on IntegriCloud