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

Re: 1.08, Pexec mode 200



>>>>> Julian Reschke <reschke@GOEDEL.UNI-MUENSTER.DE> writes:
|>  Hi,

|>  with 1.08, Pexec mode 200 reliably crashes on my system (just try something
|>  like Pexec (200, filename, "", 0L); -> memory violation). It seems that
|>  the new process tries to access either the basepage or the environment
|>  and crashes. Turning of MP cures that.

|>  Any help appreciated.

Here is a patch:

--- orig/dosmem.c	Thu Aug  5 19:09:54 1993
+++ ./dosmem.c	Sat Aug 14 02:33:32 1993
@@ -558,6 +558,32 @@
 			if (xattr.mode & S_ISGID)
 				p->egid = xattr.gid;
 		}
+
+	/* jr: add Pexec information to PROC struct */
+	p->cmdlin[0] = 0;
+	if (mkbase || mkload)
+		strncpy(p->cmdlin, ptr2, 128);
+	p->fname[0] = 0;
+	if (mkload)
+	{
+		char tmp[PATH_MAX];
+		char *source = ptr1;
+		tmp[1] = ':';
+		if (source[1] == ':') {
+			tmp[0] = source[0];
+			source += 2;
+		} else
+			tmp[0] = 'A' + curproc->curdrv;
+		if (DIRSEP(source[0]))	/* absolute path? */
+		{
+			strncpy (&tmp[2], &source[0], PATH_MAX-2);
+			strcpy (p->fname, tmp);
+		} else {
+			if (! d_getcwd (&tmp[2], tmp[0] - 'A' + 1, PATH_MAX - 2))
+				ksprintf (p->fname, "%s\\%s", tmp, source);
+		}
+	}
+
 	/* exec_region frees the memory attached to p; that's always what
 	 * we want, since fork_proc duplicates the memory, and since
 	 * if we didn't call fork_proc then we're overlaying.
@@ -588,31 +614,6 @@
 		if (p->ptracer)
 			p->ctxt[CURRENT].ptrace = 1;
 
-	/* jr: add Pexec information to PROC struct */
-	p->cmdlin[0] = 0;
-	if (mkbase || mkload)
-		strncpy(p->cmdlin, ptr2, 128);
-	p->fname[0] = 0;
-	if (mkload)
-	{
-		char tmp[PATH_MAX];
-		char *source = ptr1;
-		tmp[1] = ':';
-		if (source[1] == ':') {
-			tmp[0] = source[0];
-			source += 2;
-		} else
-			tmp[0] = 'A' + curproc->curdrv;
-		if (DIRSEP(source[0]))	/* absolute path? */
-		{
-			strncpy (&tmp[2], &source[0], PATH_MAX-2);
-			strcpy (p->fname, tmp);
-		} else {
-			if (! d_getcwd (&tmp[2], tmp[0] - 'A' + 1, PATH_MAX - 2))
-				ksprintf (p->fname, "%s\\%s", tmp, source);
-		}
-	}
-
 	/* set the time/date stamp of u:\proc */
 		proctime = timestamp;
 		procdate = datestamp;

----------------------------------------------------------------------
Andreas Schwab                                  "And now for something
schwab@ls5.informatik.uni-dortmund.de            completely different"