Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jan 2010 19:54:19 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r202644 - stable/7/sys/kern
Message-ID:  <201001191954.o0JJsJQA090915@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Jan 19 19:54:18 2010
New Revision: 202644
URL: http://svn.freebsd.org/changeset/base/202644

Log:
  MFC r197932:
  Do not map segments of zero length.
  
  Tested by:	Mykola Dzham <i levsha me>

Modified:
  stable/7/sys/kern/imgact_elf.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/kern/imgact_elf.c
==============================================================================
--- stable/7/sys/kern/imgact_elf.c	Tue Jan 19 19:53:05 2010	(r202643)
+++ stable/7/sys/kern/imgact_elf.c	Tue Jan 19 19:54:18 2010	(r202644)
@@ -639,7 +639,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;
@@ -769,6 +770,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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001191954.o0JJsJQA090915>