Do not map segments of zero length.
Discussed with: bz Reviewed by: kan Tested by: bz (i386, amd64), bsam (linux) MFC after: some time
This commit is contained in:
parent
dec4912e62
commit
5b33842a9b
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user