svn commit: r198281 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci kern

Konstantin Belousov kib at FreeBSD.org
Tue Oct 20 13:30:07 UTC 2009


Author: kib
Date: Tue Oct 20 13:30:06 2009
New Revision: 198281
URL: http://svn.freebsd.org/changeset/base/198281

Log:
  MFC r197932:
  Do not map elf segments of zero length.
  
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/imgact_elf.c

Modified: stable/8/sys/kern/imgact_elf.c
==============================================================================
--- stable/8/sys/kern/imgact_elf.c	Tue Oct 20 13:26:58 2009	(r198280)
+++ stable/8/sys/kern/imgact_elf.c	Tue Oct 20 13:30:06 2009	(r198281)
@@ -632,7 +632,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;
@@ -761,6 +762,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-stable mailing list