From owner-svn-src-user@freebsd.org  Mon Feb  1 07:39:59 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09C80A979F2
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Mon,  1 Feb 2016 07:39:59 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id B5114A5C;
 Mon,  1 Feb 2016 07:39:58 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u117dvbm084914;
 Mon, 1 Feb 2016 07:39:57 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u117dvlr084911;
 Mon, 1 Feb 2016 07:39:57 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201602010739.u117dvlr084911@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Mon, 1 Feb 2016 07:39:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r295120 - in user/pho/stress2: . misc
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.20
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 01 Feb 2016 07:39:59 -0000

Author: pho
Date: Mon Feb  1 07:39:57 2016
New Revision: 295120
URL: https://svnweb.freebsd.org/changeset/base/295120

Log:
  Delete old and outdated syscall fuzzing tests. syscall4.sh is the current syscall
  fuzzer.
  Explain how to run syscall fuzzing as root, if you really must.
  Fix a single style issue in syscall4.sh
  
  Sponsored by:	EMC / Isilon Storage Division

Deleted:
  user/pho/stress2/misc/syscall.sh
  user/pho/stress2/misc/syscall2.sh
  user/pho/stress2/misc/syscall3.sh
Modified:
  user/pho/stress2/README
  user/pho/stress2/misc/syscall4.sh

Modified: user/pho/stress2/README
==============================================================================
--- user/pho/stress2/README	Mon Feb  1 07:15:31 2016	(r295119)
+++ user/pho/stress2/README	Mon Feb  1 07:39:57 2016	(r295120)
@@ -4,12 +4,10 @@ This is the FreeBSD kernel stress test s
 computer, by stressing selected parts of the kernel, thus exposing inadequate
 error handling.
 
-Do not run the syscall test as root.
-
 To build and use:
 
 make
-sh ./run.sh
+sh ./run.sh (see stress2/misc)
 
 The "run.sh" script accepts an optional configuration file in order to test specific areas.
 For example:
@@ -40,6 +38,14 @@ To run all of these tests once, type "./
 The default mode is to compile tests, but pre-build binaries may be used.
 See default.cfg for details.
 
+There may sometimes be a need for running single syscall fuzzing as root.
+This can be achieved by setting the environment variable "USE_ROOT",
+before running misc/syscall4.sh. For example:
+$ ./syscall4.sh 6
+$ USE_ROOT= ./syscall4.sh 6
+Running syscall4 as root for 6.
+$
+
 The name stress2 indicates that this is the second generation of the Kernel Stress Test Suite.
 The first version (stress) was based mostly on scripts.
 

Modified: user/pho/stress2/misc/syscall4.sh
==============================================================================
--- user/pho/stress2/misc/syscall4.sh	Mon Feb  1 07:15:31 2016	(r295119)
+++ user/pho/stress2/misc/syscall4.sh	Mon Feb  1 07:39:57 2016	(r295120)
@@ -236,7 +236,7 @@ test(void *arg __unused)
 					if ((fd[i] = open(p->fts_path, O_RDONLY)) == -1)
 						continue;
 			i++;
-			i = i % 900;
+			i = i % nitems(fd);
 		}
 
 		if (fts_close(fts) == -1)
@@ -309,8 +309,9 @@ main(int argc, char **argv)
 	if ((pw = getpwnam("nobody")) == NULL)
 		err(1, "no such user: nobody");
 
-	if (getenv("USE_ROOT"))
-		fprintf(stderr, "Running syscall4 as root.\n");
+	if (getenv("USE_ROOT") && argc == 2)
+		fprintf(stderr, "Running syscall4 as root for %s.\n",
+				argv[1]);
 	else {
 		if (setgroups(1, &pw->pw_gid) ||
 		    setegid(pw->pw_gid) || setgid(pw->pw_gid) ||