summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-09-20 09:41:03 -0400
committerRobert Morris <[email protected]>2019-09-20 09:41:03 -0400
commit402e7b56053312f4e96737ee7cd82395c998f00f (patch)
tree4abf84fc5c23540a012e615e982648eff7a471eb /user
parent57e40a020411924dc89fba9fdd22a048ff4513f0 (diff)
downloadxv6-labs-402e7b56053312f4e96737ee7cd82395c998f00f.tar.gz
xv6-labs-402e7b56053312f4e96737ee7cd82395c998f00f.tar.bz2
xv6-labs-402e7b56053312f4e96737ee7cd82395c998f00f.zip
fix a potential kernel crash
add a regression test for it
Diffstat (limited to 'user')
-rw-r--r--user/usertests.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/user/usertests.c b/user/usertests.c
index 0042fe7..7da62d1 100644
--- a/user/usertests.c
+++ b/user/usertests.c
@@ -1908,6 +1908,18 @@ stacktest(char *s)
exit(xstatus);
}
+// copyinstr() used to cast the virtual page address to uint,
+// which (with certain wild system call arguments) could
+// result in a kernel page fault.
+void
+pgbug(char *s)
+{
+ char *argv[1];
+ argv[0] = 0;
+ exec((char*)0xeaeb0b5b00002f5e, argv);
+ exit(0);
+}
+
// run each test in its own process. run returns 1 if child's exit()
// indicates success.
int
@@ -1945,6 +1957,7 @@ main(int argc, char *argv[])
void (*f)(char *);
char *s;
} tests[] = {
+ {pgbug, "pgbug" },
{reparent, "reparent" },
{twochildren, "twochildren"},
{forkfork, "forkfork"},