Hello community,

here is the log from the commit of package stress-ng for openSUSE:Factory 
checked in at 2019-09-25 08:35:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/stress-ng (Old)
 and      /work/SRC/openSUSE:Factory/.stress-ng.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "stress-ng"

Wed Sep 25 08:35:40 2019 rev:65 rq:732852 version:0.10.06

Changes:
--------
--- /work/SRC/openSUSE:Factory/stress-ng/stress-ng.changes      2019-09-20 
14:54:20.562868922 +0200
+++ /work/SRC/openSUSE:Factory/.stress-ng.new.7948/stress-ng.changes    
2019-09-25 08:35:42.670325322 +0200
@@ -1,0 +2,16 @@
+Mon Sep 23 19:36:57 UTC 2019 - Martin Hauke <[email protected]>
+
+- Update to version 0.10.06
+  * stress-mcontend: ensure mmap'd file is sync'd with zero
+    data
+  * stress-rmap: don't make fallocate failures a rmap test
+    failure
+  * stress-shm: fork and exit a child to exercise shm dup and
+    removal
+  * stress-ng: fix jobfile with classes
+  * stress-procfs: don't randomly read pci proc info on ARM64
+  * stress-procfs: remove bad buffer test, it's not portable
+  * stress-sysfs: remove bad address reads, these fault on ARM64
+  * stress-inode-flags: move open/close to controlling process
+
+-------------------------------------------------------------------

Old:
----
  stress-ng-0.10.05.tar.xz

New:
----
  stress-ng-0.10.06.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ stress-ng.spec ++++++
--- /var/tmp/diff_new_pack.Eh2M2B/_old  2019-09-25 08:35:43.166325255 +0200
+++ /var/tmp/diff_new_pack.Eh2M2B/_new  2019-09-25 08:35:43.166325255 +0200
@@ -18,7 +18,7 @@
 
 
 Name:           stress-ng
-Version:        0.10.05
+Version:        0.10.06
 Release:        0
 Summary:        Tool to load and stress a computer
 License:        GPL-2.0-only

++++++ stress-ng-0.10.05.tar.xz -> stress-ng-0.10.06.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/Makefile 
new/stress-ng-0.10.06/Makefile
--- old/stress-ng-0.10.05/Makefile      2019-09-12 16:26:48.000000000 +0200
+++ new/stress-ng-0.10.06/Makefile      2019-09-23 18:50:56.000000000 +0200
@@ -16,7 +16,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
 #
 
-VERSION=0.10.05
+VERSION=0.10.06
 #
 # Codename "systematic system smasher"
 #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/stress-inode-flags.c 
new/stress-ng-0.10.06/stress-inode-flags.c
--- old/stress-ng-0.10.05/stress-inode-flags.c  2019-09-12 16:26:48.000000000 
+0200
+++ new/stress-ng-0.10.06/stress-inode-flags.c  2019-09-23 18:50:56.000000000 
+0200
@@ -39,6 +39,11 @@
 
 #define MAX_INODE_FLAG_THREADS         (4)
 
+typedef struct {
+       int dir_fd;
+       int file_fd;
+} data_t;
+
 static volatile bool keep_running;
 static sigset_t set;
 static shim_pthread_spinlock_t spinlock;
@@ -94,77 +99,56 @@
  */
 static int stress_inode_flags_stressor(
        const args_t *args,
-       char *filename)
+       data_t *data)
 {
-       char pathname[PATH_MAX];
-       char *path;
-       int fdfile, fddir;
-
-       (void)shim_strlcpy(pathname, filename, PATH_MAX);
-       path = dirname(pathname);
-
-       fddir = open(path, O_RDONLY | O_DIRECTORY);
-       if (fddir < 0) {
-               pr_err("%s: cannot open %s: errno=%d (%s)\n",
-                       args->name, path, errno, strerror(errno));
-               return -1;
-       }
-       fdfile = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
-       if (fdfile < 0) {
-               pr_err("%s: cannot open %s: errno=%d (%s)\n",
-                       args->name, filename, errno, strerror(errno));
-               (void)close(fddir);
-               return -1;
-       }
-
        while (keep_running && keep_stressing()) {
                int ret;
 
-               stress_inode_flags_ioctl(args, fddir, 0);
+               stress_inode_flags_ioctl(args, data->dir_fd, 0);
 #if defined(FS_DIRSYNC_FL)
-               stress_inode_flags_ioctl(args, fddir, FS_DIRSYNC_FL);
+               stress_inode_flags_ioctl(args, data->dir_fd, FS_DIRSYNC_FL);
 #endif
 #if defined(FS_PROJINHERIT_FL)
-               stress_inode_flags_ioctl(args, fddir, FS_PROJINHERIT_FL);
+               stress_inode_flags_ioctl(args, data->dir_fd, FS_PROJINHERIT_FL);
 #endif
 #if defined(FS_SYNC_FL)
-               stress_inode_flags_ioctl(args, fddir, FS_SYNC_FL);
+               stress_inode_flags_ioctl(args, data->dir_fd, FS_SYNC_FL);
 #endif
 #if defined(FS_TOPDIR_FL)
-               stress_inode_flags_ioctl(args, fddir, FS_TOPDIR_FL);
+               stress_inode_flags_ioctl(args, data->dir_fd, FS_TOPDIR_FL);
 #endif
 #if defined(FS_APPEND_LF)
-               stress_inode_flags_ioctl(args, fdfile, FS_APPEND_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_APPEND_FL);
 #endif
 #if defined(FS_COMPR_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_COMPR_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_COMPR_FL);
 #endif
 #if defined(FS_IMMUTABLE_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_IMMUTABLE_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_IMMUTABLE_FL);
 #endif
 #if defined(FS_JOURNAL_DATA_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_JOURNAL_DATA_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, 
FS_JOURNAL_DATA_FL);
 #endif
 #if defined(FS_NOCOW_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_NOCOW_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_NOCOW_FL);
 #endif
 #if defined(FS_NODUMP_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_NODUMP_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_NODUMP_FL);
 #endif
 #if defined(FS_NOTAIL_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_NOTAIL_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_NOTAIL_FL);
 #endif
 #if defined(FS_PROJINHERIT_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_PROJINHERIT_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, 
FS_PROJINHERIT_FL);
 #endif
 #if defined(FS_SECRM_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_SECRM_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_SECRM_FL);
 #endif
 #if defined(FS_SYNC_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_SYNC_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_SYNC_FL);
 #endif
 #if defined(FS_UNRM_FL)
-               stress_inode_flags_ioctl(args, fdfile, FS_UNRM_FL);
+               stress_inode_flags_ioctl(args, data->file_fd, FS_UNRM_FL);
 #endif
                ret = shim_pthread_spin_lock(&spinlock);
                if (!ret) {
@@ -172,11 +156,9 @@
                        ret = shim_pthread_spin_unlock(&spinlock);
                        (void)ret;
                }
-               stress_inode_flags_ioctl_sane(fdfile);
+               stress_inode_flags_ioctl_sane(data->file_fd);
        }
-       stress_inode_flags_ioctl_sane(fdfile);
-       (void)close(fdfile);
-       (void)close(fddir);
+       stress_inode_flags_ioctl_sane(data->file_fd);
 
        return 0;
 }
@@ -207,7 +189,7 @@
        if (stress_sigaltstack(stack, SIGSTKSZ) < 0)
                return &nowt;
 
-       pa->pthread_ret = stress_inode_flags_stressor(pa->args, (char 
*)pa->data);
+       pa->pthread_ret = stress_inode_flags_stressor(pa->args, pa->data);
 
        return &nowt;
 }
@@ -219,11 +201,13 @@
  */
 static int stress_inode_flags(const args_t *args)
 {
-       char filename[PATH_MAX];
        size_t i;
        pthread_t pthreads[MAX_INODE_FLAG_THREADS];
        int rc, ret[MAX_INODE_FLAG_THREADS];
        pthread_args_t pa[MAX_INODE_FLAG_THREADS];
+       data_t data;
+       char tmp[PATH_MAX], file_name[PATH_MAX];
+       char *dir_name;
 
        rc = shim_pthread_spin_init(&spinlock, SHIM_PTHREAD_PROCESS_SHARED);
         if (rc) {
@@ -235,14 +219,32 @@
        if (rc < 0)
                return exit_status(-rc);
        (void)stress_temp_filename_args(args,
-               filename, sizeof(filename), mwc32());
+               file_name, sizeof(file_name), mwc32());
+
+       shim_strlcpy(tmp, file_name, sizeof(tmp));
+       dir_name = dirname(tmp);
+
+       data.dir_fd = open(dir_name, O_RDONLY | O_DIRECTORY);
+       if (data.dir_fd < 0) {
+               pr_err("%s: cannot open %s: errno=%d (%s)\n",
+                       args->name, dir_name, errno, strerror(errno));
+               rc = EXIT_NO_RESOURCE;
+               goto tidy;
+       }
+       data.file_fd = open(file_name, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+       if (data.file_fd < 0) {
+               pr_err("%s: cannot open %s: errno=%d (%s)\n",
+                       args->name, file_name, errno, strerror(errno));
+               rc = EXIT_NO_RESOURCE;
+               goto tidy_dir_fd;
+       }
 
        (void)memset(ret, 0, sizeof(ret));
        keep_running = true;
 
        for (i = 0; i < MAX_INODE_FLAG_THREADS; i++) {
                pa[i].args = args;
-               pa[i].data = (void *)filename;
+               pa[i].data = (void *)&data;
                pa[i].pthread_ret = 0;
 
                ret[i] = pthread_create(&pthreads[i], NULL,
@@ -250,7 +252,7 @@
        }
 
        do {
-               stress_inode_flags_stressor(args, filename);
+               stress_inode_flags_stressor(args, &data);
        } while (keep_stressing());
 
        keep_running = false;
@@ -264,9 +266,13 @@
                }
        }
 
-       (void)shim_pthread_spin_destroy(&spinlock);
-       (void)unlink(filename);
+       (void)close(data.file_fd);
+tidy_dir_fd:
+       (void)close(data.dir_fd);
+tidy:
+       (void)unlink(file_name);
        stress_temp_dir_rm_args(args);
+       (void)shim_pthread_spin_destroy(&spinlock);
 
        return rc;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/stress-mcontend.c 
new/stress-ng-0.10.06/stress-mcontend.c
--- old/stress-ng-0.10.05/stress-mcontend.c     2019-09-12 16:26:48.000000000 
+0200
+++ new/stress-ng-0.10.06/stress-mcontend.c     2019-09-23 18:50:56.000000000 
+0200
@@ -47,6 +47,32 @@
 }
 #endif
 
+/*
+ *  page_write_sync()
+ *     write a whole page of zeros to the backing file and
+ *     ensure it is sync'd to disc for mmap'ing to avoid any
+ *     bus errors on the mmap.
+ */
+static int page_write_sync(const int fd, const size_t page_size)
+{
+       char buffer[256];
+       size_t n = 0;
+
+       (void)memset(buffer, 0, sizeof(buffer));
+
+       while (n < page_size) {
+               ssize_t rc;
+
+               rc = write(fd, buffer, sizeof(buffer));
+               if (rc < (ssize_t)sizeof(buffer))
+                       return rc;
+               n += rc;
+       }
+       (void)sync();
+
+       return 0;
+}
+
 static inline HOT OPTIMIZE3 void read64(uint64_t *data)
 {
        register uint64_t v;
@@ -299,9 +325,12 @@
        int ret[MAX_READ_THREADS];
        void *data[MAX_MAPPINGS];
        char filename[PATH_MAX];
+       char buffer[args->page_size];
        pthread_args_t pa;
        int fd, rc;
 
+       (void)memset(buffer, 0, sizeof(buffer));
+
        rc = stress_temp_dir_mk_args(args);
        if (rc < 0)
                return exit_status(-rc);
@@ -312,9 +341,20 @@
        if (fd < 0) {
                pr_inf("%s: open failed: errno=%d (%s)\n",
                        args->name, errno, strerror(errno));
+               (void)unlink(filename);
+               (void)stress_temp_dir_rm_args(args);
+               return EXIT_NO_RESOURCE;
+       }
+       rc = page_write_sync(fd, args->page_size);
+       if (rc < 0) {
+               pr_inf("%s: mmap backing file write failed: errno=%d (%s)\n",
+                       args->name, errno, strerror(errno));
+               (void)close(fd);
+               (void)unlink(filename);
+               (void)stress_temp_dir_rm_args(args);
                return EXIT_NO_RESOURCE;
+
        }
-       (void)shim_fallocate(fd, 0, 0, args->page_size);
        (void)unlink(filename);
        (void)stress_temp_dir_rm_args(args);
 
@@ -325,7 +365,7 @@
         */
        data[0] = mmap(NULL, args->page_size, PROT_READ | PROT_WRITE,
                        MAP_PRIVATE, fd, 0);
-       if (data[0] == MAP_FAILED) {
+       if (data[1] == MAP_FAILED) {
                pr_inf("%s: mmap failed: errno=%d (%s)\n",
                        args->name, errno, strerror(errno));
                (void)close(fd);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/stress-ng.c 
new/stress-ng-0.10.06/stress-ng.c
--- old/stress-ng-0.10.05/stress-ng.c   2019-09-12 16:26:48.000000000 +0200
+++ new/stress-ng-0.10.06/stress-ng.c   2019-09-23 18:50:56.000000000 +0200
@@ -2355,6 +2355,7 @@
                size_t i;
 
                opterr = (!jobmode)? opterr: 0;
+
 next_opt:
                if ((c = getopt_long(argc, argv, 
"?khMVvqnt:b:c:i:j:m:d:f:s:l:p:P:C:S:a:y:F:D:T:u:o:r:B:R:Y:x:",
                        long_options, &option_index)) == -1) {
@@ -2719,6 +2720,12 @@
        ret = parse_opts(argc, argv, false);
        if (ret != EXIT_SUCCESS)
                exit(ret);
+       /*
+        *  Load in job file options
+        */
+       (void)get_setting("job", &job_filename);
+       if (parse_jobfile(argc, argv, job_filename) < 0)
+               exit(EXIT_FAILURE);
 
        /*
         *  Sanity check minimize/maximize options
@@ -2739,6 +2746,7 @@
                exit(EXIT_FAILURE);
        }
        (void)get_setting("class", &class);
+
        if (class &&
            !(g_opt_flags & (OPT_FLAGS_SEQUENTIAL | OPT_FLAGS_ALL))) {
                (void)fprintf(stderr, "class option is only used with "
@@ -2826,13 +2834,6 @@
        }
 
        /*
-        *  Load in job file options
-        */
-       (void)get_setting("job", &job_filename);
-       if (parse_jobfile(argc, argv, job_filename) < 0)
-               exit(EXIT_FAILURE);
-
-       /*
         *  Setup stressor proc info
         */
        if (g_opt_flags & OPT_FLAGS_SEQUENTIAL) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/stress-procfs.c 
new/stress-ng-0.10.06/stress-procfs.c
--- old/stress-ng-0.10.05/stress-procfs.c       2019-09-12 16:26:48.000000000 
+0200
+++ new/stress-ng-0.10.06/stress-procfs.c       2019-09-23 18:50:56.000000000 
+0200
@@ -31,12 +31,11 @@
 #if defined(HAVE_LIB_PTHREAD) && defined(__linux__)
 
 #define PROC_BUF_SZ            (4096)
-#define MAX_READ_THREADS       (4)
+#define MAX_PROCFS_THREADS     (4)
 
 typedef struct ctxt {
        const args_t *args;
        const char *path;
-       char *badbuf;
        bool writeable;
 } ctxt_t;
 
@@ -148,23 +147,6 @@
                if (ret < 0)
                        goto err;
 
-#if 0
-               /*
-                *  Bad read buffer, should fail!
-                */
-               if (ctxt->badbuf) {
-                       ret = read(fd, ctxt->badbuf, PROC_BUF_SZ);
-                       if (ret == 0)
-                               goto err;
-               }
-
-               if (time_now() - t_start > threshold) {
-                       timeout = true;
-                       (void)close(fd);
-                       goto next;
-               }
-#endif
-
                /*
                 *  mmap it
                 */
@@ -251,17 +233,6 @@
                        ret = write(fd, buffer, 0);
                        (void)ret;
                        (void)close(fd);
-
-                       /*
-                        *  Write using badbuf, expect it to fail
-                        */
-                       if (ctxt->badbuf) {
-                               if ((fd = open(path, O_WRONLY | O_NONBLOCK)) < 
0)
-                                       return;
-                               ret = write(fd, ctxt->badbuf, PROC_BUF_SZ);
-                               (void)ret;
-                               (void)close(fd);
-                       }
                }
 next:
                if (loops > 0) {
@@ -327,6 +298,11 @@
        if (depth > 20)
                return;
 
+#if defined(STRESS_ARM)
+       if (!strncmp(path, "/proc/bus/pci", 13))
+               return;
+#endif
+
        mixup = mwc32();
        dlist = NULL;
        n = scandir(path, &dlist, NULL, mixup_sort);
@@ -380,8 +356,8 @@
 static int stress_procfs(const args_t *args)
 {
        size_t i;
-       pthread_t pthreads[MAX_READ_THREADS];
-       int rc, ret[MAX_READ_THREADS];
+       pthread_t pthreads[MAX_PROCFS_THREADS];
+       int rc, ret[MAX_PROCFS_THREADS];
        ctxt_t ctxt;
 
        (void)sigfillset(&set);
@@ -400,15 +376,7 @@
 
        (void)memset(ret, 0, sizeof(ret));
 
-       ctxt.badbuf = mmap(NULL, PROC_BUF_SZ, PROT_READ,
-                       MAP_SHARED | MAP_ANONYMOUS, -1, 0);
-       if (ctxt.badbuf == MAP_FAILED) {
-               pr_inf("%s: mmap failed: errno=%d (%s)\n",
-                       args->name, errno, strerror(errno));
-               return EXIT_NO_RESOURCE;
-       }
-
-       for (i = 0; i < MAX_READ_THREADS; i++) {
+       for (i = 0; i < MAX_PROCFS_THREADS; i++) {
                ret[i] = pthread_create(&pthreads[i], NULL,
                                stress_proc_rw_thread, &ctxt);
        }
@@ -471,11 +439,10 @@
                (void)rc;
        }
 
-       for (i = 0; i < MAX_READ_THREADS; i++) {
+       for (i = 0; i < MAX_PROCFS_THREADS; i++) {
                if (ret[i] == 0)
                        (void)pthread_join(pthreads[i], NULL);
        }
-       (void)munmap(ctxt.badbuf, PROC_BUF_SZ);
        (void)shim_pthread_spin_destroy(&lock);
 
        return EXIT_SUCCESS;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/stress-rmap.c 
new/stress-ng-0.10.06/stress-rmap.c
--- old/stress-ng-0.10.05/stress-rmap.c 2019-09-12 16:26:48.000000000 +0200
+++ new/stress-ng-0.10.06/stress-rmap.c 2019-09-23 18:50:56.000000000 +0200
@@ -173,7 +173,7 @@
                (void)stress_temp_dir_rm_args(args);
                (void)munmap((void *)counters, counters_sz);
 
-               return EXIT_FAILURE;
+               return EXIT_NO_RESOURCE;
        }
 
        for (i = 0; i < MAPPINGS_MAX; i++) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/stress-shm.c 
new/stress-ng-0.10.06/stress-shm.c
--- old/stress-ng-0.10.05/stress-shm.c  2019-09-12 16:26:48.000000000 +0200
+++ new/stress-ng-0.10.06/stress-shm.c  2019-09-23 18:50:56.000000000 +0200
@@ -134,6 +134,7 @@
        do {
                for (i = 0; ok && (i < (ssize_t)shm_posix_objects); i++) {
                        int shm_fd, ret;
+                       pid_t newpid;
                        void *addr;
                        char *shm_name = &shm_names[i * SHM_NAME_LEN];
                        struct stat statbuf;
@@ -189,6 +190,15 @@
                                (void)close(shm_fd);
                                goto reap;
                        }
+
+                       /*
+                        *  Exercise shm duplication and reaping
+                        *  on a fork and exit
+                        */
+                       newpid = fork();
+                       if (newpid == 0)
+                               _exit(0);
+
                        (void)madvise_random(addr, sz);
                        (void)shim_msync(addr, sz, mwc1() ? MS_ASYNC : MS_SYNC);
                        (void)shim_fsync(shm_fd);
@@ -222,6 +232,11 @@
                        }
 
                        (void)close(shm_fd);
+                       if (newpid > 0) {
+                               int status;
+
+                               waitpid(newpid, &status, 0);
+                       }
 
                        if (!keep_stressing())
                                goto reap;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/stress-sigq.c 
new/stress-ng-0.10.06/stress-sigq.c
--- old/stress-ng-0.10.05/stress-sigq.c 2019-09-12 16:26:48.000000000 +0200
+++ new/stress-ng-0.10.06/stress-sigq.c 2019-09-23 18:50:56.000000000 +0200
@@ -26,7 +26,7 @@
 
 static const help_t help[] = {
        { NULL, "sigq N",       "start N workers sending sigqueue signals" },
-       { NULL, "sigq-ops N",   "stop after N siqqueue bogo operations" },
+       { NULL, "sigq-ops N",   "stop after N sigqueue bogo operations" },
        { NULL, NULL,           NULL }
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.05/stress-sysfs.c 
new/stress-ng-0.10.06/stress-sysfs.c
--- old/stress-ng-0.10.05/stress-sysfs.c        2019-09-12 16:26:48.000000000 
+0200
+++ new/stress-ng-0.10.06/stress-sysfs.c        2019-09-23 18:50:56.000000000 
+0200
@@ -31,7 +31,7 @@
 #if defined(HAVE_LIB_PTHREAD) && defined(__linux__)
 
 #define SYS_BUF_SZ             (4096)
-#define MAX_READ_THREADS       (4)     /* threads stressing sysfs */
+#define MAX_SYSFS_THREADS      (4)     /* threads stressing sysfs */
 #define DRAIN_DELAY_US         (50000) /* backoff in (us) microsecs */
 #define DURATION_PER_SYSFS_FILE        (40000) /* max duration per file in 
microsecs */
 #define OPS_PER_SYSFS_FILE     (256)   /* max iterations per sysfs file */
@@ -40,34 +40,17 @@
 static shim_pthread_spinlock_t lock;
 static char sysfs_path[PATH_MAX];
 static uint32_t mixup;
-static volatile bool segv_abort = false;
 static volatile bool drain_kmsg = false;
-static volatile bool usr2_killed = false;
 static volatile uint32_t counter = 0;
-static sigjmp_buf jmp_env;
 static char signum_path[] = "/sys/kernel/notes";
 static uint32_t os_release;
 
 typedef struct ctxt {
        const args_t *args;             /* stressor args */
-       char *badbuf;                   /* bad mapping for I/O buffer */
        int kmsgfd;                     /* /dev/kmsg file descriptor */
        bool writeable;                 /* is sysfs writeable? */
 } ctxt_t;
 
-static void MLOCKED_TEXT stress_segv_handler(int signum)
-{
-       (void)signum;
-
-       segv_abort = true;
-       siglongjmp(jmp_env, 1);
-}
-
-static void MLOCKED_TEXT stress_usr2_handler(int signum)
-{
-       (void)signum;
-}
-
 static uint32_t path_sum(const char *path)
 {
        const char *ptr = path;
@@ -133,7 +116,7 @@
        const double threshold = 0.2;
        size_t page_size = ctxt->args->page_size;
 
-       while (g_keep_stressing_flag && !segv_abort) {
+       while (g_keep_stressing_flag) {
                double t_start;
                uint8_t *ptr;
 
@@ -142,8 +125,8 @@
                        return false;
                (void)shim_strlcpy(path, sysfs_path, sizeof(path));
                counter++;
-               if (counter > OPS_PER_SYSFS_FILE)
-                       (void)kill(args->pid, SIGUSR2);
+               //if (counter > OPS_PER_SYSFS_FILE)
+                       //(void)kill(args->pid, SIGUSR2);
                (void)shim_pthread_spin_unlock(&lock);
 
                if (!*path || !g_keep_stressing_flag)
@@ -226,14 +209,6 @@
                        goto drain;
                }
 
-               /*
-                *  Bad read buffer
-                */
-               if (ctxt->badbuf) {
-                       ret = read(fd, ctxt->badbuf, SYS_BUF_SZ);
-                       if (ret < 0)
-                               goto err;
-               }
                if (stress_kmsg_drain(ctxt->kmsgfd)) {
                        drain_kmsg = true;
                        (void)close(fd);
@@ -286,6 +261,7 @@
        static void *nowt = NULL;
        uint8_t stack[SIGSTKSZ + STACK_ALIGNMENT];
        ctxt_t *ctxt = (ctxt_t *)ctxt_ptr;
+       const args_t *args = ctxt->args;
 
        /*
         *  Block all signals, let controlling thread
@@ -303,7 +279,7 @@
        if (stress_sigaltstack(stack, SIGSTKSZ) < 0)
                return &nowt;
 
-       while (g_keep_stressing_flag && !segv_abort)
+       while (keep_stressing())
                stress_sys_rw(ctxt);
 
        return &nowt;
@@ -353,7 +329,7 @@
        const mode_t flags = S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
        int i, n;
 
-       if (!g_keep_stressing_flag || segv_abort)
+       if (!g_keep_stressing_flag)
                return;
 
        /* Don't want to go too deep */
@@ -366,7 +342,7 @@
        if (n <= 0)
                goto done;
 
-       for (i = 0; (i < n) && !segv_abort; i++) {
+       for (i = 0; i < n; i++) {
                int ret;
                struct stat buf;
                char tmp[PATH_MAX];
@@ -407,7 +383,6 @@
                        if (!ret) {
                                (void)shim_strlcpy(sysfs_path, tmp, 
sizeof(sysfs_path));
                                counter = 0;
-                               usr2_killed = false;
                                (void)shim_pthread_spin_unlock(&lock);
                                drain_kmsg = false;
 
@@ -417,8 +392,6 @@
                                 *  has been reached
                                 */
                                
shim_usleep_interruptible(DURATION_PER_SYSFS_FILE);
-                               if (segv_abort)
-                                       break;
                                inc_counter(args);
                        }
                        break;
@@ -442,8 +415,8 @@
 static int stress_sysfs(const args_t *args)
 {
        size_t i;
-       pthread_t pthreads[MAX_READ_THREADS];
-       int rc, ret[MAX_READ_THREADS];
+       pthread_t pthreads[MAX_SYSFS_THREADS];
+       int rc, ret[MAX_SYSFS_THREADS];
        ctxt_t ctxt;
 
        os_release = 0;
@@ -462,18 +435,6 @@
 #endif
 
        (void)memset(&ctxt, 0, sizeof(ctxt));
-       rc = sigsetjmp(jmp_env, 1);
-       if (rc) {
-               /* Potentially racy, but it's good enough for the moment */
-               pr_err("%s: A SIGSEGV occurred while exercising %s, aborting\n",
-                       args->name, sysfs_path);
-               return EXIT_FAILURE;
-       }
-       if (stress_sighandler(args->name, SIGSEGV, stress_segv_handler, NULL) < 
0)
-               return EXIT_FAILURE;
-       if (stress_sighandler(args->name, SIGUSR2, stress_usr2_handler, NULL) < 
0)
-               return EXIT_FAILURE;
-
        shim_strlcpy(sysfs_path, signum_path, sizeof(sysfs_path));
 
        ctxt.args = args;
@@ -492,24 +453,14 @@
 
        (void)memset(ret, 0, sizeof(ret));
 
-       ctxt.badbuf = mmap(NULL, SYS_BUF_SZ, PROT_READ,
-                       MAP_SHARED | MAP_ANONYMOUS, -1, 0);
-       if (ctxt.badbuf == MAP_FAILED) {
-               pr_inf("%s: mmap failed: errno=%d (%s)\n",
-                       args->name, errno, strerror(errno));
-               if (ctxt.kmsgfd != -1)
-                       (void)close(ctxt.kmsgfd);
-               return EXIT_NO_RESOURCE;
-       }
-
-       for (i = 0; i < MAX_READ_THREADS; i++) {
+       for (i = 0; i < MAX_SYSFS_THREADS; i++) {
                ret[i] = pthread_create(&pthreads[i], NULL,
                                stress_sys_rw_thread, &ctxt);
        }
 
        do {
                stress_sys_dir(&ctxt, "/sys", true, 0);
-       } while (keep_stressing() && !segv_abort);
+       } while (keep_stressing());
 
        rc = shim_pthread_spin_lock(&lock);
        if (rc) {
@@ -521,18 +472,17 @@
        }
 
        /* Forcefully kill threads */
-       for (i = 0; i < MAX_READ_THREADS; i++) {
+       for (i = 0; i < MAX_SYSFS_THREADS; i++) {
                if (ret[i] == 0)
                        (void)pthread_kill(pthreads[i], SIGHUP);
        }
 
-       for (i = 0; i < MAX_READ_THREADS; i++) {
+       for (i = 0; i < MAX_SYSFS_THREADS; i++) {
                if (ret[i] == 0)
                        (void)pthread_join(pthreads[i], NULL);
        }
        if (ctxt.kmsgfd != -1)
                (void)close(ctxt.kmsgfd);
-       (void)munmap(ctxt.badbuf, SYS_BUF_SZ);
        (void)shim_pthread_spin_destroy(&lock);
 
        return EXIT_SUCCESS;


Reply via email to