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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to