Several fixes for 64-big from Gerhard Tonn.
diff --git a/testcases/kernel/syscalls/access/access03.c b/testcases/kernel/syscalls/access/access03.c
index c49d394..0a3edea 100644
--- a/testcases/kernel/syscalls/access/access03.c
+++ b/testcases/kernel/syscalls/access/access03.c
@@ -30,7 +30,7 @@
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
  *
  */
-/* $Id: access03.c,v 1.1 2001/08/27 22:15:12 plars Exp $ */
+/* $Id: access03.c,v 1.2 2002/07/23 13:11:18 plars Exp $ */
 /**********************************************************
  * 
  *    OS Test - Silicon Graphics, Inc.
@@ -103,6 +103,7 @@
 
  
 #include <unistd.h>
+#include <sys/mman.h>
 #include "test.h"
 #include "usctest.h"
 
@@ -119,6 +120,8 @@
 
 int exp_enos[]={EFAULT, 0};  /* List must end with 0 */
 
+char * bad_addr = 0;
+
 int main(int ac, char **av)
 {
     int lc;		/* loop counter */
@@ -156,7 +159,7 @@
 	 
 
 	/* Call access(2) */
-	TEST(access( (char *)-1,R_OK));
+	TEST(access( bad_addr,R_OK));
 	
 
 	/* check return code */
@@ -195,7 +198,7 @@
 	 
 
 	/* Call access(2) */
-	TEST(access( (char *)-1,W_OK));
+	TEST(access( bad_addr,W_OK));
 	
 	/* check return code */
 	if ( TEST_RETURN == -1 ) {
@@ -233,7 +236,7 @@
 	 
 
 	/* Call access(2) */
-	TEST(access( (char *)-1,X_OK));
+	TEST(access( bad_addr,X_OK));
 	
 
 	/* check return code */
@@ -272,7 +275,7 @@
 	 
 
 	/* Call access(2) */
-	TEST(access( (char *)-1,F_OK));
+	TEST(access( bad_addr,F_OK));
 	
 
 	/* check return code */
@@ -484,6 +487,11 @@
 
     /* make and change to a temporary directory */
     tst_tmpdir();
+
+    bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+    if (bad_addr <= 0) {
+        tst_brkm(TBROK, cleanup, "mmap failed");
+    }
 }	/* End setup() */
 
 
diff --git a/testcases/kernel/syscalls/access/access05.c b/testcases/kernel/syscalls/access/access05.c
index 8b17c07..959fe25 100644
--- a/testcases/kernel/syscalls/access/access05.c
+++ b/testcases/kernel/syscalls/access/access05.c
@@ -84,6 +84,7 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <pwd.h>
 
 #include "test.h"
@@ -139,6 +140,8 @@
 void setup();			/* Main setup function of test */
 void cleanup();			/* cleanup function for the test */
 
+char * bad_addr = 0;  
+
 int
 main(int ac, char **av)
 {
@@ -245,6 +248,12 @@
 	/* make a temp directory and cd to it */
 	tst_tmpdir();
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	Test_cases[5].pathname = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/chdir/chdir04.c b/testcases/kernel/syscalls/chdir/chdir04.c
index bf7980e..eb21025 100644
--- a/testcases/kernel/syscalls/chdir/chdir04.c
+++ b/testcases/kernel/syscalls/chdir/chdir04.c
@@ -57,6 +57,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <test.h>
 #include <usctest.h>
 
@@ -99,6 +100,8 @@
 void setup(void);
 void cleanup(void);
 
+char * bad_addr = 0;
+
 main(int ac, char **av)
 {
 	int lc;				/* loop counter */
@@ -163,6 +166,12 @@
 
 	/* make a temporary directory and cd to it */
 	tst_tmpdir();
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[2].dname = bad_addr;
 }
 
 
diff --git a/testcases/kernel/syscalls/chmod/chmod06.c b/testcases/kernel/syscalls/chmod/chmod06.c
index 9144f8f..2ccb812 100644
--- a/testcases/kernel/syscalls/chmod/chmod06.c
+++ b/testcases/kernel/syscalls/chmod/chmod06.c
@@ -87,6 +87,7 @@
 #include <pwd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 
 #include "test.h"
 #include "usctest.h"
@@ -132,6 +133,8 @@
 extern int Tst_count;           /* Test Case counter for tst_* routines */
 int exp_enos[]={EPERM, EACCES, EFAULT, ENAMETOOLONG, ENOENT, ENOTDIR, 0};
 
+char * bad_addr = 0;
+
 void setup();			/* Main setup function for the tests */
 void cleanup();			/* cleanup function for the test */
 
@@ -258,6 +261,12 @@
 	/* Make a temp dir and cd to it */
 	tst_tmpdir();
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	Test_cases[3].pathname = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/chown/chown04.c b/testcases/kernel/syscalls/chown/chown04.c
index 4588793..c8e6f5f 100644
--- a/testcases/kernel/syscalls/chown/chown04.c
+++ b/testcases/kernel/syscalls/chown/chown04.c
@@ -87,6 +87,7 @@
 #include <pwd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 
 #include "test.h"
 #include "usctest.h"
@@ -135,6 +136,8 @@
 char *test_home;		/* variable to hold TESTHOME env */
 
 
+char * bad_addr = 0;
+
 void setup();			/* Main setup function for the tests */
 void cleanup();			/* cleanup function for the test */
 
@@ -255,6 +258,13 @@
 	/* Make a temp dir and cd to it */
 	tst_tmpdir();
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+
+	Test_cases[3].pathname = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/chroot/chroot03.c b/testcases/kernel/syscalls/chroot/chroot03.c
index 9befbdd..231eb93 100644
--- a/testcases/kernel/syscalls/chroot/chroot03.c
+++ b/testcases/kernel/syscalls/chroot/chroot03.c
@@ -62,6 +62,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <test.h>
 #include <usctest.h>
 
@@ -105,6 +106,8 @@
         {(char *)-1, EFAULT}
 };
 
+char * bad_addr = 0;
+
 void setup(void);
 void cleanup(void);
 
@@ -186,6 +189,12 @@
 	 * directory does not exist.
 	 */
 	(void)sprintf(good_dir, "%s.%d", good_dir, getpid());
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[3].dir = bad_addr;
 }
 
 
diff --git a/testcases/kernel/syscalls/creat/creat06.c b/testcases/kernel/syscalls/creat/creat06.c
index a68f768..92cc4c0 100644
--- a/testcases/kernel/syscalls/creat/creat06.c
+++ b/testcases/kernel/syscalls/creat/creat06.c
@@ -64,6 +64,7 @@
 #include <errno.h>
 #include <string.h>
 #include <pwd.h>
+#include <sys/mman.h>
 #include "test.h"
 #include "usctest.h"
 
@@ -115,6 +116,8 @@
 	{test6_file, MODE1, EACCES}
 };
 
+char * bad_addr = 0;
+
 main(int ac, char **av)
 {
 	int lc;				/* loop counter */
@@ -209,6 +212,12 @@
 		tst_brkm(TBROK, cleanup, "couldn't create a test file");
 	}
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[4].fname = bad_addr;
+
 	/* create a directory that will be used in test #6 */
 	if (mkdir("dir6", MODE2) == -1) {
 		tst_brkm(TBROK, cleanup, "couldn't creat a test directory");
diff --git a/testcases/kernel/syscalls/execve/execve03.c b/testcases/kernel/syscalls/execve/execve03.c
index ab858e3..11b78dd 100644
--- a/testcases/kernel/syscalls/execve/execve03.c
+++ b/testcases/kernel/syscalls/execve/execve03.c
@@ -70,6 +70,7 @@
 #include <test.h>
 #include <usctest.h>
 #include <pwd.h>
+#include <sys/mman.h>
 
 char *TCID = "execve03";
 int TST_TOTAL = 6;
@@ -78,6 +79,8 @@
 char nobody_uid[] = "nobody";
 struct passwd *ltpuser;
 
+char * bad_addr = 0;
+
 void setup(void);
 void cleanup(void);
 
@@ -221,6 +224,12 @@
 	if (close(fd) == -1) {
 		tst_brkm(TBROK, cleanup, "close() failed");
 	}
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[3].tname = bad_addr;
 }
 
 
diff --git a/testcases/kernel/syscalls/fcntl/fcntl13.c b/testcases/kernel/syscalls/fcntl/fcntl13.c
index 5790e1f..fa53b66 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl13.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl13.c
@@ -161,7 +161,7 @@
 		tst_resm(TINFO, "Test for errno EBADF");
 		fail = 0;
 
-		if (fcntl(-1, F_GETLK, 1) != -1) {
+		if (fcntl(-1, F_GETLK, &flock) != -1) {
 			tst_resm(TFAIL, "fcntl(2) failed to FAIL");
 			fail = 1;
 		} else if (errno != EBADF) {
diff --git a/testcases/kernel/syscalls/lchown/lchown02.c b/testcases/kernel/syscalls/lchown/lchown02.c
index 369a42f..847e946 100644
--- a/testcases/kernel/syscalls/lchown/lchown02.c
+++ b/testcases/kernel/syscalls/lchown/lchown02.c
@@ -88,6 +88,7 @@
 #include <pwd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 
 #include "test.h"
 #include "usctest.h"
@@ -137,6 +138,7 @@
 char nobody_uid[] = "nobody";
 struct passwd *ltpuser;
 
+char * bad_addr = 0;
 
 void setup();			/* Main setup function for the tests */
 void cleanup();			/* cleanup function for the test */
@@ -280,6 +282,12 @@
                 tst_brkm(TBROK, cleanup, "chmod() failed");
         }
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	Test_cases[3].pathname = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/link/link04.c b/testcases/kernel/syscalls/link/link04.c
index f67acb9..8a07162 100644
--- a/testcases/kernel/syscalls/link/link04.c
+++ b/testcases/kernel/syscalls/link/link04.c
@@ -30,7 +30,7 @@
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
  *
  */
-/* $Id: link04.c,v 1.1 2001/08/27 22:15:14 plars Exp $ */
+/* $Id: link04.c,v 1.2 2002/07/23 13:11:18 plars Exp $ */
 /**********************************************************
  * 
  *    OS Test - Silicon Graphics, Inc.
@@ -117,6 +117,7 @@
 #include <string.h>
 #include <signal.h>
 #include <sys/param.h>		/* for PATH_MAX */
+#include <sys/mman.h>
 #include "test.h"
 #include "usctest.h"
 
@@ -132,6 +133,8 @@
 
 int exp_enos[]={0, 0};
 
+char * bad_addr = 0;
+
 int longpath_setup();
 int no_setup();
 int filepath_setup();
@@ -303,6 +306,13 @@
     /* make a temp directory and cd to it */
     tst_tmpdir();
 
+    bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+    if (bad_addr <= 0) {
+	tst_brkm(TBROK, cleanup, "mmap failed");
+    }
+    Test_cases[6].file1 = bad_addr;
+    Test_cases[12].file2 = bad_addr;
+
     for (ind=0; Test_cases[ind].desc1 != NULL; ind++ ) {
         Test_cases[ind].setupfunc1();
         Test_cases[ind].setupfunc2();
diff --git a/testcases/kernel/syscalls/lstat/lstat02.c b/testcases/kernel/syscalls/lstat/lstat02.c
index 040fe8d..0deaf38 100644
--- a/testcases/kernel/syscalls/lstat/lstat02.c
+++ b/testcases/kernel/syscalls/lstat/lstat02.c
@@ -83,6 +83,7 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <pwd.h>
 
 #include "test.h"
@@ -127,6 +128,7 @@
 char nobody_uid[] = "nobody";
 struct passwd *ltpuser;
 
+char * bad_addr = 0;
 
 void setup();			/* Main setup function for the tests */
 void cleanup();			/* cleanup function for the test */
@@ -238,6 +240,12 @@
 	/* Make a temp dir and cd to it */
 	tst_tmpdir();
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	Test_cases[2].pathname = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/mkdir/mkdir01.c b/testcases/kernel/syscalls/mkdir/mkdir01.c
index 678f038..b0db10d 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir01.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir01.c
@@ -30,7 +30,7 @@
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
  *
  */
-/* $Id: mkdir01.c,v 1.1 2001/08/27 22:15:14 plars Exp $ */
+/* $Id: mkdir01.c,v 1.2 2002/07/23 13:11:18 plars Exp $ */
 /**********************************************************
  * 
  *    OS Test - Silicon Graphics, Inc.
@@ -107,6 +107,7 @@
 #include <signal.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/mman.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include "test.h"
@@ -124,6 +125,8 @@
 
 int exp_enos[]={EFAULT, 0};	/* List must end with 0 */
 
+char * bad_addr = 0;
+
 int
 main(int ac, char **av)
 {
@@ -159,7 +162,7 @@
 	 */
 
 	/* Call mkdir(2) */
-	TEST(mkdir((char *)-1,0777));
+	TEST(mkdir(bad_addr,0777));
 	
 	/* check return code */
 	if ( TEST_RETURN == -1 ) {
@@ -240,6 +243,11 @@
 
     /* Create a temporary directory and make it current. */
     tst_tmpdir();
+
+    bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+    if (bad_addr <= 0) {
+	tst_brkm(TBROK, cleanup, "mmap failed");
+    }
 }	/* End setup() */
 
 
diff --git a/testcases/kernel/syscalls/mkdir/mkdir03.c b/testcases/kernel/syscalls/mkdir/mkdir03.c
index 48f31c3..6487787 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir03.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir03.c
@@ -65,6 +65,7 @@
 
 #include <errno.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include "test.h"
 #include "usctest.h"
 
@@ -93,6 +94,8 @@
 
 int exp_enos[]={EFAULT, ENAMETOOLONG, EEXIST, ENOENT, ENOTDIR, 0};
 
+char * bad_addr = 0;
+
 struct test_case_t {
         char *dir;
         int perms;
@@ -263,6 +266,12 @@
 
 	/* Create a temporary directory and make it current. */
 	tst_tmpdir();
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[0].dir = bad_addr;
 }
 
 
diff --git a/testcases/kernel/syscalls/mknod/mknod06.c b/testcases/kernel/syscalls/mknod/mknod06.c
index f68d08a..0d411bd 100644
--- a/testcases/kernel/syscalls/mknod/mknod06.c
+++ b/testcases/kernel/syscalls/mknod/mknod06.c
@@ -82,6 +82,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
+#include <sys/mman.h>
 
 #include "test.h"
 #include "usctest.h"
@@ -117,6 +118,8 @@
 extern char *get_high_address();
 int exp_enos[]={EEXIST, EFAULT, ENOENT, ENAMETOOLONG, ENOTDIR, 0};
 
+char * bad_addr = 0;
+
 void setup();			/* setup function for the tests */
 void cleanup();			/* cleanup function for the tests */
 
@@ -224,6 +227,12 @@
 	/* Make a temp dir and cd to it */
 	tst_tmpdir();
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	Test_cases[2].pathname = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/open/open08.c b/testcases/kernel/syscalls/open/open08.c
index 663655d..ec44752 100644
--- a/testcases/kernel/syscalls/open/open08.c
+++ b/testcases/kernel/syscalls/open/open08.c
@@ -50,6 +50,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <sys/types.h>
+#include <sys/mman.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <pwd.h>
@@ -68,6 +69,8 @@
 
 int exp_enos[]={EEXIST, EISDIR, ENOTDIR, ENAMETOOLONG, EACCES, EFAULT, 0};
 
+char * bad_addr = 0;
+
 char filename[40] = "";
 char fname[] = "/usr/bin/test";		/* test executable to open */
 char bad_file[] = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz";
@@ -179,6 +182,12 @@
 		tst_brkm(TBROK, cleanup, "Can't creat %s", filename);
 	}
 	close(fildes);
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[5].fname = bad_addr;
 }
 
 /*
diff --git a/testcases/kernel/syscalls/read/read02.c b/testcases/kernel/syscalls/read/read02.c
index f7e98c0..02ca8c4 100644
--- a/testcases/kernel/syscalls/read/read02.c
+++ b/testcases/kernel/syscalls/read/read02.c
@@ -61,6 +61,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <sys/mman.h>
 #include "test.h"
 #include "usctest.h"
 
@@ -97,6 +98,8 @@
 	{&fd3, (void *)-1, EFAULT}
 };
 
+char * bad_addr = 0;
+
 main(int ac, char **av)
 {
 	int i;
@@ -169,6 +172,12 @@
 	if ((fd3 = open(fname, O_RDWR | O_CREAT)) == -1) {
 		tst_brkm(TBROK, cleanup, "open of fd3 (temp file) failed");
 	}
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[2].buf = bad_addr;
 }
 
 /*
diff --git a/testcases/kernel/syscalls/readv/readv02.c b/testcases/kernel/syscalls/readv/readv02.c
index 38505b2..0c5ba90 100644
--- a/testcases/kernel/syscalls/readv/readv02.c
+++ b/testcases/kernel/syscalls/readv/readv02.c
@@ -42,6 +42,7 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <sys/fcntl.h>
+#include <sys/mman.h>
 #include <memory.h>
 #include <errno.h>
 
@@ -90,6 +91,8 @@
 int TST_TOTAL = 1;
 extern int Tst_count;
 
+char * bad_addr = 0;
+
 int init_buffs(char **);
 int fill_mem(char *, int, int);
 long l_seek(int, long, int);
@@ -227,6 +230,12 @@
 	}
 
 	fd[1] = -1;		/* Invalid file descriptor */
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	rd_iovec[6].iov_base = bad_addr;
 }
 
 /*
diff --git a/testcases/kernel/syscalls/rename/rename08.c b/testcases/kernel/syscalls/rename/rename08.c
index 1e6e5b4..4a06909 100644
--- a/testcases/kernel/syscalls/rename/rename08.c
+++ b/testcases/kernel/syscalls/rename/rename08.c
@@ -66,6 +66,7 @@
  */
 #include <sys/types.h>
 #include <sys/fcntl.h>
+#include <sys/mman.h>
 #include <unistd.h>
 #include <errno.h>
 
@@ -82,6 +83,8 @@
 
 int exp_enos[]={EFAULT, 0};     /* List must end with 0 */
 
+char * bad_addr = 0;
+
 int fd;
 char fname[255];
 
@@ -179,6 +182,13 @@
 	sprintf(fname,"./tfile_%d",getpid());
 
 	do_file_setup(fname);
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[0].fd2 = bad_addr;
+	TC[1].fd = bad_addr;
 }
 
 /*
diff --git a/testcases/kernel/syscalls/rmdir/rmdir02.c b/testcases/kernel/syscalls/rmdir/rmdir02.c
index 5fbc5d7..1dd3ba9 100644
--- a/testcases/kernel/syscalls/rmdir/rmdir02.c
+++ b/testcases/kernel/syscalls/rmdir/rmdir02.c
@@ -78,6 +78,7 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/mman.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include "test.h" 
@@ -97,6 +98,8 @@
 
 int exp_enos[]={ENOTEMPTY, EBUSY, ENAMETOOLONG, ENOENT, ENOTDIR, EFAULT, 0};
 
+char * bad_addr = 0;
+
 char tstfile [255];
 char tstdir1 [255];
 char tstdir2 [255];
@@ -345,6 +348,12 @@
 
 	/* Create a temporary directory and make it current. */
 	tst_tmpdir();
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[4].dir = bad_addr;
 }
 
 /*
diff --git a/testcases/kernel/syscalls/rmdir/rmdir05.c b/testcases/kernel/syscalls/rmdir/rmdir05.c
index 0c6ae4f..afa78ff 100644
--- a/testcases/kernel/syscalls/rmdir/rmdir05.c
+++ b/testcases/kernel/syscalls/rmdir/rmdir05.c
@@ -30,7 +30,7 @@
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
  *
  */
-/* $Id: rmdir05.c,v 1.1 2001/08/27 22:15:14 plars Exp $ */
+/* $Id: rmdir05.c,v 1.2 2002/07/23 13:11:19 plars Exp $ */
 /**********************************************************
  * 
  *    OS Test - Silicon Graphics, Inc.
@@ -96,6 +96,7 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <stdlib.h>
 #include <string.h>
 #include "test.h"
@@ -114,6 +115,7 @@
 struct stat stat_buf;   	/* Stat buffer used for verification. */
 char dir_name[256];		/* Array to hold directory name. */
 
+char * bad_addr = 0;
 
 int
 main(int argc, char **argv)
@@ -280,7 +282,7 @@
 
 
 	/* Call rmdir(2) */
-	TEST(rmdir((char *)-1));
+	TEST(rmdir(bad_addr));
 	
 	/* check return code */
 	if ( TEST_RETURN == -1 ) {
@@ -412,6 +414,11 @@
     /* Create a unique directory name. */
     sprintf(dir_name,"./dir_%d",getpid());
 
+    bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+    if (bad_addr <= 0) {
+	tst_brkm(TBROK, cleanup, "mmap failed");
+    }
+
 }	/* End setup() */
 
 
diff --git a/testcases/kernel/syscalls/setgroups/setgroups03.c b/testcases/kernel/syscalls/setgroups/setgroups03.c
index 1c3509c..be97021 100644
--- a/testcases/kernel/syscalls/setgroups/setgroups03.c
+++ b/testcases/kernel/syscalls/setgroups/setgroups03.c
@@ -129,6 +129,10 @@
 		Tst_count = 0;
 
 		for (i = 0; i < TST_TOTAL; i++) {
+			if(Test_cases[i].setupfunc != NULL) {
+				Test_cases[i].setupfunc();
+			}
+
 			gidsetsize = Test_cases[i].gsize;
 			test_desc = Test_cases[i].desc;
 			
@@ -179,18 +183,9 @@
 {
 	int i;
 
-/* Switch to nobody user for correct error code collection */
         if (geteuid() != 0) {
                 tst_brkm(TBROK, tst_exit, "Test must be run as root");
         }
-         ltpuser = getpwnam(nobody_uid);
-         if (seteuid(ltpuser->pw_uid) == -1) {
-                tst_resm(TINFO, "setreuid failed to "
-                         "to set the effective uid to %d",
-                         ltpuser->pw_uid);
-                perror("setreuid");
-         }
-
 
 	/* capture signals */
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
@@ -198,12 +193,6 @@
 	/* Pause if that option was specified */
 	TEST_PAUSE;
 
-	/* call individual setup functions */
-	for (i = 0; i < TST_TOTAL; i++) {
-		if(Test_cases[i].setupfunc != NULL) {
-			Test_cases[i].setupfunc();
-		}
-	}
 }
 
 /*
@@ -218,6 +207,15 @@
 {
 	struct passwd *user_info;	/* struct. to hold test user info */
 
+/* Switch to nobody user for correct error code collection */
+         ltpuser = getpwnam(nobody_uid);
+         if (seteuid(ltpuser->pw_uid) == -1) {
+                tst_resm(TINFO, "setreuid failed to "
+                         "to set the effective uid to %d",
+                         ltpuser->pw_uid);
+                perror("setreuid");
+         }
+
 	if ((user_info = getpwnam(TESTUSER)) == NULL) {
 		tst_brkm(TFAIL, cleanup, "getpwnam(2) of %s Failed", TESTUSER);
 	}
diff --git a/testcases/kernel/syscalls/stat/stat03.c b/testcases/kernel/syscalls/stat/stat03.c
index 540f453..7ba3499 100644
--- a/testcases/kernel/syscalls/stat/stat03.c
+++ b/testcases/kernel/syscalls/stat/stat03.c
@@ -83,6 +83,7 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <pwd.h>
 
 #include "test.h"
@@ -125,6 +126,8 @@
 extern int Tst_count;           /* Test Case counter for tst_* routines */
 int exp_enos[]={EACCES, EFAULT, ENAMETOOLONG, ENOENT, ENOTDIR, 0};
 
+char * bad_addr = 0;
+
 void setup();			/* Main setup function for the tests */
 void cleanup();			/* cleanup function for the test */
 
@@ -244,6 +247,12 @@
 	/* Make a temp dir and cd to it */
 	tst_tmpdir();
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	Test_cases[2].pathname = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/stat/stat06.c b/testcases/kernel/syscalls/stat/stat06.c
index f8d4178..7b59d5f 100644
--- a/testcases/kernel/syscalls/stat/stat06.c
+++ b/testcases/kernel/syscalls/stat/stat06.c
@@ -30,7 +30,7 @@
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
  *
  */
-/* $Id: stat06.c,v 1.1 2001/08/27 22:15:15 plars Exp $ */
+/* $Id: stat06.c,v 1.2 2002/07/23 13:11:21 plars Exp $ */
 /**********************************************************
  * 
  *    OS Test - Silicon Graphics, Inc.
@@ -114,6 +114,7 @@
 #include <sys/types.h>
 #include <sys/fcntl.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <errno.h>
 #include <string.h>
 #include <signal.h>
@@ -131,6 +132,8 @@
 
 int exp_enos[]={0, 0};
 
+char * bad_addr = 0;
+
 int high_address_setup();
 int longpath_setup();
 int no_setup();
@@ -277,6 +280,13 @@
     /* make a temp directory and cd to it */
     tst_tmpdir();
 
+    bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+    if (bad_addr <= 0) {
+	tst_brkm(TBROK, cleanup, "mmap failed");
+    }
+    Test_cases[6].pathname = bad_addr;
+    
+
     for (ind=0; Test_cases[ind].desc != NULL; ind++ ) {
 	Test_cases[ind].setupfunc();
     }
diff --git a/testcases/kernel/syscalls/statfs/statfs02.c b/testcases/kernel/syscalls/statfs/statfs02.c
index 2509368..df8b108 100644
--- a/testcases/kernel/syscalls/statfs/statfs02.c
+++ b/testcases/kernel/syscalls/statfs/statfs02.c
@@ -55,6 +55,7 @@
 #include <sys/statfs.h>
 #include <sys/stat.h>
 #include <sys/vfs.h>
+#include <sys/mman.h>
 #include <errno.h>
 #include "test.h"
 #include "usctest.h"
@@ -65,6 +66,8 @@
 
 int exp_enos[]={ENOTDIR, ENOENT, ENAMETOOLONG, EFAULT, 0};
 
+char * bad_addr = 0;
+
 char bad_file[] = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyzabcdefghijklmnopqrstmnopqrstuvwxyz";
 	char good_dir[100] = "testdir";
 	char fname[30] = "testfile";
@@ -170,6 +173,12 @@
 	sprintf(fname1, "%s/%s", fname, fname);
 
 	sprintf(good_dir, "%s.statfs.%d", good_dir, getpid());
+
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	TC[3].path = bad_addr;
 }
 
 
diff --git a/testcases/kernel/syscalls/statfs/statfs03.c b/testcases/kernel/syscalls/statfs/statfs03.c
index 9be6235..d81945a 100644
--- a/testcases/kernel/syscalls/statfs/statfs03.c
+++ b/testcases/kernel/syscalls/statfs/statfs03.c
@@ -67,7 +67,7 @@
 
 char fname[30] = "testfile";
 char path[50];
-struct statfs *buf;
+struct statfs buf;
 
 void setup(void);
 void cleanup(void);
@@ -94,7 +94,7 @@
 		/* reset Tst_count in case we are looping. */
 		Tst_count = 0;
 
-		TEST(statfs(path, buf));
+		TEST(statfs(path, &buf));
 
 		if (TEST_RETURN != -1) {
 			tst_resm(TFAIL, "call succeeded unexpectedly");
diff --git a/testcases/kernel/syscalls/symlink/symlink03.c b/testcases/kernel/syscalls/symlink/symlink03.c
index 4ae27b3..2945e74 100644
--- a/testcases/kernel/syscalls/symlink/symlink03.c
+++ b/testcases/kernel/syscalls/symlink/symlink03.c
@@ -79,6 +79,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/fcntl.h>
+#include <sys/mman.h>
 #include <errno.h>
 #include <string.h>
 #include <signal.h>
@@ -104,6 +105,8 @@
 extern int Tst_count;		/* Test Case counter for tst_* routines */
 int exp_enos[]={ENOTDIR, ENOENT, ENAMETOOLONG, EFAULT,  EEXIST, EACCES, 0};
 
+char * bad_addr = 0;
+
 int no_setup();
 int setup1();                   /* setup function to test symlink for EACCES */
 int setup2();                   /* setup function to test symlink for EEXIST */
@@ -252,6 +255,12 @@
 	/* make a temp directory and cd to it */
 	tst_tmpdir();
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	Test_cases[3].link = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/truncate/truncate03.c b/testcases/kernel/syscalls/truncate/truncate03.c
index 6c2b807..69cdec5 100644
--- a/testcases/kernel/syscalls/truncate/truncate03.c
+++ b/testcases/kernel/syscalls/truncate/truncate03.c
@@ -82,6 +82,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/fcntl.h>
+#include <sys/mman.h>
 #include <errno.h>
 #include <string.h>
 #include <signal.h>
@@ -110,6 +111,8 @@
 extern int Tst_count;		/* Test Case counter for tst_* routines */
 int exp_enos[]={EACCES, ENOTDIR, EFAULT, ENAMETOOLONG, ENOENT, 0};
 
+char * bad_addr = 0;
+
 char Longpathname[PATH_MAX+2];
 char High_address_node[64];
 
@@ -280,6 +283,12 @@
 		/*NOTREACHED*/
 	}
 
+	bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+	if (bad_addr <= 0) {
+		tst_brkm(TBROK, cleanup, "mmap failed");
+	}
+	Test_cases[3].pathname = bad_addr;
+
 	/* call individual setup functions */
 	for (ind = 0; Test_cases[ind].desc != NULL; ind++) {
 		Test_cases[ind].setupfunc();
diff --git a/testcases/kernel/syscalls/unlink/unlink07.c b/testcases/kernel/syscalls/unlink/unlink07.c
index 62dd031..59b83b9 100644
--- a/testcases/kernel/syscalls/unlink/unlink07.c
+++ b/testcases/kernel/syscalls/unlink/unlink07.c
@@ -30,7 +30,7 @@
  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
  *
  */
-/* $Id: unlink07.c,v 1.1 2001/08/27 22:15:15 plars Exp $ */
+/* $Id: unlink07.c,v 1.2 2002/07/23 13:11:22 plars Exp $ */
 /**********************************************************
  * 
  *    OS Test - Silicon Graphics, Inc.
@@ -112,6 +112,7 @@
 #include <sys/types.h>
 #include <sys/fcntl.h>
 #include <sys/stat.h>
+#include <sys/mman.h>
 #include <errno.h>
 #include <string.h>
 #include <signal.h>
@@ -132,6 +133,8 @@
 
 int exp_enos[]={0, 0};
 
+char * bad_addr = 0;
+
 int longpath_setup();
 int no_setup();
 int filepath_setup();
@@ -255,6 +258,12 @@
     /* make a temp directory and cd to it */
     tst_tmpdir();
 
+    bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+    if (bad_addr <= 0) {
+	tst_brkm(TBROK, cleanup, "mmap failed");
+    }
+    Test_cases[7].pathname = bad_addr;
+
     for (ind=0; Test_cases[ind].desc != NULL; ind++ ) {
 	Test_cases[ind].setupfunc();
     }
diff --git a/testcases/kernel/syscalls/waitpid/waitpid04.c b/testcases/kernel/syscalls/waitpid/waitpid04.c
index 8fd4094..a16a382 100644
--- a/testcases/kernel/syscalls/waitpid/waitpid04.c
+++ b/testcases/kernel/syscalls/waitpid/waitpid04.c
@@ -105,6 +105,7 @@
 		if (fork() == 0) {
 			exit(0);
 		}
+		pid = 1;
 		ret = waitpid(pid, &status, WUNTRACED);
 		flag = 0;
 		if( ret != -1) {
diff --git a/testcases/kernel/syscalls/writev/writev02.c b/testcases/kernel/syscalls/writev/writev02.c
index 195d9ff..b0885db 100644
--- a/testcases/kernel/syscalls/writev/writev02.c
+++ b/testcases/kernel/syscalls/writev/writev02.c
@@ -178,7 +178,7 @@
 		fail = 0;
 
 		l_seek(fd[0], 0, 0);
-		TEST(writev(fd[0], wr_iovec, 3));
+		TEST(writev(fd[0], wr_iovec, 2));
 		if (TEST_RETURN < 0) {
 			TEST_ERROR_LOG(TEST_ERRNO);
 			if (TEST_ERRNO == EFAULT) {
diff --git a/testcases/kernel/syscalls/writev/writev05.c b/testcases/kernel/syscalls/writev/writev05.c
index b43c0a7..97f7253 100644
--- a/testcases/kernel/syscalls/writev/writev05.c
+++ b/testcases/kernel/syscalls/writev/writev05.c
@@ -171,7 +171,7 @@
 		fail = 0;
 
 		l_seek(fd[0], 0, 0);
-		TEST(writev(fd[0], wr_iovec, 3));
+		TEST(writev(fd[0], wr_iovec, 2));
 		if (TEST_RETURN < 0) {
 			TEST_ERROR_LOG(TEST_ERRNO);
 			if (TEST_ERRNO == EFAULT) {