Patch00146 was half done... this fixes one more case of VTEXT exec.
authorChris G. Demetriou <cgd@postgres.berkeley.edu>
Tue, 1 Jun 1993 00:00:00 +0000 (00:00 +0000)
committerChris G. Demetriou <cgd@postgres.berkeley.edu>
Tue, 1 Jun 1993 00:00:00 +0000 (00:00 +0000)
Patch00146 was half baked; that only took into account one case, i.e.
mark text busy when it's running; the other case is when a binary is
*already* open for writing.

chris

Date: Mon, 24 May 93 05:58:35 -0700

AUTHOR: Chris Demetriou (cdg@sun-lamp.cs.berkeley.edu)
386BSD-Patchkit: patch00165

usr/src/sys.386bsd/kern/kern_execve.c

index 3a66a9c..4bef214 100644 (file)
@@ -52,7 +52,7 @@
  *
  * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
  * --------------------         -----   ----------------------
  *
  * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
  * --------------------         -----   ----------------------
- * CURRENT PATCH LEVEL:         5       00146
+ * CURRENT PATCH LEVEL:         6       00165
  * --------------------         -----   ----------------------
  *
  * 05 Aug 92   Paul Kranenburg         Fixed #! as a magic number
  * --------------------         -----   ----------------------
  *
  * 05 Aug 92   Paul Kranenburg         Fixed #! as a magic number
@@ -63,6 +63,7 @@
  * 10 Apr 93   Yoval Yarom             Fix for busy text on executables
  * 20 Apr 93   markie                  Stop execution of a file open for write
  *             Rodney W. Grimes        Fix date on Yoval Yarom's patch
  * 10 Apr 93   Yoval Yarom             Fix for busy text on executables
  * 20 Apr 93   markie                  Stop execution of a file open for write
  *             Rodney W. Grimes        Fix date on Yoval Yarom's patch
+ * 01 Jun 93   Chris Demetriou         Completed markie's patch for VTEXT busy
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -177,6 +178,13 @@ again:                                                     /* 05 Aug 92*/
        if (rv)
                goto exec_fail;
 
        if (rv)
                goto exec_fail;
 
+        if (exdata.ex_hdr.a_text != 0 && (ndp->ni_vp->v_flag & VTEXT) == 0 &&
+           ndp->ni_vp->v_writecount != 0) {
+               rv = ETXTBSY;
+               goto exec_fail;
+       }
+               
+
        /* ... that we recognize? */
        rv = ENOEXEC;
        if (exdata.ex_hdr.a_magic != ZMAGIC) {
        /* ... that we recognize? */
        rv = ENOEXEC;
        if (exdata.ex_hdr.a_magic != ZMAGIC) {