Hello community, here is the log from the commit of package stress-ng for openSUSE:Factory checked in at 2018-06-19 12:05:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/stress-ng (Old) and /work/SRC/openSUSE:Factory/.stress-ng.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "stress-ng" Tue Jun 19 12:05:09 2018 rev:46 rq:617399 version:0.09.30 Changes: -------- --- /work/SRC/openSUSE:Factory/stress-ng/stress-ng.changes 2018-06-13 15:39:06.017200939 +0200 +++ /work/SRC/openSUSE:Factory/.stress-ng.new/stress-ng.changes 2018-06-19 12:05:11.342633571 +0200 @@ -1,0 +2,18 @@ +Sat Jun 16 12:41:28 UTC 2018 - [email protected] + +- Update to version 0.09.30 + * Makefile: bump version + * stress-socket: fix build warning if FIONREAD is not defined + * Add sanity check that child stressor processes are not calling exit() + * stress-sigio: don't exit in sighandler; return back normally + * stress-utime: fix failing utimes and futimens calls + * stress-memcpy: fix clobbering of stats data when copying b_str + * stress-shm: perform extra file operations on shm file descriptor + * Add new real time signal stressor, sigrt + * stress-sigsegv: add some verification checking + * stress-access: voidify return from umask + * stress-splice: remove variable bytes, replace with ret + * stress-apparmor: add a few more yield points + * stress-fifo: retry on select timeout rather than terminate + +------------------------------------------------------------------- Old: ---- stress-ng-0.09.29.tar.xz New: ---- stress-ng-0.09.30.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ stress-ng.spec ++++++ --- /var/tmp/diff_new_pack.i6LK8Y/_old 2018-06-19 12:05:12.274598969 +0200 +++ /var/tmp/diff_new_pack.i6LK8Y/_new 2018-06-19 12:05:12.278598820 +0200 @@ -18,7 +18,7 @@ Name: stress-ng -Version: 0.09.29 +Version: 0.09.30 Release: 0 Summary: Tool to load and stress a computer License: GPL-2.0-only ++++++ stress-ng-0.09.29.tar.xz -> stress-ng-0.09.30.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/Makefile new/stress-ng-0.09.30/Makefile --- old/stress-ng-0.09.29/Makefile 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/Makefile 2018-06-15 17:53:34.000000000 +0200 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.09.29 +VERSION=0.09.30 # # Codename "portable pressure producer" # @@ -202,9 +202,10 @@ stress-sigio.c \ stress-sigpending.c \ stress-sigpipe.c \ + stress-sigq.c \ + stress-sigrt.c \ stress-sigsegv.c \ stress-sigsuspend.c \ - stress-sigq.c \ stress-sleep.c \ stress-socket.c \ stress-socket-diag.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-access.c new/stress-ng-0.09.30/stress-access.c --- old/stress-ng-0.09.29/stress-access.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-access.c 2018-06-15 17:53:34.000000000 +0200 @@ -108,7 +108,7 @@ (void)stress_temp_filename_args(args, filename, sizeof(filename), mwc32()); - umask(0700); + (void)umask(0700); if ((fd = creat(filename, S_IRUSR | S_IWUSR)) < 0) { rc = exit_status(errno); pr_fail_err("creat"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-apparmor.c new/stress-ng-0.09.30/stress-apparmor.c --- old/stress-ng-0.09.29/stress-apparmor.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-apparmor.c 2018-06-15 17:53:34.000000000 +0200 @@ -121,7 +121,7 @@ (i < (4096 * APPARMOR_BUF_SZ))) { ssize_t ret, sz = 1 + (mwc32() % sizeof(buffer)); redo: - if (!g_keep_stressing_flag) + if (!g_keep_stressing_flag || !apparmor_run) break; ret = read(fd, buffer, sz); if (ret < 0) { @@ -219,8 +219,7 @@ (void)setpgid(0, g_pgrp); stress_parent_died_alarm(); - - if (!g_keep_stressing_flag) + if (!g_keep_stressing_flag || !apparmor_run) goto abort; ret = func(name, max_ops, counter); abort: @@ -333,6 +332,7 @@ "errno=%d (%s)\n", name, errno, strerror(errno)); rc = EXIT_FAILURE; + break; } /* @@ -343,10 +343,13 @@ "/usr/bin/pulseaudio-eg"); if (ret < 0) { if (errno != ENOENT) { + aa_kernel_interface_unref(kern_if); + pr_fail("%s: aa_kernel_interface_remove_policy() failed, " "errno=%d (%s)\n", name, errno, strerror(errno)); rc = EXIT_FAILURE; + break; } } aa_kernel_interface_unref(kern_if); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-fifo.c new/stress-ng-0.09.30/stress-fifo.c --- old/stress-ng-0.09.29/stress-fifo.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-fifo.c 2018-06-15 17:53:34.000000000 +0200 @@ -42,7 +42,8 @@ * spawn a process */ static pid_t fifo_spawn( - void (*func)(const char *name, const char *fifoname), + const args_t *args, + void (*func)(const args_t *args, const char *name, const char *fifoname), const char *name, const char *fifoname) { @@ -55,7 +56,7 @@ if (pid == 0) { (void)setpgid(0, g_pgrp); stress_parent_died_alarm(); - func(name, fifoname); + func(args, name, fifoname); exit(EXIT_SUCCESS); } (void)setpgid(pid, g_pgrp); @@ -66,7 +67,10 @@ * stress_fifo_readers() * read fifo */ -static void stress_fifo_reader(const char *name, const char *fifoname) +static void stress_fifo_reader( + const args_t *args, + const char *name, + const char *fifoname) { int fd; uint64_t val, lastval = 0; @@ -85,8 +89,8 @@ FD_ZERO(&rdfds); FD_SET(fd, &rdfds); - - timeout.tv_sec = 10; +redo: + timeout.tv_sec = 1; timeout.tv_usec = 0; ret = select(fd + 1, &rdfds, NULL, NULL, &timeout); @@ -97,7 +101,13 @@ name, errno, strerror(errno)); break; } else if (ret == 0) { - pr_err("%s: read timeout!\n", name); + /* + * nothing to read, timed-out, retry + * as this can happen on a highly + * overloaded stressed system + */ + if (keep_stressing()) + goto redo; break; } sz = read(fd, &val, sizeof(val)); @@ -164,7 +174,7 @@ memset(pids, 0, sizeof(pids)); for (i = 0; i < fifo_readers; i++) { - pids[i] = fifo_spawn(stress_fifo_reader, args->name, fifoname); + pids[i] = fifo_spawn(args, stress_fifo_reader, args->name, fifoname); if (pids[i] < 0) goto reap; if (!g_keep_stressing_flag) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-memcpy.c new/stress-ng-0.09.30/stress-memcpy.c --- old/stress-ng-0.09.29/stress-memcpy.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-memcpy.c 2018-06-15 17:53:34.000000000 +0200 @@ -47,7 +47,7 @@ static int stress_memcpy(const args_t *args) { static buffer_t b; - buffer_t *b_str = (buffer_t *)g_shared->str_shared; + uint8_t *b_str = g_shared->str_shared; uint8_t *str_shared = g_shared->str_shared; uint8_t *aligned_buf = align_address(b.buffer, ALIGN_SIZE); @@ -57,9 +57,9 @@ (void)__memcpy(aligned_buf, str_shared, STR_SHARED_SIZE); (void)__memcpy(str_shared, aligned_buf, STR_SHARED_SIZE / 2); (void)__memmove(aligned_buf, aligned_buf + 64, STR_SHARED_SIZE - 64); - *b_str = b; + (void)__memcpy(b_str, &b, STR_SHARED_SIZE); (void)__memmove(aligned_buf + 64, aligned_buf, STR_SHARED_SIZE - 64); - b = *b_str; + (void)__memcpy(&b, b_str, STR_SHARED_SIZE); (void)__memmove(aligned_buf + 1, aligned_buf, STR_SHARED_SIZE - 1); (void)__memmove(aligned_buf, aligned_buf + 1, STR_SHARED_SIZE - 1); inc_counter(args); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-ng.1 new/stress-ng-0.09.30/stress-ng.1 --- old/stress-ng-0.09.29/stress-ng.1 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-ng.1 2018-06-15 17:53:34.000000000 +0200 @@ -2720,6 +2720,16 @@ .B \-\-sigq\-ops N stop sigq stress workers after N bogo signal send operations. .TP +.B \-\-sigrt N +start N workers that each create child processes to handle SIGRTMIN to +SIGRMAX real time signals. The parent sends each child process a RT signal +via siqueue(2) and the child process waits for this via sigwaitinfo(2). +When the child receives the signal it then sends a RT signal to one of the +other child processes also via sigqueue(2). +.TP +.B \-\-sigrt\-ops N +stop sigrt stress workers after N bogo sigqueue signal send operations. +.TP .B \-\-sleep N start N workers that spawn off multiple threads that each perform multiple sleeps of ranges 1us to 0.1s. This creates multiple context switches and @@ -3725,7 +3735,11 @@ or operating system. T} 5 T{ -A stressor has been killed by an unexpected signal +A stressor has been killed by an unexpected signal. +T} +6 T{ +A stressor exited by exit(2) which was not expected and timing metrics +could not be gathered. T} .TE .SH BUGS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-ng.c new/stress-ng-0.09.30/stress-ng.c --- old/stress-ng-0.09.29/stress-ng.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-ng.c 2018-06-15 17:53:34.000000000 +0200 @@ -462,6 +462,7 @@ STRESSOR(sigpending, SIGPENDING), STRESSOR(sigpipe, SIGPIPE), STRESSOR(sigq, SIGQUEUE), + STRESSOR(sigrt, SIGRT), STRESSOR(sigsegv, SIGSEGV), STRESSOR(sigsuspend, SIGSUSPEND), STRESSOR(sleep, SLEEP), @@ -975,6 +976,8 @@ { "sigpipe-ops",1, 0, OPT_SIGPIPE_OPS }, { "sigq", 1, 0, OPT_SIGQUEUE }, { "sigq-ops", 1, 0, OPT_SIGQUEUE_OPS }, + { "sigrt", 1, 0, OPT_SIGRT }, + { "sigrt-ops", 1, 0, OPT_SIGRT_OPS }, { "sigsegv", 1, 0, OPT_SIGSEGV }, { "sigsegv-ops",1, 0, OPT_SIGSEGV_OPS }, { "sigsuspend", 1, 0, OPT_SIGSUSPEND}, @@ -1593,6 +1596,8 @@ { NULL, "sigpipe-ops N", "stop after N SIGPIPE bogo operations" }, { NULL, "sigq N", "start N workers sending sigqueue signals" }, { NULL, "sigq-ops N", "stop after N siqqueue bogo operations" }, + { NULL, "sigrt N", "start N workers sending real time signals" }, + { NULL, "sigrt-ops N", "stop after N real time signal bogo operations" }, { NULL, "sigsegv N", "start N workers generating segmentation faults" }, { NULL, "sigsegv-ops N", "stop after N bogo segmentation faults" }, { NULL, "sigsuspend N", "start N workers exercising sigsuspend" }, @@ -2243,6 +2248,11 @@ case EXIT_NOT_IMPLEMENTED: abort = true; break; + case EXIT_BY_SYS_EXIT: + pr_dbg("process [%d] (stress-ng-%s) aborted via exit() which was not expected\n", + ret, pi->stressor->name); + abort = true; + break; default: pr_err("process %d (stress-ng-%s) terminated with an error, exit status=%d (%s)\n", ret, pi->stressor->name, WEXITSTATUS(status), @@ -2353,6 +2363,15 @@ } /* + * stress_child_atexit(void) + * handle unexpected exit() call in child stressor + */ +static void stress_child_atexit(void) +{ + _exit(EXIT_BY_SYS_EXIT); +} + +/* * stress_run () * kick off and run stressors */ @@ -2406,6 +2425,7 @@ goto wait_for_procs; case 0: /* Child */ + (void)atexit(stress_child_atexit); (void)setpgid(0, g_pgrp); if (stress_set_handler(name, true) < 0) { rc = EXIT_FAILURE; @@ -2486,7 +2506,7 @@ } if (terminate_signum) rc = EXIT_SIGNALED; - exit(rc); + _exit(rc); default: if (pid > -1) { (void)setpgid(pid, g_pgrp); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-ng.h new/stress-ng-0.09.30/stress-ng.h --- old/stress-ng-0.09.29/stress-ng.h 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-ng.h 2018-06-15 17:53:34.000000000 +0200 @@ -192,6 +192,7 @@ #define EXIT_NO_RESOURCE (3) #define EXIT_NOT_IMPLEMENTED (4) #define EXIT_SIGNALED (5) +#define EXIT_BY_SYS_EXIT (6) /* * STRESS_ASSERT(test) @@ -1443,6 +1444,7 @@ STRESS_SIGPENDING, STRESS_SIGPIPE, STRESS_SIGQUEUE, + STRESS_SIGRT, STRESS_SIGSEGV, STRESS_SIGSUSPEND, STRESS_SLEEP, @@ -2117,6 +2119,9 @@ OPT_SIGQUEUE, OPT_SIGQUEUE_OPS, + OPT_SIGRT, + OPT_SIGRT_OPS, + OPT_SIGSEGV, OPT_SIGSEGV_OPS, @@ -3163,6 +3168,7 @@ STRESS(stress_sigpending); STRESS(stress_sigpipe); STRESS(stress_sigq); +STRESS(stress_sigrt); STRESS(stress_sigsegv); STRESS(stress_sigsuspend); STRESS(stress_sleep); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-shm.c new/stress-ng-0.09.30/stress-shm.c --- old/stress-ng-0.09.29/stress-shm.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-shm.c 2018-06-15 17:53:34.000000000 +0200 @@ -119,9 +119,10 @@ do { for (i = 0; ok && (i < (ssize_t)shm_posix_objects); i++) { - int shm_fd; + int shm_fd, ret; void *addr; char *shm_name = &shm_names[i * SHM_NAME_LEN]; + struct stat statbuf; shm_name[0] = '\0'; @@ -181,6 +182,31 @@ /* Expand and shrink the mapping */ (void)shim_fallocate(shm_fd, 0, 0, sz + page_size); (void)shim_fallocate(shm_fd, 0, 0, sz); + + /* Now truncated it back */ + ret = ftruncate(shm_fd, sz); + if (ret < 0) + pr_fail("%s: ftruncate of shared memory failed\n", args->name); + (void)fsync(shm_fd); + + /* fstat shared memory */ + ret = fstat(shm_fd, &statbuf); + if (ret < 0) { + pr_fail("%s: fstat failed on shared memory\n", args->name); + } else { + if (statbuf.st_size != (off_t)sz) { + pr_fail("%s: fstat reports different size of shared memory, " + "got %jd bytes, expected %zd bytes\n", args->name, + (intmax_t)statbuf.st_size, sz); + } + } + + /* Make it read only */ + ret = fchmod(shm_fd, S_IRUSR); + if (ret < 0) { + pr_fail("%s: failed to fchmod to S_IRUSR on shared memory\n", args->name); + } + (void)close(shm_fd); if (!keep_stressing()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-sigio.c new/stress-ng-0.09.30/stress-sigio.c --- old/stress-ng-0.09.29/stress-sigio.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-sigio.c 2018-06-15 17:53:34.000000000 +0200 @@ -54,7 +54,7 @@ (void)kill(pid, SIGKILL); shim_sched_yield(); - _exit(0); + return; } if (rd_fd > 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-sigrt.c new/stress-ng-0.09.30/stress-sigrt.c --- old/stress-ng-0.09.29/stress-sigrt.c 1970-01-01 01:00:00.000000000 +0100 +++ new/stress-ng-0.09.30/stress-sigrt.c 2018-06-15 17:53:34.000000000 +0200 @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2013-2018 Canonical, Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This code is a complete clean re-write of the stress tool by + * Colin Ian King <[email protected]> and attempts to be + * backwardly compatible with the stress tool by Amos Waterland + * <[email protected]> but has more stress tests and more + * functionality. + * + */ +#include "stress-ng.h" + +#if _POSIX_C_SOURCE >= 199309L && \ + defined(HAVE_SIGQUEUE) && \ + defined(HAVE_SIGWAITINFO) && \ + defined(SIGRTMIN) && \ + defined(SIGRTMAX) + +#define MAX_RTPIDS (SIGRTMAX - SIGRTMIN + 1) + +static void MLOCKED_TEXT stress_sigrthandler(int dummy) +{ + (void)dummy; +} + +/* + * stress_sigrt + * stress by heavy real time sigqueue message sending + */ +static int stress_sigrt(const args_t *args) +{ + pid_t pids[MAX_RTPIDS]; + union sigval s; + int i, status; + + memset(pids, 0, sizeof pids); + + for (i = 0; i < MAX_RTPIDS; i++) { + if (stress_sighandler(args->name, i + SIGRTMIN, stress_sigrthandler, NULL) < 0) { + return EXIT_FAILURE; + } + } + + for (i = 0; i < MAX_RTPIDS; i++) { +again: + pids[i] = fork(); + if (pids[i] < 0) { + if (g_keep_stressing_flag && (errno == EAGAIN)) + goto again; + pr_fail_dbg("fork"); + goto reap; + } else if (pids[i] == 0) { + sigset_t mask; + siginfo_t info; + + (void)setpgid(0, g_pgrp); + stress_parent_died_alarm(); + + (void)sigemptyset(&mask); + for (i = 0; i < MAX_RTPIDS; i++) + (void)sigaddset(&mask, i + SIGRTMIN); + + while (g_keep_stressing_flag) { + memset(&info, 0, sizeof info); + + if (sigwaitinfo(&mask, &info) < 0) { + if (errno == EINTR) + continue; + break; + } + if (info.si_value.sival_int == 0) + break; + + if (info.si_value.sival_int != -1) { + (void)memset(&s, 0, sizeof(s)); + s.sival_int = -1; + sigqueue(info.si_value.sival_int, SIGRTMIN, s); + } + } + /* + pr_dbg("%s: child got termination notice (%d)\n", args->name, info.si_value.sival_int); + pr_dbg("%s: exited on pid [%d] (instance %" PRIu32 ")\n", + args->name, getpid(), args->instance); + */ + _exit(0); + } + } + + /* Parent */ + do { + for (i = 0; i < MAX_RTPIDS; i++) { + const int pid = pids[(i + 1) % MAX_RTPIDS]; + + (void)memset(&s, 0, sizeof(s)); + + /* Inform child which pid to queue a signal to */ + s.sival_int = pid; + (void)sigqueue(pids[i], i + SIGRTMIN, s); + inc_counter(args); + } + } while (keep_stressing()); + + for (i = 0; i < MAX_RTPIDS; i++) { + if (pids[i] > 0) { + (void)memset(&s, 0, sizeof(s)); + s.sival_int = 0; + sigqueue(pids[i], i + SIGRTMIN, s); + } + } + (void)shim_usleep(250); +reap: + for (i = 0; i < MAX_RTPIDS; i++) { + if (pids[i] > 0) { + /* And ensure child is really dead */ + (void)kill(pids[i], SIGKILL); + (void)waitpid(pids[i], &status, 0); + } + } + + return EXIT_SUCCESS; +} + +stressor_info_t stress_sigrt_info = { + .stressor = stress_sigrt, + .class = CLASS_INTERRUPT | CLASS_OS +}; +#else +stressor_info_t stress_sigrt_info = { + .stressor = stress_not_implemented, + .class = CLASS_INTERRUPT | CLASS_OS +}; +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-sigsegv.c new/stress-ng-0.09.30/stress-sigsegv.c --- old/stress-ng-0.09.29/stress-sigsegv.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-sigsegv.c 2018-06-15 17:53:34.000000000 +0200 @@ -25,17 +25,39 @@ #include "stress-ng.h" static sigjmp_buf jmp_env; +#if defined(SA_SIGINFO) +static volatile void *fault_addr; +static volatile int signo; +static volatile int code; +#endif /* * stress_segvhandler() * SEGV handler */ +#if defined(SA_SIGINFO) +static void MLOCKED_TEXT stress_segvhandler( + int num, + siginfo_t *info, + void *ucontext) +{ + (void)num; + (void)ucontext; + + fault_addr = info->si_addr; + signo = info->si_signo; + code = info->si_code; + + siglongjmp(jmp_env, 1); /* Ugly, bounce back */ +} +#else static void MLOCKED_TEXT stress_segvhandler(int dummy) { (void)dummy; siglongjmp(jmp_env, 1); /* Ugly, bounce back */ } +#endif /* * stress_sigsegv @@ -46,6 +68,9 @@ { uint8_t *ptr; NOCLOBBER int rc = EXIT_FAILURE; +#if defined(SA_SIGINFO) + const bool verify = (g_opt_flags & OPT_FLAGS_VERIFY); +#endif /* Allocate read only page */ ptr = mmap(NULL, args->page_size, PROT_READ, @@ -58,13 +83,36 @@ for (;;) { int ret; + struct sigaction action; - if (stress_sighandler(args->name, SIGSEGV, stress_segvhandler, NULL) < 0) + (void)memset(&action, 0, sizeof action); +#if defined(SA_SIGINFO) + action.sa_sigaction = stress_segvhandler; +#else + action.sa_handler = stress_segvhandler; +#endif + (void)sigemptyset(&action.sa_mask); +#if defined(SA_SIGINFO) + action.sa_flags = SA_SIGINFO; +#endif + ret = sigaction(SIGSEGV, &action, NULL); + if (ret < 0) { + pr_fail("%s: sigaction SIGSEGV: errno=%d (%s)\n", + args->name, errno, strerror(errno)); goto tidy; - if (stress_sighandler(args->name, SIGILL, stress_segvhandler, NULL) < 0) + } + ret = sigaction(SIGILL, &action, NULL); + if (ret < 0) { + pr_fail("%s: sigaction SIGILL: errno=%d (%s)\n", + args->name, errno, strerror(errno)); goto tidy; - if (stress_sighandler(args->name, SIGBUS, stress_segvhandler, NULL) < 0) + } + ret = sigaction(SIGBUS, &action, NULL); + if (ret < 0) { + pr_fail("%s: sigaction SIGBUS: errno=%d (%s)\n", + args->name, errno, strerror(errno)); goto tidy; + } ret = sigsetjmp(jmp_env, 1); /* @@ -74,10 +122,36 @@ if (!keep_stressing()) break; - if (ret) - inc_counter(args); /* SIGSEGV/SIGILL occurred */ - else - *ptr = 0; /* Trip a SIGSEGV/SIGILL */ + if (ret) { + /* Signal was tripped */ +#if defined(SA_SIGINFO) + if (verify && fault_addr && fault_addr != ptr) { + pr_fail("%s: expecting fault address %p, got %p instead\n", + args->name, fault_addr, ptr); + } + if (verify && + (signo != -1) && + (signo != SIGSEGV) && + (signo != SIGILL) && + (signo != SIGBUS)) { + pr_fail("%s: expecting SIGSEGV/SIGILL/SIGBUS, got %s instead\n", + args->name, strsignal(signo)); + } + if (verify && (signo == SIGBUS) && (code != SEGV_ACCERR)) { + pr_fail("%s: expecting SIGBUS si_code SEGV_ACCERR (%d), got %d insread\n", + args->name, SEGV_ACCERR, code); + } +#endif + inc_counter(args); + } else { +#if defined(SA_SIGINFO) + signo = -1; + code = -1; + fault_addr = 0; +#endif + /* Trip a SIGSEGV/SIGILL/SIGBUS */ + *ptr = 0; + } } rc = EXIT_SUCCESS; tidy: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-socket.c new/stress-ng-0.09.30/stress-socket.c --- old/stress-ng-0.09.29/stress-socket.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-socket.c 2018-06-15 17:53:34.000000000 +0200 @@ -212,8 +212,8 @@ do { ssize_t n; - size_t bytes = sizeof(buf); #if defined(FIONREAD) + size_t bytes = sizeof(buf); /* * Exercise FIONREAD ioctl. Linux supports * this also with SIOCINQ but lets try and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-splice.c new/stress-ng-0.09.30/stress-splice.c --- old/stress-ng-0.09.29/stress-splice.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-splice.c 2018-06-15 17:53:34.000000000 +0200 @@ -75,13 +75,11 @@ } do { - int ret; + ssize_t ret; - ssize_t bytes; - - bytes = splice(fd_in, NULL, fds[1], NULL, + ret = splice(fd_in, NULL, fds[1], NULL, splice_bytes, SPLICE_F_MOVE); - if (bytes < 0) + if (ret < 0) break; ret = splice(fds[0], NULL, fd_out, NULL, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.09.29/stress-utime.c new/stress-ng-0.09.30/stress-utime.c --- old/stress-ng-0.09.29/stress-utime.c 2018-06-08 12:33:54.000000000 +0200 +++ new/stress-ng-0.09.30/stress-utime.c 2018-06-15 17:53:34.000000000 +0200 @@ -57,6 +57,7 @@ #endif if (gettimeofday(×[0], NULL) == 0) { + times[1] = times[0]; if (utimes(filename, times) < 0) { pr_dbg("%s: utimes failed: errno=%d: (%s)\n", args->name, errno, strerror(errno)); @@ -78,6 +79,8 @@ #if defined(UTIME_NOW) ts[0].tv_sec = UTIME_NOW; ts[0].tv_nsec = UTIME_NOW; + ts[1].tv_sec = UTIME_NOW; + ts[1].tv_nsec = UTIME_NOW; if (futimens(fd, &ts[0]) < 0) { pr_dbg("%s: futimens failed: errno=%d: (%s)\n", args->name, errno, strerror(errno));
