Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/kern Pull up revision 1.76 via patch (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/222aca176623
branches:  netbsd-1-6
changeset: 530775:222aca176623
user:      tron <tron%NetBSD.org@localhost>
date:      Thu Oct 02 09:51:56 2003 +0000

description:
Pull up revision 1.76 via patch (requested by junyoung in ticket #1488):
count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).

diffstat:

 sys/kern/exec_elf32.c |  38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)

diffs (106 lines):

diff -r 6f64f733c436 -r 222aca176623 sys/kern/exec_elf32.c
--- a/sys/kern/exec_elf32.c     Thu Oct 02 09:51:51 2003 +0000
+++ b/sys/kern/exec_elf32.c     Thu Oct 02 09:51:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_elf32.c,v 1.70.10.1 2003/09/27 15:52:43 tron Exp $        */
+/*     $NetBSD: exec_elf32.c,v 1.70.10.2 2003/10/02 09:51:56 tron Exp $        */
 
 /*-
  * Copyright (c) 1994, 2000 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exec_elf32.c,v 1.70.10.1 2003/09/27 15:52:43 tron Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf32.c,v 1.70.10.2 2003/10/02 09:51:56 tron Exp $");
 
 /* If not included by exec_elf64.c, ELFSIZE won't be defined. */
 #ifndef ELFSIZE
@@ -155,7 +155,7 @@
                a->a_v = ap->arg_entry;
                a++;
 
-               free((char *)ap, M_TEMP);
+               free(ap, M_TEMP);
                pack->ep_emul_arg = NULL;
        }
 
@@ -345,6 +345,11 @@
 #ifdef notyet /* XXX cgd 960926 */
        XXX cgd 960926: (maybe) VOP_OPEN it (and VOP_CLOSE in copyargs?)
 #endif
+
+       error = vn_marktext(vp);
+       if (error)
+               goto badunlock;
+
        VOP_UNLOCK(vp, 0);
 
        if ((error = exec_read_from(p, vp, 0, &eh, sizeof(eh))) != 0)
@@ -403,7 +408,7 @@
                }
        }
 
-       free((char *)ph, M_TEMP);
+       free(ph, M_TEMP);
        *last = addr;
        vrele(vp);
        return 0;
@@ -413,7 +418,7 @@
 
 bad:
        if (ph != NULL)
-               free((char *)ph, M_TEMP);
+               free(ph, M_TEMP);
 #ifdef notyet /* XXX cgd 960926 */
        (maybe) VOP_CLOSE it
 #endif
@@ -451,18 +456,10 @@
            ELFNAME(check_header)(eh, ET_DYN) != 0)
                return ENOEXEC;
 
-       /*
-        * check if vnode is in open for writing, because we want to
-        * demand-page out of it.  if it is, don't do it, for various
-        * reasons
-        */
-       if (epp->ep_vp->v_writecount != 0) {
-#ifdef DIAGNOSTIC
-               if (epp->ep_vp->v_flag & VTEXT)
-                       panic("exec: a VTEXT vnode has writecount != 0");
-#endif
-               return ETXTBSY;
-       }
+       error = vn_marktext(epp->ep_vp);
+       if (error)
+               return (error);
+
        /*
         * Allocate space to hold all the program headers, and read them
         * from the file
@@ -596,7 +593,7 @@
                    M_TEMP, M_WAITOK);
                if ((error = ELFNAME(load_file)(p, epp, interp,
                    &epp->ep_vmcmds, &epp->ep_entry, ap, &pos)) != 0) {
-                       FREE((char *)ap, M_TEMP);
+                       FREE(ap, M_TEMP);
                        goto bad;
                }
                pos += phsize;
@@ -616,14 +613,13 @@
            epp->ep_vp, 0, VM_PROT_READ);
 #endif
        FREE(interp, M_TEMP);
-       free((char *)ph, M_TEMP);
-       epp->ep_vp->v_flag |= VTEXT;
+       free(ph, M_TEMP);
        return exec_elf_setup_stack(p, epp);
 
 bad:
        if (interp)
                FREE(interp, M_TEMP);
-       free((char *)ph, M_TEMP);
+       free(ph, M_TEMP);
        kill_vmcmds(&epp->ep_vmcmds);
        return ENOEXEC;
 }



Home | Main Index | Thread Index | Old Index