svn commit: r197932 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Sat Oct 10 15:28:52 UTC 2009
Author: kib
Date: Sat Oct 10 15:28:52 2009
New Revision: 197932
URL: http://svn.freebsd.org/changeset/base/197932
Log:
Do not map segments of zero length.
Discussed with: bz
Reviewed by: kan
Tested by: bz (i386, amd64), bsam (linux)
MFC after: some time
Modified:
head/sys/kern/imgact_elf.c
Modified: head/sys/kern/imgact_elf.c
==============================================================================
--- head/sys/kern/imgact_elf.c Sat Oct 10 15:27:10 2009 (r197931)
+++ head/sys/kern/imgact_elf.c Sat Oct 10 15:28:52 2009 (r197932)
@@ -635,7 +635,8 @@ __elfN(load_file)(struct proc *p, const
}
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 i
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;
More information about the svn-src-all
mailing list