diff -pruN 0.15.07-1/Makefile 0.15.08-1/Makefile
--- 0.15.07-1/Makefile	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/Makefile	2023-05-21 14:30:06.000000000 +0000
@@ -17,11 +17,14 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
-VERSION=0.15.07
+VERSION=0.15.08
 #
-# Codename "speedy supercharged swordfish"
+# Codename "sleepy sanguine sloth"
 #
 
+KERNEL=$(shell uname -s)
+NODENAME=$(shell uname -n)
+
 CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"' -std=gnu99
 #
 # Default -O2 if optimization level not defined
@@ -93,6 +96,12 @@ CFLAGS += -ip -falign-loops -funroll-loo
 endif
 endif
 
+ifeq ($(findstring gcc,$(CC)),gcc)
+ifneq ($(KERNEL),SunOS)
+CFLAGS += -ftree-loop-vectorize
+endif
+endif
+
 #ifeq ($(findstring clang,$(CC)),clang)
 #CFLAGS += -Weverything
 #endif
@@ -101,8 +110,6 @@ GREP = grep
 #
 # SunOS requires special grep for -e support
 #
-KERNEL=$(shell uname -s)
-NODENAME=$(shell uname -n)
 ifeq ($(KERNEL),SunOS)
 ifneq ($(NODENAME),dilos)
 GREP = /usr/xpg4/bin/grep
@@ -238,6 +245,7 @@ STRESS_SRC = \
 	stress-filename.c \
 	stress-flock.c \
 	stress-flushcache.c \
+	stress-fma.c \
 	stress-fork.c \
 	stress-forkheavy.c \
 	stress-fp.c \
diff -pruN 0.15.07-1/Makefile.config 0.15.08-1/Makefile.config
--- 0.15.07-1/Makefile.config	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/Makefile.config	2023-05-21 14:30:06.000000000 +0000
@@ -1507,7 +1507,7 @@ functions: \
 	BUILTIN_CTZ BUILTIN_EXP BUILTIN_EXPECT BUILTIN_EXPL BUILTIN_FABS \
 	BUILTIN_FABSL BUILTIN_IA32_MOVNTDQ BUILTIN_IA32_MOVNTI \
 	BUILTIN_IA32_MOVNTI64 BUILTIN_LGAMMAL BUILTIN_LOG BUILTIN_LOGL \
-	BUILTIN_MEMCPY BUILTIN_MEMMOVE BUILTIN_NONTEMPORAL_LOAD \
+	BUILTIN_MEMCPY BUILTIN_MEMMOVE BUILTIN_MEMSET BUILTIN_NONTEMPORAL_LOAD \
 	BUILTIN_NONTEMPORAL_STORE BUILTIN_PARITY BUILTIN_POPCOUNT BUILTIN_POPCOUNTL \
 	BUILTIN_POPCOUNTLL BUILTIN_POW BUILTIN_PREFETCH BUILTIN_RINT \
 	BUILTIN_RINTL BUILTIN_ROTATELEFT8 BUILTIN_ROTATELEFT16 BUILTIN_ROTATELEFT32 \
@@ -1545,7 +1545,7 @@ functions: \
 	PTHREAD_MUTEXATTR_SETPROTOCOL PTHREAD_SETAFFINITY_NP \
 	PTHREAD_SETSCHEDPARAM PTHREAD_SIGQUEUE PTRACE PTSNAME PWRITE PWRITEV \
 	PWRITEV2 QUOTACTL_FD READLINKAT RECVMMSG REMAP_FILE_PAGES \
-	REMOVEXATTR RENAMEAT RENAMEAT2 RINTL SBRK SCHED_GETAFFINITY \
+	REMOVEXATTR RENAMEAT RENAMEAT2 RFORK RINTL SBRK SCHED_GETAFFINITY \
 	SCHED_GETCPU SCHED_GET_PRIORITY_MAX SCHED_GET_PRIORITY_MIN \
 	SCHED_RR_GET_INTERVAL SCHED_SETSCHEDULER SCHED_SETAFFINITY SCHED_YIELD \
 	SELECT SEMTIMEDOP SEM_POSIX SEM_SYSV SENDFILE SENDMMSG SETDOMAINNAME SETFSGID \
@@ -1764,6 +1764,9 @@ BUILTIN_MEMCPY:
 BUILTIN_MEMMOVE:
 	$(call check,test-builtin-memmove,HAVE_BUILTIN_MEMMOVE,__builtin_memmove)
 
+BUILTIN_MEMSET:
+	$(call check,test-builtin-memset,HAVE_BUILTIN_MEMSET,__builtin_memset)
+
 BUILTIN_NONTEMPORAL_LOAD:
 	$(call check,test-builtin-nontemporal-load,HAVE_BUILTIN_NONTEMPORAL_LOAD,__builtin_nontemporal_load)
 
@@ -2403,6 +2406,9 @@ RENAMEAT:
 RENAMEAT2:
 	$(call check,test-renameat2,HAVE_RENAMEAT2,renameat2)
 
+RFORK:
+	$(call check,test-rfork,HAVE_RFORK,rfork)
+
 RINTL:
 	$(call check,test-mathfunc,HAVE_RINTL,rintl,-lm,-DMATHFUNC=rintl)
 
diff -pruN 0.15.07-1/README.md 0.15.08-1/README.md
--- 0.15.07-1/README.md	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/README.md	2023-05-21 14:30:06.000000000 +0000
@@ -413,6 +413,8 @@ stress-ng has found Kernel and QEMU bugs
 * [AppArmor: -42.5% regression of stress-ng.kill.ops_per_sec due to commit](https://lkml.org/lkml/2022/12/31/27)
 * [clocksource: Suspend the watchdog temporarily when high read lantency detected](https://lore.kernel.org/lkml/20221220082512.186283-1-feng.tang@intel.com/t/)
 * [rtmutex: Ensure that the top waiter is always woken up](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=db370a8b9f67ae5f17e3d5482493294467784504)
+* [mm/swap: fix swap_info_struct race between swapoff and get_swap_pages()](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6fe7d6b992113719e96744d974212df3fcddc76c)
+* [block, bfq: Fix division by zero error on zero wsum](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e53413f8deedf738a6782cc14cc00bd5852ccf18)
 
 ## Kernel improvements that used stress-ng
 
@@ -432,6 +434,9 @@ stress-ng has found Kernel and QEMU bugs
 * [sched/core: Accounting forceidle time for all tasks except idle task](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b171501f258063f5c56dd2c5fdf310802d8d7dc1)
 * [ipc/mqueue: use get_tree_nodev() in mqueue_get_tree()](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d60c4d01a98bc1942dba6e3adc02031f5519f94b)
 * [mm/swapfile: add cond_resched() in get_swap_pages()](https://lore.kernel.org/lkml/20230129130320.7e2e4445ecc4b172c61c7b9c@linux-foundation.org/T/)
+* [module: avoid allocation if module is already present and ready](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=064f4536d13939b6e8cdb71298ff5d657f4f8caa)
+* [sched: Interleave cfs bandwidth timers for improved single thread performance at low utilization](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=41abdba9374734b743019fc1cc05e3225c82ba6b)
+
 ## Presentations
 
 * [Stress-ng presentation at ELCE 2019 Lyon](https://static.sched.com/hosted_files/osseu19/29/Lyon-stress-ng-presentation-oct-2019.pdf)
@@ -516,6 +521,9 @@ stress-ng has found Kernel and QEMU bugs
 * [Robust and accurate performance anomaly detection and prediction for cloud applications: a novel ensemble learning-based framework](https://journalofcloudcomputing.springeropen.com/articles/10.1186/s13677-022-00383-6#Fn4)
 * [kMVX: Detecting Kernel Information Leaks with Multi-variant Execution](https://research.vu.nl/ws/files/122357910/KMVX.pdf)
 * [Feasibility Study for a Python-Based Embedded Real-Time Control System](https://www.mdpi.com/2079-9292/12/6/1426)
+* [Adaptation of Parallel SaaS to Heterogeneous Co-Located Cloud Resources](https://www.mdpi.com/2076-3417/13/8/5115#B56-applsci-13-05115)
+* [A Methodology and Framework to Determine the Isolation Capabilities of Virtualisation Technologies](https://dl.acm.org/doi/pdf/10.1145/3578244.3583728)
+* [Data Station: Delegated, Trustworthy, and Auditable Computation to Enable Data-Sharing Consortia with a Data Escrow](https://arxiv.org/pdf/2305.03842.pdf)
 
 I am keen to add to the stress-ng project page any citations to research or
 projects that use stress-ng.  I also appreciate information concerning kernel
@@ -532,12 +540,13 @@ Arjan van de Ven, Baruch Siach, Bryan W.
 Carlos Santos, Christian Ehrhardt, Christopher Brown, Chunyu Hu,
 Danilo Krummrich, Davidson Francis, David Turner, Dominik B Czarnota,
 Dorinda Bassey, Eric Lin, Erik Stahlman, Fabien Malfoy, Fabrice Fontaine,
-Florian Weimer, Francis Laniel, Guilherme Janczak, Iyán Méndez Veiga,
-James Hunt, Jan Luebbe, Jianshen Liu, John Kacur, Jules Maselbas,
-Julien Olivain, Kenny Gong, Khalid Elmously, Khem Raj, Luca Pizzamiglio,
-Luis Chamberlain, Luis Henriques, Matthew Tippett, Mauricio Faria de Oliveira,
-Maxime Chevallier, Maya Rashish, Mayuresh Chitale, Meysam Azad,
-Mike Koreneff, Nick Hanley, Paul Menzel, Piyush Goyal, Ralf Ramsauer,
-Rosen Penev, Siddhesh Poyarekar, Shoily Rahman, Thadeu Lima de Souza Cascardo,
+Fernand Sieber, Florian Weimer, Francis Laniel, Guilherme Janczak,
+Hui Wang, Iyán Méndez Veiga, James Hunt, Jan Luebbe, Jianshen Liu,
+John Kacur, Jules Maselbas, Julien Olivain, Kenny Gong, Khalid Elmously,
+Khem Raj, Luca Pizzamiglio, Luis Chamberlain, Luis Henriques,
+Matthew Tippett, Mauricio Faria de Oliveira, Maxime Chevallier,
+Maya Rashish, Mayuresh Chitale, Meysam Azad, Mike Koreneff,
+Nick Hanley, Paul Menzel, Piyush Goyal, Ralf Ramsauer, Rosen Penev,
+Siddhesh Poyarekar, Shoily Rahman, Thadeu Lima de Souza Cascardo,
 Thia Wyrod, Thinh Tran, Tim Gardner, Tim Gates, Tim Orling,
 Tommi Rantala, Witold Baryluk, Yong-Xuan Wang, Zhiyi Sun.
diff -pruN 0.15.07-1/core-builtin.h 0.15.08-1/core-builtin.h
--- 0.15.07-1/core-builtin.h	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-builtin.h	2023-05-21 14:30:06.000000000 +0000
@@ -23,6 +23,24 @@
 #include <x86intrin.h>
 #endif
 
+#if defined(HAVE_BUILTIN_MEMSET)
+#define shim_memset(s, c, n)		__builtin_memset(s, c, n)
+#else
+#define shim_memset(s, c, n)		memset(s, c, n)
+#endif
+
+#if defined(HAVE_BUILTIN_MEMCPY)
+#define	shim_memcpy(dst, src, n)	__builtin_memcpy(dst, src, n)
+#else
+#define	shim_memcpy(dst, src, n)	memcpy(dst, src, n)
+#endif
+
+#if defined(HAVE_BUILTIN_MEMMOVE)
+#define	shim_memmove(dst, src, n)	__builtin_memmove(dst, src, n)
+#else
+#define	shim_memmove(dst, src, n)	memmove(dst, src, n)
+#endif
+
 #if defined(HAVE_BUILTIN_CABSL)
 #define shim_cabsl(x)	__builtin_cabsl(x)
 #else
diff -pruN 0.15.07-1/core-cpu-cache.c 0.15.08-1/core-cpu-cache.c
--- 0.15.07-1/core-cpu-cache.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-cpu-cache.c	2023-05-21 14:30:06.000000000 +0000
@@ -21,6 +21,7 @@
 #include "stress-ng.h"
 #include "core-asm-x86.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-cpu-cache.h"
 
 #if defined(HAVE_SYS_AUXV_H)
@@ -554,7 +555,7 @@ static int stress_cpu_cache_get_m68k(str
 	if (!fp)
 		return 0;
 
-	(void)memset(buffer, 0, sizeof(buffer));
+	(void)shim_memset(buffer, 0, sizeof(buffer));
 	while (fgets(buffer, sizeof(buffer), fp) != NULL) {
 		if (strncmp("CPU:", buffer, 4) == 0) {
 			if (sscanf(buffer + 4, "%d", &cpu_id) == 1)
@@ -718,7 +719,7 @@ static int stress_add_cpu_cache_detail(s
 	char tmp[2048];
 	char path[PATH_MAX];
 
-	(void)memset(path, 0, sizeof(path));
+	(void)shim_memset(path, 0, sizeof(path));
 	if (!cache)
 		goto out;
 	if (!index_path)
@@ -815,7 +816,7 @@ static int stress_cpu_cache_get_index(
 		const char *name = namelist[i]->d_name;
 		char fullpath[PATH_MAX];
 
-		(void)memset(fullpath, 0, sizeof(fullpath));
+		(void)shim_memset(fullpath, 0, sizeof(fullpath));
 		(void)stress_mk_filename(fullpath, sizeof(fullpath), path, name);
 		if (stress_add_cpu_cache_detail(&cpu->caches[i], fullpath) != EXIT_SUCCESS) {
 			free(cpu->caches);
@@ -1039,7 +1040,7 @@ stress_cpu_cache_cpus_t *stress_cpu_cach
 		char fullpath[PATH_MAX];
 		stress_cpu_cache_cpu_t *const cpu = &cpus->cpus[i];
 
-		(void)memset(fullpath, 0, sizeof(fullpath));
+		(void)shim_memset(fullpath, 0, sizeof(fullpath));
 		(void)stress_mk_filename(fullpath, sizeof(fullpath), SYS_CPU_PREFIX, name);
 		cpu->num = (uint32_t)i;
 		if (cpu->num == 0) {
@@ -1049,7 +1050,7 @@ stress_cpu_cache_cpus_t *stress_cpu_cach
 			char onlinepath[PATH_MAX + 8];
 			char tmp[2048];
 
-			(void)memset(onlinepath, 0, sizeof(onlinepath));
+			(void)shim_memset(onlinepath, 0, sizeof(onlinepath));
 			(void)snprintf(onlinepath, sizeof(onlinepath), "%s/%s/online", SYS_CPU_PREFIX, name);
 			if (stress_get_string_from_file(onlinepath, tmp, sizeof(tmp)) < 0) {
 				/* Assume it is online, it is the best we can do */
diff -pruN 0.15.07-1/core-ftrace.c 0.15.08-1/core-ftrace.c
--- 0.15.07-1/core-ftrace.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-ftrace.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-ftrace.h"
 
@@ -84,7 +85,7 @@ static char *stress_ftrace_get_debugfs_p
 	for (i = 0; i < n; i++) {
 		struct statfs buf;
 
-		(void)memset(&buf, 0, sizeof(buf));
+		(void)shim_memset(&buf, 0, sizeof(buf));
 		if (statfs(mnts[i], &buf) < 0)
 			continue;
 		if (buf.f_type == DEBUGFS_MAGIC) {
diff -pruN 0.15.07-1/core-hash.c 0.15.08-1/core-hash.c
--- 0.15.07-1/core-hash.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-hash.c	2023-05-21 14:30:06.000000000 +0000
@@ -174,7 +174,7 @@ uint32_t HOT OPTIMIZE3 stress_hash_murmu
 	register size_t i;
 
 	for (i = len >> 2; i; i--) {
-		(void)memcpy(&k, key, sizeof(k));
+		(void)shim_memcpy(&k, key, sizeof(k));
 		key += sizeof(k);
 		h ^= stress_hash_murmur_32_scramble(k);
 		h = (h << 13) | (h >> 19);
@@ -552,7 +552,7 @@ PRAGMA_UNROLL_N(4)
 		uint64_t v;
 
 		/* memcpy optimizes down to a 64 bit load */
-		(void)memcpy(&v, str, sizeof(v));
+		(void)shim_memcpy(&v, str, sizeof(v));
 		str += sizeof(v);
 		hash *= v;
 		hash ^= shim_ror64n(hash, 40);
@@ -580,7 +580,7 @@ PRAGMA_UNROLL_N(4)
 		uint32_t v;
 
 		/* memcpy optimizes down to a 32 bit load */
-		(void)memcpy(&v, str, sizeof(v));
+		(void)shim_memcpy(&v, str, sizeof(v));
 		str += sizeof(v);
 		hash *= v;
 		hash ^= shim_ror32n(hash, 20);
@@ -606,7 +606,7 @@ PRAGMA_UNROLL_N(4)
 		uint64_t v64;
 
 		/* memcpy optimizes down to a 64 bit load */
-		(void)memcpy(&v64, str, sizeof(v64));
+		(void)shim_memcpy(&v64, str, sizeof(v64));
 		str += sizeof(v64);
 		i--;
 		hash = v64 ^ shim_ror64n(hash, 16);
@@ -633,7 +633,7 @@ PRAGMA_UNROLL_N(8)
 		uint32_t v32;
 
 		/* memcpy optimizes down to a 32 bit load */
-		(void)memcpy(&v32, str, sizeof(v32));
+		(void)shim_memcpy(&v32, str, sizeof(v32));
 		str += sizeof(v32);
 		i--;
 		hash = v32 ^ shim_ror32n(hash, 4);
@@ -765,7 +765,7 @@ stress_hash_t *stress_hash_add(stress_ha
 
 	hash->next = hash_table->table[h];
 	hash_table->table[h] = hash;
-	(void)memcpy(HASH_STR(hash), str, len);
+	(void)shim_memcpy(HASH_STR(hash), str, len);
 
 	return hash;
 }
diff -pruN 0.15.07-1/core-helper.c 0.15.08-1/core-helper.c
--- 0.15.07-1/core-helper.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-helper.c	2023-05-21 14:30:06.000000000 +0000
@@ -119,6 +119,10 @@ int __dso_handle;
 
 #define STRESS_ABS_MIN_STACK_SIZE	(64 * 1024)
 
+const char ALIGN64 stress_ascii64[64] =
+	"0123456789ABCDEFGHIJKLMNOPQRSTUV"
+	"WXYZabcdefghijklmnopqrstuvwxyz@!";
+
 static bool stress_stack_check_flag;
 
 typedef struct {
@@ -682,7 +686,7 @@ static int stress_get_meminfo(
     defined(HAVE_SYSINFO)
 	struct sysinfo info;
 
-	(void)memset(&info, 0, sizeof(info));
+	(void)shim_memset(&info, 0, sizeof(info));
 
 	if (sysinfo(&info) == 0) {
 		*freemem = info.freeram * info.mem_unit;
@@ -739,7 +743,7 @@ static int stress_get_meminfo(
 		int ret;
 
 		/* zero vm_stat, keep cppcheck silent */
-		(void)memset(&vm_stat, 0, sizeof(vm_stat));
+		(void)shim_memset(&vm_stat, 0, sizeof(vm_stat));
 		ret = host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm_stat, &count);
 		if (ret >= 0) {
 			*freemem = page_size * vm_stat.free_count;
@@ -930,7 +934,7 @@ uint64_t stress_get_filesystem_size(void
 	if (!path)
 		return 0;
 
-	(void)memset(&buf, 0, sizeof(buf));
+	(void)shim_memset(&buf, 0, sizeof(buf));
 	rc = statvfs(path, &buf);
 	if (rc < 0)
 		return 0;
@@ -963,7 +967,7 @@ uint64_t stress_get_filesystem_available
 	if (!path)
 		return 0;
 
-	(void)memset(&buf, 0, sizeof(buf));
+	(void)shim_memset(&buf, 0, sizeof(buf));
 	rc = statvfs(path, &buf);
 	if (rc < 0)
 		return 0;
@@ -1247,32 +1251,42 @@ void stress_set_proc_state(const char *n
 }
 
 /*
- *  stress_munge_underscore()
- *	turn '_' to '-' in strings
+ *  stress_chr_munge()
+ *	convert ch _ to -, otherwise don't change it
  */
-char *stress_munge_underscore(const char *str)
+static inline char stress_chr_munge(const char ch)
 {
-	static char munged[128];
-	char *dst;
-	const char *src;
-	const size_t str_len = strlen(str);
-	const ssize_t len = (ssize_t)STRESS_MINIMUM(str_len, sizeof(munged) - 1);
-
-	for (src = str, dst = munged; *src && (dst - munged) < len; src++)
-		*dst++ = (*src == '_' ? '-' : *src);
-
-	*dst = '\0';
-
-	return munged;
+	return (ch == '_') ? '-' : ch;
 }
 
 /*
- *  stress_chr_munge()
- *	convert ch _ to -, otherwise don't change it
+ *   stress_munge_underscore()
+ *	turn '_' to '-' in strings with strlcpy api
  */
-static inline char stress_chr_munge(const char ch)
+size_t stress_munge_underscore(char *dst, const char *src, size_t len)
 {
-	return (ch == '_') ? '-' : ch;
+	register char *d = dst;
+	register const char *s = src;
+	register size_t n = len;
+
+	if (n) {
+		while (--n) {
+			register char c = *s++;
+
+			*d++ = stress_chr_munge(c);
+			if (c == '\0')
+				break;
+		}
+	}
+
+	if (!n) {
+		if (len)
+			*d = '\0';
+		while (*s)
+			s++;
+	}
+
+	return (s - src - 1);
 }
 
 /*
@@ -1372,7 +1386,7 @@ static void stress_temp_hash_truncate(ch
 #if defined(HAVE_SYS_STATVFS_H)
 	struct statvfs buf;
 
-	(void)memset(&buf, 0, sizeof(buf));
+	(void)shim_memset(&buf, 0, sizeof(buf));
 	if (statvfs(stress_get_temp_path(), &buf) == 0)
 		f_namemax = buf.f_namemax;
 #endif
@@ -1778,7 +1792,7 @@ void pr_yaml_runinfo(FILE *yaml)
 	pr_yaml(yaml, "      compiler: '%s'\n", stress_get_compiler());
 #if defined(HAVE_SYS_SYSINFO_H) &&	\
     defined(HAVE_SYSINFO)
-	(void)memset(&info, 0, sizeof(info));
+	(void)shim_memset(&info, 0, sizeof(info));
 	if (sysinfo(&info) == 0) {
 		pr_yaml(yaml, "      uptime: %ld\n", info.uptime);
 		pr_yaml(yaml, "      totalram: %lu\n", info.totalram);
@@ -1941,7 +1955,7 @@ ssize_t system_read(
 	int fd;
 	ssize_t ret;
 
-	(void)memset(buf, 0, buf_len);
+	(void)shim_memset(buf, 0, buf_len);
 
 	fd = open(path, O_RDONLY);
 	if (UNLIKELY(fd < 0))
@@ -2152,7 +2166,7 @@ int stress_get_bad_fd(void)
     defined(F_GETFL)
 	struct rlimit rlim;
 
-	(void)memset(&rlim, 0, sizeof(rlim));
+	(void)shim_memset(&rlim, 0, sizeof(rlim));
 
 	if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) {
 		if (rlim.rlim_cur < INT_MAX - 1) {
@@ -2275,7 +2289,7 @@ int stress_sighandler(
 		}
 	}
 #endif
-	(void)memset(&new_action, 0, sizeof new_action);
+	(void)shim_memset(&new_action, 0, sizeof new_action);
 	new_action.sa_handler = handler;
 	(void)sigemptyset(&new_action.sa_mask);
 	new_action.sa_flags = SA_ONSTACK;
@@ -2296,7 +2310,7 @@ int stress_sighandler_default(const int
 {
 	struct sigaction new_action;
 
-	(void)memset(&new_action, 0, sizeof new_action);
+	(void)shim_memset(&new_action, 0, sizeof new_action);
 	new_action.sa_handler = SIG_DFL;
 
 	return sigaction(signum, &new_action, NULL);
@@ -2647,8 +2661,8 @@ bool stress_check_capability(const int c
 	if (capability == SHIM_CAP_IS_ROOT)
 		return stress_check_root();
 
-	(void)memset(&uch, 0, sizeof uch);
-	(void)memset(ucd, 0, sizeof ucd);
+	(void)shim_memset(&uch, 0, sizeof uch);
+	(void)shim_memset(ucd, 0, sizeof ucd);
 
 	uch.version = _LINUX_CAPABILITY_VERSION_3;
 	uch.pid = getpid();
@@ -2683,8 +2697,8 @@ int stress_drop_capabilities(const char
 	struct __user_cap_header_struct uch;
 	struct __user_cap_data_struct ucd[_LINUX_CAPABILITY_U32S_3];
 
-	(void)memset(&uch, 0, sizeof uch);
-	(void)memset(ucd, 0, sizeof ucd);
+	(void)shim_memset(&uch, 0, sizeof uch);
+	(void)shim_memset(ucd, 0, sizeof ucd);
 
 	uch.version = _LINUX_CAPABILITY_VERSION_3;
 	uch.pid = getpid();
@@ -3149,7 +3163,7 @@ pid_t stress_get_unused_pid_racy(const b
 	pid_t pid;
 	uint32_t n;
 
-	(void)memset(buf, 0, sizeof(buf));
+	(void)shim_memset(buf, 0, sizeof(buf));
 	if (system_read("/proc/sys/kernel/pid_max", buf, sizeof(buf) - 1) > 0) {
 		max_pid = atoi(buf);
 	}
@@ -3410,7 +3424,7 @@ size_t stress_get_extents(const int fd)
     defined(HAVE_LINUX_FIEMAP_H)
 	struct fiemap fiemap;
 
-	(void)memset(&fiemap, 0, sizeof(fiemap));
+	(void)shim_memset(&fiemap, 0, sizeof(fiemap));
 	fiemap.fm_length = ~0UL;
 
 	/* Find out how many extents there are */
@@ -3587,17 +3601,17 @@ int stress_exit_status(const int err)
 
 /*
  *  stress_proc_self_exe_path()
- *	get proceess' executable path via readlink
+ *	get process' executable path via readlink
  */
-char *stress_proc_self_exe_path(const char *proc_path)
+static char *stress_proc_self_exe_path(char *path, const char *proc_path, const size_t path_len)
 {
-	static char path[PATH_MAX];
 	ssize_t len;
 
-	len = shim_readlink(proc_path, path, sizeof(path));
+	len = shim_readlink(proc_path, path, path_len);
 	if ((len < 0) || (len >= PATH_MAX))
 		return NULL;
 	path[len] = '\0';
+
 	return path;
 }
 
@@ -3605,27 +3619,48 @@ char *stress_proc_self_exe_path(const ch
  *  stress_proc_self_exe()
  *  	determine the path to the executable, return NULL if not possible/failed
  */
-char *stress_proc_self_exe(void)
+char *stress_proc_self_exe(char *path, const size_t path_len)
 {
 #if defined(__linux__)
-	return stress_proc_self_exe_path("/proc/self/exe");
+	return stress_proc_self_exe_path(path, "/proc/self/exe", path_len);
 #elif defined(__NetBSD__)
-	return stress_proc_self_exe_path("/proc/curproc/exe");
+	return stress_proc_self_exe_path(path, "/proc/curproc/exe", path_len);
 #elif defined(__DragonFly__)
-	return stress_proc_self_exe_path("/proc/curproc/file");
+	return stress_proc_self_exe_path(path, "/proc/curproc/file", path_len);
 #elif defined(__FreeBSD__)
-	return stress_proc_self_exe_path("/proc/curproc/file");
+#if defined(CTL_KERN) &&	\
+    defined(KERN_PROC) &&	\
+    defined(KERN_PROC_PATHNAME)
+	static int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+	size_t tmp_path_len = path_len;
+	int ret;
+
+	ret = sysctl(mib, SIZEOF_ARRAY(mib), (void *)path, &tmp_path_len, NULL, 0);
+	if (ret < 0) {
+		/* fall back to procfs */
+		return stress_proc_self_exe_path(path, "/proc/curproc/file", path_len);
+	}
+	return path;
+#else
+	/* fall back to procfs */
+	return stress_proc_self_exe_path(path, "/proc/curproc/file", path_len);
+#endif
 #elif defined(__sun__) && 	\
       defined(HAVE_GETEXECNAME)
-	static char path[PATH_MAX];
 	const char *execname = getexecname();
 
+	(void)stress_proc_self_exe_path;
+
 	if (!execname)
 		return NULL;
 	/* Need to perform a string copy to deconstify execname */
-	(void)shim_strlcpy(path, execname, sizeof(path));
-	return  path;
+	(void)shim_strlcpy(path, execname, path_len);
+	return path;
 #else
+	(void)stress_proc_self_exe_path;
+
+	(void)path;
+	(void)path_len;
 	return NULL;
 #endif
 }
@@ -3644,11 +3679,11 @@ int stress_bsd_getsysctl(const char *nam
 	if (!ptr)
 		return -1;
 
-	(void)memset(ptr, 0, size);
+	(void)shim_memset(ptr, 0, size);
 
 	ret = sysctlbyname(name, ptr, &nsize, NULL, 0);
 	if ((ret < 0) || (nsize != size)) {
-		(void)memset(ptr, 0, size);
+		(void)shim_memset(ptr, 0, size);
 		return -1;
 	}
 	return 0;
diff -pruN 0.15.07-1/core-ignite-cpu.c 0.15.08-1/core-ignite-cpu.c
--- 0.15.07-1/core-ignite-cpu.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-ignite-cpu.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 
 #define SETTING_SCALING_FREQ		(0x01)
 #define SETTING_CPUINFO_FREQ		(0x02)
@@ -168,7 +169,7 @@ void stress_ignite_cpu_start(void)
 			cpu_settings[cpu].setting_flag = 0;
 			cpu_settings[cpu].energy_perf_bias = -1;
 
-			(void)memset(buffer, 0, sizeof(buffer));
+			(void)shim_memset(buffer, 0, sizeof(buffer));
 			(void)snprintf(path, sizeof(path),
 				"/sys/devices/system/cpu/cpu%" PRIu32
 				"/cpufreq/scaling_max_freq", cpu);
@@ -179,7 +180,7 @@ void stress_ignite_cpu_start(void)
 				if (ret == 1)
 					cpu_settings[cpu].setting_flag |= SETTING_SCALING_FREQ;
 			}
-			(void)memset(buffer, 0, sizeof(buffer));
+			(void)shim_memset(buffer, 0, sizeof(buffer));
 			(void)snprintf(path, sizeof(path),
 				"/sys/devices/system/cpu/cpu%" PRIu32
 				"/cpufreq/scaling_min_freq", cpu);
@@ -191,7 +192,7 @@ void stress_ignite_cpu_start(void)
 					cpu_settings[cpu].setting_flag &= ~SETTING_SCALING_FREQ;
 			}
 
-			(void)memset(buffer, 0, sizeof(buffer));
+			(void)shim_memset(buffer, 0, sizeof(buffer));
 			(void)snprintf(path, sizeof(path),
 				"/sys/devices/system/cpu/cpu%" PRIu32
 				"/cpufreq/cpuinfo_max_freq", cpu);
@@ -202,7 +203,7 @@ void stress_ignite_cpu_start(void)
 				if (ret == 1)
 					cpu_settings[cpu].setting_flag |= SETTING_CPUINFO_FREQ;
 			}
-			(void)memset(buffer, 0, sizeof(buffer));
+			(void)shim_memset(buffer, 0, sizeof(buffer));
 			(void)snprintf(path, sizeof(path),
 				"/sys/devices/system/cpu/cpu%" PRIu32
 				"/cpufreq/cpuinfo_min_freq", cpu);
@@ -214,7 +215,7 @@ void stress_ignite_cpu_start(void)
 					cpu_settings[cpu].setting_flag &= ~SETTING_CPUINFO_FREQ;
 			}
 
-			(void)memset(cpu_settings[cpu].cur_governor, 0,
+			(void)shim_memset(cpu_settings[cpu].cur_governor, 0,
 				sizeof(cpu_settings[cpu].cur_governor));
 			(void)snprintf(path, sizeof(path),
 				"/sys/devices/system/cpu/cpu%" PRIu32
@@ -224,7 +225,7 @@ void stress_ignite_cpu_start(void)
 			if (ret > 0)
 				cpu_settings[cpu].setting_flag |= SETTING_GOVERNOR;
 
-			(void)memset(buffer, 0, sizeof(buffer));
+			(void)shim_memset(buffer, 0, sizeof(buffer));
 			(void)snprintf(path, sizeof(path),
 				"/sys/devices/system/cpu/cpu%" PRIu32
 				"/power/energy_perf_bias", cpu);
diff -pruN 0.15.07-1/core-job.c 0.15.08-1/core-job.c
--- 0.15.07-1/core-job.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-job.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MAX_ARGS	(64)
 #define RUN_SEQUENTIAL	(0x01)
@@ -138,7 +139,7 @@ int stress_parse_jobfile(
 		char *ptr;
 		int new_argc = 1;
 
-		(void)memset(new_argv, 0, sizeof(new_argv));
+		(void)shim_memset(new_argv, 0, sizeof(new_argv));
 		new_argv[0] = argv[0];
 		lineno++;
 
diff -pruN 0.15.07-1/core-killpid.c 0.15.08-1/core-killpid.c
--- 0.15.07-1/core-killpid.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-killpid.c	2023-05-21 14:30:06.000000000 +0000
@@ -47,3 +47,97 @@ int stress_killpid(const pid_t pid)
 	return kill(pid, SIGKILL);
 #endif
 }
+
+/*
+ *  stress_wait_until_reaped()
+ *	wait until a process has been removed from process table
+ */
+static void stress_wait_until_reaped(
+	const stress_args_t *args,
+	const pid_t pid,
+	const int signum,
+	const bool set_force_killed_counter)
+{
+	int count = 0;
+
+	for (;;) {
+		pid_t ret;
+		int wstatus;
+
+		errno = 0;
+		ret = waitpid(pid, &wstatus, 0);
+		if ((ret >= 0) || (errno != EINTR))
+			break;
+
+		if ((kill(pid, 0) < 0) && (errno == ESRCH))
+			return;
+
+		count++;
+		/*
+		 *  Retry if EINTR unless we've have 2 mins
+		 *  consecutive EINTRs then give up.
+		 */
+		if (!keep_stressing_flag()) {
+			(void)kill(pid, signum);
+			if (count > 120) {
+				if (set_force_killed_counter)
+					force_killed_counter(args);
+				stress_killpid(pid);
+			}
+		}
+		shim_sched_yield();
+		if (count > 10)
+			(void)sleep(1);
+	}
+}
+
+/*
+ *  stress_kill_and_wait()
+ *
+ */
+void stress_kill_and_wait(
+	const stress_args_t *args,
+	const pid_t pid,
+	const int signum,
+	const bool set_force_killed_counter)
+{
+	const pid_t mypid = getpid();
+
+	if ((pid == 0) || (pid == 1) || (pid == mypid)) {
+		pr_inf("%s: warning, attempt to kill pid %" PRIdMAX " ignored\n",
+			args->name, (intmax_t)pid);
+	}
+	if ((pid <= 1) || (pid == mypid))
+		return;
+
+	(void)kill(pid, signum);
+	stress_wait_until_reaped(args, pid, signum, set_force_killed_counter);
+}
+
+/*
+ *  stress_kill_and_wait_many()
+ *	kill and wait on an array of pids. Kill first, then reap.
+ *	Avoid killing pids < init and oneself to catch any stupid
+ *	breakage.
+ */
+void stress_kill_and_wait_many(
+	const stress_args_t *args,
+	const pid_t *pids,
+	const size_t n_pids,
+	const int signum,
+	const bool set_force_killed_counter)
+{
+	size_t i;
+	const pid_t mypid = getpid();
+
+	/* Kill first */
+	for (i = 0; i < n_pids; i++) {
+		if ((pids[i] > 1) && (pids[i] != mypid))
+			(void)kill(pids[i], signum);
+	}
+	/* Then reap */
+	for (i = 0; i < n_pids; i++) {
+		if ((pids[i] > 1) && (pids[i] != mypid))
+			stress_kill_and_wait(args, pids[i], signum, set_force_killed_counter);
+	}
+}
diff -pruN 0.15.07-1/core-klog.c 0.15.08-1/core-klog.c
--- 0.15.07-1/core-klog.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-klog.c	2023-05-21 14:30:06.000000000 +0000
@@ -46,6 +46,35 @@ static bool stress_klog_err_no_exception
 }
 #endif
 
+#if defined(__linux__)
+/*
+ *  stress_klog_kernel_cmdline()
+ *	where possible log kernel command line, just once
+ */
+static void stress_klog_kernel_cmdline(void)
+{
+	static bool already_dumped = false;
+	char buffer[4096], *ptr;
+	ssize_t ret;
+
+	if (already_dumped)
+		return;
+
+	ret = system_read("/proc/cmdline", buffer, sizeof(buffer));
+	if (ret < 0)
+		return;
+
+	for (ptr = buffer; *ptr && ptr < (buffer + ret); ptr++) {
+		if (*ptr == '\n') {
+			*ptr = '\0';
+			break;
+		}
+	}
+	pr_inf("klog-check: kernel cmdline: '%s'\n", buffer);
+	already_dumped = true;
+}
+#endif
+
 void stress_klog_start(void)
 {
 #if defined(__linux__)
@@ -132,12 +161,14 @@ void stress_klog_start(void)
 
 log_err:
 			if (stress_klog_err_no_exceptions(buf)) {
+				stress_klog_kernel_cmdline();
 				stress_dump_processes();
 				pr_err("klog-check: %s: %s '%s'\n", msg, ts, ptr);
 				g_shared->klog_error = true;
 				continue;
 			}
 log_info:
+			stress_klog_kernel_cmdline();
 			pr_inf("klog-check: %s: %s '%s'\n", msg, ts, ptr);
 		}
 		(void)fclose(klog_fp);
diff -pruN 0.15.07-1/core-lock.c 0.15.08-1/core-lock.c
--- 0.15.07-1/core-lock.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-lock.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  */
 #include "stress-ng.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-pthread.h"
 
 #if defined(HAVE_LINUX_FUTEX_H)
@@ -378,7 +379,7 @@ static int stress_sem_sysv_release(stres
 }
 #endif
 
-static bool stress_lock_valid(stress_lock_t *lock)
+static bool stress_lock_valid(const stress_lock_t *lock)
 {
 	return (lock && (lock->magic == STRESS_LOCK_MAGIC));
 }
@@ -470,7 +471,7 @@ int stress_lock_destroy(void *lock_handl
 
 	if (stress_lock_valid(lock)) {
 		(void)lock->deinit(lock);
-		(void)memset(lock, 0, sizeof(*lock));
+		(void)shim_memset(lock, 0, sizeof(*lock));
 		(void)munmap((void *)lock, sizeof(*lock));
 		return 0;
 	}
diff -pruN 0.15.07-1/core-log.c 0.15.08-1/core-log.c
--- 0.15.07-1/core-log.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-log.c	2023-05-21 14:30:06.000000000 +0000
@@ -32,7 +32,7 @@ static FILE	*log_file = NULL;
 
 static inline FILE *pr_file(void)
 {
-	return (g_opt_flags & OPT_FLAGS_STDOUT) ? stdout : stderr;
+	return (g_opt_flags & OPT_FLAGS_STDERR) ? stderr : stdout;
 }
 
 /*
@@ -561,7 +561,7 @@ void pr_tidy(const char *fmt, ...)
 	va_list ap;
 
 	va_start(ap, fmt);
-	(void)pr_msg(pr_file(), g_caught_signal ? PR_INFO : PR_DEBUG, fmt, ap);
+	(void)pr_msg(pr_file(), g_shared && g_shared->caught_sigint ? PR_INFO : PR_DEBUG, fmt, ap);
 	va_end(ap);
 }
 
diff -pruN 0.15.07-1/core-mounts.c 0.15.08-1/core-mounts.c
--- 0.15.07-1/core-mounts.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-mounts.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 /* *BSD systems */
 #if defined(HAVE_SYS_UCRED_H)
@@ -82,7 +83,7 @@ int stress_mount_get(char *mnts[], const
 	struct statfs *statbufs;
 #endif
 
-	(void)memset(mnts, 0, max * sizeof(*mnts));
+	(void)shim_memset(mnts, 0, max * sizeof(*mnts));
 	ret = getmntinfo(&statbufs, 0);
 	if (ret > max)
 		ret = max;
@@ -100,7 +101,7 @@ int stress_mount_get(char *mnts[], const
 	struct mntent* mnt;
 	int n = 0;
 
-	(void)memset(mnts, 0, (size_t)max * sizeof(*mnts));
+	(void)shim_memset(mnts, 0, (size_t)max * sizeof(*mnts));
 	mounts = setmntent("/etc/mtab", "r");
 	/* Failed, so assume / is available */
 	if (!mounts) {
@@ -118,7 +119,7 @@ int stress_mount_get(char *mnts[], const
 {
 	int n = 0;
 
-	(void)memset(mnts, 0, max * sizeof(*mnts));
+	(void)shim_memset(mnts, 0, max * sizeof(*mnts));
 	stress_mount_add(mnts, max, &n, "/");
 	stress_mount_add(mnts, max, &n, "/dev");
 	stress_mount_add(mnts, max, &n, "/tmp");
diff -pruN 0.15.07-1/core-net.c 0.15.08-1/core-net.c
--- 0.15.07-1/core-net.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-net.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_SYS_UN_H)
@@ -182,7 +183,7 @@ int stress_set_sockaddr_if(
 	case AF_INET: {
 		static struct sockaddr_in addr;
 
-		(void)memset(&addr, 0, sizeof(addr));
+		(void)shim_memset(&addr, 0, sizeof(addr));
 
 		if ((!ifname) || (!stress_net_interface_exists(ifname, domain, (struct sockaddr *)&addr))) {
 			switch (net_addr) {
@@ -209,7 +210,7 @@ int stress_set_sockaddr_if(
 		static const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
 		static const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
 #endif
-		(void)memset(&addr, 0, sizeof(addr));
+		(void)shim_memset(&addr, 0, sizeof(addr));
 
 		if ((!ifname) || (!stress_net_interface_exists(ifname, domain, (struct sockaddr *)&addr))) {
 			switch (net_addr) {
@@ -234,7 +235,7 @@ int stress_set_sockaddr_if(
 	case AF_UNIX: {
 		static struct sockaddr_un addr;
 
-		(void)memset(&addr, 0, sizeof(addr));
+		(void)shim_memset(&addr, 0, sizeof(addr));
 		addr.sun_family = AF_UNIX;
 		(void)snprintf(addr.sun_path, sizeof(addr.sun_path),
 			"/tmp/stress-ng-%jd-%" PRIu32,
diff -pruN 0.15.07-1/core-out-of-memory.c 0.15.08-1/core-out-of-memory.c
--- 0.15.07-1/core-out-of-memory.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-out-of-memory.c	2023-05-21 14:30:06.000000000 +0000
@@ -82,8 +82,6 @@ static int stress_set_adjustment(const c
 	const size_t len = strlen(str);
 	int i, saved_errno = 0;
 
-	/* pr_dbg("%s: %s -> %s\n", name, procname, str); */
-
 	for (i = 0; i < 32; i++) {
 		ssize_t n;
 		int fd;
@@ -101,7 +99,8 @@ static int stress_set_adjustment(const c
 		if (n < 0) {
 			if ((saved_errno != EAGAIN) &&
 			    (saved_errno != EINTR)) {
-				pr_dbg("%s: can't set oom_score_adj\n", name);
+				pr_dbg("%s: can't set oom_score_adj, errno=%d (%s)\n",
+					name, errno, strerror(errno));
 				return -saved_errno;
 			}
 		}
diff -pruN 0.15.07-1/core-perf.c 0.15.08-1/core-perf.c
--- 0.15.07-1/core-perf.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-perf.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-perf.h"
 #include "core-perf-event.h"
 
@@ -442,7 +443,7 @@ int stress_perf_open(stress_perf_t *sp)
 	if (g_shared->perf.no_perf)
 		return -1;
 
-	(void)memset(sp, 0, sizeof(*sp));
+	(void)shim_memset(sp, 0, sizeof(*sp));
 	sp->perf_opened = 0;
 
 	for (i = 0; i < STRESS_PERF_MAX; i++) {
@@ -454,7 +455,7 @@ int stress_perf_open(stress_perf_t *sp)
 		if (perf_info[i].config != UNRESOLVED) {
 			struct perf_event_attr attr;
 
-			(void)memset(&attr, 0, sizeof(attr));
+			(void)shim_memset(&attr, 0, sizeof(attr));
 			attr.type = perf_info[i].type;
 			attr.config = perf_info[i].config;
 			attr.disabled = 1;
@@ -576,7 +577,7 @@ int stress_perf_close(stress_perf_t *sp)
 			continue;
 		}
 
-		(void)memset(&data, 0, sizeof(data));
+		(void)shim_memset(&data, 0, sizeof(data));
 		ret = read(fd, &data, sizeof(data));
 		if (ret != sizeof(data))
 			sp->perf_stat[i].counter = STRESS_PERF_INVALID;
@@ -711,9 +712,9 @@ void stress_perf_stat_dump(FILE *yaml, s
 		int p;
 		uint64_t counter_totals[STRESS_PERF_MAX];
 		bool got_data = false;
-		char *munged;
+		char munged[64];
 
-		(void)memset(counter_totals, 0, sizeof(counter_totals));
+		(void)shim_memset(counter_totals, 0, sizeof(counter_totals));
 
 		/* Sum totals across all instances of the stressor */
 		for (p = 0; p < STRESS_PERF_MAX && perf_info[p].label; p++) {
@@ -738,7 +739,7 @@ void stress_perf_stat_dump(FILE *yaml, s
 		if (!got_data)
 			continue;
 
-		munged = stress_munge_underscore(ss->stressor->name);
+		(void)stress_munge_underscore(munged, ss->stressor->name, sizeof(munged));
 		pr_inf("%s:\n", munged);
 		pr_yaml(yaml, "    - stressor: %s\n", munged);
 		pr_yaml(yaml, "      duration: %f\n", duration);
diff -pruN 0.15.07-1/core-processes.c 0.15.08-1/core-processes.c
--- 0.15.07-1/core-processes.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-processes.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(__linux__)
 static int stress_dump_processes_filter(const struct dirent *d)
@@ -54,7 +55,7 @@ void stress_dump_processes(void)
 		pid_t pid, ppid;
 		ssize_t ret;
 
-		(void)memset(cmd, 0, sizeof(cmd));
+		(void)shim_memset(cmd, 0, sizeof(cmd));
 		(void)snprintf(path, sizeof(path), "/proc/%s/cmdline", namelist[i]->d_name);
 		ret = system_read(path, cmd, sizeof(cmd));
 		if (ret > 0) {
diff -pruN 0.15.07-1/core-resources.c 0.15.08-1/core-resources.c
--- 0.15.07-1/core-resources.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-resources.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-resources.h"
 
 #if defined(HAVE_LIB_PTHREAD)
@@ -31,6 +32,100 @@ static void *stress_resources_pthread_fu
 #endif
 
 /*
+ *  stress_resources_init()
+ *	helper function to set resources to initial 'unallocated' values
+ */
+static void stress_resources_init(stress_resources_t *resources, const size_t num_resources)
+{
+	size_t i;
+
+	for (i = 0; i < num_resources; i++) {
+		resources[i].m_malloc = NULL;
+		resources[i].m_mmap = MAP_FAILED;
+		resources[i].pipe_ret = -1;
+		resources[i].fd_open = -1;
+#if defined(HAVE_EVENTFD)
+		resources[i].fd_ev = -1;
+#endif
+#if defined(HAVE_MEMFD_CREATE)
+		resources[i].fd_memfd = -1;
+		resources[i].ptr_memfd = NULL;
+#endif
+#if defined(__NR_memfd_secret)
+		resources[i].fd_memfd_secret = -1;
+		resources[i].ptr_memfd_secret = NULL;
+#endif
+		resources[i].fd_sock = -1;
+		resources[i].fd_socketpair[0] = -1;
+		resources[i].fd_socketpair[1] = -1;
+#if defined(HAVE_USERFAULTFD)
+		resources[i].fd_uf = -1;
+#endif
+#if defined(O_TMPFILE)
+		resources[i].fd_tmp = -1;
+#endif
+#if defined(HAVE_LIB_PTHREAD)
+		resources[i].pthread_ret = -1;
+		resources[i].pthread = (pthread_t)0;
+#if defined(HAVE_PTHREAD_MUTEX_T) &&	\
+    defined(HAVE_PTHREAD_MUTEX_INIT) &&	\
+    defined(HAVE_PTHREAD_MUTEX_DESTROY)
+		(void)shim_memset(&resources[i].mutex, 0, sizeof(resources[i].mutex));
+		resources[i].mutex_ret = -1;
+#endif
+#endif
+
+#if defined(HAVE_LIB_RT) &&		\
+    defined(HAVE_TIMER_CREATE) &&	\
+    defined(HAVE_TIMER_DELETE) &&	\
+    defined(SIGUNUSED)
+		resources[i].timerok = false;
+#endif
+#if defined(HAVE_SYS_TIMERFD_H) &&	\
+    defined(HAVE_TIMERFD_CREATE) &&	\
+    defined(HAVE_TIMERFD_GETTIME) &&	\
+    defined(HAVE_TIMERFD_SETTIME) &&	\
+    defined(CLOCK_REALTIME)
+		resources[i].timer_fd = -1;
+#endif
+#if defined(HAVE_SYS_INOTIFY)
+		resources[i].wd_inotify = -1;
+		resources[i].fd_inotify = -1;
+#endif
+#if defined(HAVE_PTSNAME)
+		resources[i].pty = -1;
+		resources[i].pty_mtx = -1;
+#endif
+#if defined(HAVE_LIB_PTHREAD) &&	\
+    defined(HAVE_SEM_POSIX)
+		resources[i].semok = false;
+#endif
+#if defined(HAVE_SEM_SYSV)
+		resources[i].sem_id = -1;
+#endif
+#if defined(HAVE_MQ_SYSV) &&	\
+    defined(HAVE_SYS_IPC_H) &&	\
+    defined(HAVE_SYS_MSG_H)
+		resources[i].msgq_id = -1;
+#endif
+#if defined(HAVE_LIB_RT) &&	\
+    defined(HAVE_MQ_POSIX) &&	\
+    defined(HAVE_MQUEUE_H)
+		resources[i].mq = -1;
+		resources[i].mq_name[0] = '\0';
+#endif
+#if defined(HAVE_PKEY_ALLOC) &&	\
+    defined(HAVE_PKEY_FREE)
+		resources[i].pkey = -1;
+#endif
+#if defined(HAVE_PIDFD_OPEN)
+		resources[i].pid_fd = -1;
+#endif
+		resources[i].pid = 0;
+	}
+}
+
+/*
  *  stress_resources_allocate()
  *	allocate a wide range of resources, perform num_resources
  *	resource allocations
@@ -54,6 +149,7 @@ size_t stress_resources_allocate(
 	static const int domains[] = { AF_INET, AF_INET6 };
 	static const int types[] = { SOCK_STREAM, SOCK_DGRAM };
 
+	stress_resources_init(resources, num_resources);
 	stress_ksm_memory_merge(1);
 
 	(void)pid;
@@ -84,7 +180,7 @@ size_t stress_resources_allocate(
 	if ((freemem > 0) && (freemem < min_mem_free))
 		return 0;
 
-	(void)memset(resources, 0, sizeof(*resources) * num_resources);
+	(void)shim_memset(resources, 0, sizeof(*resources) * num_resources);
 
 	for (i = 0; i < num_resources; i++) {
 #if defined(HAVE_MEMFD_CREATE)
@@ -120,7 +216,7 @@ size_t stress_resources_allocate(
 #if defined(HAVE_PTHREAD_MUTEX_T) &&	\
     defined(HAVE_PTHREAD_MUTEX_INIT) &&	\
     defined(HAVE_PTHREAD_MUTEX_DESTROY)
-		(void)memset(&resources[i].mutex, 0, sizeof(resources[i].mutex));
+		(void)shim_memset(&resources[i].mutex, 0, sizeof(resources[i].mutex));
 		resources[i].mutex_ret = -1;
 #endif
 #endif
@@ -611,7 +707,7 @@ void stress_resources_free(
     defined(HAVE_PTHREAD_MUTEX_INIT) &&	\
     defined(HAVE_PTHREAD_MUTEX_DESTROY)
 			(void)pthread_mutex_destroy(&resources[i].mutex);
-			(void)memset(&resources[i].mutex, 0, sizeof(resources[i].mutex));
+			(void)shim_memset(&resources[i].mutex, 0, sizeof(resources[i].mutex));
 #endif
 		}
 #endif
diff -pruN 0.15.07-1/core-sched.c 0.15.08-1/core-sched.c
--- 0.15.07-1/core-sched.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-sched.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #ifndef SCHED_FLAG_RESET_ON_FORK
 #define SCHED_FLAG_RESET_ON_FORK        (0x01)
@@ -94,7 +95,7 @@ int stress_set_deadline_sched(
 	int rc;
 	struct shim_sched_attr attr;
 
-	(void)memset(&attr, 0, sizeof(attr));
+	(void)shim_memset(&attr, 0, sizeof(attr));
 
 	attr.size = sizeof(attr);
 	attr.sched_policy = SCHED_DEADLINE;
@@ -154,7 +155,7 @@ int stress_set_sched(
 	uint64_t sched_deadline = 0;
 #endif
 
-	(void)memset(&param, 0, sizeof(param));
+	(void)shim_memset(&param, 0, sizeof(param));
 
 	switch (sched) {
 	case UNDEFINED:	/* No preference, don't set */
@@ -197,7 +198,7 @@ int stress_set_sched(
 	case SCHED_DEADLINE:
 		min = sched_get_priority_min(sched);
 		max = sched_get_priority_max(sched);
-		(void)memset(&attr, 0, sizeof(attr));
+		(void)shim_memset(&attr, 0, sizeof(attr));
 		attr.size = sizeof(attr);
 		attr.sched_policy = SCHED_DEADLINE;
 		attr.sched_flags = SCHED_FLAG_RESET_ON_FORK;
diff -pruN 0.15.07-1/core-shim.c 0.15.08-1/core-shim.c
--- 0.15.07-1/core-shim.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-shim.c	2023-05-21 14:30:06.000000000 +0000
@@ -22,6 +22,7 @@
 #include "stress-ng.h"
 #include "core-arch.h"
 #include "core-asm-riscv.h"
+#include "core-builtin.h"
 #include "core-cpu-cache.h"
 #include "core-pragma.h"
 
@@ -233,7 +234,7 @@ static int shim_emulate_fallocate(int fd
 	if (n == (off_t)-1)
 		return -1;
 
-	(void)memset(buffer, 0, FALLOCATE_BUF_SIZE);
+	(void)shim_memset(buffer, 0, FALLOCATE_BUF_SIZE);
 	n = len;
 
 	while (keep_stressing_flag() && (n > 0)) {
@@ -1044,7 +1045,7 @@ int shim_statx(
 	unsigned int mask,
 	shim_statx_t *buffer)
 {
-	(void)memset(buffer, 0, sizeof(*buffer));
+	(void)shim_memset(buffer, 0, sizeof(*buffer));
 #if defined(HAVE_STATX)
 	return statx(dfd, filename, flags, mask, (struct statx *)buffer);
 #elif defined(__NR_statx) &&	\
diff -pruN 0.15.07-1/core-smart.c 0.15.08-1/core-smart.c
--- 0.15.07-1/core-smart.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-smart.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-smart.h"
 
@@ -245,7 +246,7 @@ static stress_smart_data_t *stress_smart
 	if (fd < 0)
 		return NULL;
 
-	(void)memset(&sg_io_hdr, 0, sizeof(sg_io_hdr));
+	(void)shim_memset(&sg_io_hdr, 0, sizeof(sg_io_hdr));
 	sg_io_hdr.interface_id = 'S';
 	sg_io_hdr.cmd_len = sizeof(cdb);
 	sg_io_hdr.mx_sb_len = sizeof(sbuf);
@@ -255,7 +256,7 @@ static stress_smart_data_t *stress_smart
 	sg_io_hdr.cmdp = cdb;
 	sg_io_hdr.sbp = sbuf;
 	sg_io_hdr.timeout = 35000;
-	(void)memset(buf, 0, sizeof(buf));
+	(void)shim_memset(buf, 0, sizeof(buf));
 
 	if (ioctl(fd, SG_IO, &sg_io_hdr) < 0) {
 		(void)close(fd);
@@ -272,7 +273,7 @@ static stress_smart_data_t *stress_smart
 	if (!data)
 		return NULL;
 
-	(void)memcpy(data->values, rv_start, values_size);
+	(void)shim_memcpy(data->values, rv_start, values_size);
 	data->size = size;
 	data->count = i;
 	return data;
diff -pruN 0.15.07-1/core-stressors.h 0.15.08-1/core-stressors.h
--- 0.15.07-1/core-stressors.h	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-stressors.h	2023-05-21 14:30:06.000000000 +0000
@@ -88,6 +88,7 @@
 	MACRO(filename)		\
 	MACRO(flock)		\
 	MACRO(flushcache)	\
+	MACRO(fma)		\
 	MACRO(fork)		\
 	MACRO(forkheavy)	\
 	MACRO(fp)		\
diff -pruN 0.15.07-1/core-thermal-zone.c 0.15.08-1/core-thermal-zone.c
--- 0.15.07-1/core-thermal-zone.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-thermal-zone.c	2023-05-21 14:30:06.000000000 +0000
@@ -272,8 +272,9 @@ void stress_tz_dump(FILE *yaml, stress_s
 
 			if (total) {
 				const double temp = (count > 0) ? ((double)total / count) / 1000.0 : 0.0;
-				char *munged = stress_munge_underscore(ss->stressor->name);
+				char munged[64];
 
+				(void)stress_munge_underscore(munged, ss->stressor->name, sizeof(munged));
 				if (!dumped_heading) {
 					dumped_heading = true;
 					pr_inf("%s:\n", munged);
diff -pruN 0.15.07-1/core-thrash.c 0.15.08-1/core-thrash.c
--- 0.15.07-1/core-thrash.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-thrash.c	2023-05-21 14:30:06.000000000 +0000
@@ -46,7 +46,7 @@ static void MLOCKED_TEXT stress_pagein_h
 		siglongjmp(jmp_env, 1);
 }
 
-static void stress_thrash_state(char *state)
+static void stress_thrash_state(const char *state)
 {
 	stress_set_proc_state_str("thrash", state);
 }
diff -pruN 0.15.07-1/core-try-open.c 0.15.08-1/core-try-open.c
--- 0.15.07-1/core-try-open.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-try-open.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 /*
  *  stress_try_kill()
@@ -152,7 +153,7 @@ int stress_open_timeout(
 	/*
 	 *  Enable a timer to interrupt log open waits
 	 */
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
diff -pruN 0.15.07-1/core-vmstat.c 0.15.08-1/core-vmstat.c
--- 0.15.07-1/core-vmstat.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/core-vmstat.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 #include "core-thermal-zone.h"
 
@@ -366,7 +367,7 @@ static void stress_read_iostat(const cha
 		(void)fclose(fp);
 
 		if (ret != 15)
-			(void)memset(iostat, 0, sizeof(*iostat));
+			(void)shim_memset(iostat, 0, sizeof(*iostat));
 	}
 }
 
@@ -383,7 +384,7 @@ static void stress_get_iostat(const char
 	static stress_iostat_t iostat_prev;
 	stress_iostat_t iostat_current;
 
-	(void)memset(&iostat_current, 0, sizeof(iostat_current));
+	(void)shim_memset(&iostat_current, 0, sizeof(iostat_current));
 	stress_read_iostat(iostat_name, &iostat_current);
 	STRESS_IOSTAT_DELTA(read_io);
 	STRESS_IOSTAT_DELTA(read_merges);
@@ -400,7 +401,7 @@ static void stress_get_iostat(const char
 	STRESS_IOSTAT_DELTA(discard_merges);
 	STRESS_IOSTAT_DELTA(discard_sectors);
 	STRESS_IOSTAT_DELTA(discard_ticks);
-	(void)memcpy(&iostat_prev, &iostat_current, sizeof(iostat_prev));
+	(void)shim_memcpy(&iostat_prev, &iostat_current, sizeof(iostat_prev));
 }
 #endif
 
@@ -697,7 +698,7 @@ static void stress_read_vmstat(stress_vm
 	size_t page_size = stress_get_page_size();
 	int ret;
 
-	(void)memset(&vm_stat, 0, sizeof(vmstat));
+	(void)shim_memset(&vm_stat, 0, sizeof(vmstat));
 	ret = host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm_stat, &count);
 	if (ret >= 0) {
 		vmstat->swap_in = vm_stat.pageins;
@@ -815,8 +816,8 @@ static void stress_get_vmstat(stress_vms
 	static stress_vmstat_t vmstat_prev;
 	stress_vmstat_t vmstat_current;
 
-	(void)memset(&vmstat_current, 0, sizeof(vmstat_current));
-	(void)memset(vmstat, 0, sizeof(*vmstat));
+	(void)shim_memset(&vmstat_current, 0, sizeof(vmstat_current));
+	(void)shim_memset(vmstat, 0, sizeof(*vmstat));
 	stress_read_vmstat(&vmstat_current);
 	STRESS_VMSTAT_COPY(procs_running);
 	STRESS_VMSTAT_COPY(procs_blocked);
@@ -838,7 +839,7 @@ static void stress_get_vmstat(stress_vms
 	STRESS_VMSTAT_DELTA(idle_time);
 	STRESS_VMSTAT_DELTA(wait_time);
 	STRESS_VMSTAT_DELTA(stolen_time);
-	(void)memcpy(&vmstat_prev, &vmstat_current, sizeof(vmstat_prev));
+	(void)shim_memcpy(&vmstat_prev, &vmstat_current, sizeof(vmstat_prev));
 }
 
 #if defined(__linux__)
@@ -846,7 +847,7 @@ static void stress_get_vmstat(stress_vms
  *  stress_get_tz_info()
  *	get temperature in degrees C from a thermal zone
  */
-static double stress_get_tz_info(stress_tz_info_t *tz_info)
+static double stress_get_tz_info(const stress_tz_info_t *tz_info)
 {
 	double temp = 0.0;
 	FILE *fp;
@@ -1079,7 +1080,7 @@ void stress_vmstat_start(void)
 			double clk_tick_vmstat_delay = (double)clk_tick * (double)vmstat_delay;
 			static uint32_t vmstat_count = 0;
 
-			if ((vmstat_count++ % 25) == 0)
+			if (vmstat_count == 0)
 				pr_inf("vmstat: %2s %2s %9s %9s %9s %9s "
 					"%4s %4s %6s %6s %4s %4s %2s %2s "
 					"%2s %2s %2s\n",
@@ -1087,6 +1088,9 @@ void stress_vmstat_start(void)
 					"cache", "si", "so", "bi", "bo",
 					"in", "cs", "us", "sy", "id",
 					"wa", "st");
+			vmstat_count++;
+			if (vmstat_count >= 25)
+				vmstat_count = 0;
 
 			stress_get_vmstat(&vmstat);
 			pr_inf("vmstat: %2" PRIu64 " %2" PRIu64 /* procs */
@@ -1135,8 +1139,11 @@ void stress_vmstat_start(void)
 					ptr += 7;
 				}
 #endif
-				if ((thermalstat_count++ % 25) == 0)
+				if (thermalstat_count == 0)
 					pr_inf("therm: AvGHz MnGhz MxGHz  LdA1  LdA5 LdA15 %s\n", therms);
+				thermalstat_count++;
+				if (thermalstat_count >= 25)
+					thermalstat_count = 0;
 
 #if defined(__linux__)
 				for (ptr = therms, tz_info = g_shared->tz_info; tz_info; tz_info = tz_info->next) {
@@ -1169,8 +1176,11 @@ void stress_vmstat_start(void)
 			double clk_scale = (iostat_delay > 0) ? 1.0 / iostat_delay : 0.0;
 			static uint32_t iostat_count = 0;
 
-			if ((iostat_count++ % 25) == 0)
+			if (iostat_count == 0)
 				pr_inf("iostat: Inflght   Rd K/s   Wr K/s Dscd K/s     Rd/s     Wr/s   Dscd/s\n");
+			iostat_count++;
+			if (iostat_count >= 25)
+				iostat_count = 0;
 
 			stress_get_iostat(iostat_name, &iostat);
 			/* sectors are 512 bytes, so >> 1 to get stats in 1024 bytes */
diff -pruN 0.15.07-1/debian/changelog 0.15.08-1/debian/changelog
--- 0.15.07-1/debian/changelog	2023-04-13 15:52:11.000000000 +0000
+++ 0.15.08-1/debian/changelog	2023-05-21 14:27:37.000000000 +0000
@@ -1,3 +1,204 @@
+stress-ng (0.15.08-1) unstable; urgency=medium
+
+  [Fernand Sieber]
+  * stress-cpu: Deduce waiting time in active cycle from idle time
+
+  [Hui Wang]
+  * snapcraft: remove a duplicated dependent package
+
+  [Thinh Tran]
+  * rawsock: locked up when parent sends SIGKILL to child
+
+  [Colin Ian King]
+  * Makefile: bump version
+  * README.md: update contributors list
+  * Manual: update date
+  * stress-ng.h: rework OPTIMIZE_FAST_MATH to workaround cpp issue with pcc
+  * stress-iomix: use pid_t type for pid array
+  * core-killpid: use intmax_t to print format pid_t
+  * Makefile: don't enable gcc flag -ftree-loop-vectorize for Solaris
+  * core-helper: voidify stress_proc_self_exe_path for __sun__ builds
+  * stress-ng: don't flag SIGALRM terminations of stressors as a failure
+  * stress-sleep: cancel alarms on tidy up to avoid alarm cascade in
+    pthreads
+  * stress-fallocate: remove messy signal handler
+  * core-klog: only declare stress_klog_kernel_cmdline for linux builds
+  * stress-ng: add optional repeated SIGKILL force option to
+    stress_kill_stressors
+  * stress-fallocate: remove short file life hint
+  * stress-fork: make 50% of forked children do immediate exit
+  * core-lock: constify function argument lock
+  * stress-tree: constify pointer node
+  * stress-sleep: add missing __PCC__ ifdef constraint check
+  * stress-rtc: move variables to local scopes
+  * stress-module: improve module loading error message
+  * stress-io-uring: constify various function arguments
+  * stress-ipsec-mb: constify function argument job
+  * stress-ipsec-mb: constify function argument p_mgr
+  * stress-flock: move variable ret into local scope
+  * stress-dnotify: reformat description declaration
+  * core-vmstat: constify function argument tz_info
+  * stress-crypt: constify function argument salt
+  * stress-cache: constify function argument mem_cache
+  * stress-aiol: constify function argument buffer
+  * stress-affinity: constify info function argument
+  * stress-sparsematrix: initialize x_node, y_node to clean up cppcheck
+    warnings
+  * stress-list: zero head to clean up pedantic static analysis warning
+  * stress-wcs: set info name to the stressor name
+  * stress-wcs: add index bounds check, keeps static analyzers happy
+  * stress-cyclic: fix off-by-one comparison for cyclic_policy
+  * stress-af-alg: add in some missing configs from 6.3 kernel
+  * README.md: add another citation
+  * stress-pthread: fix big endian tid addr for 32 bit systems
+   (Closes #1036356)
+  * stress-vecfp: replace debug metrics with standard metrics data,
+    bump metrics to 40
+  * stress-vm-segv: use pipe for a synchronization mechanism
+  * core-klog: remove extraneous tab
+  * Add --stderr option, default output now to stdout
+  * README.md: add another kernel bug found with stress-ng
+  * stress-sock: handle corner-case where n is zero
+  * core-klog: dump kernel cmdline just once
+  * stress-ng: handle SIGALRM in stressor and parent more intelligently
+  * core-builtin: use builtin versions of memset, memcpy and memmove
+  * stress-dev: disable warning for -Wgnu-variable-sized-type-not-at-end
+  * stress-getdent: remove % operator with compare and subtract
+  * core-killpid: add helper stress_kill_and_wait_many to kill many pids
+  * core-thrash: constify pointer state
+  * stress-wcs: constify static array letters
+  * stress-vecwide: constify pointer vec_args
+  * stress-udp: constify static array patterns
+  * stress-rawpkt: constify pointer idx
+  * stress-pthread: move new_head to local scope, replace memcpy with
+    assignment
+  * stress-prefetch: constify addr pointer argument
+  * stress-prctl: move temp variables to lower scopes
+  * stress-opcode: constify function parameters page_size and op
+  * stress-mmapfork: constify function pointer ptr
+  * stress-madvise: initialization poison_count
+  * stress-list: constify pointer entries_end
+  * stress-inode-flags: constify pointer to data
+  * stress-ng.h: ensure unsigned 1 is being left shifted to avoid signed
+    warnings
+  * stress-af-alg: avoid adding potential NULL ptr to length of buffer
+  * stress-chdir: move paths, fds and mkdir_ok arrays into one array
+  * stress-affinity: force random cpu choice to never be same as previous
+  * stress-af-alg: add in some missing configs
+  * stress-io-uring: clean up 32 bit build warnings on addr to user_data
+    casts
+  * core-killpid: add sanity checks to pid being killed
+  * core-killpid: add signal number to stress_kill_and_wait
+  * stress-dccp: move kill out of server to parent patj
+  * stress-*: use stress_kill_and_wait for kill and wait
+  * core: add stress_kill_and_wait helper to kill and wait for children
+  * stress-resched: ensure pids are initialized to -1
+  * core-helper: stress_proc_self_exe_path: voidify unused args
+  * stress-ng: remove empty line
+  * stress-sctp: remove trailing space at end of line
+  * Makefile: add gcc optimization flag -ftree-loop-vectorize
+  * stress-{memthrash|zlib}: use memzero for zero data generation
+  * Add build time check for __builtin_memset
+  * stress-zlib: emit DEF/INF debug only for instance 0
+  * stress-atomic: workaround gcc 11 atomic nand builtin issues
+  * stress-exec: add FreeBSD rfork and get executable name using sysctl
+  * stress-signest: add signal ignoring and don't jmp on invalid jmpbuf
+  * stress-af-alg: silently handle EOPNOTSUPP recv errors
+  * README.md: add two more research paper citations
+  * README.md: add link to another kernel improvement that used stress-ng
+  * stress-af-alg: use recv on socket rather than read
+  * stress-vecshuf: make function pointer const
+  * stress-vecfp.c: make function pointer const
+  * stress-sparsematrix: move get/put stats into metrics output
+  * stress-xattr: handle fall-out when file system fills up
+  * README.md: add another kernel bug found with stress-ng
+  * stress-xattr: keep track of xsetattr calls that succeeded using a bitmap
+  * core-helper: remove need for static buffer in stress_proc_self_exe_path
+  * stress-dnotify: double timeout, ignore notifies that timeout
+  * stress-io-uring: remove redundant check of a non-null pointer
+  * core-helper: rework underscore mungification helper
+  * stress-cacheline: use global shared index to fix cache index issue
+  * stress-urandom: fix corruption of neighbouring mmap'd page
+  * stress-inotify: make inotify_init failure message into just a warning
+  * stress-unshare: replace %= with compare and reset
+  * stress-softlockup: replace %= with compare and reset
+  * stress-rawdev: replace %= with compare and reset
+  * stress-open: replace %= with compare and reset
+  * stress-inode-flags: replace %= with compare and reset
+  * stress-fcntl: replace %= with compare and reset
+  * stress-chmod: replace %= with compare and reset
+  * stress-chattr: replace %= with compare and reset
+  * stress-chroot: replace %= with compare and reset
+  * stress-io-uring: set the setup to just enough reqs
+  * stress-io-uring: fix completion error checks for cancellation
+  * stress-io-uring: cancel if HAVE_IORING_OP_ASYNC_CANCEL is defined
+  * stress-io-uring: silently ignore cancel errors
+  * stress-io-uring: add async cancellation
+  * stress-io-uring: increase ring size, force complete on ring submit EBUSY
+  * core-out-of-memory: report why oom_score_adj can't be set
+  * Add forced_killed_counter to indicate a child has been killed forcefully
+  * stress-io-uring: perform completion at the end of a round of submits
+  * stress-rotate: remove this from the cpu cache class
+  * stress-vm: add conditional parentheses
+  * stress-vecfp: add conditional parentheses
+  * stress-tsearch: add conditional parentheses
+  * stress-sysinval: add conditional parentheses
+  * stress-sysfs: add conditional parentheses
+  * stress-sync-file: add conditional parentheses
+  * stress-socklockup: add conditional parentheses
+  * stress-skiplist: add conditional parentheses
+  * stress-sigsegv: add conditional parentheses
+  * stress-shellsort: add conditional parentheses
+  * stress-session: add conditional parentheses
+  * stress-sem-sysv: add conditional parentheses
+  * stress-seek: add conditional parentheses
+  * stress-sctp: add conditional parentheses
+  * stress-rlimit: add conditional parentheses
+  * stress-rawdev: add conditional parentheses
+  * stress-procfs: add conditional parentheses
+  * stress-peterson: add conditional parentheses
+  * stress-mremap: add conditional parentheses
+  * stress-malloc: add conditional parentheses
+  * stress-lsearch: add conditional parentheses
+  * stress-inotify: add conditional parentheses
+  * stress-hsearch: add conditional parentheses
+  * stress-hdd: add conditional parentheses
+  * stress-hash: add conditional parentheses
+  * stress-futex: add conditional parentheses
+  * stress-fstat: re-order operands of && for minor optimization
+  * stress-fp: add conditional parentheses
+  * stress-exec: add conditional parentheses
+  * stress-dnotify: add conditional parentheses
+  * stress-dev: add conditional parentheses
+  * stress-cyclic: add conditional parentheses
+  * stress-bad-ioctl: add conditional parentheses
+  * stress-af-alg: add conditional parentheses, re-order && operators
+  * core-resources: ensure resources are marked as free as soon as possible
+  * stress-io-uring: throttle calls to stress_read_fdinfo
+  * stress-io-uring: keep a cached copy of fileno(stdin)
+  * stress-io-uring: defer unlinking file to end
+  * stress-io-uring: fix statx command, don't use path, use fd to path
+  * stress-sockmany: use 64 char ascii string as base for memset data,
+    remove expensive % operator
+  * stress-sockabuse: use 64 char ascii string as base for memset data,
+    remove expensive % operator
+  * stress-sock: use 64 char ascii string as base for memset data, remove
+    expensive % operator
+  * stress-epoll: replace % operators with compare + reset and memset
+    data from stress_ascii64
+  * stress-reboot: replace expensive % operation with compare and reset
+  * stress-dccp: use 64 char ascii string as base for memset data, remove
+    expensive % operator
+  * core-helper: add stress_ascii64[] for 64 bytes of ASCII data
+  * core-vmstat: replace % operator with compare and reset
+  * stress-pthread: use 64 bit tid_addr to fix stack clobbering on 32
+    bit platforms
+  * stress-fma: add fused-multiple-add stressor
+  * stress-cpu-online: classify some write failures as non-fatal
+  * README.md: add another kernel issue found with stress-ng
+
+ -- Colin Ian King <colin.i.king@gmail.com>  Sun, 21 May 2023 15:27:37 +0100
+
 stress-ng (0.15.07-1) unstable; urgency=medium
 
   [Shoily Rahman]
diff -pruN 0.15.07-1/snap/snapcraft.yaml 0.15.08-1/snap/snapcraft.yaml
--- 0.15.07-1/snap/snapcraft.yaml	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/snap/snapcraft.yaml	2023-05-21 14:30:06.000000000 +0000
@@ -59,7 +59,6 @@ parts:
             - libattr1-dev
             - libxxhash-dev
             - libmd-dev
-            - libxxhash-dev
             - on amd64: [ libipsec-mb-dev ]
 
 apps:
diff -pruN 0.15.07-1/stress-af-alg-defconfigs.h 0.15.08-1/stress-af-alg-defconfigs.h
--- 0.15.07-1/stress-af-alg-defconfigs.h	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-af-alg-defconfigs.h	2023-05-21 14:30:06.000000000 +0000
@@ -1,6 +1,7 @@
 { .crypto_type = CRYPTO_AEAD, .type = "aead", .name = "aegis128",	.block_size = 1,	.max_auth_size = 16,	.iv_size = 16 },
 { .crypto_type = CRYPTO_AEAD, .type = "aead", .name = "aegis128l",	.block_size = 1,	.max_auth_size = 16,	.iv_size = 16 },
 { .crypto_type = CRYPTO_AEAD, .type = "aead", .name = "aegis256",	.block_size = 1,	.max_auth_size = 16,	.iv_size = 32 },
+{ .crypto_type = CRYPTO_AEAD, .type = "aead", .name = "ccm(aes)",	.block_size = 1,	.max_auth_size = 16,	.iv_size = 16 },
 { .crypto_type = CRYPTO_AEAD, .type = "aead", .name = "gcm(aes)",	.block_size = 1,	.max_auth_size = 16,	.iv_size = 12 },
 { .crypto_type = CRYPTO_AEAD, .type = "aead", .name = "morus1280",	.block_size = 1,	.max_auth_size = 16,	.iv_size = 16 },
 { .crypto_type = CRYPTO_AEAD, .type = "aead", .name = "morus640",	.block_size = 1,	.max_auth_size = 16,	.iv_size = 16 },
@@ -29,17 +30,18 @@
 { .crypto_type = CRYPTO_CIPHER, .type = "cipher", .name = "twofish",	.block_size = 16,	.max_key_size = 32 },
 { .crypto_type = CRYPTO_CIPHER, .type = "cipher", .name = "xeta",	.block_size = 8,	.max_key_size = 16 },
 { .crypto_type = CRYPTO_CIPHER, .type = "cipher", .name = "xtea",	.block_size = 8,	.max_key_size = 16 },
+{ .crypto_type = CRYPTO_RNG, .type = "rng", .name = "fips(ansi_cprng)" },
 { .crypto_type = CRYPTO_RNG, .type = "rng", .name = "jitterentropy_rng" },
 { .crypto_type = CRYPTO_RNG, .type = "rng", .name = "stdrng" },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "blake2b-160",	.block_size = 128,	.digest_size = 20 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "blake2b-256",	.block_size = 128,	.digest_size = 32 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "blake2b-384",	.block_size = 128,	.digest_size = 48 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "blake2b-512",	.block_size = 128,	.digest_size = 64 },
-{ .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "cmac(aes)",	.block_size = 16,	.digest_size = 16 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "cbcmac(aes)",	.block_size = 1,	.digest_size = 16 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "cmac(aes)",	.block_size = 16,	.digest_size = 16 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "crc32",	.block_size = 1,	.digest_size = 4 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "crc32c",	.block_size = 1,	.digest_size = 4 },
+{ .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "crc64-rocksoft",	.block_size = 1,	.digest_size = 8 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "crct10dif",	.block_size = 1,	.digest_size = 2 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "digest_null",	.block_size = 1 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "ghash",	.block_size = 16,	.digest_size = 16 },
@@ -50,6 +52,7 @@
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "michael_mic",	.block_size = 8,	.digest_size = 8 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "nhpoly1305",	.digest_size = 16 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "poly1305",	.block_size = 16,	.digest_size = 16 },
+{ .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "polyval",	.block_size = 16,	.digest_size = 16 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "rmd128",	.block_size = 64,	.digest_size = 16 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "rmd160",	.block_size = 64,	.digest_size = 20 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "rmd256",	.block_size = 64,	.digest_size = 32 },
@@ -64,7 +67,6 @@
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "sha384",	.block_size = 128,	.digest_size = 48 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "sha512",	.block_size = 128,	.digest_size = 64 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "sm3",	.block_size = 64,	.digest_size = 32 },
-{ .crypto_type = CRYPTO_CIPHER, .type = "cipher", .name = "sm4",	.block_size = 16,	.max_key_size = 16 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "streebog256",	.block_size = 64,	.digest_size = 32 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "streebog512",	.block_size = 64,	.digest_size = 64 },
 { .crypto_type = CRYPTO_SHASH, .type = "shash", .name = "tgr128",	.block_size = 64,	.digest_size = 16 },
@@ -81,7 +83,9 @@
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "cbc(cast6)",	.block_size = 16,	.max_key_size = 32,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "cbc(des3_ede)",	.block_size = 8,	.max_key_size = 24,	.iv_size = 8 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "cbc(serpent)",	.block_size = 16,	.max_key_size = 32,	.iv_size = 16 },
+{ .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "cbc(sm4)",	.block_size = 16,	.max_key_size = 16,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "cbc(twofish)",	.block_size = 16,	.max_key_size = 32,	.iv_size = 16 },
+{ .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "cfb(sm4)",	.block_size = 1,	.max_key_size = 16,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "chacha20",	.block_size = 1,	.max_key_size = 32,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ctr(aes)",	.block_size = 1,	.max_key_size = 32,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ctr(blowfish)",	.block_size = 1,	.max_key_size = 56,	.iv_size = 8 },
@@ -90,7 +94,9 @@
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ctr(cast6)",	.block_size = 1,	.max_key_size = 32,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ctr(des3_ede)",	.block_size = 1,	.max_key_size = 24,	.iv_size = 8 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ctr(serpent)",	.block_size = 1,	.max_key_size = 32,	.iv_size = 16 },
+{ .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ctr(sm4)",	.block_size = 1,	.max_key_size = 16,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ctr(twofish)",	.block_size = 1,	.max_key_size = 32,	.iv_size = 16 },
+{ .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "cts(cbc(aes))",	.block_size = 16,	.max_key_size = 32,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ecb(aes)",	.block_size = 16,	.max_key_size = 32 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ecb(blowfish)",	.block_size = 8,	.max_key_size = 56 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ecb(camellia)",	.block_size = 16,	.max_key_size = 32 },
@@ -99,10 +105,12 @@
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ecb(cipher_null)",	.block_size = 1 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ecb(des3_ede)",	.block_size = 8,	.max_key_size = 24 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ecb(serpent)",	.block_size = 16,	.max_key_size = 32 },
+{ .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ecb(sm4)",	.block_size = 16,	.max_key_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "ecb(twofish)",	.block_size = 16,	.max_key_size = 32 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "salsa20",	.block_size = 1,	.max_key_size = 32,	.iv_size = 8 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "xchacha12",	.block_size = 1,	.max_key_size = 32,	.iv_size = 32 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "xchacha20",	.block_size = 1,	.max_key_size = 32,	.iv_size = 32 },
+{ .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "xctr(aes)",	.block_size = 1,	.max_key_size = 32,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "xts(aes)",	.block_size = 16,	.max_key_size = 64,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "xts(camellia)",	.block_size = 16,	.max_key_size = 64,	.iv_size = 16 },
 { .crypto_type = CRYPTO_SKCIPHER, .type = "skcipher", .name = "xts(cast6)",	.block_size = 16,	.max_key_size = 64,	.iv_size = 16 },
diff -pruN 0.15.07-1/stress-af-alg.c 0.15.08-1/stress-af-alg.c
--- 0.15.07-1/stress-af-alg.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-af-alg.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_IF_ALG_H)
 #include <linux/if_alg.h>
@@ -129,12 +130,13 @@ static void stress_af_alg_add_crypto_def
  */
 static stress_crypto_type_t name_to_type(const char *buffer)
 {
-	const char *ptr = strchr(buffer, ':');
-	const char *end = ptr + strlen(buffer);
+	char *end, *ptr = strchr(buffer, ':');
 	size_t i;
 
 	if (!ptr)
 		return CRYPTO_UNKNOWN;
+
+	end = ptr + strlen(buffer);
 	ptr += 2;
 	if (ptr >= end)
 		return CRYPTO_UNKNOWN;
@@ -199,7 +201,7 @@ static int stress_af_alg_hash(
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(&sa, 0, sizeof(sa));
+	(void)shim_memset(&sa, 0, sizeof(sa));
 	sa.salg_family = AF_ALG;
 	(void)shim_strlcpy((char *)sa.salg_type, "hash", sizeof(sa.salg_type));
 	(void)shim_strlcpy((char *)sa.salg_name, info->name, sizeof(sa.salg_name) - 1);
@@ -231,7 +233,7 @@ retry_bind:
 			rc = EXIT_SUCCESS;
 			goto err;
 		}
-		if (errno == ETIMEDOUT && retries-- > 0)
+		if ((errno == ETIMEDOUT) && (retries-- > 0))
 			goto retry_bind;
 		pr_fail("%s: bind failed, errno=%d (%s)\n",
 			args->name, errno, strerror(errno));
@@ -266,6 +268,8 @@ retry_bind:
 			goto err_close;
 		}
 		if (recv(fd, digest, (size_t)digest_size, MSG_WAITALL) != digest_size) {
+			if (errno == EOPNOTSUPP)
+				goto err_abort;
 			pr_fail("%s: recv using %s failed: errno=%d (%s)\n",
 				args->name, info->name,
 				errno, strerror(errno));
@@ -278,6 +282,7 @@ retry_bind:
 			goto err_close;
 		}
 	}
+err_abort:
 	rc = EXIT_SUCCESS;
 err_close:
 	(void)close(fd);
@@ -318,7 +323,7 @@ static int stress_af_alg_cipher(
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(&sa, 0, sizeof(sa));
+	(void)shim_memset(&sa, 0, sizeof(sa));
 	sa.salg_family = AF_ALG;
 	(void)shim_strlcpy((char *)sa.salg_type, salg_type, sizeof(sa.salg_type));
 	(void)shim_strlcpy((char *)sa.salg_name, info->name, sizeof(sa.salg_name) - 1);
@@ -354,7 +359,7 @@ retry_bind:
 			rc = EXIT_SUCCESS;
 			goto err;
 		}
-		if (errno == ETIMEDOUT && retries-- > 0)
+		if ((errno == ETIMEDOUT) && (retries-- > 0))
 			goto retry_bind;
 		pr_fail("%s: bind failed, errno=%d (%s)\n",
 			args->name, errno, strerror(errno));
@@ -437,8 +442,8 @@ retry_bind:
 
 		if (!keep_stressing(args))
 			break;
-		(void)memset(&msg, 0, sizeof(msg));
-		(void)memset(cbuf, 0, cbuf_size);
+		(void)shim_memset(&msg, 0, sizeof(msg));
+		(void)shim_memset(cbuf, 0, cbuf_size);
 
 		msg.msg_control = cbuf;
 		msg.msg_controllen = cbuf_size;
@@ -491,7 +496,9 @@ retry_bind:
 			rc = EXIT_FAILURE;
 			goto err_close;
 		}
-		if (read(fd, output, DATA_LEN) != DATA_LEN) {
+		if (recv(fd, output, DATA_LEN, 0) != DATA_LEN) {
+			if (errno == EOPNOTSUPP)
+				goto err_abort;
 			pr_fail("%s: read using %s failed: errno=%d (%s)\n",
 				args->name, info->name,
 				errno, strerror(errno));
@@ -556,6 +563,7 @@ retry_bind:
 		}
 	}
 
+err_abort:
 	rc = EXIT_SUCCESS;
 	inc_counter(args);
 err_close:
@@ -584,7 +592,7 @@ static int stress_af_alg_rng(
 	if (!output)
 		return EXIT_NO_RESOURCE;
 
-	(void)memset(&sa, 0, sizeof(sa));
+	(void)shim_memset(&sa, 0, sizeof(sa));
 	sa.salg_family = AF_ALG;
 	(void)shim_strlcpy((char *)sa.salg_type, "rng", sizeof(sa.salg_type));
 	(void)shim_strlcpy((char *)sa.salg_name, info->name, sizeof(sa.salg_name) - 1);
@@ -602,7 +610,7 @@ retry_bind:
 			rc = EXIT_SUCCESS;
 			goto err;
 		}
-		if (errno == ETIMEDOUT && retries-- > 0)
+		if ((errno == ETIMEDOUT) && (retries-- > 0))
 			goto retry_bind;
 		pr_fail("%s: bind failed, errno=%d (%s)\n",
 			args->name, errno, strerror(errno));
@@ -763,7 +771,7 @@ static int stress_af_alg(const stress_ar
 
 	(void)stress_get_setting("af-alg-dump", &af_alg_dump);
 
-	if (af_alg_dump && args->instance == 0) {
+	if (af_alg_dump && (args->instance == 0)) {
 		pr_inf("%s: dumping cryptographic algorithms found in /proc/crypto to stdout\n",
 			args->name);
 		stress_af_alg_sort_crypto();
@@ -820,7 +828,7 @@ static int stress_af_alg(const stress_ar
 	do {
 		stress_crypto_info_t *info;
 
-		for (info = crypto_info_list; keep_stressing(args) && info; info = info->next) {
+		for (info = crypto_info_list; info && keep_stressing(args); info = info->next) {
 			if (info->internal || info->ignore)
 				continue;
 			switch (info->crypto_type) {
@@ -993,8 +1001,8 @@ static void stress_af_alg_init(void)
 	if (!fp)
 		return;
 
-	(void)memset(buffer, 0, sizeof(buffer));
-	(void)memset(&info, 0, sizeof(info));
+	(void)shim_memset(buffer, 0, sizeof(buffer));
+	(void)shim_memset(&info, 0, sizeof(info));
 
 	while (fgets(buffer, sizeof(buffer) - 1, fp)) {
 		if (!strncmp(buffer, "name", 4)) {
@@ -1032,7 +1040,7 @@ static void stress_af_alg_init(void)
 			} else {
 				stress_af_alg_info_free(&info);
 			}
-			(void)memset(&info, 0, sizeof(info));
+			(void)shim_memset(&info, 0, sizeof(info));
 		}
 	}
 	stress_af_alg_info_free(&info);
diff -pruN 0.15.07-1/stress-affinity.c 0.15.08-1/stress-affinity.c
--- 0.15.07-1/stress-affinity.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-affinity.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define STRESS_AFFINITY_PROCS	(16)
 
@@ -115,25 +116,9 @@ static int stress_affinity_supported(con
  *  stress_affinity_reap()
  *	kill and wait on child processes
  */
-static void stress_affinity_reap(const pid_t *pids)
+static void stress_affinity_reap(const stress_args_t *args, const pid_t *pids)
 {
-	size_t i;
-	const pid_t mypid = getpid();
-
-	/*
-	 *  Kill and reap children
-	 */
-	for (i = 1; i < STRESS_AFFINITY_PROCS; i++) {
-		if ((pids[i] > 1) && (pids[i] != mypid))
-			(void)kill(pids[i], SIGKILL);
-	}
-	for (i = 1; i < STRESS_AFFINITY_PROCS; i++) {
-		if ((pids[i] > 1) && (pids[i] != mypid)) {
-			int status;
-
-			(void)waitpid(pids[i], &status, 0);
-		}
-	}
+	stress_kill_and_wait_many(args, pids, STRESS_AFFINITY_PROCS,  SIGALRM, true);
 }
 
 /*
@@ -143,7 +128,7 @@ static void stress_affinity_reap(const p
  */
 static inline void stress_affinity_spin_delay(
 	const uint64_t delay,
-	stress_affinity_info_t *info)
+	const stress_affinity_info_t *info)
 {
 	const uint32_t cpu = info->cpu;
 	const double end = stress_time_now() +
@@ -163,7 +148,7 @@ static void stress_affinity_child(
 	const pid_t *pids,
 	const bool pin_controller)
 {
-	uint32_t cpu = args->instance;
+	uint32_t cpu = args->instance, last_cpu = cpu;
 	cpu_set_t mask0;
 	bool keep_stressing_affinity = true;
 
@@ -174,8 +159,15 @@ static void stress_affinity_child(
 	do {
 		cpu_set_t mask;
 
-		cpu = info->affinity_rand ? (stress_mwc32() >> 4) : cpu + 1;
-		cpu %= info->cpus;
+		if (info->affinity_rand) {
+			cpu = stress_mwc32modn(info->cpus);
+			/* More than 2 cpus and same as last, move to next cpu */
+			if ((cpu == last_cpu) && (info->cpus > 2))
+				cpu = (cpu + 1) % info->cpus;
+			last_cpu = cpu;
+		} else {
+			cpu = (cpu + 1) % info->cpus;
+		}
 
 		/*
 		 *  In pin mode stressor instance 0 controls the CPU
@@ -238,7 +230,7 @@ affinity_continue:
 			shim_nanosleep_uint64(info->affinity_sleep);
 	} while (keep_stressing(args));
 
-	stress_affinity_reap(pids);
+	stress_affinity_reap(args, pids);
 }
 
 static int stress_affinity(const stress_args_t *args)
@@ -263,7 +255,7 @@ static int stress_affinity(const stress_
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 
 	info->affinity_delay = 0;
 	info->affinity_pin = false;
@@ -298,7 +290,7 @@ static int stress_affinity(const stress_
 	 *  will have reap'd the processes, but to be safe, reap again
 	 *  to ensure all processes are really dead and reaped.
 	 */
-	stress_affinity_reap(pids);
+	stress_affinity_reap(args, pids);
 
 	(void)munmap((void *)info, info_sz);
 	(void)stress_lock_destroy(counter_lock);
diff -pruN 0.15.07-1/stress-aiol.c 0.15.08-1/stress-aiol.c
--- 0.15.07-1/stress-aiol.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-aiol.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LIBAIO_H)
 #include <libaio.h>
@@ -175,7 +176,7 @@ static inline void aio_linux_fill_buffer
  */
 static inline bool aio_linux_check_buffer(
 	const int request,
-	uint8_t *const buffer,
+	const uint8_t *const buffer,
 	const size_t size)
 {
 	register size_t i;
@@ -506,7 +507,7 @@ retry_open:
 		/*
 		 *  async writes
 		 */
-		(void)memset(cb, 0, aio_linux_requests * sizeof(*cb));
+		(void)shim_memset(cb, 0, aio_linux_requests * sizeof(*cb));
 		for (bufptr = buffer, i = 0, off = offset; i < aio_linux_requests; i++, bufptr += BUFFER_SZ, off += BUFFER_SZ) {
 			const uint8_t pattern = (uint8_t)(j + ((((intptr_t)bufptr) >> 12) & 0xff));
 
@@ -530,9 +531,9 @@ retry_open:
 		/*
 		 *  async reads
 		 */
-		(void)memset(cb, 0, aio_linux_requests * sizeof(*cb));
+		(void)shim_memset(cb, 0, aio_linux_requests * sizeof(*cb));
 		for (bufptr = buffer, i = 0, off = offset; i < aio_linux_requests; i++, bufptr += BUFFER_SZ, off += BUFFER_SZ) {
-			(void)memset(bufptr, 0, BUFFER_SZ);
+			(void)shim_memset(bufptr, 0, BUFFER_SZ);
 
 			cb[i].aio_fildes = fds[i];
 			cb[i].aio_lio_opcode = IO_CMD_PREAD;
@@ -571,7 +572,7 @@ retry_open:
 		/*
 		 *  async pwritev
 		 */
-		(void)memset(cb, 0, aio_linux_requests * sizeof(*cb));
+		(void)shim_memset(cb, 0, aio_linux_requests * sizeof(*cb));
 		for (bufptr = buffer, i = 0, off = offset; i < aio_linux_requests; i++, bufptr += BUFFER_SZ, off += BUFFER_SZ) {
 			const uint8_t pattern = (uint8_t)(j + ((((intptr_t)bufptr) >> 12) & 0xff));
 
@@ -598,7 +599,7 @@ retry_open:
 		/*
 		 *  async preadv
 		 */
-		(void)memset(cb, 0, aio_linux_requests * sizeof(*cb));
+		(void)shim_memset(cb, 0, aio_linux_requests * sizeof(*cb));
 		for (bufptr = buffer, i = 0, off = offset; i < aio_linux_requests; i++, bufptr += BUFFER_SZ, off += BUFFER_SZ) {
 			const uint8_t pattern = (uint8_t)(j + ((((intptr_t)bufptr) >> 12) & 0xff));
 
@@ -639,7 +640,7 @@ retry_open:
 				VOID_RET(int, shim_io_cancel(ctx, &cb[0], &event));
 
 				/* Exercise with io_cancel invalid context */
-				(void)memset(&bad_ctx, stress_mwc8() | 0x1, sizeof(bad_ctx));
+				(void)shim_memset(&bad_ctx, stress_mwc8() | 0x1, sizeof(bad_ctx));
 				VOID_RET(int, shim_io_cancel(bad_ctx, &cb[0], &event));
 
 				/* Exercise with io_invalid iocb */
@@ -711,14 +712,14 @@ retry_open:
 		/*
 		 *  Exercise aio_poll with illegal settings
 		 */
-		(void)memset(cb, 0, aio_linux_requests * sizeof(*cb));
+		(void)shim_memset(cb, 0, aio_linux_requests * sizeof(*cb));
 		for (i = 0; i < aio_linux_requests; i++) {
 			cb[i].aio_fildes = fds[i];
 			cb[i].aio_lio_opcode = IO_CMD_POLL;
 			cb[i].u.c.buf = (void *)POLLIN;
 			/* Set invalid sizes */
-			(void)memset(&cb[i].u.c.offset, 0xff, sizeof(cb[i].u.c.offset));
-			(void)memset(&cb[i].u.c.nbytes, 0xff, sizeof(cb[i].u.c.nbytes));
+			(void)shim_memset(&cb[i].u.c.offset, 0xff, sizeof(cb[i].u.c.offset));
+			(void)shim_memset(&cb[i].u.c.nbytes, 0xff, sizeof(cb[i].u.c.nbytes));
 			cbs[i] = &cb[i];
 		}
 		if (stress_aiol_submit(args, ctx, cbs, aio_linux_requests, true) < 0)
@@ -741,7 +742,7 @@ retry_open:
 
 			j = 0;
 			if (do_sync) {
-				(void)memset(cb, 0, aio_linux_requests * sizeof(*cb));
+				(void)shim_memset(cb, 0, aio_linux_requests * sizeof(*cb));
 				cb[0].aio_fildes = fds[0];
 				cb[0].aio_lio_opcode = stress_mwc1() ? IO_CMD_FDSYNC : IO_CMD_FSYNC;
 				cb[0].u.c.buf = NULL;
diff -pruN 0.15.07-1/stress-apparmor.c 0.15.08-1/stress-apparmor.c
--- 0.15.07-1/stress-apparmor.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-apparmor.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_SYS_APPARMOR_H)
@@ -529,7 +530,7 @@ static int apparmor_stress_corruption(co
 	 */
 	do {
 		if (ret < 0 || j > 1024) {
-			(void)memcpy(data_copy, g_apparmor_data, g_apparmor_data_len);
+			(void)shim_memcpy(data_copy, g_apparmor_data, g_apparmor_data_len);
 			j = 0;
 		}
 		/*
@@ -604,9 +605,9 @@ static int apparmor_stress_corruption(co
 					"errno=%d (%s)\n", args->name, errno,
 					strerror(errno));
 			}
-			(void)memcpy(data_copy, data_prev, g_apparmor_data_len);
+			(void)shim_memcpy(data_copy, data_prev, g_apparmor_data_len);
 		} else {
-			(void)memcpy(data_prev, data_copy, g_apparmor_data_len);
+			(void)shim_memcpy(data_prev, data_copy, g_apparmor_data_len);
 		}
 		aa_kernel_interface_unref(kern_if);
 		i++;
@@ -671,19 +672,7 @@ static int stress_apparmor(const stress_
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
 	/* Wakeup, time to die */
-	for (i = 0; i < MAX_APPARMOR_FUNCS; i++) {
-		if (pids[i] >= 0)
-			(void)kill(pids[i], SIGALRM);
-	}
-	/* Now apply death grip */
-	for (i = 0; i < MAX_APPARMOR_FUNCS; i++) {
-		int status;
-
-		if (pids[i] >= 0) {
-			(void)kill(pids[i], SIGKILL);
-			(void)shim_waitpid(pids[i], &status, 0);
-		}
-	}
+	stress_kill_and_wait_many(args, pids, MAX_APPARMOR_FUNCS, SIGALRM, true);
 
 	free(apparmor_path);
 	apparmor_path = NULL;
diff -pruN 0.15.07-1/stress-atomic.c 0.15.08-1/stress-atomic.c
--- 0.15.07-1/stress-atomic.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-atomic.c	2023-05-21 14:30:06.000000000 +0000
@@ -66,9 +66,19 @@
 
 #if defined(HAVE_ATOMIC_FETCH_NAND)
 #define HAVE_ATOMIC_OPS
+#if defined(__GNUC__) && __GNUC__ != 11
 #define	SHIM_ATOMIC_FETCH_NAND(ptr, val, memorder)	\
 	do { __atomic_fetch_nand(ptr, val, memorder); } while (0)
 #else
+/*
+ *  gcc 11.x has a buggy fetch nand that can lock indefinitely, so
+ *  workaround this
+ */
+#define	SHIM_ATOMIC_FETCH_NAND(ptr, val, memorder)	\
+	do { __atomic_fetch_and(ptr, val, memorder); 	\
+	     __atomic_fetch_xor(ptr, ~0, memorder); } while (0)
+#endif
+#else
 #define SHIM_ATOMIC_FETCH_NAND(ptr, val, memorder)	DO_NOTHING()
 #endif
 
@@ -106,9 +116,19 @@
 
 #if defined(HAVE_ATOMIC_NAND_FETCH)
 #define HAVE_ATOMIC_OPS
+#if defined(__GNUC__) && __GNUC__ != 11
 #define	SHIM_ATOMIC_NAND_FETCH(ptr, val, memorder)	\
 	do { __atomic_nand_fetch(ptr, val, memorder); } while (0)
 #else
+/*
+ *  gcc 11.x has a buggy fetch nand that can lock indefinitely, so
+ *  workaround this
+ */
+#define	SHIM_ATOMIC_NAND_FETCH(ptr, val, memorder)	\
+	do { __atomic_and_fetch(ptr, val, memorder);	\
+	     __atomic_xor_fetch(ptr, ~0, memorder); } while (0)
+#endif
+#else
 #define SHIM_ATOMIC_NAND_FETCH(ptr, val, memorder)	DO_NOTHING()
 #endif
 
@@ -362,7 +382,11 @@ static int stress_atomic(const stress_ar
 		if (atomic_info[i].pid > 0) {
 			int status;
 
-			(void)kill(atomic_info[i].pid, SIGKILL);
+			if (kill(atomic_info[i].pid, 0) == 0) {
+
+				force_killed_counter(args);
+				(void)kill(atomic_info[i].pid, SIGKILL);
+			}
 			(void)waitpid(atomic_info[i].pid, &status, 0);
 		}
 	}
diff -pruN 0.15.07-1/stress-bad-altstack.c 0.15.08-1/stress-bad-altstack.c
--- 0.15.07-1/stress-bad-altstack.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-bad-altstack.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-put.h"
 #include "core-pragma.h"
 
@@ -88,7 +89,7 @@ static void NORETURN MLOCKED_TEXT stress
 
 	(void)signum;
 	(void)munmap(stack, stress_minsigstksz);
-	(void)memset(data, 0xff, sizeof(data));
+	(void)shim_memset(data, 0xff, sizeof(data));
 	stress_uint8_put(data[0]);
 
 	if (zero_stack != MAP_FAILED)
diff -pruN 0.15.07-1/stress-bad-ioctl.c 0.15.08-1/stress-bad-ioctl.c
--- 0.15.07-1/stress-bad-ioctl.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-bad-ioctl.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-pthread.h"
 
@@ -148,7 +149,7 @@ static void stress_bad_ioctl_dev_dir(
 			int dev_n;
 			char *ptr = d->d_name + len - 1;
 
-			while (ptr > d->d_name && isdigit((int)*ptr))
+			while ((ptr > d->d_name) && isdigit((int)*ptr))
 				ptr--;
 			ptr++;
 			dev_n = atoi(ptr);
@@ -280,7 +281,7 @@ static inline void stress_bad_ioctl_rw(
 		if (ret != 0)
 			goto next;
 
-		(void)memset(buf, 0, page_size);
+		(void)shim_memset(buf, 0, page_size);
 
 		VOID_RET(int, ioctl(fd, _IOR(type, nr, uint64_t), buf64));
 		if (stress_time_now() - t_start > threshold) {
@@ -408,7 +409,7 @@ static int stress_bad_ioctl(const stress
 	pa.args = args;
 	pa.data = NULL;
 
-	(void)memset(ret, 0, sizeof(ret));
+	(void)shim_memset(ret, 0, sizeof(ret));
 
 	stress_bad_ioctl_dev_dir(args, "/dev", 0);
 	dev_ioctl_node = dev_ioctl_info_head;
@@ -432,12 +433,13 @@ again:
 				if (errno != EINTR)
 					pr_dbg("%s: waitpid(): errno=%d (%s)\n",
 						args->name, errno, strerror(errno));
+				force_killed_counter(args);
 				(void)kill(pid, SIGTERM);
 				(void)kill(pid, SIGKILL);
 				(void)shim_waitpid(pid, &status, 0);
 			} else {
 				if (WIFEXITED(status) &&
-				    WEXITSTATUS(status) != 0) {
+				    (WEXITSTATUS(status) != 0)) {
 					rc = EXIT_FAILURE;
 					break;
 				}
diff -pruN 0.15.07-1/stress-bind-mount.c 0.15.08-1/stress-bind-mount.c
--- 0.15.07-1/stress-bind-mount.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-bind-mount.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pthread.h"
 
 #if defined(HAVE_SYS_MOUNT_H)
@@ -183,7 +184,7 @@ static int stress_bind_mount(const stres
 		static char stack[CLONE_STACK_SIZE];
 		char *stack_top = (char *)stress_get_stack_top((void *)stack, CLONE_STACK_SIZE);
 
-		(void)memset(stack, 0, sizeof stack);
+		(void)shim_memset(stack, 0, sizeof stack);
 
 		pid = (pid_t)clone(stress_bind_mount_child,
 			stress_align_stack(stack_top),
diff -pruN 0.15.07-1/stress-binderfs.c 0.15.08-1/stress-binderfs.c
--- 0.15.07-1/stress-binderfs.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-binderfs.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_LINUX_ANDROID_BINDER_H)
@@ -171,7 +172,7 @@ static int stress_binderfs(const stress_
 		}
 #if defined(BINDER_CTL_ADD)
 		for (i = 0; i < 256; i++) {
-			(void)memset(&device, 0, sizeof(device));
+			(void)shim_memset(&device, 0, sizeof(device));
 			(void)snprintf(device.name, sizeof(device.name), "sng-%d\n", i);
 			ret = ioctl(fd, BINDER_CTL_ADD, &device);
 			if (ret < 0)
diff -pruN 0.15.07-1/stress-cache.c 0.15.08-1/stress-cache.c
--- 0.15.07-1/stress-cache.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-cache.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-cpu-cache.h"
 #include "core-put.h"
 
@@ -612,7 +613,7 @@ static void stress_cache_flush(void *add
 
 static void stress_cache_read(
 	const stress_args_t *args,
-	uint8_t *mem_cache,
+	const uint8_t *mem_cache,
 	const uint64_t mem_cache_size,
 	const uint64_t inc,
 	uint64_t *i_ptr,
@@ -687,7 +688,7 @@ static void stress_cache_show_flags(cons
 	size_t i;
 	char buf[256];
 
-	(void)memset(buf, 0, sizeof(buf));
+	(void)shim_memset(buf, 0, sizeof(buf));
 	for (i = 0; i < SIZEOF_ARRAY(mask_flag_info); i++) {
 		if (flags & mask_flag_info[i].flag) {
 			shim_strlcat(buf, " ", sizeof(buf));
@@ -962,7 +963,7 @@ next:
 		char buf[1024], *ptr = buf;
 		size_t buf_len = sizeof(buf);
 
-		(void)memset(buf, 0, sizeof(buf));
+		(void)shim_memset(buf, 0, sizeof(buf));
 		for (j = 0; j < SIZEOF_ARRAY(mask_flag_info); j++) {
 			if (mask_flag_info[j].flag & disabled_flags) {
 				const size_t len = strlen(mask_flag_info[j].name);
diff -pruN 0.15.07-1/stress-cacheline.c 0.15.08-1/stress-cacheline.c
--- 0.15.07-1/stress-cacheline.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-cacheline.c	2023-05-21 14:30:06.000000000 +0000
@@ -660,19 +660,69 @@ static int stress_cacheline_child(
 }
 
 /*
+ *  stress_cacheline_init()
+ *	called once by stress-ng, so we can set index to 0
+ */
+static void stress_cacheline_init(void)
+{
+	g_shared->cacheline_index = 0;
+	g_shared->cacheline_lock = stress_lock_create();
+}
+
+/*
+ *  stress_cacheline_deinit()
+ *	called once by stress-ng, so we can set index to 0
+ */
+static void stress_cacheline_deinit(void)
+{
+	if (g_shared->cacheline_lock) {
+		stress_lock_destroy(g_shared->cacheline_lock);
+		g_shared->cacheline_lock = NULL;
+		g_shared->cacheline_index = 0;
+	}
+}
+
+static int stress_cacheline_next_index(void)
+{
+	int ret;
+
+	if (stress_lock_acquire(g_shared->cacheline_lock) < 0)
+		return -1;
+
+	ret = g_shared->cacheline_index;
+	g_shared->cacheline_index++;
+
+	if (stress_lock_release(g_shared->cacheline_lock) < 0)
+		return -1;
+
+	return ret * 2;
+}
+
+/*
  *  stress_cacheline()
  *	execise a cacheline by multiple processes
  */
 static int stress_cacheline(const stress_args_t *args)
 {
 	size_t l1_cacheline_size = (size_t)get_L1_line_size(args);
-	const int index = (int)(args->instance * 2);
+	int index;
 	pid_t pid;
 	int rc = EXIT_SUCCESS;
 	size_t cacheline_method = 0;
 	stress_cacheline_func func;
 	bool cacheline_affinity = false;
 
+	if (!g_shared->cacheline_lock) {
+		pr_inf("%s: failed to initialized cacheline lock, skipping stressor\n", args->name);
+		return EXIT_NO_RESOURCE;
+	}
+
+	index = stress_cacheline_next_index();
+	if (index < 0) {
+		pr_inf("%s: failed to get cacheline index, skipping stressor\n", args->name);
+		return EXIT_NO_RESOURCE;
+	}
+
 	(void)stress_get_setting("cacheline-affinity", &cacheline_affinity);
 	(void)stress_get_setting("cacheline-method", &cacheline_method);
 
@@ -703,21 +753,14 @@ again:
 		rc = stress_cacheline_child(args, index + 1, false, l1_cacheline_size, func, cacheline_affinity);
 		_exit(rc);
 	} else {
-		int status;
-
 		stress_cacheline_child(args, index, true, l1_cacheline_size, func, cacheline_affinity);
-
-		(void)kill(pid, SIGALRM);
-		(void)shim_waitpid(pid, &status, 0);
-
-		if (WIFEXITED(status) && (WEXITSTATUS(status) != EXIT_SUCCESS))
-			rc = WEXITSTATUS(status);
+		stress_kill_and_wait(args, pid, SIGALRM, false);
 	}
 
 finish:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
-	return rc;
+	return EXIT_SUCCESS;
 }
 
 static const stress_opt_set_func_t opt_set_funcs[] = {
@@ -731,5 +774,7 @@ stressor_info_t stress_cacheline_info =
 	.class = CLASS_CPU_CACHE,
 	.verify = VERIFY_ALWAYS,
 	.opt_set_funcs = opt_set_funcs,
+	.init = stress_cacheline_init,
+	.deinit = stress_cacheline_deinit,
 	.help = help
 };
diff -pruN 0.15.07-1/stress-cap.c 0.15.08-1/stress-cap.c
--- 0.15.07-1/stress-cap.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-cap.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_CAPABILITY_H)
 #include <sys/capability.h>
@@ -42,8 +43,8 @@ static int stress_capgetset_pid(
 	struct __user_cap_header_struct uch;
 	struct __user_cap_data_struct ucd[_LINUX_CAPABILITY_U32S_3];
 
-	(void)memset(&uch, 0, sizeof uch);
-	(void)memset(ucd, 0, sizeof ucd);
+	(void)shim_memset(&uch, 0, sizeof uch);
+	(void)shim_memset(ucd, 0, sizeof ucd);
 
 #if defined(_LINUX_CAPABILITY_VERSION_3)
 	uch.version = _LINUX_CAPABILITY_VERSION_3;
diff -pruN 0.15.07-1/stress-chattr.c 0.15.08-1/stress-chattr.c
--- 0.15.07-1/stress-chattr.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-chattr.c	2023-05-21 14:30:06.000000000 +0000
@@ -217,7 +217,8 @@ static int stress_chattr(const stress_ar
 		if ((flag_count > 0) && (flag_perms)) {
 			(void)do_chattr(args, filename, (unsigned long)flag_perms[index]);
 			index++;
-			index %= flag_count;
+			if (index >= flag_count)
+				index = 0;
 		}
 		inc_counter(args);
 	} while (keep_stressing(args));
diff -pruN 0.15.07-1/stress-chdir.c 0.15.08-1/stress-chdir.c
--- 0.15.07-1/stress-chdir.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-chdir.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,12 +18,20 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #define MIN_CHDIR_DIRS		(64)
 #define MAX_CHDIR_DIRS		(65536)
 #define DEFAULT_CHDIR_DIRS	(8192)
 
+typedef struct {
+	char *path;		/* path to chdir to */
+	int fd;			/* fd of open dir */
+	bool mkdir_ok;		/* true if mkdir succeeded */
+} stress_chdir_info_t;
+
+
 static const stress_help_t help[] = {
 	{ NULL, "chdir N",	"start N workers thrashing chdir on many paths" },
 	{ NULL,	"chdir-dirs N",	"select number of directories to exercise chdir on" },
@@ -52,10 +60,9 @@ static int stress_set_chdir_dirs(const c
 static int stress_chdir(const stress_args_t *args)
 {
 	uint32_t i, chdir_dirs = DEFAULT_CHDIR_DIRS;
+	stress_chdir_info_t *chdir_info;
 	char path[PATH_MAX], cwd[PATH_MAX], badpath[PATH_MAX], longpath[PATH_MAX + 16];
-	int rc, ret = EXIT_FAILURE, *fds;
-	char **paths;
-	bool *mkdir_ok;
+	int rc, ret = EXIT_FAILURE;
 	struct stat statbuf;
 	const bool is_root = stress_check_capability(SHIM_CAP_IS_ROOT);
 	bool got_statbuf = false;
@@ -63,25 +70,10 @@ static int stress_chdir(const stress_arg
 	double count = 0.0, duration = 0.0, rate, start_time;
 
 	(void)stress_get_setting("chdir-dirs", &chdir_dirs);
-	paths = calloc(chdir_dirs, sizeof(*paths));
-	if (!paths) {
-		pr_inf_skip("%s: out of memory allocating %" PRIu32 " paths, "
-			    "skipping stressor\n", args->name, chdir_dirs);
-		return EXIT_NO_RESOURCE;
-	}
-	fds = calloc(chdir_dirs, sizeof(*fds));
-	if (!fds) {
-		pr_inf_skip("%s: out of memory allocating %" PRIu32 " file descriptors, "
-			    "skipping stressor\n", args->name, chdir_dirs);
-		free(paths);
-		return EXIT_NO_RESOURCE;
-	}
-	mkdir_ok = calloc(chdir_dirs, sizeof(*mkdir_ok));
-	if (!mkdir_ok) {
-		pr_inf_skip("%s: out of memory allocating %" PRIu32 " boolean flags, "
+	chdir_info = calloc(chdir_dirs, sizeof(*chdir_info));
+	if (!chdir_info) {
+		pr_inf_skip("%s: out of memory allocating %" PRIu32 " chdir structs, "
 			    "skipping stressor\n", args->name, chdir_dirs);
-		free(fds);
-		free(paths);
 		return EXIT_NO_RESOURCE;
 	}
 
@@ -98,15 +90,16 @@ static int stress_chdir(const stress_arg
 	}
 
 	for (i = 0; i < chdir_dirs; i++) {
-		fds[i] = -1;
-		paths[i] = NULL;
+		chdir_info[i].path = NULL;
+		chdir_info[i].fd = -1;
+		chdir_info[i].mkdir_ok = false;
 	}
 
 	stress_rndstr(longpath, sizeof(longpath));
 	longpath[0] = '/';
 
 	(void)stress_temp_filename_args(args, badpath, sizeof(badpath), ~0ULL);
-	(void)memset(&statbuf, 0, sizeof(statbuf));
+	(void)shim_memset(&statbuf, 0, sizeof(statbuf));
 	*path = '\0';	/* Keep static analysis tools happy */
 
 	/* Populate */
@@ -122,16 +115,16 @@ static int stress_chdir(const stress_arg
 #endif
 		(void)stress_temp_filename_args(args,
 			path, sizeof(path), rnd | gray_code);
-		paths[i] = strdup(path);
-		if (paths[i] == NULL)
+		chdir_info[i].path = strdup(path);
+		if (chdir_info[i].path == NULL)
 			goto abort;
 		rc = mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR);
 		if (rc < 0) {
 			if ((errno == ENOMEM) ||
 			    (errno == ENOSPC) ||
 			    (errno == EMLINK)) {
-				mkdir_ok[i] = false;
-				fds[i] = -1;
+				chdir_info[i].mkdir_ok = false;
+				chdir_info[i].fd = -1;
 				continue;
 			}
 			ret = stress_exit_status(errno);
@@ -140,8 +133,8 @@ static int stress_chdir(const stress_arg
 					args->name, path, errno, strerror(errno));
 			goto abort;
 		}
-		mkdir_ok[i] = true;
-		fds[i] = open(paths[i], flags);
+		chdir_info[i].mkdir_ok = true;
+		chdir_info[i].fd = open(chdir_info[i].path, flags);
 
 		if (!got_statbuf) {
 			if (stat(path, &statbuf) == 0)
@@ -162,18 +155,18 @@ static int stress_chdir(const stress_arg
 	do {
 		for (i = 0; keep_stressing(args) && (i < chdir_dirs); i++) {
 			const uint32_t j = stress_mwc32modn(chdir_dirs);
-			const int fd = fds[j] >= 0 ? fds[j] : fds[0];
+			const int fd = chdir_info[j].fd >= 0 ? chdir_info[j].fd : chdir_info[0].fd;
 			double t;
 
-			if (mkdir_ok[i] && paths[i]) {
+			if (chdir_info[i].mkdir_ok && chdir_info[i].path) {
 				t = stress_time_now();
-				if (chdir(paths[i]) == 0) {
+				if (chdir(chdir_info[i].path) == 0) {
 					duration += stress_time_now() - t;
 					count += 1.0;
 				} else {
 					if (errno != ENOMEM) {
 						pr_fail("%s: chdir %s failed, errno=%d (%s)%s\n",
-							args->name, paths[i],
+							args->name, chdir_info[i].path,
 							errno, strerror(errno),
 							stress_fs_type(path));
 						goto abort;
@@ -186,7 +179,7 @@ static int stress_chdir(const stress_arg
 					pr_fail("%s: fchdir failed, errno=%d (%s)%s\n",
 						args->name,
 						errno, strerror(errno),
-						stress_fs_type(paths[i]));
+						stress_fs_type(chdir_info[i].path));
 					goto abort;
 				}
 			}
@@ -276,12 +269,12 @@ tidy:
 
 	/* force unlink of all files */
 	start_time = stress_time_now();
-	for (i = 0; (i < chdir_dirs) && paths[i] ; i++) {
-		if (fds[i] >= 0)
-			(void)close(fds[i]);
-		if (paths[i]) {
-			(void)shim_rmdir(paths[i]);
-			free(paths[i]);
+	for (i = 0; (i < chdir_dirs) && chdir_info[i].path ; i++) {
+		if (chdir_info[i].fd >= 0)
+			(void)close(chdir_info[i].fd);
+		if (chdir_info[i].path) {
+			(void)shim_rmdir(chdir_info[i].path);
+			free(chdir_info[i].path);
 		}
 		/* ..taking a while?, inform user */
 		if ((args->instance == 0) && !tidy_info &&
@@ -296,9 +289,7 @@ tidy:
 	stress_metrics_set(args, 0, "chdir calls per sec", rate);
 err:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
-	free(mkdir_ok);
-	free(fds);
-	free(paths);
+	free(chdir_info);
 
 	return ret;
 }
diff -pruN 0.15.07-1/stress-chmod.c 0.15.08-1/stress-chmod.c
--- 0.15.07-1/stress-chmod.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-chmod.c	2023-05-21 14:30:06.000000000 +0000
@@ -149,14 +149,15 @@ static int do_chmod(
 	const size_t mode_count,
 	const int *mode_perms)
 {
-	static int index;
+	static size_t index;
 
 	if (!mode_count)
 		return 0;
 
 	(void)chmod(filename, (mode_t)mode_perms[index]);
 	index++;
-	index %= mode_count;
+	if (index >= mode_count)
+		index = 0;
 
 	stress_chmod_check(chmod(filename, modes[i]) < 0);
 	stress_chmod_check(chmod(filename, mask) < 0);
diff -pruN 0.15.07-1/stress-chroot.c 0.15.08-1/stress-chroot.c
--- 0.15.07-1/stress-chroot.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-chroot.c	2023-05-21 14:30:06.000000000 +0000
@@ -359,7 +359,8 @@ again:
 			inc_counter(args);
 		}
 		i++;
-		i %= SIZEOF_ARRAY(test_chroot_test_funcs);
+		if (i >= SIZEOF_ARRAY(test_chroot_test_funcs))
+			i = 0;
 	} while (keep_stressing(args));
 
 	rate = (metrics->duration > 0.0) ? metrics->count / metrics->duration : 0.0;
diff -pruN 0.15.07-1/stress-clock.c 0.15.08-1/stress-clock.c
--- 0.15.07-1/stress-clock.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-clock.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_POLL_H)
@@ -150,7 +151,7 @@ static const char *stress_clock_name(int
 static inline bool check_invalid_clock_id(const clockid_t id) {
         struct timespec tp;
 
-        (void)memset(&tp, 0, sizeof(tp));
+        (void)shim_memset(&tp, 0, sizeof(tp));
         return (clock_gettime(id, &tp) != 0);
 }
 #endif
@@ -327,15 +328,15 @@ static int stress_clock(const stress_arg
 
 				/* Exercise clock_nanosleep on invalid clock id */
 				if (invalid_clock_id) {
-					(void)memset(&t, 0, sizeof(t));
+					(void)shim_memset(&t, 0, sizeof(t));
 					VOID_RET(int, clock_nanosleep(INT_MAX, TIMER_ABSTIME, &t, NULL));
 				}
 
-				(void)memset(&t, 0, sizeof(t));
+				(void)shim_memset(&t, 0, sizeof(t));
 				t.tv_sec = -1;
 				VOID_RET(int, clock_nanosleep(clocks_nanosleep[0], TIMER_ABSTIME, &t, NULL));
 
-				(void)memset(&t, 0, sizeof(t));
+				(void)shim_memset(&t, 0, sizeof(t));
 				t.tv_nsec = STRESS_NANOSECOND;
 				VOID_RET(int, clock_nanosleep(clocks_nanosleep[0], TIMER_ABSTIME, &t, NULL));
 			}
@@ -375,7 +376,7 @@ static int stress_clock(const stress_arg
 
 			/* Exercise clock_adjtime on invalid clock id */
 			if (invalid_clock_id) {
-				(void)memset(&tx, 0, sizeof(tx));
+				(void)shim_memset(&tx, 0, sizeof(tx));
 				VOID_RET(int, shim_clock_adjtime(INT_MAX, &tx));
 			}
 
@@ -385,7 +386,7 @@ static int stress_clock(const stress_arg
 			for (i = 0; i < SIZEOF_ARRAY(clocks); i++) {
 				int ret;
 
-				(void)memset(&tx, 0, sizeof(tx));
+				(void)shim_memset(&tx, 0, sizeof(tx));
 
 				tx.modes = ADJ_SETOFFSET;
 				tx.time.tv_sec = 0;
@@ -426,7 +427,7 @@ static int stress_clock(const stress_arg
 				timer_fail[i] = false;
 				timer_id[i] = (timer_t)-1;
 
-				(void)memset(&sevp, 0, sizeof(sevp));
+				(void)shim_memset(&sevp, 0, sizeof(sevp));
 				sevp.sigev_notify = SIGEV_NONE;
 				ret = timer_create(timers[i], &sevp, &timer_id[i]);
 				if (ret < 0) {
diff -pruN 0.15.07-1/stress-clone.c 0.15.08-1/stress-clone.c
--- 0.15.07-1/stress-clone.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-clone.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_MODIFY_LDT)
 #include <asm/ldt.h>
@@ -387,7 +388,7 @@ static int clone_func(void *arg)
 	{
 		struct user_desc ud;
 
-		(void)memset(&ud, 0, sizeof(ud));
+		(void)shim_memset(&ud, 0, sizeof(ud));
 		if (shim_modify_ldt(0, &ud, sizeof(ud)) == 0) {
 			(void)shim_modify_ldt(1, &ud, sizeof(ud));
 			/* Exercise invalid size */
@@ -397,19 +398,19 @@ static int clone_func(void *arg)
 			(void)shim_modify_ldt(1, &ud, sizeof(ud));
 		}
 
-		(void)memset(&ud, 0, sizeof(ud));
+		(void)shim_memset(&ud, 0, sizeof(ud));
 		if (shim_modify_ldt(0, &ud, sizeof(ud)) == 0) {
 			/* Old mode style */
 			(void)shim_modify_ldt(0x11, &ud, sizeof(ud));
 		}
-		(void)memset(&ud, 0, sizeof(ud));
+		(void)shim_memset(&ud, 0, sizeof(ud));
 		(void)shim_modify_ldt(2, &ud, sizeof(ud));
 
 		/* Exercise invalid command */
 		(void)shim_modify_ldt(0xff, &ud, sizeof(ud));
 
 		/* Exercise invalid ldt size */
-		(void)memset(&ud, 0, sizeof(ud));
+		(void)shim_memset(&ud, 0, sizeof(ud));
 		(void)shim_modify_ldt(0, &ud, 0);
 	}
 #endif
@@ -479,7 +480,7 @@ static int stress_clone_child(const stre
 				struct shim_clone_args cl_args;
 				int pidfd = -1;
 
-				(void)memset(&cl_args, 0, sizeof(cl_args));
+				(void)shim_memset(&cl_args, 0, sizeof(cl_args));
 
 				cl_args.flags = flag;
 				cl_args.pidfd = uint64_ptr(&pidfd);
diff -pruN 0.15.07-1/stress-context.c 0.15.08-1/stress-context.c
--- 0.15.07-1/stress-context.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-context.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_UCONTEXT_H)
 #include <ucontext.h>
@@ -131,7 +132,7 @@ static int stress_context_init(
 	ucontext_t *uctx_link,
 	context_data_t *context_data)
 {
-	(void)memset(context_data, 0, sizeof(*context_data));
+	(void)shim_memset(context_data, 0, sizeof(*context_data));
 
 	if (getcontext(&context_data->cu.uctx) < 0) {
 		pr_fail("%s: getcontext failed: %d (%s)\n",
@@ -172,7 +173,7 @@ static int stress_context(const stress_a
 			args->name, STRESS_CONTEXTS, sizeof(context_data_t));
 		return EXIT_NO_RESOURCE;
 	}
-	(void)memset(&uctx_main, 0, sizeof(uctx_main));
+	(void)shim_memset(&uctx_main, 0, sizeof(uctx_main));
 
 	context_counter = 0;
 	stress_max_ops = args->max_ops * 1000;
diff -pruN 0.15.07-1/stress-copy-file.c 0.15.08-1/stress-copy-file.c
--- 0.15.07-1/stress-copy-file.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-copy-file.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_COPY_FILE_BYTES	(128 * MB)
 #define MAX_COPY_FILE_BYTES	(MAX_FILE_LIMIT)
@@ -64,7 +65,7 @@ static int stress_copy_file_fill(
 	char buf[COPY_FILE_MAX_BUF_SIZE];
 	ssize_t sz = size;
 
-	(void)memset(buf, stress_mwc8(), sizeof(buf));
+	(void)shim_memset(buf, stress_mwc8(), sizeof(buf));
 
 	if (lseek(fd, off, SEEK_SET) < 0)
 		return -1;
diff -pruN 0.15.07-1/stress-cpu-online.c 0.15.08-1/stress-cpu-online.c
--- 0.15.07-1/stress-cpu-online.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-cpu-online.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"cpu-online N",		"start N workers offlining/onlining the CPUs" },
@@ -46,12 +47,20 @@ static int stress_cpu_online_set(
 		"/sys/devices/system/cpu/cpu%" PRIu32 "/online", cpu);
 
 	ret = system_write(filename, data, sizeof(data));
-	if ((ret < 0) &&
-	    ((ret != -EAGAIN) && (ret != -EINTR) &&
-	     (ret != -EBUSY) && (ret != -EOPNOTSUPP))) {
-		pr_fail("%s: write failed, errno=%d (%s)\n",
-			args->name, errno, strerror(errno));
-		return EXIT_FAILURE;
+	if (ret < 0) {
+		switch (ret) {
+		case -EAGAIN:
+		case -EINTR:
+		case -EBUSY:
+		case -EOPNOTSUPP:
+			/* Not strictly a failure */
+			return EXIT_NO_RESOURCE;
+		default:
+			pr_fail("%s: write failed, errno=%d (%s)\n",
+				args->name, errno, strerror(errno));
+			/* Anything else is a failure */
+			return EXIT_FAILURE;
+		}
 	}
 	return EXIT_SUCCESS;
 }
@@ -69,7 +78,7 @@ static int stress_cpu_online_get(const u
 	(void)snprintf(filename, sizeof(filename),
 		"/sys/devices/system/cpu/cpu%" PRIu32 "/online", cpu);
 
-	(void)memset(data, 0, sizeof(data));
+	(void)shim_memset(data, 0, sizeof(data));
 	ret = system_read(filename, data, sizeof(data));
 	if (ret < 1) {
 		*setting = -1;
@@ -212,27 +221,32 @@ static int stress_cpu_online(const stres
 
 			t = stress_time_now();
 			rc = stress_cpu_online_set(args, cpu, 0);
-			if (rc != EXIT_SUCCESS)
+			if (rc == EXIT_FAILURE)
 				break;
-			rc = stress_cpu_online_get(cpu, &setting);
-			if ((rc == EXIT_SUCCESS) && (setting != 0)) {
-				pr_inf("%s: set cpu offline, expecting setting to be 0, got %d instead\n",
-					args->name, setting);
-			} else {
-				offline_duration += stress_time_now() - t;
-				offline_count += 1.0;
+			if (rc == EXIT_SUCCESS) {
+				rc = stress_cpu_online_get(cpu, &setting);
+				if ((rc == EXIT_SUCCESS) && (setting != 0)) {
+					pr_inf("%s: set cpu offline, expecting setting to be 0, got %d instead\n",
+						args->name, setting);
+				} else {
+					offline_duration += stress_time_now() - t;
+					offline_count += 1.0;
+				}
 			}
+
 			t = stress_time_now();
 			rc = stress_cpu_online_set(args, cpu, 1);
-			if (rc != EXIT_SUCCESS)
+			if (rc == EXIT_FAILURE)
 				break;
-			rc = stress_cpu_online_get(cpu, &setting);
-			if ((rc == EXIT_SUCCESS) && (setting != 1)) {
-				pr_inf("%s: set cpu offline, expecting setting to be 1, got %d instead\n",
-					args->name, setting);
-			} else {
-				online_duration += stress_time_now() - t;
-				online_count += 1.0;
+			if (rc == EXIT_SUCCESS) {
+				rc = stress_cpu_online_get(cpu, &setting);
+				if ((rc == EXIT_SUCCESS) && (setting != 1)) {
+					pr_inf("%s: set cpu offline, expecting setting to be 1, got %d instead\n",
+						args->name, setting);
+				} else {
+					online_duration += stress_time_now() - t;
+					online_count += 1.0;
+				}
 			}
 			inc_counter(args);
 		}
diff -pruN 0.15.07-1/stress-cpu.c 0.15.08-1/stress-cpu.c
--- 0.15.07-1/stress-cpu.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-cpu.c	2023-05-21 14:30:06.000000000 +0000
@@ -660,7 +660,7 @@ static void TARGET_CLONES stress_cpu_fft
 	for (i = 0; i < FFT_SIZE; i++)
 		buf[i] = (double complex)(i % 63);
 
-	(void)memcpy(tmp, buf, sizeof(*tmp) * FFT_SIZE);
+	(void)shim_memcpy(tmp, buf, sizeof(*tmp) * FFT_SIZE);
 	fft_partial(buf, tmp, FFT_SIZE, 1);
 }
 #else
@@ -1666,7 +1666,7 @@ static void HOT OPTIMIZE3 stress_cpu_sie
 	static uint32_t sieve[(SIEVE_SIZE + 31) / 32];
 	uint32_t i, j;
 
-	(void)memset(sieve, 0xff, sizeof(sieve));
+	(void)shim_memset(sieve, 0xff, sizeof(sieve));
 	for (i = 2; i < nsqrt; i++)
 		if (STRESS_GETBIT(sieve, i))
 			for (j = i * i; j < SIEVE_SIZE; j += i)
@@ -3023,12 +3023,15 @@ static int HOT OPTIMIZE3 stress_cpu(cons
 	 */
 	bias = 0.0;
 	do {
-		double delay, t1, t2;
+		double delay_cpu_clock, t1_cpu_clock, t2_cpu_clock;
+		double delay_wall_clock, t1_wall_clock, t2_wall_clock;
+		double delay;
 #if defined(HAVE_SELECT)
 		struct timeval tv;
 #endif
 
-		t1 = stress_per_cpu_time();
+		t1_wall_clock = stress_time_now();
+		t1_cpu_clock = stress_per_cpu_time();
 		if (cpu_load_slice < 0) {
 			/* < 0 specifies number of iterations to do per slice */
 			int j;
@@ -3038,31 +3041,36 @@ static int HOT OPTIMIZE3 stress_cpu(cons
 				if (!keep_stressing_flag())
 					break;
 			}
-			t2 = stress_per_cpu_time();
+			t2_wall_clock = stress_time_now();
+			t2_cpu_clock = stress_per_cpu_time();
 		} else if (cpu_load_slice == 0) {
 			/* == 0, random time slices */
 			const uint16_t r = stress_mwc16();
-			double slice_end = t1 + ((double)r / 131072.0);
+			double slice_end = t1_cpu_clock + ((double)r / 131072.0);
 			do {
 				stress_cpu_method(cpu_method, args, &counter);
-				t2 = stress_per_cpu_time();
+				t2_wall_clock = stress_time_now();
+				t2_cpu_clock = stress_per_cpu_time();
 				if (!keep_stressing_flag())
 					break;
-			} while (t2 < slice_end);
+			} while (t2_cpu_clock < slice_end);
 		} else {
 			/* > 0, time slice in milliseconds */
-			const double slice_end = t1 + ((double)cpu_load_slice / STRESS_DBL_MILLISECOND);
+			const double slice_end = t1_cpu_clock + ((double)cpu_load_slice / STRESS_DBL_MILLISECOND);
 
 			do {
 				stress_cpu_method(cpu_method, args, &counter);
-				t2 = stress_per_cpu_time();
+				t2_wall_clock = stress_time_now();
+				t2_cpu_clock = stress_per_cpu_time();
 				if (!keep_stressing_flag())
 					break;
-			} while (t2 < slice_end);
+			} while (t2_cpu_clock < slice_end);
 		}
 
 		/* Must not calculate this with zero % load */
-		delay = (((100 - cpu_load) * (t2 - t1)) / (double)cpu_load);
+		delay_cpu_clock = t2_cpu_clock - t1_cpu_clock;
+		delay_wall_clock = t2_wall_clock - t1_wall_clock;
+		delay = (((100 - cpu_load) * delay_cpu_clock) / (double)cpu_load) + (delay_cpu_clock - delay_wall_clock);
 		delay -= bias;
 
 		/* We may have clock warping so don't sleep for -ve delays */
@@ -3074,9 +3082,9 @@ static int HOT OPTIMIZE3 stress_cpu(cons
 			 *  time, measurements need to be based on
 			 *  wall clock time and NOT on cpu time used.
 			 */
-			double t3;
+			double t3_wall_clock;
 
-			t2 = stress_time_now();
+			t2_wall_clock = stress_time_now();
 
 #if defined(HAVE_SELECT)
 			tv.tv_sec = (time_t)delay;
@@ -3086,9 +3094,9 @@ static int HOT OPTIMIZE3 stress_cpu(cons
 			shim_nanosleep_uint64((uint64_t)(delay * STRESS_DBL_NANOSECOND));
 #endif
 
-			t3 = stress_time_now();
+			t3_wall_clock = stress_time_now();
 			/* Bias takes account of the time to do the delay */
-			bias = (t3 - t2) - delay;
+			bias = (t3_wall_clock - t2_wall_clock) - delay;
 		}
 	} while (keep_stressing(args));
 
diff -pruN 0.15.07-1/stress-crypt.c 0.15.08-1/stress-crypt.c
--- 0.15.07-1/stress-crypt.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-crypt.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_CRYPT_H)
 #include <crypt.h>
@@ -59,7 +60,7 @@ static int stress_crypt_id(
 	const size_t prefix_len,
 	const char *method,
 	const char *passwd,
-	char *salt,
+	const char *salt,
 	stress_metrics_t *metrics)
 {
 	char *encrypted;
@@ -68,10 +69,10 @@ static int stress_crypt_id(
 #if defined (HAVE_CRYPT_R)
 	static struct crypt_data data;
 
-	(void)memset(&data, 0, sizeof(data));
+	(void)shim_memset(&data, 0, sizeof(data));
 #endif
 	(void)shim_strlcpy(newsalt, salt, sizeof(newsalt));
-	(void)memcpy(newsalt, prefix, prefix_len);
+	(void)shim_memcpy(newsalt, prefix, prefix_len);
 	errno = 0;
 
 #if defined (HAVE_CRYPT_R)
diff -pruN 0.15.07-1/stress-cyclic.c 0.15.08-1/stress-cyclic.c
--- 0.15.07-1/stress-cyclic.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-cyclic.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #define DEFAULT_DELAY_NS	(100000)
@@ -331,14 +332,14 @@ static int stress_cyclic_itimer(
 	if (stress_sighandler(args->name, SIGRTMIN, stress_cyclic_itimer_handler, &old_action) < 0)
 		return ret;
 
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
 	if (timer_create(CLOCK_REALTIME, &sev, &timerid) < 0)
 		goto restore;
 
-	(void)memset(&itimer_time, 0, sizeof(itimer_time));
+	(void)shim_memset(&itimer_time, 0, sizeof(itimer_time));
 	(void)clock_gettime(CLOCK_REALTIME, &t1);
 	if (timer_settime(timerid, 0, &timer, NULL) < 0)
 		goto restore;
@@ -363,7 +364,7 @@ static int stress_cyclic_itimer(
 	ret = 0;
 tidy:
 	/* And cancel timer */
-	(void)memset(&timer, 0, sizeof(timer));
+	(void)shim_memset(&timer, 0, sizeof(timer));
 	(void)timer_settime(timerid, 0, &timer, NULL);
 restore:
 	stress_sigrestore(args->name, SIGRTMIN, &old_action);
@@ -755,7 +756,7 @@ again:
 				goto tidy_ok;
 			(void)usleep(50000);
 			__atomic_load(&g_shared->softlockup_count, &count, __ATOMIC_RELAXED);
-		} while (keep_stressing(args) && count < num_instances);
+		} while (keep_stressing(args) && (count < num_instances));
 #endif
 
 		/*
@@ -799,7 +800,7 @@ redo_policy:
 			if ((errno == E2BIG) &&
 			    (policies[cyclic_policy].policy == SCHED_DEADLINE)) {
 				cyclic_policy = 1;
-				if (cyclic_policy > SIZEOF_ARRAY(policies)) {
+				if (cyclic_policy >= SIZEOF_ARRAY(policies)) {
 					pr_inf("%s: DEADLINE not supported by kernel, no other policies "
 						"available. skipping stressor\n", args->name);
 					ncrc = EXIT_NO_RESOURCE;
@@ -850,6 +851,7 @@ tidy:
 		VOID_RET(int, stress_set_sched(args->pid, policy, rt_stats->max_prio, true));
 
 		(void)pause();
+		force_killed_counter(args);
 		(void)kill(pid, SIGKILL);
 #if defined(HAVE_ATOMIC)
 		__sync_fetch_and_sub(&g_shared->softlockup_count, 1);
diff -pruN 0.15.07-1/stress-dccp.c 0.15.08-1/stress-dccp.c
--- 0.15.07-1/stress-dccp.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-dccp.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_SYS_UN_H)
@@ -225,7 +226,6 @@ retry:
  */
 static int stress_dccp_server(
 	const stress_args_t *args,
-	const pid_t pid,	/* Pid of client child */
 	const int mypid,
 	const int dccp_port,
 	const int dccp_domain,
@@ -233,12 +233,10 @@ static int stress_dccp_server(
 	const int dccp_opts)
 {
 	char buf[DCCP_BUF];
-	int fd, status;
-	int so_reuseaddr = 1;
+	int fd, so_reuseaddr = 1, rc = EXIT_SUCCESS;
 	socklen_t addr_len = 0;
 	struct sockaddr *addr = NULL;
 	uint64_t msgs = 0;
-	int rc = EXIT_SUCCESS;
 	double t1 = 0.0, t2 = 0.0, dt;
 
 	if (stress_sig_stop_stressing(args->name, SIGALRM) < 0) {
@@ -321,7 +319,7 @@ static int stress_dccp_server(
 				break;
 			}
 
-			(void)memset(buf, 'A' + (get_counter(args) % 26), sizeof(buf));
+			(void)shim_memset(buf, stress_ascii64[get_counter(args) & 63], sizeof(buf));
 			switch (dccp_opts) {
 			case DCCP_OPT_SEND:
 				for (i = 16; i < sizeof(buf); i += 16) {
@@ -344,7 +342,7 @@ again:
 					vec[j].iov_base = buf;
 					vec[j].iov_len = i;
 				}
-				(void)memset(&msg, 0, sizeof(msg));
+				(void)shim_memset(&msg, 0, sizeof(msg));
 				msg.msg_iov = vec;
 				msg.msg_iovlen = j;
 				if (sendmsg(sfd, &msg, 0) < 0) {
@@ -356,7 +354,7 @@ again:
 				break;
 #if defined(HAVE_SENDMMSG)
 			case DCCP_OPT_SENDMMSG:
-				(void)memset(msgvec, 0, sizeof(msgvec));
+				(void)shim_memset(msgvec, 0, sizeof(msgvec));
 				for (j = 0, i = 16; i < sizeof(buf); i += 16, j++) {
 					vec[j].iov_base = buf;
 					vec[j].iov_len = i;
@@ -407,11 +405,6 @@ die:
 		(void)shim_unlink(addr_un->sun_path);
 	}
 #endif
-
-	if (pid) {
-		(void)kill(pid, SIGKILL);
-		(void)shim_waitpid(pid, &status, 0);
-	}
 	pr_dbg("%s: %" PRIu64 " messages sent\n", args->name, msgs);
 
 	dt = t2 - t1;
@@ -481,8 +474,13 @@ again:
 		(void)kill(getppid(), SIGALRM);
 		_exit(rc);
 	} else {
-		rc = stress_dccp_server(args, pid, mypid, dccp_port,
+		int status;
+
+		rc = stress_dccp_server(args, mypid, dccp_port,
 			dccp_domain, dccp_if, dccp_opts);
+
+		(void)kill(pid, SIGKILL);
+		(void)shim_waitpid(pid, &status, 0);
 	}
 finish:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
diff -pruN 0.15.07-1/stress-dentry.c 0.15.08-1/stress-dentry.c
--- 0.15.07-1/stress-dentry.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-dentry.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_SELECT_H)
 #include <sys/select.h>
@@ -197,7 +198,7 @@ static void stress_dentry_misc(const cha
 
 #if defined(HAVE_UTIME_H)
 	(void)utime(path, NULL);
-	(void)memset(&utim, 0, sizeof(utim));
+	(void)shim_memset(&utim, 0, sizeof(utim));
 	(void)utime(path, &utim);
 #endif
 
diff -pruN 0.15.07-1/stress-dev-shm.c 0.15.08-1/stress-dev-shm.c
--- 0.15.07-1/stress-dev-shm.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-dev-shm.c	2023-05-21 14:30:06.000000000 +0000
@@ -139,6 +139,7 @@ again:
 				if (errno != EINTR)
 					pr_dbg("%s: waitpid(): errno=%d (%s)\n",
 						args->name, errno, strerror(errno));
+				force_killed_counter(args);
 				(void)kill(pid, SIGTERM);
 				(void)kill(pid, SIGKILL);
 				(void)shim_waitpid(pid, &status, 0);
diff -pruN 0.15.07-1/stress-dev.c 0.15.08-1/stress-dev.c
--- 0.15.07-1/stress-dev.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-dev.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,7 +19,9 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-pthread.h"
+#include "core-pragma.h"
 #include "core-put.h"
 
 #if defined(HAVE_LIBGEN_H)
@@ -297,7 +299,7 @@ static void ioctl_clr_timeout(void)
 #if defined(ITIMER_REAL)
 	struct itimerval it;
 
-	(void)memset(&it, 0, sizeof(it));
+	(void)shim_memset(&it, 0, sizeof(it));
 	VOID_RET(int, setitimer(ITIMER_REAL, &it, NULL));
 #else
 	UNEXPECTED
@@ -448,7 +450,7 @@ static void stress_dev_video_linux(
 	{
 		struct v4l2_capability c;
 
-		(void)memset(&c, 0, sizeof(c));
+		(void)shim_memset(&c, 0, sizeof(c));
 		VOID_RET(int, ioctl(fd, VIDIOC_QUERYCAP, &c));
 	}
 #else
@@ -459,7 +461,7 @@ static void stress_dev_video_linux(
 	{
 		struct v4l2_framebuffer f;
 
-		(void)memset(&f, 0, sizeof(f));
+		(void)shim_memset(&f, 0, sizeof(f));
 		VOID_RET(int, ioctl(fd, VIDIOC_G_FBUF, &f));
 	}
 #else
@@ -470,7 +472,7 @@ static void stress_dev_video_linux(
 	{
 		v4l2_std_id id;
 
-		(void)memset(&id, 0, sizeof(id));
+		(void)shim_memset(&id, 0, sizeof(id));
 		VOID_RET(int, ioctl(fd, VIDIOC_G_STD, &id));
 	}
 #else
@@ -481,7 +483,7 @@ static void stress_dev_video_linux(
 	{
 		struct v4l2_audio a;
 
-		(void)memset(&a, 0, sizeof(a));
+		(void)shim_memset(&a, 0, sizeof(a));
 		VOID_RET(int, ioctl(fd, VIDIOC_G_AUDIO, &a));
 	}
 #else
@@ -510,7 +512,7 @@ static void stress_dev_video_linux(
 	{
 		struct v4l2_audioout a;
 
-		(void)memset(&a, 0, sizeof(a));
+		(void)shim_memset(&a, 0, sizeof(a));
 		VOID_RET(int, ioctl(fd, VIDIOC_G_AUDOUT, &a));
 	}
 #else
@@ -521,7 +523,7 @@ static void stress_dev_video_linux(
 	{
 		struct v4l2_jpegcompression a;
 
-		(void)memset(&a, 0, sizeof(a));
+		(void)shim_memset(&a, 0, sizeof(a));
 		VOID_RET(int, ioctl(fd, VIDIOC_G_JPEGCOMP, &a));
 	}
 #else
@@ -532,7 +534,7 @@ static void stress_dev_video_linux(
 	{
 		v4l2_std_id a;
 
-		(void)memset(&a, 0, sizeof(a));
+		(void)shim_memset(&a, 0, sizeof(a));
 		VOID_RET(int, ioctl(fd, VIDIOC_QUERYSTD, &a));
 	}
 #else
@@ -552,7 +554,7 @@ static void stress_dev_video_linux(
 	{
 		struct v4l2_enc_idx a;
 
-		(void)memset(&a, 0, sizeof(a));
+		(void)shim_memset(&a, 0, sizeof(a));
 		VOID_RET(int, ioctl(fd, VIDIOC_G_ENC_INDEX, &a));
 	}
 #else
@@ -563,7 +565,7 @@ static void stress_dev_video_linux(
 	{
 		struct v4l2_dv_timings a;
 
-		(void)memset(&a, 0, sizeof(a));
+		(void)shim_memset(&a, 0, sizeof(a));
 		VOID_RET(int, ioctl(fd, VIDIOC_QUERY_DV_TIMINGS, &a));
 	}
 #else
@@ -1296,7 +1298,7 @@ static void stress_dev_scsi_blk(
 			int host_unique_id;
 		} lun;
 
-		(void)memset(&lun, 0, sizeof(lun));
+		(void)shim_memset(&lun, 0, sizeof(lun));
 		VOID_RET(int, ioctl(fd, SCSI_IOCTL_GET_IDLUN, &lun));
 	}
 #else
@@ -1551,7 +1553,7 @@ static void stress_dev_random_linux(
 
 			info.entropy_count = sz * 8;
 			info.buf_size = sz;
-			(void)memcpy(&info.buf, &rnd, sz);
+			(void)shim_memcpy(&info.buf, &rnd, sz);
 
 			ret = ioctl(fd_rdwr, RNDADDENTROPY, &info);
 			(void)ret;
@@ -1676,7 +1678,7 @@ static void cdrom_get_address_msf(
 {
 	struct cdrom_tocentry entry;
 
-	(void)memset(&entry, 0, sizeof(entry));
+	(void)shim_memset(&entry, 0, sizeof(entry));
 	entry.cdte_track = (uint8_t)track;
 	entry.cdte_format = CDROM_MSF;
 
@@ -1710,7 +1712,7 @@ static void stress_cdrom_ioctl_msf(const
 		struct cdrom_tochdr header;
 		/* Reading the number of tracks on disc */
 
-		(void)memset(&header, 0, sizeof(header));
+		(void)shim_memset(&header, 0, sizeof(header));
 		if (ioctl(fd, CDROMREADTOCHDR, &header) == 0) {
 			starttrk = header.cdth_trk0;
 			endtrk = header.cdth_trk1;
@@ -1733,7 +1735,7 @@ static void stress_cdrom_ioctl_msf(const
 		struct cdrom_ti ti;
 		int ret;
 
-		(void)memset(&ti, 0, sizeof(ti));
+		(void)shim_memset(&ti, 0, sizeof(ti));
 		ti.cdti_trk1 = endtrk;
 		if (ioctl(fd, CDROMPLAYTRKIND, &ti) == 0) {
 			ret = ioctl(fd, CDROMPAUSE, 0);
@@ -1752,7 +1754,7 @@ static void stress_cdrom_ioctl_msf(const
 		int ret;
 
 		/* Fetch address of start and end track in MSF format */
-		(void)memset(&msf, 0, sizeof(msf));
+		(void)shim_memset(&msf, 0, sizeof(msf));
 		cdrom_get_address_msf(fd, starttrk, &msf.cdmsf_min0,
 			&msf.cdmsf_sec0, &msf.cdmsf_frame0);
 		cdrom_get_address_msf(fd, endtrk, &msf.cdmsf_min1,
@@ -1844,7 +1846,7 @@ static void stress_dev_cdrom_linux(
 		struct cdrom_mcn mcn;
 		int ret;
 
-		(void)memset(&mcn, 0, sizeof(mcn));
+		(void)shim_memset(&mcn, 0, sizeof(mcn));
 		ret = ioctl(fd, CDROM_GET_MCN, &mcn);
 		(void)ret;
 	}, return);
@@ -1857,7 +1859,7 @@ static void stress_dev_cdrom_linux(
 		struct cdrom_tochdr header;
 		int ret;
 
-		(void)memset(&header, 0, sizeof(header));
+		(void)shim_memset(&header, 0, sizeof(header));
 		ret = ioctl(fd, CDROMREADTOCHDR, &header);
 		(void)ret;
 	}, return);
@@ -1870,7 +1872,7 @@ static void stress_dev_cdrom_linux(
 		struct cdrom_tocentry entry;
 		int ret;
 
-		(void)memset(&entry, 0, sizeof(entry));
+		(void)shim_memset(&entry, 0, sizeof(entry));
 		ret = ioctl(fd, CDROMREADTOCENTRY, &entry);
 		(void)ret;
 	}, return);
@@ -1884,7 +1886,7 @@ static void stress_dev_cdrom_linux(
 		struct cdrom_volctrl volume;
 		int ret;
 
-		(void)memset(&volume, 0, sizeof(volume));
+		(void)shim_memset(&volume, 0, sizeof(volume));
 		ret = ioctl(fd, CDROMVOLREAD, &volume);
 		if (ret == 0)
 			ret = ioctl(fd, CDROMVOLCTRL, &volume);
@@ -1899,7 +1901,7 @@ static void stress_dev_cdrom_linux(
 		struct cdrom_subchnl q;
 		int ret;
 
-		(void)memset(&q, 0, sizeof(q));
+		(void)shim_memset(&q, 0, sizeof(q));
 		ret = ioctl(fd, CDROMSUBCHNL, &q);
 		(void)ret;
 	}, return);
@@ -1912,7 +1914,7 @@ static void stress_dev_cdrom_linux(
 		struct cdrom_read_audio ra;
 		int ret;
 
-		(void)memset(&ra, 0, sizeof(ra));
+		(void)shim_memset(&ra, 0, sizeof(ra));
 		ret = ioctl(fd, CDROMREADAUDIO, &ra);
 		(void)ret;
 	}, return);
@@ -1925,7 +1927,7 @@ static void stress_dev_cdrom_linux(
 		uint8_t buffer[CD_FRAMESIZE];
 		int ret;
 
-		(void)memset(&buffer, 0, sizeof(buffer));
+		(void)shim_memset(&buffer, 0, sizeof(buffer));
 		ret = ioctl(fd, CDROMREADCOOKED, buffer);
 		(void)ret;
 	}, return);
@@ -1938,7 +1940,7 @@ static void stress_dev_cdrom_linux(
 		uint8_t buffer[CD_FRAMESIZE];
 		int ret;
 
-		(void)memset(&buffer, 0, sizeof(buffer));
+		(void)shim_memset(&buffer, 0, sizeof(buffer));
 		ret = ioctl(fd, CDROMREADALL, buffer);
 		(void)ret;
 	}, return);
@@ -1951,7 +1953,7 @@ static void stress_dev_cdrom_linux(
 		struct cdrom_msf msf;
 		int ret;
 
-		(void)memset(&msf, 0, sizeof(msf));
+		(void)shim_memset(&msf, 0, sizeof(msf));
 		ret = ioctl(fd, CDROMSEEK, &msf);
 		(void)ret;
 	}, return);
@@ -2139,7 +2141,7 @@ static void stress_dev_cdrom_linux(
 		 *  Invalid DVD_READ_STRUCT ioctl syscall with
 		 *  invalid layer number resulting in EINVAL
 		 */
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 		s.type = DVD_STRUCT_PHYSICAL;
 		s.physical.layer_num = UINT8_MAX;
 		ret = ioctl(fd, DVD_READ_STRUCT, &s);
@@ -2149,33 +2151,33 @@ static void stress_dev_cdrom_linux(
 		 *  Exercise each DVD structure type to cover all the
 		 *  respective functions to increase kernel coverage
 		 */
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 		s.type = DVD_STRUCT_PHYSICAL;
 		ret = ioctl(fd, DVD_READ_STRUCT, &s);
 		(void)ret;
 
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 		s.type = DVD_STRUCT_COPYRIGHT;
 		ret = ioctl(fd, DVD_READ_STRUCT, &s);
 		(void)ret;
 
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 		s.type = DVD_STRUCT_DISCKEY;
 		ret = ioctl(fd, DVD_READ_STRUCT, &s);
 		(void)ret;
 
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 		s.type = DVD_STRUCT_BCA;
 		ret = ioctl(fd, DVD_READ_STRUCT, &s);
 		(void)ret;
 
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 		s.type = DVD_STRUCT_MANUFACT;
 		ret = ioctl(fd, DVD_READ_STRUCT, &s);
 		(void)ret;
 
 		/* Invalid DVD_READ_STRUCT call with invalid type argument */
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 		s.type = UINT8_MAX;
 		ret = ioctl(fd, DVD_READ_STRUCT, &s);
 		(void)ret;
@@ -2202,7 +2204,7 @@ static void stress_dev_cdrom_linux(
 		dvd_authinfo ai;
 
 		/* Invalid DVD_AUTH call with no credentials */
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
@@ -2210,58 +2212,58 @@ static void stress_dev_cdrom_linux(
 		 *  Exercise each DVD AUTH type to cover all the
 		 *  respective code to increase kernel coverage
 		 */
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_LU_SEND_AGID;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_LU_SEND_KEY1;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_LU_SEND_CHALLENGE;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_LU_SEND_TITLE_KEY;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_LU_SEND_ASF;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_HOST_SEND_CHALLENGE;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_HOST_SEND_KEY2;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_INVALIDATE_AGID;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_LU_SEND_RPC_STATE;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = DVD_HOST_SEND_RPC_STATE;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
 
 		/* Invalid DVD_READ_STRUCT call with invalid type argument */
-		(void)memset(&ai, 0, sizeof(ai));
+		(void)shim_memset(&ai, 0, sizeof(ai));
 		ai.type = (uint8_t)~0;
 		ret = ioctl(fd, DVD_AUTH, &ai);
 		(void)ret;
@@ -2378,7 +2380,7 @@ static void stress_dev_cdrom_linux(
 		struct cdrom_blk blk;
 		int ret;
 
-		(void)memset(&blk, 0, sizeof(blk));
+		(void)shim_memset(&blk, 0, sizeof(blk));
 		ret = ioctl(fd, CDROMPLAYBLK, &blk);
 		(void)ret;
 	}, return);
@@ -2528,7 +2530,7 @@ static void stress_dev_console_linux(
 		struct consolefontdesc font;
 		int ret;
 
-		(void)memset(&font, 0, sizeof(font));
+		(void)shim_memset(&font, 0, sizeof(font));
 		ret = ioctl(fd, GIO_FONTX, &font);
 #if defined(PIO_FONTX)
 		if (ret == 0) {
@@ -2550,7 +2552,7 @@ static void stress_dev_console_linux(
 		int ret;
 		struct kbkeycode argp;
 
-		(void)memset(&argp, 0, sizeof(argp));
+		(void)shim_memset(&argp, 0, sizeof(argp));
 		ret = ioctl(fd, KDGETKEYCODE, &argp);
 #if defined(KDSETKEYCODE)
 		if (ret == 0) {
@@ -2564,7 +2566,7 @@ static void stress_dev_console_linux(
 			 * with invalid keycode having different values
 			 * of scancode and keycode for scancode < 89
 			 */
-			(void)memset(&bad_arg, 0, sizeof(bad_arg));
+			(void)shim_memset(&bad_arg, 0, sizeof(bad_arg));
 			bad_arg.scancode = (unsigned int)-1;
 			bad_arg.keycode = 2;
 
@@ -2712,7 +2714,7 @@ static void stress_dev_console_linux(
 		int ret;
 		struct unimapdesc argp;
 
-		(void)memset(&argp, 0, sizeof(argp));
+		(void)shim_memset(&argp, 0, sizeof(argp));
 		ret = ioctl(fd, GIO_UNIMAP, &argp);
 #if defined(PIO_UNIMAP)
 		if (ret == 0) {
@@ -2735,7 +2737,7 @@ static void stress_dev_console_linux(
 		int ret;
 		struct kbdiacrs argp;
 
-		(void)memset(&argp, 0, sizeof(argp));
+		(void)shim_memset(&argp, 0, sizeof(argp));
 		ret = ioctl(fd, KDGKBDIACR, &argp);
 		(void)ret;
 	}
@@ -2754,7 +2756,7 @@ static void stress_dev_console_linux(
 
 		/* Exercise only if permission is not present */
 		if (!perm) {
-			(void)memset(&argp, 0, sizeof(argp));
+			(void)shim_memset(&argp, 0, sizeof(argp));
 			ret = ioctl(fd, VT_RESIZE, &argp);
 			(void)ret;
 		}
@@ -2774,7 +2776,7 @@ static void stress_dev_console_linux(
 
 		/* Exercise only if permission is not present */
 		if (!perm) {
-			(void)memset(&argp, 0, sizeof(argp));
+			(void)shim_memset(&argp, 0, sizeof(argp));
 			ret = ioctl(fd, VT_RESIZEX, &argp);
 			(void)ret;
 		}
@@ -2790,7 +2792,7 @@ static void stress_dev_console_linux(
 		int ret;
 		struct kbsentry argp;
 
-		(void)memset(&argp, 0, sizeof(argp));
+		(void)shim_memset(&argp, 0, sizeof(argp));
 		ret = ioctl(fd, KDGKBSENT, &argp);
 #if defined(KDSKBSENT)
 		if (ret == 0) {
@@ -2813,7 +2815,7 @@ static void stress_dev_console_linux(
 		int ret;
 		struct vt_mode mode;
 
-		(void)memset(&mode, 0, sizeof(mode));
+		(void)shim_memset(&mode, 0, sizeof(mode));
 		ret = ioctl(fd, VT_GETMODE, &mode);
 #if defined(VT_SETMODE)
 		if (ret == 0) {
@@ -2836,7 +2838,7 @@ static void stress_dev_console_linux(
 		int ret;
 		struct kbentry entry;
 
-		(void)memset(&entry, 0, sizeof(entry));
+		(void)shim_memset(&entry, 0, sizeof(entry));
 		ret = ioctl(fd, KDGKBENT, &entry);
 #if defined(KDSKBENT)
 		if (ret == 0) {
@@ -2930,18 +2932,18 @@ static void stress_dev_hpet_linux(
 		 *  Invalid CDROMMULTISESSION ioctl syscall with
 		 *  invalid format number resulting in EINVAL
 		 */
-		(void)memset(&ms_info, 0, sizeof(ms_info));
+		(void)shim_memset(&ms_info, 0, sizeof(ms_info));
 		ms_info.addr_format = UINT8_MAX;
 		ret = ioctl(fd, CDROMMULTISESSION, &ms_info);
 		(void)ret;
 
 		/* Valid CDROMMULTISESSION with address formats */
-		(void)memset(&ms_info, 0, sizeof(ms_info));
+		(void)shim_memset(&ms_info, 0, sizeof(ms_info));
 		ms_info.addr_format = CDROM_MSF;
 		ret = ioctl(fd, CDROMMULTISESSION, &ms_info);
 		(void)ret;
 
-		(void)memset(&ms_info, 0, sizeof(ms_info));
+		(void)shim_memset(&ms_info, 0, sizeof(ms_info));
 		ms_info.addr_format = CDROM_LBA;
 		ret = ioctl(fd, CDROMMULTISESSION, &ms_info);
 		(void)ret;
@@ -3140,7 +3142,7 @@ static void stress_dev_ptp_linux(
 		for (i = 0; i < pins; i++) {
 			struct ptp_pin_desc desc;
 
-			(void)memset(&desc, 0, sizeof(desc));
+			(void)shim_memset(&desc, 0, sizeof(desc));
 			desc.index = (unsigned int)i;
 			ret = ioctl(fd, PTP_PIN_GETFUNC, &desc);
 			(void)ret;
@@ -3357,10 +3359,14 @@ static void stress_dev_snd_control_linux
     defined(HAVE_SND_CTL_TLV)
 	{
 		int ret;
+STRESS_PRAGMA_PUSH
+STRESS_PRAGMA_WARN_OFF
+		/* disable warning for -Wgnu-variable-sized-type-not-at-end */
 		struct tlv_buf {
 			struct snd_ctl_tlv tlv;
 			unsigned int data[4];
 		} buf;
+STRESS_PRAGMA_POP
 
 		/* intentionally will fail with -EINVAL */
 		buf.tlv.numid = 0;
@@ -4300,7 +4306,7 @@ static size_t stress_dev_infos_get(
 			int dev_n;
 			char *ptr = d->d_name + len - 1;
 
-			while (ptr > d->d_name && isdigit((int)*ptr))
+			while ((ptr > d->d_name) && isdigit((int)*ptr))
 				ptr--;
 			ptr++;
 			dev_n = atoi(ptr);
@@ -4391,7 +4397,7 @@ static int stress_dev(const stress_args_
 	pa.args = args;
 	pa.data = NULL;
 
-	(void)memset(ret, 0, sizeof(ret));
+	(void)shim_memset(ret, 0, sizeof(ret));
 
 	(void)stress_get_setting("dev-file", &dev_file);
 	if (dev_file) {
diff -pruN 0.15.07-1/stress-dirmany.c 0.15.08-1/stress-dirmany.c
--- 0.15.07-1/stress-dirmany.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-dirmany.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_DIRMANY_BYTES     (0)
 #define MAX_DIRMANY_BYTES     (MAX_FILE_LIMIT)
@@ -54,10 +55,10 @@ static void stress_dirmany_filename(
 	if (pathname_len + filename_len + 18 < filename_sz) {
 		char *ptr = filename;
 
-		(void)memcpy(ptr, pathname, pathname_len);
+		(void)shim_memcpy(ptr, pathname, pathname_len);
 		ptr += pathname_len;
 		*ptr++ = '/';
-		(void)memset(ptr, 'x', filename_len);
+		(void)shim_memset(ptr, 'x', filename_len);
 		ptr += filename_len;
 		(void)snprintf(ptr, sizeof(filename) + (size_t)(ptr - filename), "%16.16" PRIx64, n);
 	} else {
diff -pruN 0.15.07-1/stress-dnotify.c 0.15.08-1/stress-dnotify.c
--- 0.15.07-1/stress-dnotify.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-dnotify.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_SELECT_H)
 #include <sys/select.h>
@@ -75,7 +76,7 @@ typedef void (*stress_dnotify_func)(cons
 
 typedef struct {
 	const stress_dnotify_func func;
-	const char*	description;
+	const char *description;
 } stress_dnotify_stress_t;
 
 /*
@@ -118,17 +119,21 @@ static void dnotify_exercise(
 	if (func(args, filename, private) < 0)
 		goto cleanup;
 
-	/* Wait for up to 1 second for event */
-	while ((i < 1000) && (dnotify_fd == -1)) {
+	/* Wait for up to 2 seconds for event */
+	while ((i < 2000) && (dnotify_fd == -1)) {
 		if (!keep_stressing(args))
 			goto cleanup;
 		i++;
 		(void)shim_usleep(1000);
 	}
 
-	if (dnotify_fd != fd) {
-		pr_fail("%s: did not get expected dnotify file descriptor\n",
-			args->name);
+	/*
+	 *  If we didn't time out and we got an expected fd, report
+	 *  a failure.
+	 */
+	if ((dnotify_fd != -1) && (dnotify_fd != fd)) {
+		pr_fail("%s: did not get expected dnotify file descriptor %d, got %d instead\n",
+			args->name, fd, dnotify_fd);
 	}
 
 cleanup:
@@ -142,7 +147,7 @@ cleanup:
  */
 static int rm_file(const stress_args_t *args, const char *path)
 {
-	if ((shim_force_unlink(path) < 0) && errno != ENOENT) {
+	if ((shim_force_unlink(path) < 0) && (errno != ENOENT)) {
 		pr_err("%s: cannot remove file %s: errno=%d (%s)\n",
 			args->name, path, errno, strerror(errno));
 		return -1;
@@ -169,7 +174,7 @@ static int mk_file(const stress_args_t *
 		return -1;
 	}
 
-	(void)memset(buffer, 'x', BUF_SIZE);
+	(void)shim_memset(buffer, 'x', BUF_SIZE);
 	while (keep_stressing(args) && (sz > 0)) {
 		size_t n = (sz > BUF_SIZE) ? BUF_SIZE : sz;
 		ssize_t ret;
diff -pruN 0.15.07-1/stress-dup.c 0.15.08-1/stress-dup.c
--- 0.15.07-1/stress-dup.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-dup.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"dup N",	"start N workers exercising dup/close" },
@@ -93,7 +94,7 @@ static int static_dup2_child(info_t *inf
 	info->fd_pipe = -1;
 	info->pid_clone = -1;
 
-	(void)memset(&action, 0, sizeof(action));
+	(void)shim_memset(&action, 0, sizeof(action));
 	action.sa_flags = 0;
 	action.sa_handler = stress_sighandler_nop;
 	if (UNLIKELY(sigaction(SIGALRM, &action, NULL) < 0))
@@ -137,7 +138,7 @@ static int static_dup2_child(info_t *inf
 	/*
 	 *  Cancel timer
 	 */
-	(void)memset(&timer, 0, sizeof(timer));
+	(void)shim_memset(&timer, 0, sizeof(timer));
 	(void)setitimer(ITIMER_PROF, &timer, NULL);
 
 	/*
diff -pruN 0.15.07-1/stress-dynlib.c 0.15.08-1/stress-dynlib.c
--- 0.15.07-1/stress-dynlib.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-dynlib.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-put.h"
 
 #if defined(HAVE_LIB_DL)
@@ -119,7 +120,7 @@ static int stress_dynlib(const stress_ar
 {
 	void *handles[MAX_LIBNAMES];
 
-	(void)memset(handles, 0, sizeof(handles));
+	(void)shim_memset(handles, 0, sizeof(handles));
 
 	if (stress_sighandler(args->name, SIGSEGV, stress_segvhandler, NULL) < 0)
 		return EXIT_NO_RESOURCE;
diff -pruN 0.15.07-1/stress-efivar.c 0.15.08-1/stress-efivar.c
--- 0.15.07-1/stress-efivar.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-efivar.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #define STRESS_EFI_UNKNOWN	(0)
@@ -218,7 +219,7 @@ static int efi_get_data(
 	}
 
 	(void)stress_read_fdinfo(pid, fd);
-	(void)memset(buf, 0, buf_len);
+	(void)shim_memset(buf, 0, buf_len);
 
 	if (metrics)
 		t = stress_time_now();
@@ -508,6 +509,7 @@ again:
 			if (errno != EINTR)
 				pr_dbg("%s: waitpid(): errno=%d (%s)\n",
 					args->name, errno, strerror(errno));
+			force_killed_counter(args);
 			(void)kill(pid, SIGTERM);
 			(void)kill(pid, SIGKILL);
 			(void)shim_waitpid(pid, &status, 0);
diff -pruN 0.15.07-1/stress-enosys.c 0.15.08-1/stress-enosys.c
--- 0.15.07-1/stress-enosys.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-enosys.c	2023-05-21 14:30:06.000000000 +0000
@@ -3631,8 +3631,13 @@ again:
 				pr_dbg("%s: waitpid(): errno=%d (%s)\n",
 					args->name, errno, strerror(errno));
 			(void)kill(pid, SIGALRM);
+
+			/* Still alive, kill it */
+			if (kill(pid, 0) == 0) {
+				force_killed_counter(args);
+				(void)kill(pid, SIGKILL);
+			}
 			(void)shim_waitpid(pid, &status, 0);
-			(void)kill(pid, SIGKILL);
 		} else if (WIFSIGNALED(status)) {
 			pr_dbg("%s: child died: %s (instance %d)\n",
 				args->name, stress_strsignal(WTERMSIG(status)),
diff -pruN 0.15.07-1/stress-epoll.c 0.15.08-1/stress-epoll.c
--- 0.15.07-1/stress-epoll.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-epoll.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_SYS_UN_H)
@@ -276,7 +277,7 @@ static int epoll_ctl_add(const int efd,
 {
 	struct epoll_event event;
 
-	(void)memset(&event, 0, sizeof(event));
+	(void)shim_memset(&event, 0, sizeof(event));
 	event.data.fd = fd;
 	event.events = events;
 	if (UNLIKELY(epoll_ctl(efd, EPOLL_CTL_ADD, fd, &event) < 0))
@@ -294,7 +295,7 @@ static int epoll_ctl_mod(const int efd,
 {
 	struct epoll_event event;
 
-	(void)memset(&event, 0, sizeof(event));
+	(void)shim_memset(&event, 0, sizeof(event));
 	event.events = events;
 	if (UNLIKELY(epoll_ctl(efd, EPOLL_CTL_MOD, fd, &event) < 0))
 		return -1;
@@ -311,7 +312,7 @@ static int epoll_ctl_del(const int efd,
 {
 	struct epoll_event event;
 
-	(void)memset(&event, 0, sizeof(event));
+	(void)shim_memset(&event, 0, sizeof(event));
 	if (UNLIKELY(epoll_ctl(efd, EPOLL_CTL_DEL, fd, &event) < 0))
 		return -1;
 
@@ -377,7 +378,7 @@ static int epoll_notification(
 		 *  Exercise invalid epoll_ctl syscall with EPOLL_CTL_DEL
 		 *  and EPOLL_CTL_MOD on fd not registered with efd
 		 */
-		(void)memset(&event, 0, sizeof(event));
+		(void)shim_memset(&event, 0, sizeof(event));
 		(void)epoll_ctl(efd, EPOLL_CTL_DEL, fd, &event);
 		(void)epoll_ctl(efd, EPOLL_CTL_MOD, fd, &event);
 #endif
@@ -395,7 +396,7 @@ static int epoll_notification(
 		(void)epoll_ctl_add(efd, bad_fd, EPOLLIN | EPOLLET);
 
 		/* Exercise epoll_ctl syscall with invalid operation */
-		(void)memset(&event, 0, sizeof(event));
+		(void)shim_memset(&event, 0, sizeof(event));
 		(void)epoll_ctl(efd, INT_MIN, fd, &event);
 
 		/*
@@ -570,7 +571,9 @@ static int epoll_client(
 		socklen_t addr_len = 0;
 
 		/* Cycle through the servers */
-		port_counter = (port_counter + 1) % max_servers;
+		port_counter = 0;
+		if (port_counter >= max_servers)
+			port_counter = 0;
 retry:
 		if (!keep_stressing_flag())
 			break;
@@ -586,7 +589,7 @@ retry:
 			return EXIT_FAILURE;
 		}
 
-		(void)memset(&sev, 0, sizeof(sev));
+		(void)shim_memset(&sev, 0, sizeof(sev));
 		sev.sigev_notify = SIGEV_SIGNAL;
 		sev.sigev_signo = SIGRTMIN;
 		sev.sigev_value.sival_ptr = &epoll_timerid;
@@ -664,7 +667,7 @@ retry:
 			goto retry;
 		}
 
-		(void)memset(buf, 'A' + (get_counter(args) % 26), sizeof(buf));
+		(void)shim_memset(buf, stress_ascii64[get_counter(args) & 63], sizeof(buf));
 		if (UNLIKELY(send(fd, buf, sizeof(buf), 0) < 0)) {
 			(void)close(fd);
 			pr_dbg("%s: send failed, errno=%d (%s)\n",
@@ -867,7 +870,7 @@ static void NORETURN epoll_server(
 		(void)sigemptyset(&sigmask);
 		(void)sigaddset(&sigmask, SIGALRM);
 
-		(void)memset(events, 0, MAX_EPOLL_EVENTS * sizeof(*events));
+		(void)shim_memset(events, 0, MAX_EPOLL_EVENTS * sizeof(*events));
 		errno = 0;
 
 		ret = sigsetjmp(jmp_env, 1);
@@ -1067,7 +1070,7 @@ static int stress_epoll(const stress_arg
 	 *  Typically, we are limited to ~500 connections per second
 	 *  on a default Linux configuration.
 	 */
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 	for (i = 0; i < max_servers; i++) {
 		pids[i] = epoll_spawn(args, epoll_server, i, mypid, epoll_port, epoll_domain, epoll_sockets);
 		if (pids[i] < 0) {
@@ -1082,17 +1085,7 @@ reap:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 	stress_net_release_ports(start_port, end_port);
 
-	for (i = 0; i < max_servers; i++) {
-		int status;
-
-		if (pids[i] > 0) {
-			(void)kill(pids[i], SIGALRM);
-			if (shim_waitpid(pids[i], &status, 0) < 0) {
-				pr_dbg("%s: waitpid failed, errno=%d (%s)\n",
-					args->name, errno, strerror(errno));
-			}
-		}
-	}
+	stress_kill_and_wait_many(args, pids, max_servers, SIGALRM, true);
 
 	return rc;
 }
diff -pruN 0.15.07-1/stress-eventfd.c 0.15.08-1/stress-eventfd.c
--- 0.15.07-1/stress-eventfd.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-eventfd.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_EVENTFD_H)
 #include <sys/eventfd.h>
@@ -145,7 +146,7 @@ again:
 				n = 0;
 
 				/* Exercise write using small buffer */
-				(void)memset(re, 0, sizeof(re));
+				(void)shim_memset(re, 0, sizeof(re));
 				VOID_RET(ssize_t, write(fd1, re, sizeof(re)));
 
 				/* Exercise write on buffer out of range */
diff -pruN 0.15.07-1/stress-exec.c 0.15.08-1/stress-exec.c
--- 0.15.07-1/stress-exec.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-exec.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SPAWN_H)
 #include <spawn.h>
@@ -45,6 +46,11 @@ UNEXPECTED
     defined(HAVE_POSIX_SPAWN)
 #define EXEC_FORK_METHOD_SPAWN	(0x13)
 #endif
+#if defined(HAVE_RFORK) &&	\
+    defined(RFPROC) &&		\
+    defined(RFFDG)
+#define EXEC_FORK_METHOD_RFORK	(0x14)
+#endif
 
 #define MAX_ARG_PAGES		(32)
 
@@ -101,6 +107,11 @@ static const stress_exec_method_t stress
 	{ "clone",	EXEC_FORK_METHOD_CLONE },
 #endif
 	{ "fork",	EXEC_FORK_METHOD_FORK },
+#if defined(HAVE_RFORK) &&	\
+    defined(RFPROC) &&		\
+    defined(RFFDG)
+	{ "rfork",	EXEC_FORK_METHOD_RFORK },
+#endif
 #if defined(HAVE_SPAWN_H) &&	\
     defined(HAVE_POSIX_SPAWN)
 	{ "spawn",	EXEC_FORK_METHOD_SPAWN },
@@ -118,6 +129,11 @@ static const stress_help_t help[] = {
 					" clone"
 #endif
 					" fork"
+#if defined(HAVE_RFORK) &&	\
+    defined(RFPROC) &&		\
+    defined(RFFDG)
+					" rfork"
+#endif
 #if defined(HAVE_SPAWN_H) &&	\
     defined(HAVE_POSIX_SPAWN)
 					" spawn"
@@ -442,7 +458,7 @@ static inline int stress_do_exec(stress_
 	int ret_dummy = EINVAL;
 	pthread_t pthread_exec, pthread_dummy = 0;
 
-	if (!context->no_pthread && (stress_mwc8() & 3) == 0) {
+	if (!context->no_pthread && ((stress_mwc8() & 3) == 0)) {
 		ret_dummy = pthread_create(&pthread_dummy, NULL, stress_exec_dummy_pthread, (void *)context);
 
 		ret = pthread_create(&pthread_exec, NULL, stress_exec_from_pthread, (void*)context);
@@ -559,8 +575,8 @@ do_exec:
 	context.args = argp->args;
 	context.exec_method = method;
 	context.no_pthread = argp->no_pthread;
-	(void)memcpy(&context.argv, argp->argv, sizeof(context.argv));
-	(void)memcpy(&context.env, argp->env, sizeof(context.env));
+	(void)shim_memcpy(&context.argv, argp->argv, sizeof(context.argv));
+	(void)shim_memcpy(&context.env, argp->env, sizeof(context.env));
 	if (big_env)
 		argp->env[0] = argp->str;
 	if (big_arg)
@@ -672,6 +688,7 @@ do_exec:
 static int stress_exec(const stress_args_t *args)
 {
 	char *exec_prog;
+	char exec_path[PATH_MAX];
 	char garbage_prog[PATH_MAX];
 	int ret, rc = EXIT_FAILURE;
 #if defined(HAVE_EXECVEAT) &&	\
@@ -696,7 +713,7 @@ static int stress_exec(const stress_args
 	/*
 	 *  Determine our own self as the executable, e.g. run stress-ng
 	 */
-	exec_prog = stress_proc_self_exe();
+	exec_prog = stress_proc_self_exe(exec_path, sizeof(exec_path));
 	if (!exec_prog) {
 		if (args->instance == 0)
 			pr_inf_skip("%s: skipping stressor, can't determine stress-ng "
@@ -730,7 +747,7 @@ static int stress_exec(const stress_args
 	if (str == MAP_FAILED)
 		str = NULL;
 	else
-		(void)memset(str, 'X', arg_max - 1);
+		(void)shim_memset(str, 'X', arg_max - 1);
 
 #if !defined(HAVE_EXECVEAT)
 	if (args->instance == 0 &&
@@ -804,6 +821,16 @@ static int stress_exec(const stress_args
 					_exit(stress_exec_child(&sph->arg));
 				}
 				break;
+#if defined(HAVE_RFORK) &&	\
+    defined(RFPROC) &&		\
+    defined(RFFDG)
+			case EXEC_FORK_METHOD_RFORK:
+				pid = rfork(RFPROC | RFFDG);
+				if (pid == 0) {
+					_exit(stress_exec_child(&sph->arg));
+				}
+				break;
+#endif
 #if defined(HAVE_VFORK)
 			case EXEC_FORK_METHOD_VFORK:
 				pid = shim_vfork();
diff -pruN 0.15.07-1/stress-exit-group.c 0.15.08-1/stress-exit-group.c
--- 0.15.07-1/stress-exit-group.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-exit-group.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define STRESS_PTHREAD_EXIT_GROUP_MAX	(16)
 
@@ -116,7 +117,7 @@ static void NORETURN stress_exit_group_c
 	sigaddset(&set, SIGALRM);
 	sigprocmask(SIG_BLOCK, &set, NULL);
 
-	(void)memset(&pthreads, 0, sizeof(pthreads));
+	(void)shim_memset(&pthreads, 0, sizeof(pthreads));
 	ret = pthread_mutex_lock(&mutex);
 	if (ret) {
 		stop_running();
diff -pruN 0.15.07-1/stress-fallocate.c 0.15.08-1/stress-fallocate.c
--- 0.15.07-1/stress-fallocate.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fallocate.c	2023-05-21 14:30:06.000000000 +0000
@@ -47,15 +47,6 @@ static const stress_opt_set_func_t opt_s
 
 #if defined(HAVE_FALLOCATE)
 
-static sigjmp_buf jmp_env;
-
-static void NORETURN MLOCKED_TEXT stress_fallocate_handler(int signum)
-{
-	(void)signum;
-
-	siglongjmp(jmp_env, 1);
-}
-
 static const int modes[] = {
 	0,
 #if defined(FALLOC_FL_KEEP_SIZE)
@@ -108,7 +99,7 @@ static const int illegal_modes[] = {
  */
 static int stress_fallocate(const stress_args_t *args)
 {
-	NOCLOBBER int fd = -1, ret, pipe_ret, pipe_fds[2];
+	int fd = -1, ret, pipe_ret = -1, pipe_fds[2] = { -1, -1 };
 	const int bad_fd = stress_get_bad_fd();
 	char filename[PATH_MAX];
 	uint64_t ftrunc_errs = 0;
@@ -121,16 +112,6 @@ static int stress_fallocate(const stress
 		all_modes |= modes[i];
 	mode_count = stress_flag_permutation(all_modes, &mode_perms);
 
-	ret = sigsetjmp(jmp_env, 1);
-	if (ret) {
-		/*
-		 * We return here if SIGALRM jmp'd back
-		 */
-		goto done;
-	}
-	VOID_RET(int, stress_sighandler(args->name, SIGALRM, stress_fallocate_handler, NULL));
-	VOID_RET(int, stress_sighandler(args->name, SIGINT, stress_fallocate_handler, NULL));
-
 	if (!stress_get_setting("fallocate-bytes", &fallocate_bytes)) {
 		if (g_opt_flags & OPT_FLAGS_MAXIMIZE)
 			fallocate_bytes = MAXIMIZED_FILE_SIZE;
@@ -162,8 +143,6 @@ static int stress_fallocate(const stress
 
 	pipe_ret = pipe(pipe_fds);
 
-	stress_file_rw_hint_short(fd);
-
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
 	do {
@@ -303,7 +282,6 @@ static int stress_fallocate(const stress
 		inc_counter(args);
 	} while (keep_stressing(args));
 
-done:
 	if (ftrunc_errs)
 		pr_dbg("%s: %" PRIu64
 			" ftruncate errors occurred.\n", args->name, ftrunc_errs);
@@ -316,14 +294,7 @@ done:
 	if (fd != -1)
 		(void)close(fd);
 
-	/*
-	 *  We may reach here on a siglongjmp without the temp dirs
-	 *  having been created. Don't call the normal helper but
-	 *  use rmdir and ignore any error if the directories don't
-	 *  exist.
-	 */
-	(void)stress_temp_dir_args(args, filename, sizeof(filename));
-	(void)shim_rmdir(filename);
+	(void)stress_temp_dir_rm_args(args);
 	free(mode_perms);
 
 	return EXIT_SUCCESS;
diff -pruN 0.15.07-1/stress-fanotify.c 0.15.08-1/stress-fanotify.c
--- 0.15.07-1/stress-fanotify.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fanotify.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_SYS_FANOTIFY_H)
@@ -481,7 +482,7 @@ static int stress_fanotify(const stress_
 	int ret, rc = EXIT_SUCCESS;
 	stress_fanotify_account_t account;
 
-	(void)memset(&account, 0, sizeof(account));
+	(void)shim_memset(&account, 0, sizeof(account));
 
 	stress_temp_dir_args(args, pathname, sizeof(pathname));
 	(void)stress_mk_filename(filename, sizeof(filename), pathname, "fanotify_file");
@@ -495,7 +496,7 @@ static int stress_fanotify(const stress_
 	pid = fork();
 
 	/* do all mount points */
-	(void)memset(mnts, 0, sizeof(mnts));
+	(void)shim_memset(mnts, 0, sizeof(mnts));
 
 	n_mnts = stress_mount_get(mnts, MAX_MNTS);
 	if (n_mnts < 1) {
diff -pruN 0.15.07-1/stress-far-branch.c 0.15.08-1/stress-far-branch.c
--- 0.15.07-1/stress-far-branch.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-far-branch.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"far-branch N",		"start N far branching workers" },
@@ -262,7 +263,7 @@ static void *stress_far_mmap(
 
 use_page:
 	for (i = 0; i < page_size; i += ret_opcode.stride) {
-		(void)memcpy((ptr + i), ret_opcode.opcodes, ret_opcode.len);
+		(void)shim_memcpy((ptr + i), ret_opcode.opcodes, ret_opcode.len);
 		funcs[*total_funcs] = (ret_func_t)(ptr + i);
 		(*total_funcs)++;
 	}
@@ -335,7 +336,7 @@ static int stress_far_branch(const stres
 	if (args->instance == 0)
 		pr_dbg("%s: using assembler opcode '%s' as function return code\n", args->name, ret_opcode.assembler);
 
-	(void)memset(&sa, 0, sizeof(sa));
+	(void)shim_memset(&sa, 0, sizeof(sa));
 	sa.sa_sigaction = stress_sig_handler;
 #if defined(SA_SIGINFO)
 	sa.sa_flags = SA_SIGINFO;
diff -pruN 0.15.07-1/stress-fcntl.c 0.15.08-1/stress-fcntl.c
--- 0.15.07-1/stress-fcntl.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fcntl.c	2023-05-21 14:30:06.000000000 +0000
@@ -179,12 +179,13 @@ static int do_fcntl(
 
 			/* Exercise all permutations of SETFL flags */
 			if ((setfl_flag_count > 0) && (setfl_flag_perms)) {
-				static int index;
+				static size_t index;
 
 				VOID_RET(int, fcntl(fd, F_SETFL, setfl_flag_perms[index]));
 
 				index++;
-				index %= setfl_flag_count;
+				if (index >= setfl_flag_count)
+					index = 0;
 			}
 
 			new_flags = old_flags | O_APPEND;
diff -pruN 0.15.07-1/stress-fiemap.c 0.15.08-1/stress-fiemap.c
--- 0.15.07-1/stress-fiemap.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fiemap.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_FIEMAP_H)
 #include <linux/fiemap.h>
@@ -188,7 +189,7 @@ static void stress_fiemap_ioctl(
 		}
 		fiemap = tmp;
 
-		(void)memset(fiemap->fm_extents, 0, extents_size);
+		(void)shim_memset(fiemap->fm_extents, 0, extents_size);
 		fiemap->fm_extent_count = fiemap->fm_mapped_extents;
 		fiemap->fm_mapped_extents = 0;
 
@@ -239,9 +240,9 @@ static inline pid_t stress_fiemap_spawn(
 static int stress_fiemap(const stress_args_t *args)
 {
 	pid_t pids[MAX_FIEMAP_PROCS];
-	int ret, fd, rc = EXIT_FAILURE, status;
+	int ret, fd, rc = EXIT_FAILURE;
 	char filename[PATH_MAX];
-	size_t i, n;
+	size_t n;
 	uint64_t fiemap_bytes = DEFAULT_FIEMAP_SIZE;
 	struct fiemap fiemap;
 	const char *fs_type;
@@ -284,7 +285,7 @@ static int stress_fiemap(const stress_ar
 	fs_type = stress_fs_type(filename);
 	(void)shim_unlink(filename);
 
-	(void)memset(&fiemap, 0, sizeof(fiemap));
+	(void)shim_memset(&fiemap, 0, sizeof(fiemap));
 	fiemap.fm_length = ~0UL;
 	if (ioctl(fd, FS_IOC_FIEMAP, &fiemap) < 0) {
 		errno = EOPNOTSUPP;
@@ -312,13 +313,9 @@ static int stress_fiemap(const stress_ar
 	rc = stress_fiemap_writer(args, fd, fiemap_bytes);
 reap:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
+
 	/* And reap stressors */
-	for (i = 0; i < n; i++) {
-		(void)kill(pids[i], SIGKILL);
-	}
-	for (i = 0; i < n; i++) {
-		(void)shim_waitpid(pids[i], &status, 0);
-	}
+	stress_kill_and_wait_many(args, pids, n, SIGALRM, true);
 close_clean:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 	(void)close(fd);
diff -pruN 0.15.07-1/stress-fifo.c 0.15.08-1/stress-fifo.c
--- 0.15.07-1/stress-fifo.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fifo.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_SELECT_H)
 #include <sys/select.h>
@@ -244,7 +245,7 @@ static int stress_fifo(const stress_args
 		goto tidy;
 	}
 
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 	for (i = 0; i < fifo_readers; i++) {
 		pids[i] = fifo_spawn(args, stress_fifo_reader, args->name, fifoname, fifo_data_size);
 		if (pids[i] < 0) {
@@ -270,7 +271,7 @@ static int stress_fifo(const stress_args
 		goto reap;
 	}
 
-	(void)memset(buf, 0xaa, sizeof(buf));
+	(void)shim_memset(buf, 0xaa, sizeof(buf));
 	buf[0] = 0ULL;
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
@@ -307,14 +308,7 @@ static int stress_fifo(const stress_args
 	(void)close(fd);
 reap:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
-	for (i = 0; i < fifo_readers; i++) {
-		if (pids[i] > 0) {
-			int status;
-
-			(void)stress_killpid(pids[i]);
-			(void)shim_waitpid(pids[i], &status, 0);
-		}
-	}
+	stress_kill_and_wait_many(args, pids, fifo_readers, SIGALRM, false);
 tidy:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 	(void)shim_unlink(fifoname);
diff -pruN 0.15.07-1/stress-file-ioctl.c 0.15.08-1/stress-file-ioctl.c
--- 0.15.07-1/stress-file-ioctl.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-file-ioctl.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_FS_H)
 #include <linux/fs.h>
@@ -288,14 +289,14 @@ static int stress_file_ioctl(const stres
 			const off_t sz = 4096 * (stress_mwc8() & 0x3);
 			const off_t offset = (stress_mwc8() * 4096) & (file_sz - 1);
 
-			(void)memset(&fcr, 0, sizeof(fcr));
+			(void)shim_memset(&fcr, 0, sizeof(fcr));
 			fcr.src_fd = fd;
 			fcr.src_offset = (uint64_t)offset;
 			fcr.src_length = (uint64_t)sz;
 			fcr.dest_offset = (uint64_t)offset;
 			VOID_RET(int, ioctl(dfd, FICLONERANGE, &fcr));
 
-			(void)memset(&fcr, 0, sizeof(fcr));
+			(void)shim_memset(&fcr, 0, sizeof(fcr));
 			fcr.src_fd = fd;
 			fcr.src_offset = 0;
 			fcr.src_length = file_sz;
@@ -303,21 +304,21 @@ static int stress_file_ioctl(const stres
 			VOID_RET(int, ioctl(dfd, FICLONERANGE, &fcr));
 
 			/* Exercise invalid parameters */
-			(void)memset(&fcr, 0, sizeof(fcr));
+			(void)shim_memset(&fcr, 0, sizeof(fcr));
 			fcr.src_fd = fd;
 			fcr.src_offset = 0ULL;
 			fcr.src_length = (uint64_t)~0ULL;	/* invalid length */
 			fcr.dest_offset = 0ULL;
 			VOID_RET(int, ioctl(dfd, FICLONERANGE, &fcr));
 
-			(void)memset(&fcr, 0, sizeof(fcr));
+			(void)shim_memset(&fcr, 0, sizeof(fcr));
 			fcr.src_fd = dfd;	/* invalid fd */
 			fcr.src_offset = 0;
 			fcr.src_length = 0;
 			fcr.dest_offset = 0;
 			VOID_RET(int, ioctl(dfd, FICLONERANGE, &fcr));
 
-			(void)memset(&fcr, 0, sizeof(fcr));
+			(void)shim_memset(&fcr, 0, sizeof(fcr));
 			fcr.src_fd = dfd;
 			fcr.src_offset = file_sz;	/* invalid offset */
 			fcr.src_length = 4096;
@@ -413,20 +414,20 @@ static int stress_file_ioctl(const stres
 		{
 			struct shim_space_resv r;
 
-			(void)memset(&r, 0, sizeof(r));
+			(void)shim_memset(&r, 0, sizeof(r));
 			r.l_whence = SEEK_SET;
 			r.l_start = (int64_t)0;
 			r.l_len = (int64_t)file_sz * 2;
 			VOID_RET(int, ioctl(fd, FS_IOC_RESVSP, &r));
 
 			if (lseek(fd, (off_t)0, SEEK_SET) != (off_t)-1) {
-				(void)memset(&r, 0, sizeof(r));
+				(void)shim_memset(&r, 0, sizeof(r));
 				r.l_whence = SEEK_CUR;
 				r.l_start = (int64_t)0;
 				r.l_len = (int64_t)file_sz;
 				VOID_RET(int, ioctl(fd, FS_IOC_RESVSP, &r));
 
-				(void)memset(&r, 0, sizeof(r));
+				(void)shim_memset(&r, 0, sizeof(r));
 				r.l_whence = SEEK_END;
 				r.l_start = (int64_t)0;
 				r.l_len = (int64_t)1;
@@ -442,7 +443,7 @@ static int stress_file_ioctl(const stres
 		{
 			struct shim_space_resv r;
 
-			(void)memset(&r, 0, sizeof(r));
+			(void)shim_memset(&r, 0, sizeof(r));
 			r.l_whence = SEEK_SET;
 			r.l_start = (int64_t)0;
 			r.l_len = (int64_t)file_sz * 2;
@@ -450,13 +451,13 @@ static int stress_file_ioctl(const stres
 			VOID_RET(int, ioctl(fd, FS_IOC_RESVSP64, &r));
 
 			if (lseek(fd, (off_t)0, SEEK_SET) != (off_t)-1) {
-				(void)memset(&r, 0, sizeof(r));
+				(void)shim_memset(&r, 0, sizeof(r));
 				r.l_whence = SEEK_CUR;
 				r.l_start = (int64_t)0;
 				r.l_len = (int64_t)file_sz;
 				VOID_RET(int, ioctl(fd, FS_IOC_RESVSP64, &r));
 
-				(void)memset(&r, 0, sizeof(r));
+				(void)shim_memset(&r, 0, sizeof(r));
 				r.l_whence = SEEK_END;
 				r.l_start = (int64_t)0;
 				r.l_len = (int64_t)1;
@@ -472,7 +473,7 @@ static int stress_file_ioctl(const stres
 		{
 			struct shim_space_resv r;
 
-			(void)memset(&r, 0, sizeof(r));
+			(void)shim_memset(&r, 0, sizeof(r));
 			r.l_whence = SEEK_SET;
 			r.l_start = (int64_t)file_sz;
 			r.l_len = (int64_t)file_sz * 2;
@@ -488,7 +489,7 @@ static int stress_file_ioctl(const stres
 		{
 			struct shim_space_resv r;
 
-			(void)memset(&r, 0, sizeof(r));
+			(void)shim_memset(&r, 0, sizeof(r));
 			r.l_whence = SEEK_SET;
 			r.l_start = (int64_t)file_sz;
 			r.l_len = (int64_t)file_sz * 2;
@@ -504,7 +505,7 @@ static int stress_file_ioctl(const stres
 		{
 			struct shim_space_resv r;
 
-			(void)memset(&r, 0, sizeof(r));
+			(void)shim_memset(&r, 0, sizeof(r));
 			r.l_whence = SEEK_SET;
 			r.l_start = (int64_t)0;
 			r.l_len = (int64_t)file_sz / 2;
diff -pruN 0.15.07-1/stress-filename.c 0.15.08-1/stress-filename.c
--- 0.15.07-1/stress-filename.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-filename.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_STATVFS_H)
 #include <sys/statvfs.h>
@@ -348,7 +349,7 @@ static int stress_filename(const stress_
 	}
 
 #if defined(HAVE_SYS_STATVFS_H)
-	(void)memset(&buf, 0, sizeof(buf));
+	(void)shim_memset(&buf, 0, sizeof(buf));
 	if (statvfs(pathname, &buf) < 0) {
 		pr_fail("%s: statvfs %s failed, errno=%d (%s)%s\n",
 			args->name, pathname, errno, strerror(errno),
@@ -444,6 +445,7 @@ again:
 			if (errno != EINTR)
 				pr_dbg("%s: waitpid(): errno=%d (%s)\n",
 					args->name, errno, strerror(errno));
+			force_killed_counter(args);
 			(void)kill(pid, SIGTERM);
 			(void)kill(pid, SIGKILL);
 			(void)shim_waitpid(pid, &status, 0);
diff -pruN 0.15.07-1/stress-flock.c 0.15.08-1/stress-flock.c
--- 0.15.07-1/stress-flock.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-flock.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"flock N",	"start N workers locking a single file" },
@@ -44,7 +45,6 @@ static void stress_flock_child(
 	double rate;
 
 	for (i = 0; ; i++) {
-		int ret;
 		double t;
 
 #if defined(LOCK_EX)
@@ -97,11 +97,15 @@ static void stress_flock_child(
 		/*
 		 *  Exercise flock with invalid operation
 		 */
-		ret = flock(fd, LOCK_NB);
-		if (ret == 0) {
-			pr_fail("%s: flock failed expected EINVAL, instead got "
-				"errno=%d (%s)\n", args->name, errno, strerror(errno));
-			(void)flock(fd, LOCK_UN);
+		{
+			int ret;
+
+			ret = flock(fd, LOCK_NB);
+			if (ret == 0) {
+				pr_fail("%s: flock failed expected EINVAL, instead got "
+					"errno=%d (%s)\n", args->name, errno, strerror(errno));
+				(void)flock(fd, LOCK_UN);
+			}
 		}
 #else
 		UNEXPECTED
@@ -279,7 +283,7 @@ static int stress_flock(const stress_arg
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 	for (i = 0; i < MAX_FLOCK_STRESSORS; i++) {
 		pids[i] = fork();
 		if (pids[i] < 0) {
@@ -299,16 +303,7 @@ reap:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
 	(void)close(fd);
-
-	for (i = 0; i < MAX_FLOCK_STRESSORS; i++) {
-		if (pids[i] > 0) {
-			int status;
-
-			(void)kill(pids[i], SIGKILL);
-			(void)shim_waitpid(pids[i], &status, 0);
-		}
-	}
-
+	stress_kill_and_wait_many(args, pids, MAX_FLOCK_STRESSORS, SIGALRM, true);
 	(void)shim_unlink(filename);
 err:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
diff -pruN 0.15.07-1/stress-fma.c 0.15.08-1/stress-fma.c
--- 0.15.07-1/stress-fma.c	1970-01-01 00:00:00.000000000 +0000
+++ 0.15.08-1/stress-fma.c	2023-05-21 14:30:06.000000000 +0000
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2021-2023 Colin Ian King
+ *
+ * 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.
+ *
+ */
+#include "stress-ng.h"
+#include "core-arch.h"
+#include "core-put.h"
+#include "core-pragma.h"
+#include "core-target-clones.h"
+
+#define FMA_ELEMENTS	(512)
+#define FMA_UNROLL	(8)
+
+typedef struct {
+	double	double_init[FMA_ELEMENTS];
+	double	double_a[FMA_ELEMENTS];
+
+	float	float_init[FMA_ELEMENTS];
+	float	float_a[FMA_ELEMENTS];
+
+	double	double_b;
+	double	double_c;
+
+	float	float_b;
+	float	float_c;
+} stress_fma_t;
+
+typedef void (*stress_fma_func)(stress_fma_t *fma);
+
+static const stress_help_t help[] = {
+	{ NULL,	"fma N",	"start N workers performing floating point multiply-add ops" },
+	{ NULL,	"fma-ops N",	"stop after N floating point multiply-add bogo operations" },
+	{ NULL,	NULL,		 NULL }
+};
+
+static inline double stress_fma_rnd_float(void)
+{
+	register const float fhalfpwr32 = (float)1.0 / (float)(0x80000000);
+
+	return (float)stress_mwc32() * fhalfpwr32;
+}
+
+static void TARGET_CLONES stress_fma_add132_double(stress_fma_t *fma)
+{
+	register size_t i;
+	register double *a = fma->double_a;
+	register double b = fma->double_b;
+	register double c = fma->double_c;
+
+PRAGMA_UNROLL_N(FMA_UNROLL)
+	for (i = 0; i < FMA_ELEMENTS; i++)
+		a[i] = a[i] * c + b;
+}
+
+static void TARGET_CLONES stress_fma_add132_float(stress_fma_t *fma)
+{
+	register size_t i;
+	register float *a = fma->float_a;
+	register float b = fma->float_b;
+	register float c = fma->float_c;
+
+PRAGMA_UNROLL_N(FMA_UNROLL)
+	for (i = 0; i < FMA_ELEMENTS; i++)
+		a[i] = a[i] * c + b;
+}
+
+static void TARGET_CLONES stress_fma_add213_double(stress_fma_t *fma)
+{
+	register size_t i;
+	register double *a = fma->double_a;
+	register double b = fma->double_b;
+	register double c = fma->double_c;
+
+PRAGMA_UNROLL_N(FMA_UNROLL)
+	for (i = 0; i < FMA_ELEMENTS; i++)
+		a[i] = b * a[i] + c;
+}
+
+static void TARGET_CLONES stress_fma_add213_float(stress_fma_t *fma)
+{
+	register size_t i;
+	register float *a = fma->float_a;
+	register float b = fma->float_b;
+	register float c = fma->float_c;
+
+PRAGMA_UNROLL_N(FMA_UNROLL)
+	for (i = 0; i < FMA_ELEMENTS; i++)
+		a[i] = b * a[i] + c;
+}
+
+static void TARGET_CLONES stress_fma_add231_double(stress_fma_t *fma)
+{
+	register size_t i;
+	register double *a = fma->double_a;
+	register double b = fma->double_b;
+	register double c = fma->double_c;
+
+PRAGMA_UNROLL_N(FMA_UNROLL)
+	for (i = 0; i < FMA_ELEMENTS; i++)
+		a[i] = b * c + a[i];
+}
+
+static void TARGET_CLONES stress_fma_add231_float(stress_fma_t *fma)
+{
+	register size_t i;
+	register float *a = fma->float_a;
+	register float b = fma->float_b;
+	register float c = fma->float_c;
+
+PRAGMA_UNROLL_N(FMA_UNROLL)
+	for (i = 0; i < FMA_ELEMENTS; i++)
+		a[i] = b * c + a[i];
+}
+
+stress_fma_func stress_fma_funcs[] = {
+	stress_fma_add132_double,
+	stress_fma_add132_float,
+	stress_fma_add213_double,
+	stress_fma_add213_float,
+	stress_fma_add231_double,
+	stress_fma_add231_float,
+};
+
+static inline void stress_fma_init(stress_fma_t *fma)
+{
+	register size_t i;
+
+	for (i = 0; i < FMA_ELEMENTS; i++) {
+		register const float rnd = stress_fma_rnd_float();
+
+		fma->double_init[i] = (double)rnd;
+		fma->float_init[i] = rnd;
+	}
+}
+
+static inline  void stress_fma_reset_a(stress_fma_t *fma)
+{
+	register size_t i;
+
+	for (i = 0; i < FMA_ELEMENTS; i++)
+		fma->double_a[i] = fma->double_init[i];
+
+	for (i = 0; i < FMA_ELEMENTS; i++)
+		fma->float_a[i] = fma->float_init[i];
+}
+
+static int stress_fma(const stress_args_t *args)
+{
+	stress_fma_t *fma;
+	register size_t idx_b = 0, idx_c = 0;
+
+	fma = (stress_fma_t *)mmap(NULL, sizeof(*fma), PROT_READ | PROT_WRITE,
+				MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+	if (fma == MAP_FAILED) {
+		pr_inf("%s: failed to mmap %zd bytes for FMA data\n",
+			args->name, sizeof(*fma));
+		return EXIT_NO_RESOURCE;
+	}
+
+	stress_set_proc_state(args->name, STRESS_STATE_RUN);
+	stress_fma_init(fma);
+
+	do {
+		size_t i;
+
+		stress_fma_reset_a(fma);
+
+		idx_b++;
+		if (idx_b >= FMA_ELEMENTS)
+			idx_b = 0;
+		idx_c += 3;
+		if (idx_c >= FMA_ELEMENTS)
+			idx_c = 0;
+
+		fma->double_b = fma->double_a[idx_b];
+		fma->double_c = fma->double_a[idx_c];
+
+		fma->float_b = fma->float_a[idx_b];
+		fma->float_c = fma->float_a[idx_c];
+
+		for (i = 0; i < SIZEOF_ARRAY(stress_fma_funcs); i++)
+			stress_fma_funcs[i](fma);
+		inc_counter(args);
+	} while (keep_stressing(args));
+
+	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
+
+	(void)munmap((void *)fma, sizeof(*fma));
+
+	return EXIT_SUCCESS;
+}
+
+stressor_info_t stress_fma_info = {
+	.stressor = stress_fma,
+	.class = CLASS_CPU,
+	.help = help
+};
diff -pruN 0.15.07-1/stress-fork.c 0.15.08-1/stress-fork.c
--- 0.15.07-1/stress-fork.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fork.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 
 #define MIN_FORKS		(1)
@@ -113,7 +114,7 @@ static int stress_fork_fn(
 		NOCLOBBER uint32_t i, n;
 		NOCLOBBER char *fork_fn_name;
 
-		(void)memset(info, 0, sizeof(info));
+		(void)shim_memset(info, 0, sizeof(info));
 
 		for (n = 0; n < fork_max; n++) {
 			pid_t pid;
@@ -140,12 +141,11 @@ static int stress_fork_fn(
 			}
 
 			if (pid == 0) {
-#if defined(HAVE_GETPGID)
-				const pid_t my_pid = getpid();
-				const pid_t my_pgid = getpgid(my_pid);
-#else
-				UNEXPECTED
-#endif
+				/*
+				 *  50% of forks are short lived exiting processes
+				 */
+				if (n & 1)
+					goto fast_exit;
 
 				/*
 				 *  With new session and capabilities
@@ -209,7 +209,12 @@ static int stress_fork_fn(
 				/* exercise some setpgid calls before we die */
 				VOID_RET(int, setpgid(0, 0));
 #if defined(HAVE_GETPGID)
-				VOID_RET(int, setpgid(my_pid, my_pgid));
+				{
+					const pid_t my_pid = getpid();
+					const pid_t my_pgid = getpgid(my_pid);
+
+					VOID_RET(int, setpgid(my_pid, my_pgid));
+				}
 #else
 				UNEXPECTED
 #endif
@@ -218,7 +223,7 @@ static int stress_fork_fn(
 				VOID_RET(int, setpgid(0, -1));
 				/* -ve pid is EINVAL */
 				VOID_RET(int, setpgid(-1, 0));
-
+fast_exit:
 				(void)shim_sched_yield();
 				stress_set_proc_state(args->name, STRESS_STATE_ZOMBIE);
 				_exit(0);
@@ -233,7 +238,6 @@ static int stress_fork_fn(
 			if (info[i].pid > 0) {
 				int status;
 				/* Parent, kill and then wait for child */
-				/* (void)kill(info[i].pid, SIGKILL); no need to kill */
 				(void)shim_waitpid(info[i].pid, &status, 0);
 				inc_counter(args);
 			}
diff -pruN 0.15.07-1/stress-fp.c 0.15.08-1/stress-fp.c
--- 0.15.07-1/stress-fp.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fp.c	2023-05-21 14:30:06.000000000 +0000
@@ -206,7 +206,7 @@ static double TARGET_CLONES OPTIMIZE3 na
 	}							\
 								\
 	t1 = stress_time_now();					\
-	for (i = 0; keep_stressing_flag() && i < loops ; i++) {	\
+	for (i = 0; keep_stressing_flag() && (i < loops); i++) {\
 		fp_data[0].field.r /= fp_data[0].field.mul;	\
 		fp_data[0].field.r /= fp_data[0].field.mul_rev;	\
 		fp_data[1].field.r /= fp_data[1].field.mul;	\
@@ -495,7 +495,7 @@ static int stress_fp(const stress_args_t
 		for (i = 1; i < SIZEOF_ARRAY(stress_fp_funcs); i++) {
 			const double ops = stress_fp_funcs[i].ops;
 			const double duration = stress_fp_funcs[i].duration;
-			if (duration > 0.0 && ops > 0.0) {
+			if ((duration > 0.0) && (ops > 0.0)) {
 				char msg[64];
 				const double rate = stress_fp_funcs[i].ops / stress_fp_funcs[i].duration;
 
diff -pruN 0.15.07-1/stress-fpunch.c 0.15.08-1/stress-fpunch.c
--- 0.15.07-1/stress-fpunch.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fpunch.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"fpunch N",	"start N workers punching holes in a 16MB file" },
@@ -240,8 +241,8 @@ static int stress_fpunch(const stress_ar
 
 	stress_file_rw_hint_short(fd);
 
-	(void)memset(buf_before, 0xff, (size_t)BUF_SIZE);
-	(void)memset(buf_after, 0xa5, (size_t)BUF_SIZE);
+	(void)shim_memset(buf_before, 0xff, (size_t)BUF_SIZE);
+	(void)shim_memset(buf_after, 0xa5, (size_t)BUF_SIZE);
 
 	/*
 	 *  Create file with lots of holes and extents by populating
@@ -271,7 +272,7 @@ static int stress_fpunch(const stress_ar
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 	for (i = 0; i < STRESS_PUNCH_PIDS; i++) {
 		pids[i] = fork();
 		if (pids[i] == 0) {
@@ -284,17 +285,7 @@ static int stress_fpunch(const stress_ar
 	/* Wait for test run duration to complete */
 	(void)sleep((unsigned int)g_opt_timeout);
 
-	for (i = 0; i < STRESS_PUNCH_PIDS; i++) {
-		if (pids[i] > 1)
-			(void)kill(pids[i], SIGKILL);
-	}
-	for (i = 0; i < STRESS_PUNCH_PIDS; i++) {
-		if (pids[i] > 1) {
-			int status;
-
-			(void)waitpid(pids[i], &status, 0);
-		}
-	}
+	stress_kill_and_wait_many(args, pids, STRESS_PUNCH_PIDS, SIGALRM, true);
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
diff -pruN 0.15.07-1/stress-fstat.c 0.15.08-1/stress-fstat.c
--- 0.15.07-1/stress-fstat.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-fstat.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MAX_FSTAT_THREADS	(4)
 #define FSTAT_LOOPS		(16)
@@ -210,8 +211,8 @@ static void stress_fstat_threads(const s
 
 	keep_running = true;
 #if defined(HAVE_LIB_PTHREAD)
-	(void)memset(ret, 0, sizeof(ret));
-	(void)memset(pthreads, 0, sizeof(pthreads));
+	(void)shim_memset(ret, 0, sizeof(ret));
+	(void)shim_memset(pthreads, 0, sizeof(pthreads));
 
 	for (i = 0; i < MAX_FSTAT_THREADS; i++) {
 		ret[i] = pthread_create(&pthreads[i], NULL,
@@ -296,7 +297,7 @@ static int stress_fstat(const stress_arg
 	do {
 		stat_some = false;
 
-		for (si = stat_info; keep_stressing_flag() && si; si = si->next) {
+		for (si = stat_info; si && keep_stressing_flag(); si = si->next) {
 			if (!keep_stressing(args))
 				break;
 			if (si->ignore == IGNORE_ALL)
diff -pruN 0.15.07-1/stress-funcret.c 0.15.08-1/stress-funcret.c
--- 0.15.07-1/stress-funcret.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-funcret.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 typedef void (*stress_funcret_func)(const stress_args_t *argse);
 
@@ -55,8 +56,8 @@ static type NOINLINE stress_funcret_ ##
 {								\
 	type b;							\
 								\
-	(void)memcpy(&b, &a, sizeof(a));			\
-	(void)memset(&a, 0, sizeof(a));				\
+	(void)shim_memcpy(&b, &a, sizeof(a));			\
+	(void)shim_memset(&a, 0, sizeof(a));			\
 	return b;						\
 }								\
 
@@ -67,8 +68,8 @@ static type NOINLINE stress_funcret_deep
 {								\
 	type b;							\
 								\
-	(void)memcpy(&b, &a, sizeof(a));			\
-	(void)memset(&a, 0, sizeof(a));				\
+	(void)shim_memcpy(&b, &a, sizeof(a));			\
+	(void)shim_memset(&a, 0, sizeof(a));			\
 	return stress_funcret_ ## type ## 1(b);			\
 }								\
 
@@ -79,8 +80,8 @@ static type NOINLINE stress_funcret_deep
 {								\
 	type b;							\
 								\
-	(void)memcpy(&b, &a, sizeof(a));			\
-	(void)memset(&a, 0, sizeof(a));				\
+	(void)shim_memcpy(&b, &a, sizeof(a));			\
+	(void)shim_memset(&a, 0, sizeof(a));			\
 								\
 	return stress_funcret_deep_ ## type ## 1(		\
 		stress_funcret_ ## type ## 1(b));		\
diff -pruN 0.15.07-1/stress-futex.c 0.15.08-1/stress-futex.c
--- 0.15.07-1/stress-futex.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-futex.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_FUTEX_H)
 #include <linux/futex.h>
@@ -47,10 +48,10 @@ static int stress_futex_wait(uint32_t *f
 	static int try_futex_waitv = true;
 	static int try = 0;
 
-	if (try_futex_waitv && try++ > 16) {
+	if (try_futex_waitv && (try++ > 16)) {
 		struct shim_futex_waitv w;
 
-		(void)memset(&w, 0, sizeof(w));
+		(void)shim_memset(&w, 0, sizeof(w));
 
 		w.val = (uint64_t)val;
 		w.uaddr = (uintptr_t)futex;
diff -pruN 0.15.07-1/stress-get.c 0.15.08-1/stress-get.c
--- 0.15.07-1/stress-get.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-get.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_LINUX_SYSCTL_H)
@@ -319,7 +320,7 @@ static int stress_get(const stress_args_
 		 *  system call if possible. Memset gids to zero to keep
 		 *  valgrind happy.
 		 */
-		(void)memset(gids, 0, sizeof(gids));
+		(void)shim_memset(gids, 0, sizeof(gids));
 		VOID_RET(long, syscall(__NR_getgroups, -1, gids));
 #endif
 		if (!keep_stressing_flag())
@@ -488,7 +489,7 @@ static int stress_get(const stress_args_
 			size_t kern_version_len = 0;
 			struct __sysctl_args sysctl_args;
 
-			(void)memset(&sysctl_args, 0, sizeof(sysctl_args));
+			(void)shim_memset(&sysctl_args, 0, sizeof(sysctl_args));
 			sysctl_args.name = name;
 			sysctl_args.nlen = SIZEOF_ARRAY(name);
 			sysctl_args.oldval = kern_version;
@@ -690,7 +691,7 @@ static int stress_get(const stress_args_
 
 #if defined(HAVE_SYS_TIMEX_H) &&	\
     defined(HAVE_ADJTIME)
-		(void)memset(&delta, 0, sizeof(delta));
+		(void)shim_memset(&delta, 0, sizeof(delta));
 		ret = adjtime(&delta, &tv);
 		if (cap_sys_time && verify && (ret < 0) && (errno != EPERM))
 			pr_fail("%s: adjtime failed, errno=%d (%s)\n",
diff -pruN 0.15.07-1/stress-getdent.c 0.15.08-1/stress-getdent.c
--- 0.15.07-1/stress-getdent.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-getdent.c	2023-05-21 14:30:06.000000000 +0000
@@ -86,7 +86,8 @@ static inline int stress_getdents_rand(
 				return ret;
 		}
 		j++;
-		j = j % n;
+		if (j >= n)
+			j -= n;
 	}
 	pr_fail("%s: getdents: errno=%d (%s)%s\n",
 		args->name, -ret, strerror(-ret), stress_fs_type(path));
diff -pruN 0.15.07-1/stress-handle.c 0.15.08-1/stress-handle.c
--- 0.15.07-1/stress-handle.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-handle.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"handle N",	"start N workers exercising name_to_handle_at" },
@@ -69,7 +70,7 @@ static int get_mount_info(const stress_a
 		return -1;
 	}
 
-	(void)memset(&mount_info, 0, sizeof(mount_info));
+	(void)shim_memset(&mount_info, 0, sizeof(mount_info));
 
 	while (mounts < MAX_MOUNT_IDS) {
 		char mount_path[PATH_MAX + 1];
diff -pruN 0.15.07-1/stress-hash.c 0.15.08-1/stress-hash.c
--- 0.15.07-1/stress-hash.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-hash.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-hash.h"
 #if defined(HAVE_XXHASH_H)
 #include <xxhash.h>
@@ -83,7 +84,7 @@ static void stress_hash_generic(
 		stress_mwc_reseed();
 	}
 
-	(void)memset(bucket->buckets, 0, bucket->size);
+	(void)shim_memset(bucket->buckets, 0, bucket->size);
 
 	stress_uint8rnd4((uint8_t *)bucket->buffer, bucket->n_keys);
 	/* Make it ASCII range ' '..'_' */
@@ -709,7 +710,7 @@ static int HOT OPTIMIZE3 stress_hash(con
 		for (i = 1; hash_methods[i].name; i++) {
 			stress_hash_stats_t *stats = hash_methods[i].stats;
 
-			if (stats->duration > 0.0 && stats->total > 0) {
+			if ((stats->duration > 0.0) && (stats->total > 0)) {
 				const double rate = (double)((stats->duration > 0.0) ?
 					(double)stats->total / stats->duration : (double)0.0);
 
diff -pruN 0.15.07-1/stress-hdd.c 0.15.08-1/stress-hdd.c
--- 0.15.07-1/stress-hdd.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-hdd.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 
 #if defined(HAVE_SYS_UIO_H)
@@ -756,7 +757,7 @@ static int stress_hdd(const stress_args_
 	}
 	buf = (uint8_t *)stress_align_address(alloc_buf, BUF_ALIGNMENT);
 #endif
-	(void)memset(buf, stress_mwc8(), hdd_write_size);
+	(void)shim_memset(buf, stress_mwc8(), hdd_write_size);
 	(void)stress_temp_filename_args(args,
 		filename, sizeof(filename), stress_mwc32());
 
@@ -1041,7 +1042,7 @@ rnd_rd_retry:
 								baddata++;
 						} else {
 							/* Write rnd has written to some of the file, so data either zero or OK */
-							if (buf[j] != 0 && buf[j] != v)
+							if ((buf[j] != 0) && (buf[j] != v))
 								baddata++;
 						}
 					}
diff -pruN 0.15.07-1/stress-hrtimers.c 0.15.08-1/stress-hrtimers.c
--- 0.15.07-1/stress-hrtimers.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-hrtimers.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"hrtimers N",	  "start N workers that exercise high resolution timers" },
@@ -113,7 +114,7 @@ static void MLOCKED_TEXT OPTIMIZE3 stres
 cancel:
 	keep_stressing_set_flag(false);
 	/* Cancel timer if we detect no more runs */
-	(void)memset(&timer, 0, sizeof(timer));
+	(void)shim_memset(&timer, 0, sizeof(timer));
 	(void)timer_settime(timerid, 0, &timer, NULL);
 	(void)kill(getpid(), SIGALRM);
 }
@@ -138,14 +139,14 @@ static int stress_hrtimer_process(const
 
 	start = stress_time_now();
 
-	(void)memset(&action, 0, sizeof action);
+	(void)shim_memset(&action, 0, sizeof action);
 	action.sa_handler = stress_hrtimers_handler;
 	(void)sigemptyset(&action.sa_mask);
 
 	if (sigaction(SIGRTMIN, &action, NULL) < 0)
 		return EXIT_FAILURE;
 
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
@@ -196,7 +197,7 @@ static int stress_hrtimers(const stress_
 	ns_delay = hrtimers_adjust ? 10000 : -1;
 	max_ops = args->max_ops / PROCS_MAX;
 
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
 	for (i = 0; i < PROCS_MAX; i++) {
@@ -227,20 +228,9 @@ static int stress_hrtimers(const stress_
 reap:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
-	for (i = 0; i < PROCS_MAX; i++) {
-		if (pids[i] > 0)
-			(void)kill(pids[i], SIGALRM);
-	}
+	stress_kill_and_wait_many(args, pids, PROCS_MAX, SIGALRM, true);
 	end_time = stress_time_now();
 
-	for (i = 0; i < PROCS_MAX; i++) {
-		if (pids[i] > 0) {
-			int status;
-
-			VOID_RET(int, shim_waitpid(pids[i], &status, 0));
-		}
-	}
-
 	if (start_time >= 0.0) {
 		const double dt = end_time - start_time;
 
diff -pruN 0.15.07-1/stress-hsearch.c 0.15.08-1/stress-hsearch.c
--- 0.15.07-1/stress-hsearch.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-hsearch.c	2023-05-21 14:30:06.000000000 +0000
@@ -111,7 +111,7 @@ static int stress_hsearch(const stress_a
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
 	do {
-		for (i = 0; keep_stressing_flag() && i < max; i++) {
+		for (i = 0; keep_stressing_flag() && (i < max); i++) {
 			ENTRY e, *ep;
 
 			e.key = keys[i];
diff -pruN 0.15.07-1/stress-icmp-flood.c 0.15.08-1/stress-icmp-flood.c
--- 0.15.07-1/stress-icmp-flood.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-icmp-flood.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_NETINET_IP_H)
@@ -77,7 +78,7 @@ static int stress_icmp_flood(const stres
 	struct icmphdr *const icmp_hdr = (struct icmphdr *)(pkt + sizeof(struct iphdr));
 	char *const payload = pkt + sizeof(struct iphdr) + sizeof(struct icmphdr);
 
-	(void)memset(pkt, 0, sizeof(pkt));
+	(void)shim_memset(pkt, 0, sizeof(pkt));
 	stress_rndbuf(payload, MAX_PAYLOAD_SIZE);
 
 	fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
@@ -101,7 +102,7 @@ static int stress_icmp_flood(const stres
 
 	servaddr.sin_family = AF_INET;
 	servaddr.sin_addr.s_addr = (in_addr_t)addr;
-	(void)memset(&servaddr.sin_zero, 0, sizeof(servaddr.sin_zero));
+	(void)shim_memset(&servaddr.sin_zero, 0, sizeof(servaddr.sin_zero));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
@@ -112,7 +113,7 @@ static int stress_icmp_flood(const stres
 			sizeof(struct iphdr) + sizeof(struct icmphdr) + payload_len;
 		ssize_t ret;
 
-		(void)memset(pkt, 0, sizeof(pkt));
+		(void)shim_memset(pkt, 0, sizeof(pkt));
 
 		ip_hdr->version = 4;
 		ip_hdr->ihl = 5;
diff -pruN 0.15.07-1/stress-idle-page.c 0.15.08-1/stress-idle-page.c
--- 0.15.07-1/stress-idle-page.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-idle-page.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 static const char bitmap_file[] = "/sys/kernel/mm/page_idle/bitmap";
@@ -78,7 +79,7 @@ static int stress_idle_page(const stress
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(bitmap_set, 0xff, sizeof(bitmap_set));
+	(void)shim_memset(bitmap_set, 0xff, sizeof(bitmap_set));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
diff -pruN 0.15.07-1/stress-inode-flags.c 0.15.08-1/stress-inode-flags.c
--- 0.15.07-1/stress-inode-flags.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-inode-flags.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pthread.h"
 
 #if defined(HAVE_LIBGEN_H)
@@ -150,9 +151,9 @@ static inline void stress_inode_flags_io
  */
 static int stress_inode_flags_stressor(
 	const stress_args_t *args,
-	stress_data_t *data)
+	const stress_data_t *data)
 {
-	int index = 0;
+	size_t index = 0;
 
 	while (keep_running && keep_stressing(args)) {
 		size_t i;
@@ -161,7 +162,8 @@ static int stress_inode_flags_stressor(
 		stress_inode_flags_ioctl(args, data->dir_fd, inode_flag_perms[index]);
 		stress_inode_flags_ioctl(args, data->file_fd, inode_flag_perms[index]);
 		index++;
-		index %= inode_flag_count;
+		if (index >= inode_flag_count)
+			index = 0;
 		stress_inode_flags_ioctl_sane(data->dir_fd);
 		stress_inode_flags_ioctl_sane(data->file_fd);
 
@@ -258,7 +260,7 @@ static int stress_inode_flags(const stre
 		goto tidy_dir_fd;
 	}
 
-	(void)memset(ret, 0, sizeof(ret));
+	(void)shim_memset(ret, 0, sizeof(ret));
 	keep_running = true;
 
 	for (i = 0; i < MAX_INODE_FLAG_THREADS; i++) {
diff -pruN 0.15.07-1/stress-inotify.c 0.15.08-1/stress-inotify.c
--- 0.15.07-1/stress-inotify.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-inotify.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,8 +17,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  */
-
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_EPOLL_H)
 #include <sys/epoll.h>
@@ -215,7 +215,7 @@ retry:
 			return;
 
 		/* This is just so wrong... */
-		if (n < 10000 && errno == EMFILE) {
+		if ((n < 10000) && (errno == EMFILE)) {
 			/*
 			 * inotify cleanup may be still running from a previous
 			 * iteration, in which case we've run out of resources
@@ -224,8 +224,8 @@ retry:
 			(void)shim_usleep(10000);
 			goto retry;
 		}
-		/* Nope, give up */
-		pr_fail("%s: inotify_init failed: errno=%d (%s) after %" PRIu32 " calls\n",
+		/* Nope, give up, not necessarily a test failure, we maybe low on fds */
+		pr_warn("%s: inotify_init failed: errno=%d (%s) after %" PRIu32 " calls\n",
 			args->name, errno, strerror(errno), n);
 		return;
 	}
@@ -330,7 +330,7 @@ cleanup:
  */
 static int rm_file(const stress_args_t *args, const char *path)
 {
-	if ((shim_unlink(path) < 0) && errno != ENOENT) {
+	if ((shim_unlink(path) < 0) && (errno != ENOENT)) {
 		pr_err("%s: cannot remove file %s: errno=%d (%s)\n",
 			args->name, path, errno, strerror(errno));
 		return -1;
@@ -405,7 +405,7 @@ static int mk_file(const stress_args_t *
 		return -1;
 	}
 
-	(void)memset(buffer, 'x', BUF_SIZE);
+	(void)shim_memset(buffer, 'x', BUF_SIZE);
 	while (keep_stressing(args) && (sz > 0)) {
 		size_t n = (sz > BUF_SIZE) ? BUF_SIZE : sz;
 		ssize_t ret;
diff -pruN 0.15.07-1/stress-io-uring.c 0.15.08-1/stress-io-uring.c
--- 0.15.07-1/stress-io-uring.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-io-uring.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "io-uring.h"
 
 #if defined(HAVE_LINUX_IO_URING_H)
@@ -31,7 +32,7 @@
 static const stress_help_t help[] = {
 	{ NULL,	"io-uring N",		"start N workers that issue io-uring I/O requests" },
 	{ NULL,	"io-uring-ops N",	"stop after N bogo io-uring I/O requests" },
-	{ NULL,	NULL,		NULL }
+	{ NULL,	NULL,			NULL }
 };
 
 #if defined(HAVE_LINUX_IO_URING_H) &&	\
@@ -56,13 +57,13 @@ static const stress_help_t help[] = {
      defined(HAVE_IORING_OP_GETXATTR) || \
      defined(HAVE_IORING_OP_SYNC_FILE_RANGE))
 
-
-
 /*
  *  io uring file info
  */
 typedef struct {
 	int fd;			/* file descriptor */
+	int fd_at;		/* file path descriptor */
+	int fd_dup;		/* file descriptor to dup */
 	char *filename;		/* filename */
 	struct iovec *iovecs;	/* iovecs array 1 per block to submit */
 	size_t iovecs_sz;	/* size of iovecs allocation */
@@ -107,9 +108,16 @@ typedef struct {
 	size_t sq_size;
 	size_t cq_size;
 	size_t sqes_size;
+	size_t sqes_entries;
 } stress_io_uring_submit_t;
 
-typedef void (*stress_io_uring_setup)(stress_io_uring_file_t *io_uring_file, struct io_uring_sqe *sqe);
+typedef struct {
+	size_t  index;
+	uint8_t opcode;
+	bool	supported;
+} stress_io_uring_user_data_t;
+
+typedef void (*stress_io_uring_setup)(const stress_io_uring_file_t *io_uring_file, struct io_uring_sqe *sqe, const void *extra);
 
 /*
  *  opcode to human readable name lookup
@@ -126,7 +134,7 @@ static const char *stress_io_uring_opcod
  *  shim_io_uring_setup
  *	wrapper for io_uring_setup()
  */
-static int shim_io_uring_setup(unsigned entries, struct io_uring_params *p)
+static inline int shim_io_uring_setup(unsigned entries, struct io_uring_params *p)
 {
 	return (int)syscall(__NR_io_uring_setup, entries, p);
 }
@@ -135,7 +143,7 @@ static int shim_io_uring_setup(unsigned
  *  shim_io_uring_enter
  *	wrapper for io_uring_enter()
  */
-static int shim_io_uring_enter(
+static inline int shim_io_uring_enter(
 	int fd,
 	unsigned int to_submit,
 	unsigned int min_complete,
@@ -184,8 +192,14 @@ static int stress_setup_io_uring(
 	stress_uring_io_cq_ring_t *cring = &submit->cq_ring;
 	struct io_uring_params p;
 
-	(void)memset(&p, 0, sizeof(p));
-	submit->io_uring_fd = shim_io_uring_setup(256, &p);
+	(void)shim_memset(&p, 0, sizeof(p));
+	/*
+	 *  16 is plenty, with too many we end up with lots of cache
+	 *  misses, with too few we end up with ring filling. This
+	 *  seems to be a good fit with the set of requests being
+	 *  issue by this stressor
+	 */
+	submit->io_uring_fd = shim_io_uring_setup(16, &p);
 	if (submit->io_uring_fd < 0) {
 		if (errno == ENOSYS) {
 			pr_inf_skip("%s: io-uring not supported by the kernel, skipping stressor\n",
@@ -241,6 +255,7 @@ static int stress_setup_io_uring(
 	sring->flags = VOID_ADDR_OFFSET(submit->sq_mmap, p.sq_off.flags);
 	sring->array = VOID_ADDR_OFFSET(submit->sq_mmap, p.sq_off.array);
 
+	submit->sqes_entries = p.sq_entries;
 	submit->sqes_size = p.sq_entries * sizeof(struct io_uring_sqe);
 	submit->sqes_mmap = mmap(NULL, submit->sqes_size,
 			PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE,
@@ -297,9 +312,7 @@ static void stress_close_io_uring(stress
  */
 static inline int stress_io_uring_complete(
 	const stress_args_t *args,
-	stress_io_uring_submit_t *submit,
-	const uint8_t opcode,
-	bool *supported)
+	stress_io_uring_submit_t *submit)
 {
 	stress_uring_io_cq_ring_t *cring = &submit->cq_ring;
 	struct io_uring_cqe *cqe;
@@ -314,31 +327,45 @@ static inline int stress_io_uring_comple
 			break;
 
 		cqe = &cring->cqes[head & *submit->cq_ring.ring_mask];
-		if ((cqe->res < 0)
-#ifdef HAVE_IORING_OP_FALLOCATE
-			&& (opcode != IORING_OP_FALLOCATE)
-#endif
-		) {
-			const int err = abs(cqe->res);
+		stress_io_uring_user_data_t *const user_data =
+			(stress_io_uring_user_data_t *)(uintptr_t)cqe->user_data;
+		if (cqe->res < 0) {
+			int err;
 
+			err = abs(cqe->res);
 			/* Silently ignore some completion errors */
 			if ((err == EOPNOTSUPP) || (err == ENOTDIR)) {
-				*supported = false;
+				user_data->supported = false;
 			} else  {
-				pr_fail("%s: completion opcode=%d (%s), error=%d (%s)\n",
-					args->name, opcode,
-					stress_io_uring_opcode_name(opcode),
+				switch (err) {
+				/* Silently ignore some errors */
+				case ENOSPC:
+				case EFBIG:
+					goto next_head;
+				case ENOENT:
+					if (user_data->opcode == IORING_OP_ASYNC_CANCEL)
+						goto next_head;
+					break;
+				case EINVAL:
+					if (user_data->opcode == IORING_OP_FALLOCATE)
+						goto next_head;
+					break;
+				default:
+					break;
+				}
+				pr_fail("%s: completion opcode 0x%2.2x (%s), error=%d (%s)\n",
+					args->name, user_data->opcode,
+					stress_io_uring_opcode_name(user_data->opcode),
 					err, strerror(err));
 				ret = EXIT_FAILURE;
 			}
 		}
+next_head:
 		head++;
 	}
 
 	*cring->head = head;
 	shim_mb();
-	if (ret == EXIT_SUCCESS)
-		inc_counter(args);
 
 	return ret;
 }
@@ -349,26 +376,27 @@ static inline int stress_io_uring_comple
  */
 static int stress_io_uring_submit(
 	const stress_args_t *args,
-	stress_io_uring_setup setup_func,
-	stress_io_uring_file_t *io_uring_file,
+	const stress_io_uring_setup setup_func,
+	const stress_io_uring_file_t *io_uring_file,
 	stress_io_uring_submit_t *submit,
-	bool *supported)
+	stress_io_uring_user_data_t *user_data,
+	const void *extra_data)
 {
 	stress_uring_io_sq_ring_t *sring = &submit->sq_ring;
 	unsigned index = 0, tail = 0, next_tail = 0;
 	struct io_uring_sqe *sqe;
 	int ret;
-	uint8_t opcode;
 
 	next_tail = tail = *sring->tail;
 	next_tail++;
 	shim_mb();
 	index = tail & *submit->sq_ring.ring_mask;
 	sqe = &submit->sqes_mmap[index];
-	(void)memset(sqe, 0, sizeof(*sqe));
+	(void)shim_memset(sqe, 0, sizeof(*sqe));
 
-	setup_func(io_uring_file, sqe);
-	opcode = sqe->opcode;
+	setup_func(io_uring_file, sqe, extra_data);
+	/* Save opcode for later completion error reporting */
+	sqe->user_data = (uint64_t)(uintptr_t)user_data;
 
 	sring->array[index] = index;
 	tail = next_tail;
@@ -376,25 +404,94 @@ static int stress_io_uring_submit(
 		shim_mb();
 		*sring->tail = tail;
 		shim_mb();
+	} else {
+		return EXIT_FAILURE;
 	}
 
+retry:
 	ret = shim_io_uring_enter(submit->io_uring_fd, 1,
 		1, IORING_ENTER_GETEVENTS);
 	if (ret < 0) {
-		/* Silently ignore ENOSPC failures */
-		if (errno == ENOSPC)	
+		if (errno == EBUSY){
+			stress_io_uring_complete(args, submit);
+			goto retry;
+		}
+		/* Silently ignore ENOSPC or cancel opcode failures */
+		if ((errno == ENOSPC) || (sqe->opcode == IORING_OP_ASYNC_CANCEL))
 			return EXIT_SUCCESS;
 		pr_fail("%s: io_uring_enter failed, opcode=%d (%s), errno=%d (%s)\n",
-			args->name, opcode,
-			stress_io_uring_opcode_name(opcode),
+			args->name, sqe->opcode,
+			stress_io_uring_opcode_name(sqe->opcode),
 			errno, strerror(errno));
 		if (errno == EOPNOTSUPP)
-			*supported = false;
+			user_data->supported = false;
 		return EXIT_FAILURE;
 	}
+	inc_counter(args);
+	return EXIT_SUCCESS;
+}
 
-	return stress_io_uring_complete(args, submit, opcode, supported);
+#if defined(HAVE_IORING_OP_ASYNC_CANCEL)
+/*
+ *  stress_io_uring_cancel_setup()
+ *	setup cancel submit over io_uring
+ */
+static void stress_io_uring_async_cancel_setup(
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
+{
+	(void)io_uring_file;
+
+	const struct io_uring_sqe *sqe_to_cancel =
+		(const struct io_uring_sqe *)extra_info;
+
+	sqe->fd = sqe_to_cancel->fd;
+	sqe->flags = 2;
+	sqe->opcode = IORING_OP_ASYNC_CANCEL;
+	sqe->addr = sqe_to_cancel->addr;
+	sqe->off = 0;
+	sqe->len = 0;
+	sqe->splice_fd_in = 0;
+}
+
+/*
+ *  stress_io_uring_cancel_rdwr()
+ *	try to cancel pending read/writes
+ */
+static void stress_io_uring_cancel_rdwr(
+	const stress_args_t *args,
+	const stress_io_uring_file_t *io_uring_file,
+	stress_io_uring_submit_t *submit)
+{
+	size_t i;
+	stress_io_uring_user_data_t user_data;
+
+	user_data.supported = true;
+	user_data.index = -1;
+	user_data.opcode = IORING_OP_ASYNC_CANCEL;
+
+	for (i = 0; i < submit->sqes_entries; i++) {
+		struct io_uring_sqe *sqe_to_cancel = &submit->sqes_mmap[i];
+
+		if (!sqe_to_cancel->addr)
+			continue;
+
+		switch (sqe_to_cancel->opcode) {
+		case IORING_OP_READ:
+		case IORING_OP_READV:
+		case IORING_OP_WRITE:
+		case IORING_OP_WRITEV:
+			(void)stress_io_uring_submit(args, stress_io_uring_async_cancel_setup,
+				io_uring_file, submit, &user_data, (void *)sqe_to_cancel);
+			break;
+		default:
+			break;
+		}
+	}
+	(void)stress_io_uring_complete(args, submit);
 }
+#endif
 
 #if defined(HAVE_IORING_OP_READV)
 /*
@@ -402,16 +499,18 @@ static int stress_io_uring_submit(
  *	setup readv submit over io_uring
  */
 static void stress_io_uring_readv_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->fd = io_uring_file->fd;
 	sqe->flags = 0;
 	sqe->opcode = IORING_OP_READV;
 	sqe->addr = (uintptr_t)io_uring_file->iovecs;
 	sqe->len = io_uring_file->blocks;
 	sqe->off = (uint64_t)stress_mwc8() * io_uring_file->blocks;
-	sqe->user_data = (uintptr_t)io_uring_file;
 }
 #endif
 
@@ -421,16 +520,18 @@ static void stress_io_uring_readv_setup(
  *	setup writev submit over io_uring
  */
 static void stress_io_uring_writev_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->fd = io_uring_file->fd;
 	sqe->flags = 0;
 	sqe->opcode = IORING_OP_WRITEV;
 	sqe->addr = (uintptr_t)io_uring_file->iovecs;
 	sqe->len = io_uring_file->blocks;
 	sqe->off = (uint64_t)stress_mwc8() * io_uring_file->blocks;
-	sqe->user_data = (uintptr_t)io_uring_file;
 }
 #endif
 
@@ -440,16 +541,18 @@ static void stress_io_uring_writev_setup
  *	setup read submit over io_uring
  */
 static void stress_io_uring_read_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->fd = io_uring_file->fd;
 	sqe->flags = 0;
 	sqe->opcode = IORING_OP_READ;
 	sqe->addr = (uintptr_t)io_uring_file->iovecs[0].iov_base;
 	sqe->len = io_uring_file->iovecs[0].iov_len;
 	sqe->off = (uint64_t)stress_mwc8() * io_uring_file->blocks;
-	sqe->user_data = (uintptr_t)io_uring_file;
 }
 #endif
 
@@ -459,16 +562,18 @@ static void stress_io_uring_read_setup(
  *	setup write submit over io_uring
  */
 static void stress_io_uring_write_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->fd = io_uring_file->fd;
 	sqe->flags = 0;
 	sqe->opcode = IORING_OP_WRITE;
 	sqe->addr = (uintptr_t)io_uring_file->iovecs[0].iov_base;
 	sqe->len = io_uring_file->iovecs[0].iov_len;
 	sqe->off = (uint64_t)stress_mwc8() * io_uring_file->blocks;
-	sqe->user_data = (uintptr_t)io_uring_file;
 }
 #endif
 
@@ -478,14 +583,16 @@ static void stress_io_uring_write_setup(
  *	setup fsync submit over io_uring
  */
 static void stress_io_uring_fsync_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->fd = io_uring_file->fd;
 	sqe->opcode = IORING_OP_FSYNC;
 	sqe->len = 0;
 	sqe->off = 0;
-	sqe->user_data = (uintptr_t)io_uring_file;
 	sqe->ioprio = 0;
 	sqe->buf_index = 0;
 	sqe->rw_flags = 0;
@@ -498,10 +605,12 @@ static void stress_io_uring_fsync_setup(
  *	setup nop submit over io_uring
  */
 static void stress_io_uring_nop_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
 	(void)io_uring_file;
+	(void)extra_info;
 
 	sqe->opcode = IORING_OP_NOP;
 }
@@ -513,9 +622,12 @@ static void stress_io_uring_nop_setup(
  *	setup fallocate submit over io_uring
  */
 static void stress_io_uring_fallocate_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->fd = io_uring_file->fd;
 	sqe->opcode = IORING_OP_FALLOCATE;
 	sqe->off = 0;			/* offset */
@@ -533,9 +645,12 @@ static void stress_io_uring_fallocate_se
  *	setup fadvise submit over io_uring
  */
 static void stress_io_uring_fadvise_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->fd = io_uring_file->fd;
 	sqe->opcode = IORING_OP_FADVISE;
 	sqe->off = 0;			/* offset */
@@ -557,13 +672,15 @@ static void stress_io_uring_fadvise_setu
  *	setup close submit over io_uring
  */
 static void stress_io_uring_close_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
 	(void)io_uring_file;
+	(void)extra_info;
 
 	/* don't worry about bad fd if dup fails */
-	sqe->fd = dup(fileno(stdin));
+	sqe->fd = dup(io_uring_file->fd_dup);
 	sqe->opcode = IORING_OP_CLOSE;
 	sqe->ioprio = 0;
 	sqe->off = 0;
@@ -580,9 +697,12 @@ static void stress_io_uring_close_setup(
  *	setup madvise submit over io_uring
  */
 static void stress_io_uring_madvise_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->fd = io_uring_file->fd;
 	sqe->opcode = IORING_OP_MADVISE;
 	sqe->addr = (uintptr_t)io_uring_file->iovecs[0].iov_base;
@@ -604,19 +724,29 @@ static void stress_io_uring_madvise_setu
  *	setup statx submit over io_uring
  */
 static void stress_io_uring_statx_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
-	static shim_statx_t statxbuf;
+	(void)io_uring_file;
+	(void)sqe;
+	(void)extra_info;
 
-	sqe->opcode = IORING_OP_STATX;
-	sqe->fd = io_uring_file->fd;
-	sqe->addr = (uintptr_t)io_uring_file->filename;
-	sqe->addr2 = (uintptr_t)&statxbuf;
-	sqe->statx_flags = AT_EMPTY_PATH;
-	sqe->ioprio = 0;
-	sqe->buf_index = 0;
-	sqe->flags = 0;
+#if defined(STATX_SIZE)
+	if (io_uring_file->fd_at >= 0) {
+		static shim_statx_t statxbuf;
+
+		sqe->opcode = IORING_OP_STATX;
+		sqe->fd = io_uring_file->fd_at;
+		sqe->addr = (uintptr_t)"";
+		sqe->addr2 = (uintptr_t)&statxbuf;
+		sqe->statx_flags = AT_EMPTY_PATH;
+		sqe->ioprio = 0;
+		sqe->buf_index = 0;
+		sqe->flags = 0;
+		sqe->len = STATX_SIZE;
+	}
+#endif
 }
 #endif
 
@@ -626,9 +756,12 @@ static void stress_io_uring_statx_setup(
  *	setup sync_file_range submit over io_uring
  */
 static void stress_io_uring_sync_file_range_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
+	const stress_io_uring_file_t *io_uring_file,
+	struct io_uring_sqe *sqe,
+	const void *extra_info)
 {
+	(void)extra_info;
+
 	sqe->opcode = IORING_OP_SYNC_FILE_RANGE;
 	sqe->fd = io_uring_file->fd;
 	sqe->off = stress_mwc16() & ~511UL;
@@ -640,39 +773,22 @@ static void stress_io_uring_sync_file_ra
 }
 #endif
 
-#if defined(HAVE_IORING_OP_GETXATTR)
 /*
- *  stress_io_uring_getxattr_setup()
- *	setup getxattr submit over io_uring
+ *  We have some duplications here because we want to perform more than
+ *  one of these io-urion ops per round before we do a completion so we
+ *  can add more activity onto the ring for a bit more activity/stress.
  */
-static void stress_io_uring_getxattr_setup(
-	stress_io_uring_file_t *io_uring_file,
-	struct io_uring_sqe *sqe)
-{
-	char value[1024];
-
-	sqe->opcode = IORING_OP_STATX;
-	sqe->fd = io_uring_file->fd;
-	sqe->addr = (uintptr_t)io_uring_file->filename;
-	sqe->addr2 = (uintptr_t)value;
-	sqe->len = sizeof(value);
-	sqe->xattr_flags = 0;
-	sqe->ioprio = 0;
-	sqe->buf_index = 0;
-	sqe->flags = 0;
-}
-#endif
-
-
 static const stress_io_uring_setup_info_t stress_io_uring_setups[] = {
 #if defined(HAVE_IORING_OP_READV)
 	{ IORING_OP_READV,	"IORING_OP_READV", 	stress_io_uring_readv_setup },
+	{ IORING_OP_READV,	"IORING_OP_READV", 	stress_io_uring_readv_setup },
 #endif
 #if defined(HAVE_IORING_OP_WRITEV)
 	{ IORING_OP_WRITEV,	"IORING_OP_WRITEV",	stress_io_uring_writev_setup },
 #endif
 #if defined(HAVE_IORING_OP_READ)
 	{ IORING_OP_READ,	"IORING_OP_READ",	stress_io_uring_read_setup },
+	{ IORING_OP_READ,	"IORING_OP_READ",	stress_io_uring_read_setup },
 #endif
 #if defined(HAVE_IORING_OP_WRITE)
 	{ IORING_OP_WRITE,	"IORING_OP_WRITE",	stress_io_uring_write_setup },
@@ -682,6 +798,9 @@ static const stress_io_uring_setup_info_
 #endif
 #if defined(HAVE_IORING_OP_NOP)
 	{ IORING_OP_NOP,	"IORING_OP_NOP",	stress_io_uring_nop_setup },
+	{ IORING_OP_NOP,	"IORING_OP_NOP",	stress_io_uring_nop_setup },
+	{ IORING_OP_NOP,	"IORING_OP_NOP",	stress_io_uring_nop_setup },
+	{ IORING_OP_NOP,	"IORING_OP_NOP",	stress_io_uring_nop_setup },
 #endif
 #if defined(HAVE_IORING_OP_FALLOCATE)
 	{ IORING_OP_FALLOCATE,	"IORING_OP_FALLOCATE",	stress_io_uring_fallocate_setup },
@@ -697,13 +816,11 @@ static const stress_io_uring_setup_info_
 #endif
 #if defined(HAVE_IORING_OP_STATX)
 	{ IORING_OP_STATX,	"IORING_OP_STATX",	stress_io_uring_statx_setup },
+	{ IORING_OP_STATX,	"IORING_OP_STATX",	stress_io_uring_statx_setup },
 #endif
 #if defined(HAVE_IORING_OP_SYNC_FILE_RANGE)
 	{ IORING_OP_SYNC_FILE_RANGE, "IORING_OP_SYNC_FILE_RANGE", stress_io_uring_sync_file_range_setup },
 #endif
-#if defined(HAVE_IORING_OP_GETXATTR)
-	{ IORING_OP_GETXATTR, "IORING_OP_GETXATTR",	stress_io_uring_getxattr_setup },
-#endif
 };
 
 /*
@@ -721,7 +838,6 @@ static const char *stress_io_uring_opcod
 	return "unknown";
 }
 
-
 /*
  *  stress_io_uring
  *	stress asynchronous I/O
@@ -737,11 +853,12 @@ static int stress_io_uring(const stress_
 	off_t file_size = (off_t)blocks * block_size;
 	stress_io_uring_submit_t submit;
 	const pid_t self = getpid();
-	bool supported[SIZEOF_ARRAY(stress_io_uring_setups)];
+	stress_io_uring_user_data_t user_data[SIZEOF_ARRAY(stress_io_uring_setups)];
 
-	(void)memset(&submit, 0, sizeof(submit));
-	(void)memset(&io_uring_file, 0, sizeof(io_uring_file));
+	(void)shim_memset(&submit, 0, sizeof(submit));
+	(void)shim_memset(&io_uring_file, 0, sizeof(io_uring_file));
 
+	io_uring_file.fd_dup = fileno(stdin);
 	io_uring_file.file_size = file_size;
 	io_uring_file.blocks = blocks;
 	io_uring_file.block_size = block_size;
@@ -773,7 +890,7 @@ static int stress_io_uring(const stress_
 			stress_io_uring_unmap_iovecs(&io_uring_file);
 			return EXIT_NO_RESOURCE;
 		}
-		(void)memset(io_uring_file.iovecs[i].iov_base, stress_mwc8(), block_size);
+		(void)shim_memset(io_uring_file.iovecs[i].iov_base, stress_mwc8(), block_size);
 		file_size -= iov_length;
 	}
 
@@ -798,8 +915,11 @@ static int stress_io_uring(const stress_
 			args->name, filename, errno, strerror(errno));
 		goto clean;
 	}
-	(void)shim_unlink(filename);
-
+#if defined(O_PATH)
+	io_uring_file.fd_at = open(filename, O_PATH);
+#else
+	io_uring_file.fd_at = -1;
+#endif
 	stress_file_rw_hint_short(io_uring_file.fd);
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
@@ -808,34 +928,44 @@ static int stress_io_uring(const stress_
 	 *  Assume all opcodes are supported
 	 */
 	for (j = 0; j < SIZEOF_ARRAY(stress_io_uring_setups); j++) {
-		supported[j] = true;
+		user_data[j].supported = true;
+		user_data[j].index = j;
+		user_data[j].opcode = stress_io_uring_setups[j].opcode;
 	}
 
 	rc = EXIT_SUCCESS;
 	i = 0;
 	do {
-		for (j = 0; j < SIZEOF_ARRAY(stress_io_uring_setups); j++) {
-			if (supported[j]) {
+		for (j = 0; (j < SIZEOF_ARRAY(stress_io_uring_setups)) && keep_stressing_flag(); j++) {
+			if (user_data[j].supported) {
 				rc = stress_io_uring_submit(args,
 					stress_io_uring_setups[j].setup_func,
-					&io_uring_file, &submit, &supported[j]);
+					&io_uring_file, &submit, &user_data[j], NULL);
 				if ((rc != EXIT_SUCCESS) || !keep_stressing(args))
 					break;
 			}
 		}
+		stress_io_uring_complete(args, &submit);
 
-		if (i++ > 1024) {
+		if (i++ >= 4096) {
 			i = 0;
 			(void)stress_read_fdinfo(self, submit.io_uring_fd);
 		}
 	} while (keep_stressing(args));
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
+	pr_dbg("%s: submits completed, closing uring and unlinking file\n", args->name);
+#if defined(HAVE_IORING_OP_ASYNC_CANCEL)
+	stress_io_uring_cancel_rdwr(args, &io_uring_file, &submit);
+#endif
 	(void)close(io_uring_file.fd);
 clean:
+	if (io_uring_file.fd_at >= 0)
+		(void)close(io_uring_file.fd_at);
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 	stress_close_io_uring(&submit);
 	stress_io_uring_unmap_iovecs(&io_uring_file);
+	(void)shim_unlink(filename);
 	(void)stress_temp_dir_rm_args(args);
 	return rc;
 }
diff -pruN 0.15.07-1/stress-iomix.c 0.15.08-1/stress-iomix.c
--- 0.15.07-1/stress-iomix.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-iomix.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-put.h"
 
 #if defined(HAVE_LINUX_FS_H)
@@ -957,7 +958,7 @@ static int stress_iomix(const stress_arg
 	off_t iomix_bytes = DEFAULT_IOMIX_BYTES;
 	const size_t page_size = args->page_size;
 	size_t i;
-	int pids[SIZEOF_ARRAY(iomix_funcs)];
+	pid_t pids[SIZEOF_ARRAY(iomix_funcs)];
 	const char *fs_type;
 	int oflags = O_CREAT | O_RDWR;
 	const pid_t parent = getpid();
@@ -1019,7 +1020,7 @@ static int stress_iomix(const stress_arg
 
 	stress_file_rw_hint_short(fd);
 
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
@@ -1042,20 +1043,7 @@ static int stress_iomix(const stress_arg
 
 	ret = EXIT_SUCCESS;
 reap:
-	for (i = 0; i < SIZEOF_ARRAY(iomix_funcs); i++) {
-		if (pids[i]) {
-			(void)kill(pids[i], SIGALRM);
-			(void)kill(pids[i], SIGKILL);
-		}
-	}
-	for (i = 0; i < SIZEOF_ARRAY(iomix_funcs); i++) {
-		if (pids[i]) {
-			int status;
-
-			(void)shim_waitpid(pids[i], &status, 0);
-		}
-	}
-
+	stress_kill_and_wait_many(args, pids, SIZEOF_ARRAY(iomix_funcs), SIGALRM, true);
 tidy:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 	(void)close(fd);
diff -pruN 0.15.07-1/stress-ioprio.c 0.15.08-1/stress-ioprio.c
--- 0.15.07-1/stress-ioprio.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-ioprio.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-io-priority.h"
 
 #if defined(HAVE_SYS_UIO_H)
@@ -143,7 +144,7 @@ static int stress_ioprio(const stress_ar
 			break;
 
 		for (i = 0; i < MAX_IOV; i++) {
-			(void)memset(buffer[i], stress_mwc8(), BUF_SIZE);
+			(void)shim_memset(buffer[i], stress_mwc8(), BUF_SIZE);
 			iov[i].iov_base = buffer[i];
 			iov[i].iov_len = BUF_SIZE;
 		}
diff -pruN 0.15.07-1/stress-ipsec-mb.c 0.15.08-1/stress-ipsec-mb.c
--- 0.15.07-1/stress-ipsec-mb.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-ipsec-mb.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 
 #if defined(HAVE_INTEL_IPSEC_MB_H)
@@ -154,7 +155,7 @@ static int stress_set_ipsec_mb_feature(c
  *  stress_ipsec_mb_features()
  *	get list of CPU feature bits
  */
-static uint64_t stress_ipsec_mb_features(const stress_args_t *args, MB_MGR *p_mgr)
+static uint64_t stress_ipsec_mb_features(const stress_args_t *args, const MB_MGR *p_mgr)
 {
 	const uint64_t features = p_mgr->features;
 
@@ -216,7 +217,7 @@ static inline struct JOB_AES_HMAC *stres
 {
 	struct JOB_AES_HMAC *job = IMB_GET_NEXT_JOB(mb_mgr);
 
-	(void)memset(job, 0, sizeof(*job));
+	(void)shim_memset(job, 0, sizeof(*job));
 	return job;
 }
 
@@ -227,7 +228,7 @@ static inline struct JOB_AES_HMAC *stres
 static void stress_job_check_status(
 	const stress_args_t *args,
 	const char *name,
-	struct JOB_AES_HMAC *job,
+	const struct JOB_AES_HMAC *job,
 	int *jobs_done)
 {
 	if (job->status != STS_COMPLETED) {
@@ -655,7 +656,7 @@ static void stress_ipsec_hmac_sha512(
 		return;
 
 	stress_rnd_fill(rndkey, sizeof(rndkey));
-	(void)memset(key, 0, sizeof(key));
+	(void)shim_memset(key, 0, sizeof(key));
 
 	IMB_SHA512(mb_mgr, rndkey, SHA_512_BLOCK_SIZE, key);
 
diff -pruN 0.15.07-1/stress-itimer.c 0.15.08-1/stress-itimer.c
--- 0.15.07-1/stress-itimer.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-itimer.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_ITIMER_FREQ		(1)
 #define MAX_ITIMER_FREQ		(100000000)
@@ -145,7 +146,7 @@ static void stress_itimer_handler(int si
 cancel:
 	keep_stressing_set_flag(false);
 	/* Cancel timer if we detect no more runs */
-	(void)memset(&timer, 0, sizeof(timer));
+	(void)shim_memset(&timer, 0, sizeof(timer));
 	(void)setitimer(ITIMER_PROF, &timer, NULL);
 }
 
@@ -212,7 +213,7 @@ static int stress_itimer(const stress_ar
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
-	(void)memset(&timer, 0, sizeof(timer));
+	(void)shim_memset(&timer, 0, sizeof(timer));
 	(void)setitimer(ITIMER_PROF, &timer, NULL);
 	return EXIT_SUCCESS;
 }
diff -pruN 0.15.07-1/stress-kcmp.c 0.15.08-1/stress-kcmp.c
--- 0.15.07-1/stress-kcmp.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-kcmp.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-net.h"
 
@@ -177,7 +178,7 @@ static int stress_kcmp(const stress_args
 		goto again;
 	}
 
-	(void)memset(&ev, 0, sizeof(ev));
+	(void)shim_memset(&ev, 0, sizeof(ev));
 	ev.data.fd = efd;
 	ev.events = EPOLLIN | EPOLLET;
 	if (epoll_ctl(efd, EPOLL_CTL_ADD, sfd, &ev) < 0) {
diff -pruN 0.15.07-1/stress-key.c 0.15.08-1/stress-key.c
--- 0.15.07-1/stress-key.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-key.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_KEYUTILS_H)
 #include <keyutils.h>
@@ -274,7 +275,7 @@ static int stress_key(const stress_args_
 #endif
 
 #if defined(KEYCTL_READ)
-			(void)memset(payload, 0, sizeof(payload));
+			(void)shim_memset(payload, 0, sizeof(payload));
 			if (shim_keyctl(KEYCTL_READ, keys[i],
 			    payload, sizeof(payload)) < 0) {
 				if ((errno != ENOMEM) &&
diff -pruN 0.15.07-1/stress-kvm.c 0.15.08-1/stress-kvm.c
--- 0.15.07-1/stress-kvm.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-kvm.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_KVM_H)
 #include <linux/kvm.h>
@@ -115,7 +116,7 @@ static int stress_kvm(const stress_args_
 		if (vm_mem == MAP_FAILED)
 			goto tidy_vm_fd;
 
-		(void)memset(&kvm_mem, 0, sizeof(kvm_mem));
+		(void)shim_memset(&kvm_mem, 0, sizeof(kvm_mem));
 		kvm_mem.slot = 0;
 		kvm_mem.guest_phys_addr = 0;
 		kvm_mem.memory_size = vm_mem_size;
@@ -139,7 +140,7 @@ static int stress_kvm(const stress_args_
 			goto tidy_vm_mmap;
 		}
 
-		(void)memcpy(vm_mem, &kvm_x86_kernel, sizeof(kvm_x86_kernel));
+		(void)shim_memcpy(vm_mem, &kvm_x86_kernel, sizeof(kvm_x86_kernel));
 		if (ioctl(vcpu_fd, KVM_GET_SREGS, &sregs) < 0) {
 			if (errno == EINTR)
 				goto tidy_vcpu_fd;
@@ -167,7 +168,7 @@ static int stress_kvm(const stress_args_
 			goto tidy_vcpu_fd;
 		}
 
-		(void)memset(&regs, 0, sizeof(regs));
+		(void)shim_memset(&regs, 0, sizeof(regs));
 		regs.rflags = 2;
 		regs.rip = 0;
 		if (ioctl(vcpu_fd, KVM_SET_REGS, &regs) < 0) {
diff -pruN 0.15.07-1/stress-landlock.c 0.15.08-1/stress-landlock.c
--- 0.15.07-1/stress-landlock.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-landlock.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_LANDLOCK_H)
 #include <linux/landlock.h>
@@ -112,7 +113,7 @@ static int stress_landlock_supported(con
 	int ruleset_fd;
 	struct landlock_ruleset_attr ruleset_attr;
 
-	(void)memset(&ruleset_attr, 0, sizeof(ruleset_attr));
+	(void)shim_memset(&ruleset_attr, 0, sizeof(ruleset_attr));
 	ruleset_attr.handled_access_fs = SHIM_LANDLOCK_ACCESS_FS_READ_FILE;
 
 	ruleset_fd = shim_landlock_create_ruleset(&ruleset_attr, sizeof(ruleset_attr), 0);
@@ -152,7 +153,7 @@ static int stress_landlock_flag(const st
 	if (!path)
 		return 0;
 
-	(void)memset(&ruleset_attr, 0, sizeof(ruleset_attr));
+	(void)shim_memset(&ruleset_attr, 0, sizeof(ruleset_attr));
 	/* Exercise illegal ruleset sizes, EINVAL */
 	VOID_RET(int, shim_landlock_create_ruleset(&ruleset_attr, 0, 0));
 	/* Exercise illegal ruleset sizes, E2BIG */
@@ -160,7 +161,7 @@ static int stress_landlock_flag(const st
 	/* Exercise fetch of ruleset API version, ignore return */
 	VOID_RET(int, shim_landlock_create_ruleset(NULL, 0, SHIM_LANDLOCK_CREATE_RULESET_VERSION));
 
-	(void)memset(&ruleset_attr, 0, sizeof(ruleset_attr));
+	(void)shim_memset(&ruleset_attr, 0, sizeof(ruleset_attr));
 	ruleset_attr.handled_access_fs = flag;
 
 	ruleset_fd = shim_landlock_create_ruleset(&ruleset_attr, sizeof(ruleset_attr), 0);
diff -pruN 0.15.07-1/stress-lease.c 0.15.08-1/stress-lease.c
--- 0.15.07-1/stress-lease.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-lease.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_LEASE_BREAKERS	(1)
 #define MAX_LEASE_BREAKERS	(64)
@@ -195,7 +196,7 @@ static int stress_lease(const stress_arg
 			lease_breakers = MIN_LEASE_BREAKERS;
 	}
 
-	(void)memset(l_pids, 0, sizeof(l_pids));
+	(void)shim_memset(l_pids, 0, sizeof(l_pids));
 
 	if (stress_sighandler(args->name, SIGIO, stress_lease_handler, NULL) < 0)
 		return EXIT_FAILURE;
diff -pruN 0.15.07-1/stress-link.c 0.15.08-1/stress-link.c
--- 0.15.07-1/stress-link.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-link.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LIBGEN_H)
 #include <libgen.h>
@@ -95,7 +96,7 @@ static int stress_link_generic(
 	bool symlink_func = (linkfunc == symlink);
 	char *mnts[MOUNTS_MAX];
 
-	(void)memset(tmp_newpath, 0, sizeof(tmp_newpath));
+	(void)shim_memset(tmp_newpath, 0, sizeof(tmp_newpath));
 	(void)snprintf(tmp_newpath, sizeof(tmp_newpath),
 		"/tmp/stress-ng-%s-%d-%" PRIu64 "-link",
 		args->name, (int)getpid(), stress_mwc64());
diff -pruN 0.15.07-1/stress-list.c 0.15.08-1/stress-list.c
--- 0.15.07-1/stress-list.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-list.c	2023-05-21 14:30:06.000000000 +0000
@@ -32,7 +32,7 @@ struct list_entry;
 
 typedef void (*stress_list_func)(const stress_args_t *args,
 				 struct list_entry *entries,
-				 struct list_entry *entries_end,
+				 const struct list_entry *entries_end,
 				 stress_metrics_t *metrics);
 
 typedef struct {
@@ -171,7 +171,7 @@ static void MLOCKED_TEXT stress_list_han
 static void OPTIMIZE3 stress_list_slistt(
 	const stress_args_t *args,
 	struct list_entry *entries,
-	struct list_entry *entries_end,
+	const struct list_entry *entries_end,
 	stress_metrics_t *metrics)
 {
 	register struct list_entry *entry, *head, *tail;
@@ -215,7 +215,7 @@ static void OPTIMIZE3 stress_list_slistt
 static void OPTIMIZE3 stress_list_list(
 	const stress_args_t *args,
 	struct list_entry *entries,
-	struct list_entry *entries_end,
+	const struct list_entry *entries_end,
 	stress_metrics_t *metrics)
 {
 	register struct list_entry *entry;
@@ -223,6 +223,7 @@ static void OPTIMIZE3 stress_list_list(
 	bool found = false;
 	double t;
 
+	(void)shim_memset(&head, 0, sizeof(head));
 	LIST_INIT(&head);
 
 	for (entry = entries; entry < entries_end; entry++) {
@@ -259,7 +260,7 @@ static void OPTIMIZE3 stress_list_list(
 static void OPTIMIZE3 stress_list_slist(
 	const stress_args_t *args,
 	struct list_entry *entries,
-	struct list_entry *entries_end,
+	const struct list_entry *entries_end,
 	stress_metrics_t *metrics)
 {
 	register struct list_entry *entry;
@@ -267,6 +268,7 @@ static void OPTIMIZE3 stress_list_slist(
 	bool found = false;
 	double t;
 
+	(void)shim_memset(&head, 0, sizeof(head));
 	SLIST_INIT(&head);
 
 	for (entry = entries; entry < entries_end; entry++) {
@@ -302,7 +304,7 @@ static void OPTIMIZE3 stress_list_slist(
 static void OPTIMIZE3 stress_list_circleq(
 	const stress_args_t *args,
 	struct list_entry *entries,
-	struct list_entry *entries_end,
+	const struct list_entry *entries_end,
 	stress_metrics_t *metrics)
 {
 	register struct list_entry *entry;
@@ -310,6 +312,7 @@ static void OPTIMIZE3 stress_list_circle
 	bool found = false;
 	double t;
 
+	(void)shim_memset(&head, 0, sizeof(head));
 	CIRCLEQ_INIT(&head);
 
 	for (entry = entries; entry < entries_end; entry++) {
@@ -345,7 +348,7 @@ static void OPTIMIZE3 stress_list_circle
 static void OPTIMIZE3 stress_list_stailq(
 	const stress_args_t *args,
 	struct list_entry *entries,
-	struct list_entry *entries_end,
+	const struct list_entry *entries_end,
 	stress_metrics_t *metrics)
 {
 	register struct list_entry *entry;
@@ -353,6 +356,7 @@ static void OPTIMIZE3 stress_list_stailq
 	bool found = false;
 	double t;
 
+	(void)shim_memset(&head, 0, sizeof(head));
 	STAILQ_INIT(&head);
 
 	for (entry = entries; entry < entries_end; entry++) {
@@ -388,7 +392,7 @@ static void OPTIMIZE3 stress_list_stailq
 static void OPTIMIZE3 stress_list_tailq(
 	const stress_args_t *args,
 	struct list_entry *entries,
-	struct list_entry *entries_end,
+	const struct list_entry *entries_end,
 	stress_metrics_t *metrics)
 {
 	register struct list_entry *entry;
@@ -396,6 +400,7 @@ static void OPTIMIZE3 stress_list_tailq(
 	bool found = false;
 	double t;
 
+	(void)shim_memset(&head, 0, sizeof(head));
 	TAILQ_INIT(&head);
 
 	for (entry = entries; entry < entries_end; entry++) {
@@ -430,7 +435,7 @@ static void OPTIMIZE3 stress_list_tailq(
 static void stress_list_all(
 	const stress_args_t *args,
 	struct list_entry *entries,
-	struct list_entry *entries_end,
+	const struct list_entry *entries_end,
 	stress_metrics_t *metrics);
 
 
@@ -460,7 +465,7 @@ static const stress_list_method_info_t l
 static void stress_list_all(
 	const stress_args_t *args,
 	struct list_entry *entries,
-	struct list_entry *entries_end,
+	const struct list_entry *entries_end,
 	stress_metrics_t *metrics)
 {
 	static size_t index = 1;
diff -pruN 0.15.07-1/stress-locka.c 0.15.08-1/stress-locka.c
--- 0.15.07-1/stress-locka.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-locka.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"locka N",	"start N workers locking a file via advisory locks" },
@@ -223,7 +224,7 @@ static int stress_locka(const stress_arg
 	off_t offset;
 	ssize_t rc;
 
-	(void)memset(buffer, 0, sizeof(buffer));
+	(void)shim_memset(buffer, 0, sizeof(buffer));
 
 	/*
 	 *  There will be a race to create the directory
@@ -304,12 +305,8 @@ again:
 tidy:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
-	if (cpid > 0) {
-		int status;
-
-		(void)kill(cpid, SIGALRM);
-		(void)shim_waitpid(cpid, &status, 0);
-	}
+	if (cpid > 1)
+		stress_kill_and_wait(args, cpid, SIGALRM, true);
 	stress_locka_info_free();
 
 	(void)close(fd);
diff -pruN 0.15.07-1/stress-lockf.c 0.15.08-1/stress-lockf.c
--- 0.15.07-1/stress-lockf.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-lockf.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"lockf N",	  "start N workers locking a single file via lockf" },
@@ -246,7 +247,7 @@ static int stress_lockf(const stress_arg
 	off_t offset;
 	ssize_t rc;
 
-	(void)memset(buffer, 0, sizeof(buffer));
+	(void)shim_memset(buffer, 0, sizeof(buffer));
 
 	/*
 	 *  There will be a race to create the directory
@@ -327,12 +328,8 @@ again:
 tidy:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
-	if (cpid > 0) {
-		int status;
-
-		(void)kill(cpid, SIGALRM);
-		(void)shim_waitpid(cpid, &status, 0);
-	}
+	if (cpid > 1)
+		stress_kill_and_wait(args, cpid, SIGALRM, true);
 	stress_lockf_info_free();
 
 	(void)close(fd);
diff -pruN 0.15.07-1/stress-lockofd.c 0.15.08-1/stress-lockofd.c
--- 0.15.07-1/stress-lockofd.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-lockofd.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL, "lockofd N",	 "start N workers using open file description locking" },
@@ -221,7 +222,7 @@ static int stress_lockofd(const stress_a
 	off_t offset;
 	ssize_t rc;
 
-	(void)memset(buffer, 0, sizeof(buffer));
+	(void)shim_memset(buffer, 0, sizeof(buffer));
 
 	/*
 	 *  There will be a race to create the directory
@@ -302,12 +303,8 @@ again:
 tidy:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
-	if (cpid > 0) {
-		int status;
-
-		(void)kill(cpid, SIGALRM);
-		(void)shim_waitpid(cpid, &status, 0);
-	}
+	if (cpid > 1)
+		stress_kill_and_wait(args, cpid, SIGALRM, true);
 	stress_lockofd_info_free();
 
 	(void)close(fd);
diff -pruN 0.15.07-1/stress-loop.c 0.15.08-1/stress-loop.c
--- 0.15.07-1/stress-loop.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-loop.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_LINUX_LOOP_H)
@@ -320,7 +321,7 @@ static int stress_loop(const stress_args
 			/*
 			 *  Attempt to configure with illegal fd
 			 */
-			(void)memset(&config, 0, sizeof(config));
+			(void)shim_memset(&config, 0, sizeof(config));
 			config.fd = (uint32_t)bad_fd;
 
 			VOID_RET(int, ioctl(loop_dev, LOOP_CONFIGURE, &config));
diff -pruN 0.15.07-1/stress-lsearch.c 0.15.08-1/stress-lsearch.c
--- 0.15.07-1/stress-lsearch.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-lsearch.c	2023-05-21 14:30:06.000000000 +0000
@@ -99,13 +99,13 @@ static int stress_lsearch(const stress_a
 		stress_sort_data_int32_shuffle(data, max);
 
 		/* Step #1, populate with data */
-		for (i = 0; keep_stressing_flag() && i < max; i++) {
+		for (i = 0; keep_stressing_flag() && (i < max); i++) {
 			VOID_RET(void *, lsearch(&data[i], root, &n, sizeof(*data), stress_sort_cmp_fwd_int32));
 		}
 		/* Step #2, find */
 		stress_sort_compare_reset();
 		t = stress_time_now();
-		for (i = 0; keep_stressing_flag() && i < n; i++) {
+		for (i = 0; keep_stressing_flag() && (i < n); i++) {
 			int32_t *result;
 
 			result = lfind(&data[i], root, &n, sizeof(*data), stress_sort_cmp_fwd_int32);
diff -pruN 0.15.07-1/stress-madvise.c 0.15.08-1/stress-madvise.c
--- 0.15.07-1/stress-madvise.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-madvise.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"madvise N",	 "start N workers exercising madvise on memory" },
@@ -227,7 +228,7 @@ static int stress_random_advise(
 	const int idx = stress_mwc32modn((size_t)SIZEOF_ARRAY(madvise_options));
 	const int advise = madvise_options[idx];
 #if defined(MADV_HWPOISON) || defined(MADV_SOFT_OFFLINE)
-	static int poison_count;
+	static int poison_count = 0;
 #if defined(MADV_NORMAL)
 	const int madv_normal = MADV_NORMAL;
 #else
@@ -504,7 +505,7 @@ static int stress_madvise(const stress_a
 	/* Make sure this is killable by OOM killer */
 	stress_set_oom_adjustment(args->name, true);
 
-	(void)memset(page, 0xa5, page_size);
+	(void)shim_memset(page, 0xa5, page_size);
 
 	ret = stress_temp_dir_mk_args(args);
 	if (ret < 0) {
@@ -572,7 +573,7 @@ static int stress_madvise(const stress_a
 			continue;
 		}
 
-		(void)memset(buf, 0xff, sz);
+		(void)shim_memset(buf, 0xff, sz);
 		(void)stress_madvise_random(buf, sz);
 		(void)stress_mincore_touch_pages(buf, sz);
 		stress_process_madvise(pid, buf, sz);
diff -pruN 0.15.07-1/stress-malloc.c 0.15.08-1/stress-malloc.c
--- 0.15.07-1/stress-malloc.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-malloc.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_MALLOC_H)
 #include <malloc.h>
@@ -155,7 +156,7 @@ static void stress_malloc_free(void *ptr
 static void stress_malloc_zerofree(void *ptr, size_t len)
 {
 	if (len)
-		(void)memset(ptr, 0, len);
+		(void)shim_memset(ptr, 0, len);
 	free(ptr);
 }
 
@@ -314,7 +315,7 @@ static void *stress_malloc_loop(void *pt
 	}
 
 	for (j = 0; j < malloc_max; j++) {
-		if (verify && info[j].addr && (uintptr_t)info[j].addr != *info[j].addr) {
+		if (verify && info[j].addr && ((uintptr_t)info[j].addr != *info[j].addr)) {
 			pr_fail("%s: allocation at %p does not contain correct value\n",
 				args->name, (void *)info[j].addr);
 		}
@@ -358,7 +359,7 @@ static int stress_malloc_child(const str
 	 */
 	stress_malloc_args_t malloc_args[MAX_MALLOC_PTHREADS + 1];
 
-	(void)memset(malloc_args, 0, sizeof(malloc_args));
+	(void)shim_memset(malloc_args, 0, sizeof(malloc_args));
 
 	malloc_args[0].args = args;
 	malloc_args[0].instance = 0;
@@ -369,7 +370,7 @@ static int stress_malloc_child(const str
 
 #if defined(HAVE_LIB_PTHREAD)
 	keep_thread_running_flag = true;
-	(void)memset(pthreads, 0, sizeof(pthreads));
+	(void)shim_memset(pthreads, 0, sizeof(pthreads));
 	for (j = 0; j < malloc_pthreads; j++) {
 		malloc_args[j + 1].args = args;
 		malloc_args[j + 1].instance = j + 1;
diff -pruN 0.15.07-1/stress-mcontend.c 0.15.08-1/stress-mcontend.c
--- 0.15.07-1/stress-mcontend.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mcontend.c	2023-05-21 14:30:06.000000000 +0000
@@ -20,6 +20,7 @@
 #include "stress-ng.h"
 #include "core-arch.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-cpu-cache.h"
 #include "core-pthread.h"
 
@@ -47,7 +48,7 @@ static int page_write_sync(const int fd,
 	char ALIGN64 buffer[256];
 	size_t n = 0;
 
-	(void)memset(buffer, 0, sizeof(buffer));
+	(void)shim_memset(buffer, 0, sizeof(buffer));
 
 	while (n < page_size) {
 		ssize_t rc;
diff -pruN 0.15.07-1/stress-membarrier.c 0.15.08-1/stress-membarrier.c
--- 0.15.07-1/stress-membarrier.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-membarrier.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pthread.h"
 
 #if defined(HAVE_LINUX_MEMBARRIER_H)
@@ -175,7 +176,7 @@ static int stress_membarrier(const stres
 	(void)sigfillset(&set);
 	for (i = 0; i < MAX_MEMBARRIER_THREADS + 1; i++) {
 		info[i].pthread_ret = -1;
-		(void)memset(&info[i].pthread, 0, sizeof(info[i].pthread));
+		(void)shim_memset(&info[i].pthread, 0, sizeof(info[i].pthread));
 		info[i].duration = 0.0;
 		info[i].count = 0.0;
 	}
diff -pruN 0.15.07-1/stress-memhotplug.c 0.15.08-1/stress-memhotplug.c
--- 0.15.07-1/stress-memhotplug.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-memhotplug.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(__linux__)
@@ -79,7 +80,7 @@ static void stress_memhotplug_set_timer(
 {
 	struct itimerval timer;
 
-	(void)memset(&timer, 0, sizeof(timer));
+	(void)shim_memset(&timer, 0, sizeof(timer));
 	timer.it_value.tv_sec = secs;
 	timer.it_value.tv_usec = 0;
 	timer.it_interval.tv_sec = secs;
diff -pruN 0.15.07-1/stress-memrate.c 0.15.08-1/stress-memrate.c
--- 0.15.07-1/stress-memrate.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-memrate.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-cpu-cache.h"
 #include "core-nt-store.h"
 #include "core-target-clones.h"
@@ -319,7 +320,7 @@ static uint64_t stress_memrate_memset(
 {
 	const size_t size = context->memrate_bytes;
 
-	(void)memset(context->start, 0xaa, size);
+	(void)shim_memset(context->start, 0xaa, size);
 
 	*valid = true;
 	return (uint64_t)size / KB;
@@ -339,7 +340,7 @@ static uint64_t OPTIMIZE3 stress_memrate
 
 	t1 = stress_time_now();
 	for (ptr = start; (ptr + chunk_size) < end; ptr += chunk_size) {
-		(void)memset(ptr, 0xaa, chunk_size);
+		(void)shim_memset(ptr, 0xaa, chunk_size);
 
 		t2 = stress_time_now();
 		total_dur += dur;
@@ -358,7 +359,7 @@ static uint64_t OPTIMIZE3 stress_memrate
 	}
 
 	if (end - ptr > 0) {
-		(void)memset(ptr, 0xaa, end - ptr);
+		(void)shim_memset(ptr, 0xaa, end - ptr);
 		t2 = stress_time_now();
 		total_dur += dur;
 		dur_remainder = total_dur - (t2 - t1);
@@ -392,7 +393,7 @@ static uint64_t TARGET_CLONES OPTIMIZE3
 	{							\
 		type vaa;					\
 								\
-		(void)memset(&vaa, 0xaa, sizeof(vaa));		\
+		(void)shim_memset(&vaa, 0xaa, sizeof(vaa));	\
 		v = vaa;					\
 	}							\
 								\
@@ -662,7 +663,7 @@ static uint64_t TARGET_CLONES OPTIMIZE3
 	{							\
 		type vaa;					\
 								\
-		(void)memset(&vaa, 0xaa, sizeof(vaa));		\
+		(void)shim_memset(&vaa, 0xaa, sizeof(vaa));	\
 		v = vaa;					\
 	}							\
 								\
@@ -734,7 +735,7 @@ static uint64_t OPTIMIZE3 stress_memrate
 	{							\
 		type vaa;					\
 								\
-		(void)memset(&vaa, 0xaa, sizeof(vaa));		\
+		(void)shim_memset(&vaa, 0xaa, sizeof(vaa));	\
 		v = vaa;					\
 	}							\
 								\
@@ -787,7 +788,7 @@ static uint64_t OPTIMIZE3 stress_memrate
 	{							\
 		type vaa;					\
 								\
-		(void)memset(&vaa, 0xaa, sizeof(vaa));		\
+		(void)shim_memset(&vaa, 0xaa, sizeof(vaa));	\
 		v = vaa;					\
 	}							\
 								\
diff -pruN 0.15.07-1/stress-memthrash.c 0.15.08-1/stress-memthrash.c
--- 0.15.07-1/stress-memthrash.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-memthrash.c	2023-05-21 14:30:06.000000000 +0000
@@ -20,6 +20,7 @@
 #include "stress-ng.h"
 #include "core-arch.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-cpu-cache.h"
 #include "core-nt-store.h"
 #include "core-pthread.h"
@@ -121,11 +122,7 @@ static inline HOT OPTIMIZE3 void stress_
 		const size_t offset = chunk * chunk_size;
 		void *ptr = (void *)(((uint8_t *)mem) + offset);
 
-#if defined(__GNUC__)
-		(void)__builtin_memset(ptr, stress_mwc8(), chunk_size);
-#else
-		(void)memset(ptr, stress_mwc8(), chunk_size);
-#endif
+		(void)shim_memset(ptr, stress_mwc8(), chunk_size);
 	}
 }
 
@@ -178,11 +175,7 @@ static void stress_memthrash_memset(
 {
 	(void)context;
 
-#if defined(__GNUC__)
-	(void)__builtin_memset((void *)mem, stress_mwc8(), mem_size);
-#else
-	(void)memset((void *)mem, stress_mwc8(), mem_size);
-#endif
+	(void)shim_memset((void *)mem, stress_mwc8(), mem_size);
 }
 
 #if defined(HAVE_ASM_X86_REP_STOSD) &&	\
@@ -215,11 +208,7 @@ static void stress_memthrash_memmove(
 	char *dst = ((char *)mem) + 1;
 
 	(void)context;
-#if defined(__GNUC__)
-	(void)shim_builtin_memmove((void *)dst, mem, mem_size - 1);
-#else
-	(void)memmove((void *)dst, mem, mem_size - 1);
-#endif
+	(void)shim_memmove((void *)dst, mem, mem_size - 1);
 }
 
 static void HOT OPTIMIZE3 stress_memthrash_memset64(
@@ -620,7 +609,7 @@ static void OPTIMIZE3 TARGET_CLONES stre
 		return;
 
 	node = (unsigned long)stress_mwc32modn((uint32_t)context->numa_nodes);
-	(void)memset(context->numa_node_mask, 0, context->numa_node_mask_size);
+	(void)shim_memset(context->numa_node_mask, 0, context->numa_node_mask_size);
 
 	for (ptr = (uint8_t *)mem; ptr < end; ptr += page_size) {
 		STRESS_SETBIT(context->numa_node_mask, (unsigned long)node);
diff -pruN 0.15.07-1/stress-mknod.c 0.15.08-1/stress-mknod.c
--- 0.15.07-1/stress-mknod.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mknod.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LIBGEN_H)
 #include <libgen.h>
@@ -84,7 +85,7 @@ static int stress_mknod_find_dev(mode_t
 	struct dirent *d;
 	int rc = -1;
 
-	(void)memset(dev, 0, sizeof(*dev));
+	(void)shim_memset(dev, 0, sizeof(*dev));
 
 	dir = opendir("/dev");
 	if (!dir)
@@ -100,7 +101,7 @@ static int stress_mknod_find_dev(mode_t
 
 		/* A match, cope it */
 		if ((statbuf.st_mode & S_IFMT) == mode) {
-			(void)memcpy(dev, &statbuf.st_dev, sizeof(*dev));
+			(void)shim_memcpy(dev, &statbuf.st_dev, sizeof(*dev));
 			rc = 0;
 			break;
 		}
diff -pruN 0.15.07-1/stress-mlockmany.c 0.15.08-1/stress-mlockmany.c
--- 0.15.07-1/stress-mlockmany.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mlockmany.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define UNSET_MLOCK_PROCS		(0)
 #define DEFAULT_MLOCK_PROCS		(1024)
@@ -94,11 +95,10 @@ static int stress_mlockmany(const stress
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
 	do {
-		unsigned int i, n;
+		unsigned int n;
 		size_t shmall, freemem, totalmem, freeswap, totalswap, last_freeswap, last_totalswap;
 
-		(void)memset(pids, 0, sizeof(*pids) * mlockmany_procs);
-
+		(void)shim_memset(pids, 0, sizeof(*pids) * mlockmany_procs);
 		stress_get_memlimits(&shmall, &freemem, &totalmem, &last_freeswap, &last_totalswap);
 
 		for (n = 0; n < mlockmany_procs; n++) {
@@ -144,7 +144,6 @@ static int stress_mlockmany(const stress
 				if (ptr == MAP_FAILED)
 					_exit(0);
 
-
 				(void)stress_mincore_touch_pages(ptr, mmap_size);
 
 				mlock_size = mmap_size;
@@ -186,18 +185,12 @@ unmap:
 				_exit(0);
 			}
 			pids[n] = pid;
+			if (pid > 1)
+				inc_counter(args);
 			if (!keep_stressing_flag())
 				break;
 		}
-		for (i = 0; i < n; i++) {
-			if (pids[i] > 0) {
-				int status;
-				/* Parent, wait for child */
-				(void)stress_killpid(pids[i]);
-				(void)shim_waitpid(pids[i], &status, 0);
-				inc_counter(args);
-			}
-		}
+		stress_kill_and_wait_many(args, pids, n, SIGALRM, false);
 	} while (keep_stressing(args));
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
diff -pruN 0.15.07-1/stress-mmap.c 0.15.08-1/stress-mmap.c
--- 0.15.07-1/stress-mmap.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mmap.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_PRCTL_H)
 #include <sys/prctl.h>
@@ -519,7 +520,7 @@ retry:
 
 		no_mem_retries = 0;
 		if (mmap_file) {
-			(void)memset(buf, 0xff, sz);
+			(void)shim_memset(buf, 0xff, sz);
 			(void)shim_msync((void *)buf, sz, ms_flags);
 		}
 		(void)stress_madvise_random(buf, sz);
@@ -625,7 +626,7 @@ retry:
 						pr_fail("%s: mmap'd region of %zu bytes does "
 							"not contain expected data\n", args->name, page_size);
 					if (mmap_file) {
-						(void)memset(mappings[page], (int)n, page_size);
+						(void)shim_memset(mappings[page], (int)n, page_size);
 						(void)shim_msync((void *)mappings[page], page_size, ms_flags);
 #if defined(FALLOC_FL_KEEP_SIZE) &&	\
     defined(FALLOC_FL_PUNCH_HOLE)
diff -pruN 0.15.07-1/stress-mmapfixed.c 0.15.08-1/stress-mmapfixed.c
--- 0.15.07-1/stress-mmapfixed.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mmapfixed.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 
 static const stress_help_t help[] = {
@@ -59,7 +60,7 @@ static bool OPTIMIZE3 stress_mmapfixed_i
 		sz = n_pages * page_size;
 		n -= n_pages;
 
-		(void)memset(vec, 0, PAGE_CHUNKS);
+		(void)shim_memset(vec, 0, PAGE_CHUNKS);
 		ret = shim_mincore(addr, sz, vec);
 		if (UNLIKELY(ret == ENOSYS))
 			return false;	/* Dodgy, assume not in memory */
diff -pruN 0.15.07-1/stress-mmapfork.c 0.15.08-1/stress-mmapfork.c
--- 0.15.07-1/stress-mmapfork.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mmapfork.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"mmapfork N",	  "start N workers stressing many forked mmaps/munmaps" },
@@ -82,7 +83,7 @@ static inline bool should_terminate(cons
  *  stress_memory_is_not_zero()
  *	return true if memory is non-zero
  */
-static bool stress_memory_is_not_zero(uint8_t *ptr, const size_t size)
+static bool stress_memory_is_not_zero(const uint8_t *ptr, const size_t size)
 {
 	size_t i;
 
@@ -117,7 +118,7 @@ static int stress_mmapfork(const stress_
 	wipe_ptr = mmap(NULL, wipe_size, PROT_READ | PROT_WRITE,
 		MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 	if (wipe_ptr != MAP_FAILED) {
-		(void)memset(wipe_ptr, 0xff, wipe_size);
+		(void)shim_memset(wipe_ptr, 0xff, wipe_size);
 		if (shim_madvise(wipe_ptr, wipe_size, MADV_WIPEONFORK) == 0)
 			wipe_ok = true;
 	}
@@ -148,7 +149,7 @@ static int stress_mmapfork(const stress_
 				if (stress_sighandler(args->name, SIGSEGV, stress_segvhandler, NULL) < 0)
 					_exit(MMAPFORK_FAILURE);
 
-				(void)memset(&info, 0, sizeof(info));
+				(void)shim_memset(&info, 0, sizeof(info));
 				if (sysinfo(&info) < 0) {
 					pr_fail("%s: sysinfo failed, errno=%d (%s)\n",
 						args->name, errno, strerror(errno));
@@ -177,7 +178,7 @@ static int stress_mmapfork(const stress_
 					if (should_terminate(args, ppid))
 						_exit(EXIT_SUCCESS);
 					segv_ret = MMAPFORK_SEGV_MEMSET;
-					(void)memset(ptr, 0, len);
+					(void)shim_memset(ptr, 0, len);
 
 #if defined(MADV_DONTNEED)
 					if (should_terminate(args, ppid))
@@ -225,17 +226,7 @@ static int stress_mmapfork(const stress_
 			}
 		}
 reap:
-		/*
-		 *  Force child death and reap
-		 */
-		for (i = 0; i < MAX_PIDS; i++) {
-			int status;
-
-			if (UNLIKELY(pids[i] < 0))
-				continue;
-			(void)stress_killpid(pids[i]);
-			(void)shim_waitpid(pids[i], &status, 0);
-		}
+		stress_kill_and_wait_many(args, pids, MAX_PIDS, SIGALRM, false);
 		inc_counter(args);
 	} while (keep_stressing(args));
 
diff -pruN 0.15.07-1/stress-module.c 0.15.08-1/stress-module.c
--- 0.15.07-1/stress-module.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-module.c	2023-05-21 14:30:06.000000000 +0000
@@ -214,7 +214,7 @@ static int get_modpath_name(
         if (uname(&u) < 0)
 		return -1;
 	(void)snprintf(depmod, sizeof(depmod), "%s/%s/modules.dep",
-		 dirname_default_prefix, u.release);
+		dirname_default_prefix, u.release);
 
 	fp = fopen(depmod, "r");
 	if (!fp)
@@ -328,7 +328,7 @@ static int stress_module(const stress_ar
 
 	module_name = module_name_cli ? module_name_cli : default_module;
 	ret = get_modpath_name(args, module_name, global_module_path, sizeof(global_module_path));
-	if (ret) {
+	if (ret < 0) {
 		if (args->instance == 0) {
 			if (module_name_cli) {
 				pr_inf_skip("%s: could not find a module path for "
@@ -340,7 +340,8 @@ static int stress_module(const stress_ar
 				pr_inf_skip("%s: could not find a module path for "
 					"the default test_module '%s', perhaps "
 					"CONFIG_TEST_LKM is disabled in your "
-					"kernel, skipping stressor\n",
+					"kernel (or alternatively use --module-name "
+					"to specify module), skipping stressor\n",
 					args->name, module_name);
 			}
 		}
diff -pruN 0.15.07-1/stress-mprotect.c 0.15.08-1/stress-mprotect.c
--- 0.15.07-1/stress-mprotect.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mprotect.c	2023-05-21 14:30:06.000000000 +0000
@@ -140,16 +140,7 @@ static int stress_mprotect(const stress_
 	}
 
 	stress_mprotect_mem(args, page_size, mem, mem_pages, prot_flags, n_flags);
-
-
-	for (i = 0; i < MPROTECT_MAX; i++) {
-		int status;
-
-		if (pids[i] <= 1)
-			continue;
-		(void)kill(pids[i], SIGKILL);
-		(void)waitpid(pids[i], &status, 0);
-	}
+	stress_kill_and_wait_many(args, pids, MPROTECT_MAX, SIGALRM, true);
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
diff -pruN 0.15.07-1/stress-mq.c 0.15.08-1/stress-mq.c
--- 0.15.07-1/stress-mq.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mq.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_MQUEUE_H)
 #include <mqueue.h>
@@ -222,8 +223,7 @@ again:
 
 		stress_parent_died_alarm();
 		(void)sched_settings_apply(true);
-
-		(void)memset(&values, 0, sizeof(values));
+		(void)shim_memset(&values, 0, sizeof(values));
 
 		while (keep_stressing_flag()) {
 			uint64_t i;
@@ -268,8 +268,7 @@ again:
 							args->name, errno, strerror(errno));
 					}
 #endif
-
-					(void)memset(&sigev, 0, sizeof sigev);
+					(void)shim_memset(&sigev, 0, sizeof sigev);
 					switch (stress_mwc8modn(5)) {
 					case 0:
 						/* Illegal signal */
@@ -411,9 +410,8 @@ again:
 		uint64_t i = 0;
 
 		/* Parent */
-		(void)memset(&msg, 0, sizeof(msg));
-
-		(void)memset(&values, 0, sizeof(values));
+		(void)shim_memset(&msg, 0, sizeof(msg));
+		(void)shim_memset(&values, 0, sizeof(values));
 
 		do {
 			int ret;
diff -pruN 0.15.07-1/stress-mremap.c 0.15.08-1/stress-mremap.c
--- 0.15.07-1/stress-mremap.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mremap.c	2023-05-21 14:30:06.000000000 +0000
@@ -138,7 +138,7 @@ static int try_remap(
 #else
 		newbuf = mremap(*buf, old_sz, new_sz, flags);
 #endif
-		if (newbuf && newbuf != MAP_FAILED) {
+		if (newbuf && (newbuf != MAP_FAILED)) {
 			if (UNLIKELY(metrics_counter == 0)) {
 				(*duration) += stress_time_now() - t;
 				(*count) += 1.0;
@@ -155,7 +155,7 @@ static int try_remap(
 				t = stress_time_now();
 			newbuf = mremap(*buf, new_sz, new_sz,
 					MREMAP_DONTUNMAP | MREMAP_MAYMOVE);
-			if (newbuf && newbuf != MAP_FAILED) {
+			if (newbuf && (newbuf != MAP_FAILED)) {
 				if (UNLIKELY(metrics_counter == 0)) {
 					(*duration) += stress_time_now() - t;
 					(*count) += 1.0;
@@ -308,15 +308,15 @@ static int stress_mremap_child(const str
 
 		/* Invalid remap flags */
 		ptr = mremap(buf, old_sz, old_sz, ~0);
-		if (ptr && ptr != MAP_FAILED)
+		if (ptr && (ptr != MAP_FAILED))
 			buf = ptr;
 		ptr = mremap(buf, old_sz, old_sz, MREMAP_FIXED | MREMAP_MAYMOVE, (void *)~(uintptr_t)0);
-		if (ptr && ptr != MAP_FAILED)
+		if (ptr && (ptr != MAP_FAILED))
 			buf = ptr;
 #if defined(MREMAP_MAYMOVE)
 		/* Invalid new size */
 		ptr = mremap(buf, old_sz, 0, MREMAP_MAYMOVE);
-		if (ptr && ptr != MAP_FAILED)
+		if (ptr && (ptr != MAP_FAILED))
 			buf = ptr;
 #endif
 		(void)munmap(buf, old_sz);
diff -pruN 0.15.07-1/stress-msg.c 0.15.08-1/stress-msg.c
--- 0.15.07-1/stress-msg.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-msg.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_IPC_H)
 #include <sys/ipc.h>
@@ -100,7 +101,7 @@ static int stress_msg_get_stats(const st
 		struct msqid_ds buf;
 
 		/* Keep static analyzers happy */
-		(void)memset(&buf, 0, sizeof(buf));
+		(void)shim_memset(&buf, 0, sizeof(buf));
 
 		/*
 		 * select random msgq index numbers, we may hit
@@ -138,7 +139,7 @@ static int stress_msg_get_stats(const st
 		struct msqid_ds buf;
 
 		/* Keep static analyzers happy */
-		(void)memset(&buf, 0, sizeof(buf));
+		(void)shim_memset(&buf, 0, sizeof(buf));
 
 		/* Exercise invalid msgctl commands */
 		(void)msgctl(msgq_id, ~0, &buf);
@@ -322,7 +323,7 @@ static void OPTIMIZE3 stress_msg_sender(
 #endif
 
 	/* Parent */
-	(void)memset(&msg.u.data, '#', sizeof(msg.u.data));
+	(void)shim_memset(&msg.u.data, '#', sizeof(msg.u.data));
 	msg.u.value = 0;
 
 	do {
diff -pruN 0.15.07-1/stress-msync.c 0.15.08-1/stress-msync.c
--- 0.15.07-1/stress-msync.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-msync.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_MSYNC_BYTES		(1 * MB)  /* MUST NOT BE page size or less! */
 #define MAX_MSYNC_BYTES		(MAX_FILE_LIMIT)
@@ -204,7 +205,7 @@ static int stress_msync(const stress_arg
 		offset = (off_t)stress_mwc64modn(sz - page_size) & ~((off_t)page_size - 1);
 		val = stress_mwc8();
 
-		(void)memset(buf + offset, val, page_size);
+		(void)shim_memset(buf + offset, val, page_size);
 		ret = shim_msync(buf + offset, page_size, MS_SYNC);
 		if (ret < 0) {
 			pr_fail("%s: msync MS_SYNC on "
@@ -240,7 +241,7 @@ do_invalidate:
 		offset = (off_t)stress_mwc64modn(sz - page_size) & ~((off_t)page_size - 1);
 		val = stress_mwc8();
 
-		(void)memset(buf + offset, val, page_size);
+		(void)shim_memset(buf + offset, val, page_size);
 
 		ret = lseek(fd, offset, SEEK_SET);
 		if (ret == (off_t)-1) {
diff -pruN 0.15.07-1/stress-munmap.c 0.15.08-1/stress-munmap.c
--- 0.15.07-1/stress-munmap.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-munmap.c	2023-05-21 14:30:06.000000000 +0000
@@ -22,7 +22,7 @@
 typedef struct {
 	const stress_args_t *args;	/* stress-ng arguments */
 	size_t page_shift;		/* log2(page_size) */
-	char *exe_path;			/* path of executable */
+	char *exec_path;		/* path of executable */
 	double duration;		/* mmap run time duration */
 	double count;			/* count of mmap calls */
 } munmap_context_t;
@@ -182,7 +182,7 @@ static int stress_munmap_child(const str
 			continue;	/* don't unmap libc */
 		if (strstr(path, "/dev/zero"))
 			continue;	/* need this for zero'd page data */
-		if (!strcmp(path, ctxt->exe_path))
+		if (!strcmp(path, ctxt->exec_path))
 			continue;	/* don't unmap stress-ng */
 		if (prot[0] != 'r')
 			continue;	/* don't unmap non-readable pages */
@@ -219,6 +219,7 @@ static int stress_munmap(const stress_ar
 {
 	munmap_context_t *ctxt;
 	double rate;
+	char exec_path[PATH_MAX];
 
 	ctxt = mmap(NULL, sizeof(*ctxt), PROT_READ | PROT_WRITE,
 		MAP_SHARED | MAP_ANONYMOUS, -1, 0);
@@ -231,14 +232,14 @@ static int stress_munmap(const stress_ar
 	ctxt->count = 0.0;
 	ctxt->args = args;
 	ctxt->page_shift = stress_munmap_log2(args->page_size);
-	ctxt->exe_path = stress_proc_self_exe();
-	if (!ctxt->exe_path) {
+	ctxt->exec_path = stress_proc_self_exe(exec_path, sizeof(exec_path));
+	if (!ctxt->exec_path) {
 		pr_inf_skip("%s: skipping stressor, cannot determine child executable path\n",
 			args->name);
 		(void)munmap((void *)ctxt, sizeof(*ctxt));
 		return EXIT_NO_RESOURCE;
 	}
-	stress_munmap_clean_path(ctxt->exe_path);
+	stress_munmap_clean_path(ctxt->exec_path);
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 	while (keep_stressing(args)) {
diff -pruN 0.15.07-1/stress-mutex.c 0.15.08-1/stress-mutex.c
--- 0.15.07-1/stress-mutex.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-mutex.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_PTHREAD_NP_H)
 #include <pthread_np.h>
@@ -208,7 +209,7 @@ static int stress_mutex(const stress_arg
 			mutex_procs = MIN_MUTEX_PROCS;
 	}
 
-	(void)memset(&pthread_info, 0, sizeof(pthread_info));
+	(void)shim_memset(&pthread_info, 0, sizeof(pthread_info));
 
 	if (pthread_mutex_init(&mutex, NULL) < 0) {
 		pr_fail("pthread_mutex_init failed: errno=%d: "
diff -pruN 0.15.07-1/stress-netdev.c 0.15.08-1/stress-netdev.c
--- 0.15.07-1/stress-netdev.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-netdev.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_SOCKIOS_H)
 #include <linux/sockios.h>
@@ -94,7 +95,7 @@ static int stress_netdev(const stress_ar
 		struct ifconf ifc;
 
 		/* Get list of transport layer addresses */
-		(void)memset(&ifc, 0, sizeof(ifc));
+		(void)shim_memset(&ifc, 0, sizeof(ifc));
 		rc = ioctl(fd, SIOCGIFCONF, &ifc);
 		if (rc < 0) {
 			pr_fail("%s: ioctl SIOCGIFCONF failed, errno=%d (%s)\n",
diff -pruN 0.15.07-1/stress-netlink-proc.c 0.15.08-1/stress-netlink-proc.c
--- 0.15.07-1/stress-netlink-proc.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-netlink-proc.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_LINUX_CN_PROC_H)
@@ -205,7 +206,7 @@ static int stress_netlink_proc(const str
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(&addr, 0, sizeof(addr));
+	(void)shim_memset(&addr, 0, sizeof(addr));
 	addr.nl_pid = (uint32_t)getpid();
 	addr.nl_family = AF_NETLINK;
 	addr.nl_groups = CN_IDX_PROC;
@@ -217,14 +218,14 @@ static int stress_netlink_proc(const str
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(&nlmsghdr, 0, sizeof(nlmsghdr));
+	(void)shim_memset(&nlmsghdr, 0, sizeof(nlmsghdr));
 	nlmsghdr.nlmsg_len = NLMSG_LENGTH(sizeof(cn_msg) + sizeof(op));
 	nlmsghdr.nlmsg_pid = (uint32_t)getpid();
 	nlmsghdr.nlmsg_type = NLMSG_DONE;
 	iov[0].iov_base = &nlmsghdr;
 	iov[0].iov_len = sizeof(nlmsghdr);
 
-	(void)memset(&cn_msg, 0, sizeof(cn_msg));
+	(void)shim_memset(&cn_msg, 0, sizeof(cn_msg));
 	cn_msg.id.idx = CN_IDX_PROC;
 	cn_msg.id.val = CN_VAL_PROC;
 	cn_msg.len = sizeof(enum proc_cn_mcast_op);
diff -pruN 0.15.07-1/stress-netlink-task.c 0.15.08-1/stress-netlink-task.c
--- 0.15.07-1/stress-netlink-task.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-netlink-task.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_LINUX_CN_PROC_H)
@@ -117,7 +118,7 @@ static int OPTIMIZE3 stress_netlink_send
 	nlmsgbuf = (char *)&nlmsg;
 	nlmsgbuf_len = nlmsg.n.nlmsg_len;
 
-	(void)memset(&addr, 0, sizeof(addr));
+	(void)shim_memset(&addr, 0, sizeof(addr));
 	addr.nl_family = AF_NETLINK;
 
 	while (nlmsgbuf_len > 0) {
@@ -214,7 +215,7 @@ static int OPTIMIZE3 stress_netlink_task
 			break;
 		}
 
-		(void)memset(&msg, 0, sizeof(msg));
+		(void)shim_memset(&msg, 0, sizeof(msg));
 		msg_len = recv(sock, &msg, sizeof(msg), 0);
 		if (UNLIKELY(msg_len < 0))
 			continue;
@@ -264,7 +265,7 @@ static int stress_netlink_task(const str
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(&addr, 0, sizeof(addr));
+	(void)shim_memset(&addr, 0, sizeof(addr));
 	addr.nl_family = AF_NETLINK;
 
 	if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
diff -pruN 0.15.07-1/stress-ng.1 0.15.08-1/stress-ng.1
--- 0.15.07-1/stress-ng.1	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-ng.1	2023-05-21 14:30:06.000000000 +0000
@@ -2,7 +2,7 @@
 .\" First parameter, NAME, should be all caps
 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
 .\" other parameters are allowed: see man(7), man(1)
-.TH STRESS-NG 1 "23 March 2023"
+.TH STRESS-NG 1 "21 May 2023"
 .\" Please adjust this date whenever revising the manpage.
 .\"
 .\" Some roff macros, for reference:
@@ -453,10 +453,14 @@ inaccurate.
 .B \-\-sn
 use scientific notation (e.g. 2.412e+01) for metrics.
 .TP
+.B \-\-stderr
+write messages to stderr. With version 0.15.08 output is written to stdout,
+previously due to a historical oversight output went to stderr. This
+option allows one to revert to the pre-0.15.08 behaviour.
+.TP
 .B \-\-stdout
-all output goes to stdout. By default all output goes to stderr (which
-is a historical oversight that will cause breakage to users if it is
-now changed). This option allows the output to be written to stdout.
+all output goes to stdout. This is the new default for version 0.15.08. Use
+the \-\-stderr option for the original behaviour.
 .TP
 .B \-\-stressors
 output the names of the available stressors.
@@ -1700,10 +1704,11 @@ context.
 .B \-\-exec\-ops N
 stop exec stress workers after N bogo operations.
 .TP
-.B \-\-exec\-fork\-method [ clone | fork | spawn | vfork ]
-select the process creation method using clone(2), fork(2), posix_spawn(3) or
-vfork(2). Note that vfork will only exec programs using execve due to the
-constraints on the shared stack between the parent and the child process.
+.B \-\-exec\-fork\-method [ clone | fork | rfork | spawn | vfork ]
+select the process creation method using clone(2), fork(2), BSD rfork(2),
+posix_spawn(3) or vfork(2). Note that vfork will only exec programs using
+execve due to the constraints on the shared stack between the parent and
+the child process.
 .TP
 .B \-\-exec\-max P
 create P child processes that exec stress-ng and then wait for them to exit per
@@ -1859,6 +1864,24 @@ which case these become no-ops.
 .B \-\-flush\-cache\-ops N
 stop after N cache flush iterations.
 .TP
+.B \-\-fma N
+start N workers that exercise single and double precision floating point
+multiplication and add operations on arrays of 512 floating point values.
+More modern processors (Intel Haswell, AMD Bulldozer and Piledriver) and
+modern C compilers these will be performed by fused-multiply-add (fma3)
+opcodes. Operations used are:
+.TS
+expand;
+l.
+a \(eq a \(mu b \(pl c
+a \(eq b \(mu a \(pl c
+a \(eq b \(mu c \(pl a
+.TE
+.TP
+.B \-\-fma\-ops N
+stop after N bogo-loops of the 3 above operations on 512 single and double
+precision floating point numbers.
+.TP
 .B \-f N, \-\-fork N
 start N workers continually forking children that immediately exit.
 .TP
diff -pruN 0.15.07-1/stress-ng.c 0.15.08-1/stress-ng.c
--- 0.15.07-1/stress-ng.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-ng.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-ftrace.h"
 #include "core-hash.h"
 #include "core-perf.h"
@@ -69,13 +70,24 @@ int32_t g_opt_parallel = DEFAULT_PARALLE
 uint64_t g_opt_timeout = TIMEOUT_NOT_SET;	/* timeout in seconds */
 uint64_t g_opt_flags = PR_ERROR | PR_INFO | OPT_FLAGS_MMAP_MADVISE;
 volatile bool g_keep_stressing_flag = true;	/* false to exit stressor */
-volatile bool g_caught_signal = false;		/* true if stopped by SIGINT */
 const char g_app_name[] = "stress-ng";		/* Name of application */
 stress_shared_t *g_shared;			/* shared memory */
 jmp_buf g_error_env;				/* parsing error env */
 stress_put_val_t g_put_val;			/* sync data to somewhere */
 
-static void stress_kill_stressors(const int sig);
+#if defined(SA_SIGINFO)
+typedef struct {
+	int	code;
+	pid_t	pid;
+	uid_t	uid;
+	struct timeval when;
+	bool 	triggered;
+} stress_sigalrm_info_t;
+
+stress_sigalrm_info_t g_sigalrm_info;
+#endif
+
+static void stress_kill_stressors(const int sig, const bool force_sigkill);
 /*
  *  optarg option to global setting option flags
  */
@@ -109,6 +121,7 @@ static const stress_opt_flag_t opt_flags
 	{ OPT_smart,		OPT_FLAGS_SMART },
 	{ OPT_sn,		OPT_FLAGS_SN },
 	{ OPT_sock_nodelay,	OPT_FLAGS_SOCKET_NODELAY },
+	{ OPT_stderr,		OPT_FLAGS_STDERR },
 	{ OPT_stdout,		OPT_FLAGS_STDOUT },
 #if defined(HAVE_SYSLOG_H)
 	{ OPT_syslog,		OPT_FLAGS_SYSLOG },
@@ -432,6 +445,8 @@ static const struct option long_options[
 	{ "flock-ops",		1,	0,	OPT_flock_ops },
 	{ "flushcache",		1,	0,	OPT_flushcache },
 	{ "flushcache-ops",	1,	0,	OPT_flushcache_ops },
+	{ "fma",		1,	0,	OPT_fma },
+	{ "fma-ops",		1,	0,	OPT_fma_ops },
 	{ "fork",		1,	0,	OPT_fork },
 	{ "fork-max",		1,	0,	OPT_fork_max },
 	{ "fork-ops",		1,	0,	OPT_fork_ops },
@@ -1017,6 +1032,7 @@ static const struct option long_options[
 	{ "stack-unmap",	0,	0,	OPT_stack_unmap },
 	{ "stackmmap",		1,	0,	OPT_stackmmap },
 	{ "stackmmap-ops",	1,	0,	OPT_stackmmap_ops },
+	{ "stderr",		0,	0,	OPT_stderr },
 	{ "stdout",		0,	0,	OPT_stdout },
 	{ "str",		1,	0,	OPT_str },
 	{ "str-method",		1,	0,	OPT_str_method },
@@ -1379,8 +1395,12 @@ static int stress_get_class(char *const
 					(void)printf("class '%s' stressors:",
 						token);
 					for (j = 0; stressors[j].name; j++) {
-						if (stressors[j].info->class & cl)
-							(void)printf(" %s", stress_munge_underscore(stressors[j].name));
+						if (stressors[j].info->class & cl) {
+							char munged[64];
+
+							(void)stress_munge_underscore(munged, stressors[j].name, sizeof(munged));
+							(void)printf(" %s", munged);
+						}
 					}
 					(void)printf("\n");
 					return 1;
@@ -1439,12 +1459,13 @@ static int stress_exclude(void)
 static void MLOCKED_TEXT stress_sigint_handler(int signum)
 {
 	(void)signum;
-	g_caught_signal = true;
+	if (g_shared)
+		g_shared->caught_sigint = true;
 	keep_stressing_set_flag(false);
 	wait_flag = false;
 
 	/* Send alarm to all stressors */
-	stress_kill_stressors(SIGALRM);
+	stress_kill_stressors(SIGALRM, true);
 }
 
 /*
@@ -1453,16 +1474,41 @@ static void MLOCKED_TEXT stress_sigint_h
  */
 static void MLOCKED_TEXT stress_sigalrm_handler(int signum)
 {
+	if (g_shared)
+		g_shared->caught_sigint = true;
 	if (getpid() == main_pid) {
 		/* Parent */
 		wait_flag = false;
+		stress_kill_stressors(SIGALRM, false);
 	} else {
 		/* Child */
-		g_caught_signal = true;
 		stress_handle_stop_stressing(signum);
 	}
 }
 
+#if defined(SA_SIGINFO)
+static void MLOCKED_TEXT stress_sigalrm_action_handler(
+	int signum,
+	siginfo_t *info,
+	void *ucontext)
+{
+	(void)ucontext;
+
+	if (g_shared && 			/* shared mem initialized */
+	    !g_shared->caught_sigint &&		/* and SIGINT not already handled */
+	    info && 				/* and info is valid */
+	    (info->si_code == SI_USER) &&	/* and not from kernel SIGALRM */
+	    (!g_sigalrm_info.triggered)) {	/* and not already handled */
+		g_sigalrm_info.code = info->si_code;
+		g_sigalrm_info.pid = info->si_pid;
+		g_sigalrm_info.uid = info->si_uid;
+		(void)gettimeofday(&g_sigalrm_info.when, NULL);
+		g_sigalrm_info.triggered = true;
+	}
+	stress_sigalrm_handler(signum);
+}
+#endif
+
 #if defined(SIGUSR2)
 /*
  *  stress_stats_handler()
@@ -1505,6 +1551,9 @@ static void MLOCKED_TEXT stress_stats_ha
  */
 static int stress_set_handler(const char *stress, const bool child)
 {
+#if defined(SA_SIGINFO)
+	struct sigaction sa;
+#endif
 	if (stress_sighandler(stress, SIGINT, stress_sigint_handler, NULL) < 0)
 		return -1;
 	if (stress_sighandler(stress, SIGHUP, stress_sigint_handler, NULL) < 0)
@@ -1517,8 +1566,18 @@ static int stress_set_handler(const char
 		}
 	}
 #endif
+#if defined(SA_SIGINFO)
+	(void)shim_memset(&sa, 0, sizeof(sa));
+	sa.sa_sigaction = stress_sigalrm_action_handler;
+	sa.sa_flags = SA_SIGINFO;
+	if (sigaction(SIGALRM, &sa, NULL) < 0) {
+		pr_fail("%s: sigaction SIGALRM: errno=%d (%s)\n",
+                        stress, errno, strerror(errno));
+	}
+#else
 	if (stress_sighandler(stress, SIGALRM, stress_sigalrm_handler, NULL) < 0)
 		return -1;
+#endif
 	return 0;
 }
 
@@ -1590,8 +1649,10 @@ static void stress_verifiable_mode(stres
 
 	for (i = 0; stressors[i].name; i++)
 		if (stressors[i].info->verify == mode) {
-			(void)printf("%s%s", space ? " " : "",
-				stress_munge_underscore(stressors[i].name));
+			char munged[64];
+
+			(void)stress_munge_underscore(munged, stressors[i].name, sizeof(munged));
+			(void)printf("%s%s", space ? " " : "", munged);
 			space = true;
 		}
 	(void)putchar('\n');
@@ -1631,9 +1692,12 @@ static inline void stress_show_stressor_
 {
 	size_t i;
 
-	for (i = 0; stressors[i].name; i++)
-		(void)printf("%s%s", i ? " " : "",
-			stress_munge_underscore(stressors[i].name));
+	for (i = 0; stressors[i].name; i++) {
+		char munged[64];
+
+		(void)stress_munge_underscore(munged, stressors[i].name, sizeof(munged));
+		(void)printf("%s%s", i ? " " : "", munged);
+	}
 	(void)putchar('\n');
 }
 
@@ -1700,17 +1764,19 @@ static inline void stress_stressor_finis
  *  stress_kill_stressors()
  * 	kill stressor tasks using signal sig
  */
-static void stress_kill_stressors(const int sig)
+static void stress_kill_stressors(const int sig, const bool force_sigkill)
 {
 	static int count = 0;
 	int signum = sig;
 	stress_stressor_t *ss;
 
-	/* multiple calls will always fallback to SIGKILL */
-	count++;
-	if (count > 5) {
-		pr_dbg("killing processes with SIGKILL\n");
-		signum = SIGKILL;
+	if (force_sigkill) {
+		/* multiple calls will always fallback to SIGKILL */
+		count++;
+		if (count > 5) {
+			pr_dbg("killing processes with SIGKILL\n");
+			signum = SIGKILL;
+		}
 	}
 
 	for (ss = stressors_head; ss; ss = ss->next) {
@@ -2029,10 +2095,10 @@ redo:
 			if (stress_process_oomed(ret)) {
 				pr_dbg("process [%d] (%s) was killed by the OOM killer\n",
 					ret, stressor_name);
-			} else if (WTERMSIG(status) == SIGKILL) {
+			} else if (wterm_signal == SIGKILL) {
 				pr_dbg("process [%d] (%s) was possibly killed by the OOM killer\n",
 					ret, stressor_name);
-			} else {
+			} else if (wterm_signal != SIGALRM) {
 				*success = false;
 			}
 		}
@@ -2088,7 +2154,7 @@ redo:
 		if ((g_opt_flags & OPT_FLAGS_ABORT) && do_abort) {
 			keep_stressing_set_flag(false);
 			wait_flag = false;
-			stress_kill_stressors(SIGALRM);
+			stress_kill_stressors(SIGALRM, true);
 		}
 
 		stress_stressor_finished(&stats->pid);
@@ -2134,10 +2200,11 @@ static void stress_wait_stressors(
 			const pid_t pid = stats->pid;
 
 			if (pid) {
-				const char *stressor_name = stress_munge_underscore(ss->stressor->name);
+				char munged[64];
 
-				stress_wait_pid(ss, pid, stressor_name, stats, success, resource_success, metrics_success);
-				stress_clean_dir(stressor_name, pid, (uint32_t)j);
+				(void)stress_munge_underscore(munged, ss->stressor->name, sizeof(munged));
+				stress_wait_pid(ss, pid, munged, stats, success, resource_success, metrics_success);
+				stress_clean_dir(munged, pid, (uint32_t)j);
 			}
 		}
 	}
@@ -2167,13 +2234,13 @@ static void MLOCKED_TEXT stress_handle_t
 		(void)snprintf(buf, sizeof(buf), "%s: info:  [%d] stressor terminated with unexpected signal %s\n",
 			g_app_name, (int)getpid(), stress_strsignal(signum));
 		VOID_RET(ssize_t, write(fd, buf, strlen(buf)));
-		stress_kill_stressors(SIGALRM);
+		stress_kill_stressors(SIGALRM, true);
 		_exit(EXIT_SIGNALED);
 	default:
 		/*
 		 *  Kill stressors
 		 */
-		stress_kill_stressors(SIGALRM);
+		stress_kill_stressors(SIGALRM, true);
 		break;
 	}
 }
@@ -2351,7 +2418,7 @@ static void MLOCKED_TEXT stress_run(
 			int rc = EXIT_SUCCESS;
 			size_t i;
 			pid_t pid, child_pid;
-			char name[64], *munged;
+			char name[64];
 			stress_stats_t *const stats = g_stressor_current->stats[j];
 			double run_duration, fork_time_start;
 			bool ok;
@@ -2379,14 +2446,13 @@ again:
 				}
 				pr_err("Cannot fork: errno=%d (%s)\n",
 					errno, strerror(errno));
-				stress_kill_stressors(SIGALRM);
+				stress_kill_stressors(SIGALRM, false);
 				goto wait_for_stressors;
 			case 0:
 				/* Child */
 				child_pid = getpid();
-				munged = stress_munge_underscore(g_stressor_current->stressor->name);
 
-				shim_strlcpy(name, munged, sizeof(name));
+				(void)stress_munge_underscore(name, g_stressor_current->stressor->name, sizeof(name));
 				stress_set_proc_state(name, STRESS_STATE_START);
 
 				(void)sched_settings_apply(true);
@@ -2438,15 +2504,38 @@ again:
 						.info = g_stressor_current->stressor->info
 					};
 
-					(void)memset(*checksum, 0, sizeof(**checksum));
+					(void)shim_memset(*checksum, 0, sizeof(**checksum));
 					rc = g_stressor_current->stressor->info->stressor(&args);
 					pr_fail_check(&rc);
 
+#if defined(SA_SIGINFO) &&	\
+    defined(SI_USER)
+					/*
+					 *  Sanity check if process was killed by
+					 *  an external SIGALRM source
+					 */
+					if (g_sigalrm_info.triggered && (g_sigalrm_info.code == SI_USER)) {
+						time_t t = g_sigalrm_info.when.tv_sec;
+						const struct tm *tm = localtime(&t);
+
+						if (tm) {
+							pr_inf("%s: terminated by SIGALRM externally at %2.2d:%2.2d:%2.2d.%2.2ld by user %d\n",
+								name,
+								tm->tm_hour, tm->tm_min, tm->tm_sec,
+								(long)g_sigalrm_info.when.tv_usec / 10000,
+								g_sigalrm_info.uid);
+						} else {
+							pr_inf("%s: terminated by SIGALRM externally by user %d\n",
+								name, g_sigalrm_info.uid);
+						}
+					}
+#endif
+
 					ok = (rc == EXIT_SUCCESS);
 					stats->ci.run_ok = ok;
 					(*checksum)->data.ci.run_ok = ok;
 					/* Ensure reserved padding is zero to not confuse checksum */
-					(void)memset((*checksum)->data.reserved, 0, sizeof((*checksum)->data.reserved));
+					(void)shim_memset((*checksum)->data.reserved, 0, sizeof((*checksum)->data.reserved));
 
 					/*
 					 *  We're done, cancel SIGALRM
@@ -2459,7 +2548,7 @@ again:
 					 *  if not then flag up that the counter may
 					 *  be untrustyworthy
 					 */
-					if (!stats->ci.counter_ready) {
+					if ((!stats->ci.counter_ready) && (!stats->ci.force_killed)) {
 						pr_warn("%s: WARNING: bogo-ops counter in non-ready state, "
 							"metrics are untrustworthy (process may have been "
 							"terminated prematurely)\n",
@@ -2487,7 +2576,7 @@ again:
 				stress_getrusage(RUSAGE_SELF, stats);
 				stress_getrusage(RUSAGE_CHILDREN, stats);
 #else
-				(void)memset(&stats->tms, 0, sizeof(stats->tms));
+				(void)shim_memset(&stats->tms, 0, sizeof(stats->tms));
 				if (times(&stats->tms) == (clock_t)-1) {
 					pr_dbg("times failed: errno=%d (%s)\n",
 						errno, strerror(errno));
@@ -2503,7 +2592,8 @@ again:
 				 * Apparently succeeded but terminated early?
 				 * Could be a bug, so report a warning
 				 */
-				if (stats->ci.run_ok && !g_caught_signal &&
+				if (stats->ci.run_ok &&
+				    (g_shared && !g_shared->caught_sigint) &&
 				    (run_duration < (double)g_opt_timeout) &&
 				    (!(g_stressor_current->bogo_ops && stats->ci.counter >= g_stressor_current->bogo_ops))) {
 
@@ -2540,7 +2630,7 @@ child_exit:
 				/* Forced early abort during startup? */
 				if (!keep_stressing_flag()) {
 					pr_dbg("abort signal during startup, cleaning up\n");
-					stress_kill_stressors(SIGALRM);
+					stress_kill_stressors(SIGALRM, true);
 					goto wait_for_stressors;
 				}
 				break;
@@ -2581,11 +2671,12 @@ static int stress_show_stressors(void)
 		const int32_t n = ss->num_instances;
 
 		if (n) {
-			const ssize_t buffer_len =
-				snprintf(buffer, sizeof(buffer),
-					"%s %" PRId32 " %s",
-					previous ? "," : "", n,
-					stress_munge_underscore(ss->stressor->name));
+			char munged[64];
+			ssize_t buffer_len;
+
+			(void)stress_munge_underscore(munged, ss->stressor->name, sizeof(munged));
+			buffer_len = snprintf(buffer, sizeof(buffer),
+					"%s %" PRId32 " %s", previous ? "," : "", n, munged);
 			previous = true;
 			if (buffer_len >= 0) {
 				newstr = realloc(str, (size_t)(len + buffer_len + 1));
@@ -2625,13 +2716,12 @@ static void stress_exit_status_type(cons
 
 	for (ss = stressors_head; ss; ss = ss->next) {
 		if (ss->status[type] > 0) {
-			char buf[64];
+			char buf[80], munged[64];
 			char *new_str;
 			size_t buf_len;
 
-			(void)snprintf(buf, sizeof(buf), " %s (%" PRIu32")",
-				stress_munge_underscore(ss->stressor->name),
-				ss->status[type]);
+			(void)stress_munge_underscore(munged, ss->stressor->name, sizeof(munged));
+			(void)snprintf(buf, sizeof(buf), " %s (%" PRIu32")", munged, ss->status[type]);
 			buf_len = strlen(buf);
 			new_str = realloc(str, str_len + buf_len);
 			if (!new_str) {
@@ -2696,7 +2786,7 @@ static void stress_metrics_check(bool *s
 				continue;
 			}
 
-			(void)memset(&stats_checksum, 0, sizeof(stats_checksum));
+			(void)shim_memset(&stats_checksum, 0, sizeof(stats_checksum));
 			stats_checksum.data.ci.counter = stats->ci.counter;
 			stats_checksum.data.ci.run_ok = stats->ci.run_ok;
 			stress_hash_checksum(&stats_checksum);
@@ -2797,13 +2887,15 @@ static void stress_metrics_dump(
 		long int maxrss = 0;
 		int32_t  j;
 		size_t i;
-		const char *munged = stress_munge_underscore(ss->stressor->name);
+		char munged[64];
 		double u_time, s_time, t_time, bogo_rate_r_time, bogo_rate, cpu_usage;
 		bool run_ok = false;
 
 		if (!ss->stats)
 			continue;
 
+		(void)stress_munge_underscore(munged, ss->stressor->name, sizeof(munged));
+
 		for (j = 0; j < ss->started_instances; j++) {
 			const stress_stats_t *const stats = ss->stats[j];
 
@@ -2950,11 +3042,13 @@ static void stress_metrics_dump(
 		for (ss = stressors_head; ss; ss = ss->next) {
 			size_t i;
 			int32_t j;
-			const char *munged = stress_munge_underscore(ss->stressor->name);
+			char munged[64];
 
 			if (!ss->stats)
 				continue;
 
+			(void)stress_munge_underscore(munged, ss->stressor->name, sizeof(munged));
+
 			for (i = 0; i < SIZEOF_ARRAY(ss->stats[0]->metrics); i++) {
 				const char *description = ss->stats[0]->metrics[i].description;
 
@@ -3112,7 +3206,7 @@ void stress_log_system_mem_info(void)
     defined(HAVE_SYSLOG_H)
 	struct sysinfo info;
 
-	(void)memset(&info, 0, sizeof(info));
+	(void)shim_memset(&info, 0, sizeof(info));
 	if (sysinfo(&info) == 0) {
 		shim_syslog(LOG_INFO, "memory (MB): total %.2f, "
 			"free %.2f, "
@@ -3191,7 +3285,7 @@ static inline void stress_shared_map(con
 	}
 
 	/* Paraniod */
-	(void)memset(g_shared, 0, sz);
+	(void)shim_memset(g_shared, 0, sz);
 	g_shared->length = sz;
 
 	/*
@@ -3242,7 +3336,7 @@ STRESS_PRAGMA_POP
 			errno, strerror(errno));
 		goto err_unmap_shared;
 	}
-	(void)memset(g_shared->checksums, 0, sz);
+	(void)shim_memset(g_shared->checksums, 0, sz);
 	g_shared->checksums_length = sz;
 
 	/*
@@ -3457,11 +3551,13 @@ static inline void stress_exclude_pathol
 
 			if (ss->stressor->info->class & CLASS_PATHOLOGICAL) {
 				if (ss->num_instances > 0) {
+					char munged[64];
+
+					(void)stress_munge_underscore(munged, ss->stressor->name, sizeof(munged));
 					pr_inf("disabled '%s' as it "
 						"may hang or reboot the machine "
 						"(enable it with the "
-						"--pathological option)\n",
-						stress_munge_underscore(ss->stressor->name));
+						"--pathological option)\n", munged);
 				}
 				stress_remove_stressor(ss);
 			}
@@ -3953,7 +4049,6 @@ static inline void stress_run_sequential
 		stress_run(ss, duration, success, resource_success,
 			metrics_success, &checksum);
 		ss->next = next;
-
 	}
 }
 
@@ -4091,6 +4186,14 @@ int main(int argc, char **argv, char **e
 	if (ret != EXIT_SUCCESS)
 		goto exit_settings_free;
 
+	if ((g_opt_flags & (OPT_FLAGS_STDERR | OPT_FLAGS_STDOUT)) ==
+	    (OPT_FLAGS_STDERR | OPT_FLAGS_STDOUT)) {
+		(void)fprintf(stderr, "stderr and stdout cannot "
+			"be used together\n");
+		ret = EXIT_FAILURE;
+		goto exit_stressors_free;
+	}
+
 	if (stress_check_temp_path() < 0) {
 		ret = EXIT_FAILURE;
 		goto exit_stressors_free;
diff -pruN 0.15.07-1/stress-ng.h 0.15.08-1/stress-ng.h
--- 0.15.07-1/stress-ng.h	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-ng.h	2023-05-21 14:30:06.000000000 +0000
@@ -322,13 +322,14 @@ typedef unsigned long int __kernel_ulong
 #define OPT_FLAGS_SMART		 STRESS_BIT_ULL(40)	/* --smart */
 #define OPT_FLAGS_NO_OOM_ADJUST	 STRESS_BIT_ULL(41)	/* --no-oom-adjust */
 #define OPT_FLAGS_KEEP_FILES	 STRESS_BIT_ULL(42)	/* --keep-files */
-#define OPT_FLAGS_STDOUT	 STRESS_BIT_ULL(43)	/* --stdout */
-#define OPT_FLAGS_KLOG_CHECK	 STRESS_BIT_ULL(44)	/* --klog-check */
-#define OPT_FLAGS_DRY_RUN	 STRESS_BIT_ULL(45)	/* Don't actually run */
-#define OPT_FLAGS_OOM_AVOID	 STRESS_BIT_ULL(46)	/* --oom-avoid */
-#define OPT_FLAGS_TZ_INFO	 STRESS_BIT_ULL(47)	/* Require thermal zone info */
-#define OPT_FLAGS_LOG_LOCKLESS	 STRESS_BIT_ULL(48)	/* --log-lockless */
-#define OPT_FLAGS_SN		 STRESS_BIT_ULL(49)	/* --sn scientific notation */
+#define OPT_FLAGS_STDERR	 STRESS_BIT_ULL(43)	/* --stderr */
+#define OPT_FLAGS_STDOUT	 STRESS_BIT_ULL(44)	/* --stdout */
+#define OPT_FLAGS_KLOG_CHECK	 STRESS_BIT_ULL(45)	/* --klog-check */
+#define OPT_FLAGS_DRY_RUN	 STRESS_BIT_ULL(46)	/* Don't actually run */
+#define OPT_FLAGS_OOM_AVOID	 STRESS_BIT_ULL(47)	/* --oom-avoid */
+#define OPT_FLAGS_TZ_INFO	 STRESS_BIT_ULL(48)	/* Require thermal zone info */
+#define OPT_FLAGS_LOG_LOCKLESS	 STRESS_BIT_ULL(49)	/* --log-lockless */
+#define OPT_FLAGS_SN		 STRESS_BIT_ULL(50)	/* --sn scientific notation */
 
 #define OPT_FLAGS_MINMAX_MASK		\
 	(OPT_FLAGS_MINIMIZE | OPT_FLAGS_MAXIMIZE)
@@ -395,6 +396,7 @@ typedef struct {
 	uint64_t	counter;	/* bogo-op counter */
 	bool		counter_ready;	/* ready flag */
 	bool	 	run_ok;		/* stressor run w/o issues */
+	bool		force_killed;	/* true if sent SIGKILL */
 } stress_counter_info_t;
 
 /*
@@ -462,7 +464,7 @@ typedef struct {
 	void *page_wo;			/* mmap'd PROT_WO page */
 } stress_mapped_t;
 
-#define STRESS_MISC_METRICS_MAX	(28)
+#define STRESS_MISC_METRICS_MAX	(40)
 
 typedef struct {
 	void *lock;			/* optional lock */
@@ -531,9 +533,9 @@ typedef struct stressor_info {
 #endif
 
 #if defined(HAVE_ATTRIBUTE_FAST_MATH) &&		\
+    !defined(__INTEL_COMPILER) &&			\
     defined(__GNUC__) &&				\
-    NEED_GNUC(10, 0, 0) &&				\
-    !defined(__INTEL_COMPILER)
+    NEED_GNUC(10, 0, 0)
 #define OPTIMIZE_FAST_MATH __attribute__((optimize("fast-math")))
 #else
 #define OPTIMIZE_FAST_MATH
@@ -797,11 +799,11 @@ extern void pr_lock_exited(const pid_t p
 /* Generic bit setting on an array macros */
 #define STRESS_NBITS(a)		(sizeof(a[0]) * 8)
 #define STRESS_GETBIT(a, i)	(a[i / STRESS_NBITS(a)] & \
-				 (TYPEOF_CAST(a[0])1 << (i & (STRESS_NBITS(a)-1))))
+				 (TYPEOF_CAST(a[0])1U << (i & (STRESS_NBITS(a)-1))))
 #define STRESS_CLRBIT(a, i)	(a[i / STRESS_NBITS(a)] &= \
-				 ~(TYPEOF_CAST(a[0])1 << (i & (STRESS_NBITS(a)-1))))
+				 ~(TYPEOF_CAST(a[0])1U << (i & (STRESS_NBITS(a)-1))))
 #define STRESS_SETBIT(a, i)	(a[i / STRESS_NBITS(a)] |= \
-				 (TYPEOF_CAST(a[0])1 << (i & (STRESS_NBITS(a)-1))))
+				 (TYPEOF_CAST(a[0])1U << (i & (STRESS_NBITS(a)-1))))
 
 #define SIZEOF_ARRAY(a)		(sizeof(a) / sizeof(a[0]))
 
@@ -908,6 +910,8 @@ typedef struct shared_heap {
 /* The stress-ng global shared memory segment */
 typedef struct {
 	size_t length;					/* Size of segment */
+	void *cacheline_lock;				/* Cacheline stressor lock */
+	int cacheline_index;				/* Cacheline stressor index */
 	uint8_t *cacheline;				/* Cacheline stressor buffer */
 	size_t cacheline_size;				/* Cacheline buffer size */
 	uint8_t	*mem_cache;				/* Shared memory cache */
@@ -924,7 +928,8 @@ typedef struct {
 	int pr_lock_count;				/* pr_* lock count, release when zero */
 	pid_t pr_pid;					/* pid owning the lock */
 #endif
-	bool     klog_error;				/* True if error detected in klog */
+	bool klog_error;				/* True if error detected in klog */
+	bool caught_sigint;				/* True if SIGINT caught */
 	pid_t (*vfork)(void);				/* vfork syscall */
 	stress_mapped_t mapped;				/* mmap'd pages to help testing */
 	shared_heap_t shared_heap;
@@ -1278,6 +1283,9 @@ typedef enum {
 	OPT_flushcache,
 	OPT_flushcache_ops,
 
+	OPT_fma,
+	OPT_fma_ops,
+
 	OPT_fork_ops,
 	OPT_fork_max,
 	OPT_fork_vm,
@@ -2058,6 +2066,7 @@ typedef enum {
 	OPT_stackmmap,
 	OPT_stackmmap_ops,
 
+	OPT_stderr,
 	OPT_stdout,
 
 	OPT_str,
@@ -2365,6 +2374,10 @@ static inline void ALWAYS_INLINE OPTIMIZ
 /*
  *  add_counter()
  *	add inc to the stessor bogo ops counter
+ *	NOTE: try to only add to the counter inside a stressor
+ *	and not a child process of a stressor. If one has to add to
+ *	the counter in a child and the child is force KILL'd then indicate
+ *	so with the force_killed_counter() call from the parent.
  */
 static inline void ALWAYS_INLINE OPTIMIZE3 add_counter(const stress_args_t *args, const uint64_t inc)
 {
@@ -2380,6 +2393,10 @@ static inline void ALWAYS_INLINE OPTIMIZ
 /*
  *  inc_counter()
  *	increment the stessor bogo ops counter
+ *	NOTE: try to only increment the counter inside a stressor
+ *	and not a child process of a stressor. If one has to increment
+ *	the counter in a child and the child is force KILL'd then indicate
+ *	so with the force_killed_counter() call from the parent.
  */
 static inline void ALWAYS_INLINE OPTIMIZE3 inc_counter(const stress_args_t *args)
 {
@@ -2406,6 +2423,10 @@ static inline uint64_t ALWAYS_INLINE OPT
 /*
  *  set_counter()
  *	set the stessor bogo ops counter
+ *	NOTE: try to only set the counter inside a stressor
+ *	and not a child process of a stressor. If one has to set
+ *	the counter in a child and the child is force KILL'd then indicate
+ *	so with the force_killed_counter() call from the parent.
  */
 static inline void ALWAYS_INLINE OPTIMIZE3 set_counter(const stress_args_t *args, const uint64_t val)
 {
@@ -2419,6 +2440,17 @@ static inline void ALWAYS_INLINE OPTIMIZ
 }
 
 /*
+ *  force_killed_counter()
+ *	note that the process is force killed and counter ready state can
+ *	be ignored. Use only if the parent kills the child *and* the child
+ *	was used to increment the bogo-op counter.
+ */
+static inline void ALWAYS_INLINE force_killed_counter(const stress_args_t *args)
+{
+	args->ci->force_killed = true;
+}
+
+/*
  *  keep_stressing()
  *      returns true if we can keep on running a stressor
  */
@@ -2546,6 +2578,9 @@ typedef int stress_oomable_child_func_t(
 #define STRESS_OOMABLE_QUIET	(0x00000002)		/* Don't report activity */
 
 /* Misc helpers */
+
+extern const char ALIGN64 stress_ascii64[64];
+
 extern size_t stress_mk_filename(char *fullname, const size_t fullname_len,
 	const char *pathname, const char *filename);
 extern void stress_set_oom_adjustment(const char *name, const bool killable);
@@ -2613,7 +2648,7 @@ extern WARN_UNUSED size_t stress_min_pth
 
 extern void stress_shared_unmap(void);
 extern void stress_log_system_mem_info(void);
-extern WARN_UNUSED char *stress_munge_underscore(const char *str);
+extern size_t stress_munge_underscore(char *dst, const char *src, size_t len);
 extern WARN_UNUSED int stress_strcmp_munged(const char *s1, const char *s2);
 extern size_t stress_get_page_size(void);
 extern WARN_UNUSED int32_t stress_get_processors_online(void);
@@ -2695,8 +2730,7 @@ extern WARN_UNUSED bool stress_check_cap
 extern WARN_UNUSED bool stress_sigalrm_pending(void);
 extern WARN_UNUSED bool stress_is_dev_tty(const int fd);
 extern WARN_UNUSED bool stress_little_endian(void);
-extern WARN_UNUSED char *stress_proc_self_exe_path(const char *proc_path);
-extern WARN_UNUSED char *stress_proc_self_exe(void);
+extern WARN_UNUSED char *stress_proc_self_exe(char *path, const size_t path_len);
 extern WARN_UNUSED void *stress_shared_heap_init(void);
 extern void stress_shared_heap_deinit(void);
 extern WARN_UNUSED void *stress_shared_heap_malloc(const size_t size);
@@ -2740,6 +2774,11 @@ extern void stress_sighandler_nop(int si
 extern int stress_killpid(const pid_t pid);
 extern WARN_UNUSED bool stress_low_memory(const size_t requested);
 extern void stress_ksm_memory_merge(const int flag);
+extern void stress_kill_and_wait(const stress_args_t *args,
+	const pid_t pid, const int signum, const bool set_force_killed_counter);
+extern void stress_kill_and_wait_many(const stress_args_t *args,
+	const pid_t *pids, const size_t n_pids, const int signum,
+	const bool set_force_killed_counter);
 
 /* process information */
 extern void stress_dump_processes(void);
diff -pruN 0.15.07-1/stress-nice.c 0.15.08-1/stress-nice.c
--- 0.15.07-1/stress-nice.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-nice.c	2023-05-21 14:30:06.000000000 +0000
@@ -151,6 +151,7 @@ static int stress_nice(const stress_args
 
 			/* Parent, wait for child */
 			if (shim_waitpid(pid, &status, 0) < 0) {
+				force_killed_counter(args);
 				(void)kill(pid, SIGTERM);
 				(void)kill(pid, SIGKILL);
 			}
diff -pruN 0.15.07-1/stress-null.c 0.15.08-1/stress-null.c
--- 0.15.07-1/stress-null.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-null.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_FS_H)
 #include <linux/fs.h>
@@ -56,7 +57,7 @@ static int stress_null(const stress_args
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(buffer, 0xff, sizeof(buffer));
+	(void)shim_memset(buffer, 0xff, sizeof(buffer));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
@@ -132,7 +133,7 @@ static int stress_null(const stress_args
 			ptr = mmap(NULL, page_size, PROT_WRITE,
 				MAP_PRIVATE | MAP_ANONYMOUS, fd, off);
 			if (ptr != MAP_FAILED) {
-				(void)memset(ptr, stress_mwc8(), page_size);
+				(void)shim_memset(ptr, stress_mwc8(), page_size);
 				(void)shim_msync(ptr, page_size, MS_SYNC);
 				(void)munmap(ptr, page_size);
 			}
diff -pruN 0.15.07-1/stress-numa.c 0.15.08-1/stress-numa.c
--- 0.15.07-1/stress-numa.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-numa.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_LINUX_MEMPOLICY_H)
@@ -209,7 +210,7 @@ static inline void stress_set_numa_array
 {
 	const size_t n = nmemb * size;
 
-	(void)memset(array, val, n);
+	(void)shim_memset(array, val, n);
 }
 
 /*
@@ -348,7 +349,7 @@ static int stress_numa(const stress_args
 			}
 		}
 
-		(void)memset(buf, 0xff, MMAP_SZ);
+		(void)shim_memset(buf, 0xff, MMAP_SZ);
 		if (!keep_stressing_flag())
 			break;
 
@@ -448,7 +449,7 @@ static int stress_numa(const stress_args
 				goto err;
 			}
 		} else {
-			(void)memset(buf, 0xaa, MMAP_SZ);
+			(void)shim_memset(buf, 0xaa, MMAP_SZ);
 		}
 		if (!keep_stressing_flag())
 			break;
@@ -467,7 +468,7 @@ static int stress_numa(const stress_args
 				goto err;
 			}
 		} else {
-			(void)memset(buf, 0x5c, MMAP_SZ);
+			(void)shim_memset(buf, 0x5c, MMAP_SZ);
 		}
 		if (!keep_stressing_flag())
 			break;
@@ -557,7 +558,7 @@ static int stress_numa(const stress_args
 					goto err;
 				}
 			}
-			(void)memset(buf, j, MMAP_SZ);
+			(void)shim_memset(buf, j, MMAP_SZ);
 			if (!keep_stressing_flag())
 				break;
 		}
diff -pruN 0.15.07-1/stress-opcode.c 0.15.08-1/stress-opcode.c
--- 0.15.07-1/stress-opcode.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-opcode.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-bitops.h"
 
 #if defined(HAVE_LINUX_AUDIT_H)
@@ -65,7 +66,7 @@ static sigjmp_buf jmp_env;
 #define PAGES		(16)
 
 typedef void(*stress_opcode_func)(const size_t page_size, void *ops_begin,
-				  const void *ops_end, volatile uint64_t *op);
+				  const void *ops_end, const volatile uint64_t *op);
 
 typedef struct {
 	const char *name;
@@ -186,10 +187,10 @@ static void MLOCKED_TEXT stress_badhandl
 }
 
 static void OPTIMIZE3 stress_opcode_random(
-	size_t page_size,
+	const size_t page_size,
 	void *ops_begin,
 	const void *ops_end,
-	volatile uint64_t *op)
+	const volatile uint64_t *op)
 {
 	register uint32_t *ops = (uint32_t *)ops_begin;
 
@@ -208,10 +209,10 @@ static void OPTIMIZE3 stress_opcode_rand
 #define OPCODE_HEX_DIGITS	(STRESS_OPCODE_SIZE >> 2)
 
 static void OPTIMIZE3 stress_opcode_inc(
-	size_t page_size,
+	const size_t page_size,
 	void *ops_begin,
 	const void *ops_end,
-	volatile uint64_t *op)
+	const volatile uint64_t *op)
 {
 	switch (STRESS_OPCODE_SIZE) {
 	case 8:	{
@@ -277,10 +278,10 @@ static void OPTIMIZE3 stress_opcode_inc(
 }
 
 static void OPTIMIZE3 stress_opcode_mixed(
-	size_t page_size,
+	const size_t page_size,
 	void *ops_begin,
 	const void *ops_end,
-	volatile uint64_t *op)
+	const volatile uint64_t *op)
 {
 	register uint64_t tmp = *op;
 	register uint64_t *ops = (uint64_t *)ops_begin;
@@ -302,10 +303,10 @@ static void OPTIMIZE3 stress_opcode_mixe
 }
 
 static void stress_opcode_text(
-	size_t page_size,
+	const size_t page_size,
 	void *ops_begin,
 	const void *ops_end,
-	volatile uint64_t *op)
+	const volatile uint64_t *op)
 {
 	char *text_start, *text_end;
 	const size_t ops_len = (uintptr_t)ops_end - (uintptr_t)ops_begin;
@@ -319,7 +320,7 @@ static void stress_opcode_text(
 	}
 
 	offset = stress_mwc64modn(text_len - ops_len) & ~(0x7ULL);
-	(void)memcpy(ops_begin, text_start + offset, ops_len);
+	(void)shim_memcpy(ops_begin, text_start + offset, ops_len);
 	for (ops = (uint8_t *)ops_begin; ops < (const uint8_t *)ops_end; ops++) {
 		const uint8_t rnd = stress_mwc8();
 
@@ -407,7 +408,7 @@ static int stress_opcode(const stress_ar
 		return EXIT_NO_RESOURCE;
 	}
 	/* Force pages resident */
-	(void)memset(opcodes, 0x00, page_size * PAGES);
+	(void)shim_memset(opcodes, 0x00, page_size * PAGES);
 
 	(void)stress_get_setting("opcode-method", &opcode_method);
 
diff -pruN 0.15.07-1/stress-open.c 0.15.08-1/stress-open.c
--- 0.15.07-1/stress-open.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-open.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_OPENAT2_H)
 #include <linux/openat2.h>
@@ -382,7 +383,8 @@ static int open_flag_perm(
 #endif
 	(void)shim_unlink(filename);
 	index++;
-	index %= open_count;
+	if (index >= open_count)
+		index = 0;
 
 	return fd;
 }
@@ -775,7 +777,7 @@ static int open_with_openat2_cwd(
 	for (i = 0; i < SIZEOF_ARRAY(resolve_flags); i++) {
 		double t;
 
-		(void)memset(&how, 0, sizeof(how));
+		(void)shim_memset(&how, 0, sizeof(how));
 		how.flags = O_CREAT | O_RDWR;
 		how.mode = S_IRUSR | S_IWUSR;
 		how.resolve = resolve_flags[j++];
diff -pruN 0.15.07-1/stress-peterson.c 0.15.08-1/stress-peterson.c
--- 0.15.07-1/stress-peterson.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-peterson.c	2023-05-21 14:30:06.000000000 +0000
@@ -56,7 +56,7 @@ static void stress_peterson_p0(const str
 	peterson->m.flag[0] = true;
 	peterson->m.turn = 1;
 	shim_mfence();
-	while (peterson->m.flag[1] && peterson->m.turn == 1) {
+	while (peterson->m.flag[1] && (peterson->m.turn == 1)) {
 	}
 
 	/* Critical section */
@@ -84,7 +84,7 @@ static void stress_peterson_p1(const str
 	peterson->m.flag[1] = true;
 	peterson->m.turn = 0;
 	shim_mfence();
-	while (peterson->m.flag[0] && peterson->m.turn == 0) {
+	while (peterson->m.flag[0] && (peterson->m.turn == 0)) {
 	}
 
 	/* Critical section */
diff -pruN 0.15.07-1/stress-pidfd.c 0.15.08-1/stress-pidfd.c
--- 0.15.07-1/stress-pidfd.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-pidfd.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"pidfd N",	"start N workers exercising pidfd system call" },
@@ -86,7 +87,7 @@ static int stress_pidfd_supported(const
 	}
 
 	/* initialized info to be safe */
-	(void)memset(&info, 0, sizeof(info));
+	(void)shim_memset(&info, 0, sizeof(info));
 
 	/*
 	 * Exercise pidfd_send_signal with
diff -pruN 0.15.07-1/stress-ping-sock.c 0.15.08-1/stress-ping-sock.c
--- 0.15.07-1/stress-ping-sock.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-ping-sock.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_NETINET_IP_ICMP_H)
 #include <netinet/ip_icmp.h>
@@ -50,10 +51,6 @@ static int stress_ping_sock(const stress
 	char ALIGN64 buf[sizeof(*icmp_hdr) + PING_PAYLOAD_SIZE];
 	double t, duration = 0.0, rate;
 
-	static const char ALIGN64 data[64] =
-		"0123456789ABCDEFGHIJKLMNOPQRSTUV"
-		"WXYZabcdefghijklmnopqrstuvwxyz@!";
-
 	if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP)) < 0) {
 		if (errno == EPROTONOSUPPORT) {
 			pr_inf_skip("%s: skipping stressor, protocol not supported\n",
@@ -70,12 +67,12 @@ static int stress_ping_sock(const stress
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(&addr, 0, sizeof(addr));
+	(void)shim_memset(&addr, 0, sizeof(addr));
 	addr.sin_family = AF_INET;
 	addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 
 	icmp_hdr = (struct icmphdr *)buf;
-	(void)memset(icmp_hdr, 0, sizeof(*icmp_hdr));
+	(void)shim_memset(icmp_hdr, 0, sizeof(*icmp_hdr));
 	icmp_hdr->type = ICMP_ECHO;
 	icmp_hdr->un.echo.id = (uint16_t)getpid();	/* some unique ID */
 	icmp_hdr->un.echo.sequence = 1;
@@ -86,7 +83,7 @@ static int stress_ping_sock(const stress
 
 	t = stress_time_now();
 	do {
-		(void)memset(buf + sizeof(*icmp_hdr), data[j++ & 63], PING_PAYLOAD_SIZE);
+		(void)shim_memset(buf + sizeof(*icmp_hdr), stress_ascii64[j++ & 63], PING_PAYLOAD_SIZE);
 		addr.sin_port = htons(rand_port);
 
 		if (LIKELY(sendto(fd, buf, sizeof(buf), 0, (struct sockaddr *)&addr, sizeof(addr)) > 0))
diff -pruN 0.15.07-1/stress-pipe.c 0.15.08-1/stress-pipe.c
--- 0.15.07-1/stress-pipe.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-pipe.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ "p N", "pipe N",		"start N workers exercising pipe I/O" },
@@ -128,7 +129,7 @@ static int stress_pipe(const stress_args
 	buf32 = (uint32_t *)buf;
 	stress_rndbuf(buf, pipe_data_size);
 
-	(void)memset(pipefds, 0, sizeof(pipefds));
+	(void)shim_memset(pipefds, 0, sizeof(pipefds));
 
 #if defined(HAVE_PIPE2) &&	\
     defined(O_DIRECT)
diff -pruN 0.15.07-1/stress-pipeherd.c 0.15.08-1/stress-pipeherd.c
--- 0.15.07-1/stress-pipeherd.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-pipeherd.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 /*
  *  Herd of pipe processes, simulates how GNU make passes tokens
@@ -179,11 +180,11 @@ static int stress_pipeherd(const stress_
     defined(RUSAGE_CHILDREN) &&	\
     defined(RUSAGE_SELF) &&	\
     defined(HAVE_RUSAGE_RU_NVCSW)
-	(void)memset(&usage, 0, sizeof(usage));
+	(void)shim_memset(&usage, 0, sizeof(usage));
 	if (shim_getrusage(RUSAGE_CHILDREN, &usage) == 0) {
 		long total = usage.ru_nvcsw + usage.ru_nivcsw;
 
-		(void)memset(&usage, 0, sizeof(usage));
+		(void)shim_memset(&usage, 0, sizeof(usage));
 		if (getrusage(RUSAGE_SELF, &usage) == 0) {
 			const uint64_t count = get_counter(args);
 			const double dt = t2 - t1;
diff -pruN 0.15.07-1/stress-plugin.c 0.15.08-1/stress-plugin.c
--- 0.15.07-1/stress-plugin.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-plugin.c	2023-05-21 14:30:06.000000000 +0000
@@ -369,6 +369,7 @@ again:
 				if (errno != EINTR)
 					pr_dbg("%s: waitpid(): errno=%d (%s)\n",
 						args->name, errno, strerror(errno));
+				force_killed_counter(args);
 				(void)kill(pid, SIGTERM);
 				(void)kill(pid, SIGKILL);
 				(void)shim_waitpid(pid, &status, 0);
diff -pruN 0.15.07-1/stress-prctl.c 0.15.08-1/stress-prctl.c
--- 0.15.07-1/stress-prctl.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-prctl.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_ASM_PRCTL_H)
 #include <asm/prctl.h>
@@ -296,7 +297,7 @@ static int stress_prctl_syscall_user_dis
 	struct sigaction action, oldaction;
 	const pid_t pid = getpid();
 
-	(void)memset(&action, 0, sizeof(action));
+	(void)shim_memset(&action, 0, sizeof(action));
 	(void)sigemptyset(&action.sa_mask);
 	action.sa_sigaction = stress_prctl_sigsys_handler;
 	action.sa_flags = SA_SIGINFO;
@@ -305,7 +306,7 @@ static int stress_prctl_syscall_user_dis
 	if (ret < 0)
 		return 0;
 
-	(void)memset(&prctl_sigsys_info, 0, sizeof(prctl_sigsys_info));
+	(void)shim_memset(&prctl_sigsys_info, 0, sizeof(prctl_sigsys_info));
 
 	/* syscall emulation off */
 	PRCTL_SYSCALL_OFF();
@@ -367,8 +368,6 @@ static int stress_prctl_child(
 	void *page_anon,
 	size_t page_anon_size)
 {
-	int ret;
-
 	(void)args;
 	(void)mypid;
 
@@ -387,7 +386,7 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_CHILD_SUBREAPER)
 	{
-		int reaper = 0;
+		int ret, reaper = 0;
 
 		ret = prctl(PR_GET_CHILD_SUBREAPER, &reaper);
 		(void)ret;
@@ -403,6 +402,8 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_DUMPABLE)
 	{
+		int ret;
+
 		ret = prctl(PR_GET_DUMPABLE);
 		(void)ret;
 
@@ -417,7 +418,7 @@ static int stress_prctl_child(
 #if defined(PR_GET_ENDIAN)
 	/* PowerPC only, but try it on all arches */
 	{
-		int endian;
+		int ret, endian;
 
 		ret = prctl(PR_GET_ENDIAN, &endian);
 		(void)ret;
@@ -484,7 +485,7 @@ static int stress_prctl_child(
 #if defined(PR_GET_FPEMU)
 	/* ia64 only, but try it on all arches */
 	{
-		int control;
+		int ret, control;
 
 		ret = prctl(PR_GET_FPEMU, &control);
 		(void)ret;
@@ -500,7 +501,7 @@ static int stress_prctl_child(
 #if defined(PR_GET_FPEXC)
 	/* PowerPC only, but try it on all arches */
 	{
-		int mode;
+		int ret, mode;
 
 		ret = prctl(PR_GET_FPEXC, &mode);
 		(void)ret;
@@ -515,7 +516,7 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_KEEPCAPS)
 	{
-		int flag = 0;
+		int ret, flag = 0;
 
 		ret = prctl(PR_GET_KEEPCAPS, &flag);
 		(void)ret;
@@ -602,10 +603,11 @@ static int stress_prctl_child(
 #if defined(PR_GET_NAME)
 	{
 		char name[17];
+		int ret;
 
-		(void)memset(name, 0, sizeof name);
+		(void)shim_memset(name, 0, sizeof name);
 
-		ret =prctl(PR_GET_NAME, name);
+		ret = prctl(PR_GET_NAME, name);
 		(void)ret;
 
 #if defined(PR_SET_NAME)
@@ -618,6 +620,8 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_NO_NEW_PRIVS)
 	{
+		int ret;
+
 		ret = prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0);
 		(void)ret;
 
@@ -634,7 +638,7 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_PDEATHSIG)
 	{
-		int sig;
+		int ret, sig;
 
 		ret = prctl(PR_GET_PDEATHSIG, &sig);
 		(void)ret;
@@ -651,8 +655,11 @@ static int stress_prctl_child(
 
 #if defined(PR_SET_PTRACER)
 	{
+		int ret;
+
 		ret = prctl(PR_SET_PTRACER, mypid, 0, 0, 0);
 		(void)ret;
+
 #if defined(PR_SET_PTRACER_ANY)
 		VOID_RET(int, prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0));
 #endif
@@ -672,7 +679,10 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_SECUREBITS)
 	{
+		int ret;
+
 		ret = prctl(PR_GET_SECUREBITS, 0, 0, 0, 0);
+		(void)ret;
 
 #if defined(PR_SET_SECUREBITS)
 		if (ret >= 0) {
@@ -684,6 +694,8 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_THP_DISABLE)
 	{
+		int ret;
+
 		ret = prctl(PR_GET_THP_DISABLE, 0, 0, 0, 0);
 		(void)ret;
 
@@ -734,6 +746,8 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_TIMING)
 	{
+		int ret;
+
 		ret = prctl(PR_GET_TIMING, 0, 0, 0, 0);
 		(void)ret;
 
@@ -748,7 +762,7 @@ static int stress_prctl_child(
 #if defined(PR_GET_TSC)
 	{
 		/* x86 only, but try it on all arches */
-		int state;
+		int ret, state;
 
 		ret = prctl(PR_GET_TSC, &state, 0, 0, 0);
 		(void)ret;
@@ -765,6 +779,7 @@ static int stress_prctl_child(
 	{
 		/* ia64, parisc, powerpc, alpha, sh, tile, but try it on all arches */
 		unsigned int control;
+		int ret;
 
 		ret = prctl(PR_GET_UNALIGN, &control, 0, 0, 0);
 		(void)ret;
@@ -779,55 +794,65 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_SPECULATION_CTRL)
 	{
-		unsigned long lval;
-
 		/* exercise invalid args */
 		VOID_RET(int, prctl(PR_GET_SPECULATION_CTRL, ~0, ~0, ~0, ~0));
 
 #if defined(PR_SPEC_STORE_BYPASS)
-		lval = (unsigned long)prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, 0, 0, 0);
+		{
+			unsigned long lval;
+
+			lval = (unsigned long)prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, 0, 0, 0);
 
-		if (lval & PR_SPEC_PRCTL) {
-			lval &= ~PR_SPEC_PRCTL;
+			if (lval & PR_SPEC_PRCTL) {
+				lval &= ~PR_SPEC_PRCTL;
 #if defined(PR_SPEC_ENABLE)
 
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_ENABLE, 0, 0));
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_ENABLE, 0, 0));
 #endif
 #if defined(PR_SPEC_DISABLE)
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0));
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0));
 #endif
-			/* ..and restore */
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, lval, 0, 0));
+				/* ..and restore */
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, lval, 0, 0));
+			}
 		}
 #endif
 
 #if defined(PR_SPEC_INDIRECT_BRANCH)
-		lval = (unsigned long)prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, 0, 0, 0);
-		if (lval & PR_SPEC_PRCTL) {
-			lval &= ~PR_SPEC_PRCTL;
+		{
+			unsigned long lval;
+
+			lval = (unsigned long)prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, 0, 0, 0);
+			if (lval & PR_SPEC_PRCTL) {
+				lval &= ~PR_SPEC_PRCTL;
 #if defined(PR_SPEC_ENABLE)
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_ENABLE, 0, 0));
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_ENABLE, 0, 0));
 #endif
 #if defined(PR_SPEC_DISABLE)
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_DISABLE, 0, 0));
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, PR_SPEC_DISABLE, 0, 0));
 #endif
-			/* ..and restore */
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, lval, 0, 0));
+				/* ..and restore */
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_INDIRECT_BRANCH, lval, 0, 0));
+			}
 		}
 #endif
 
 #if defined(PR_SPEC_L1D_FLUSH)
-		lval = (unsigned long)prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, 0, 0, 0);
-		if (lval & PR_SPEC_PRCTL) {
-			lval &= ~PR_SPEC_PRCTL;
+		{
+			unsigned long lval;
+
+			lval = (unsigned long)prctl(PR_GET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, 0, 0, 0);
+			if (lval & PR_SPEC_PRCTL) {
+				lval &= ~PR_SPEC_PRCTL;
 #if defined(PR_SPEC_ENABLE)
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, PR_SPEC_ENABLE, 0, 0));
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, PR_SPEC_ENABLE, 0, 0));
 #endif
 #if defined(PR_SPEC_DISABLE)
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, PR_SPEC_DISABLE, 0, 0));
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, PR_SPEC_DISABLE, 0, 0));
 #endif
-			/* ..and restore */
-			VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, lval, 0, 0));
+				/* ..and restore */
+				VOID_RET(int, prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_L1D_FLUSH, lval, 0, 0));
+			}
 		}
 #endif
 	}
@@ -842,10 +867,14 @@ static int stress_prctl_child(
 
 #if defined(PR_GET_IO_FLUSHER)
 	{
-		VOID_RET(int, prctl(PR_GET_IO_FLUSHER, 0, 0, 0, 0));
+		int ret;
+
+		ret = prctl(PR_GET_IO_FLUSHER, 0, 0, 0, 0);
+		(void)ret;
 
 #if defined(PR_SET_IO_FLUSHER)
-		VOID_RET(int, prctl(PR_SET_IO_FLUSHER, ret, 0, 0, 0));
+		if (ret > 0)
+			VOID_RET(int, prctl(PR_SET_IO_FLUSHER, ret, 0, 0, 0));
 #endif
 	}
 #endif
@@ -968,8 +997,6 @@ static int stress_prctl_child(
 		VOID_RET(int, prctl(0xf00000, ~0, ~0, ~0, ~0));
 	}
 
-	(void)ret;
-
 	return 0;
 }
 
diff -pruN 0.15.07-1/stress-prefetch.c 0.15.08-1/stress-prefetch.c
--- 0.15.07-1/stress-prefetch.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-prefetch.c	2023-05-21 14:30:06.000000000 +0000
@@ -20,6 +20,7 @@
 #include "stress-ng.h"
 #include "core-asm-ppc64.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 #include "core-cpu-cache.h"
 #include "core-put.h"
@@ -170,22 +171,22 @@ static inline uint64_t get_prefetch_L3_s
 	return cache_size;
 }
 
-static inline void stress_prefetch_builtin(void *addr)
+static inline void stress_prefetch_builtin(const void *addr)
 {
 	shim_builtin_prefetch(addr);
 }
 
-static inline void stress_prefetch_builtin_locality0(void *addr)
+static inline void stress_prefetch_builtin_locality0(const void *addr)
 {
 	shim_builtin_prefetch(addr, 0, 0);
 }
 
-static inline void stress_prefetch_builtin_locality3(void *addr)
+static inline void stress_prefetch_builtin_locality3(const void *addr)
 {
 	shim_builtin_prefetch(addr, 0, 3);
 }
 
-static inline void stress_prefetch_none(void *addr)
+static inline void stress_prefetch_none(const void *addr)
 {
 	(void)addr;
 }
@@ -343,7 +344,7 @@ static int stress_prefetch(const stress_
 
 	l3_data_end = (uint64_t *)((uintptr_t)l3_data + l3_data_size);
 
-	(void)memset(l3_data, 0xa5, l3_data_mmap_size);
+	(void)shim_memset(l3_data, 0xa5, l3_data_mmap_size);
 
 	for (i = 0; i < SIZEOF_ARRAY(prefetch_info); i++) {
 		prefetch_info[i].offset = i * STRESS_CACHE_LINE_SIZE;
diff -pruN 0.15.07-1/stress-priv-instr.c 0.15.08-1/stress-priv-instr.c
--- 0.15.07-1/stress-priv-instr.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-priv-instr.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 #include "core-put.h"
 
@@ -508,7 +509,7 @@ finish:
 		if (str) {
 			int unhandled = 0;
 
-			(void)memset(str, 0, len);
+			(void)shim_memset(str, 0, len);
 			for (i = 0; i < SIZEOF_ARRAY(op_info); i++) {
 				if (!op_info[i].trapped) {
 					unhandled++;
diff -pruN 0.15.07-1/stress-procfs.c 0.15.08-1/stress-procfs.c
--- 0.15.07-1/stress-procfs.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-procfs.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-pthread.h"
 #include "core-put.h"
 
@@ -177,7 +178,7 @@ static void stress_proc_self_mem(const s
 	}
 	offset = (off_t)(uintptr_t)page;
 
-	(void)memset(page, rnd, page_size);
+	(void)shim_memset(page, rnd, page_size);
 	if (lseek(fd, offset, SEEK_SET) == offset) {
 		ssize_t ret;
 		size_t mem_offset = stress_mwc32modn((uint32_t)page_size);
@@ -207,7 +208,7 @@ static void stress_proc_mtrr(const stres
 
 	(void)args;
 
-	(void)memset(&gentry, 0, sizeof(gentry));
+	(void)shim_memset(&gentry, 0, sizeof(gentry));
 	while (ioctl(fd, MTRRIOC_GET_ENTRY, &gentry) == 0) {
 		gentry.regnum++;
 	}
@@ -427,14 +428,14 @@ static inline void stress_proc_rw(
 		pos = lseek(fd, 0, SEEK_SET);
 		if (pos < 0)
 			goto mmap_test;
-		(void)memset(buffer, 0, sizeof(buffer));
+		(void)shim_memset(buffer, 0, sizeof(buffer));
 		ret = read(fd, buffer, sizeof(buffer));
 		if (ret < 0)
 			goto mmap_test;
 		if (ret < (ssize_t)(sizeof(buffer) >> 1)) {
 			char *bptr;
 
-			for (bptr = buffer; *bptr && *bptr != '\n'; bptr++)
+			for (bptr = buffer; *bptr && (*bptr != '\n'); bptr++)
 				;
 			if (*bptr == '\n') {
 				const off_t offset = 2 + (bptr - buffer);
@@ -704,10 +705,10 @@ static void stress_proc_dir(
 	}
 
 	/* Now recurse on directories */
-	for (i = 0; i < n && keep_stressing_flag(); i++) {
+	for (i = 0; (i < n) && keep_stressing_flag(); i++) {
 		struct dirent *d = dlist[i];
 
-		if (d && d->d_type == DT_DIR) {
+		if (d && (d->d_type == DT_DIR)) {
 			(void)stress_mk_filename(tmp, sizeof(tmp), path, d->d_name);
 
 			free(d);
@@ -801,7 +802,7 @@ static int stress_procfs(const stress_ar
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(ret, 0, sizeof(ret));
+	(void)shim_memset(ret, 0, sizeof(ret));
 
 	for (i = 0; i < MAX_PROCFS_THREADS; i++) {
 		ret[i] = pthread_create(&pthreads[i], NULL,
diff -pruN 0.15.07-1/stress-pthread.c 0.15.08-1/stress-pthread.c
--- 0.15.07-1/stress-pthread.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-pthread.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-pthread.h"
 
 #if defined(HAVE_MODIFY_LDT)
@@ -163,17 +164,36 @@ static void OPTIMIZE3 stress_pthread_tid
     defined(__NR_set_tid_address) &&	\
     defined(HAVE_KERNEL_ULONG_T) &&	\
     defined(HAVE_SYSCALL)
-	__kernel_ulong_t tid_addr = 0;
+	/*
+	 *   prctl(2) states:
+	 *    "Note that since the prctl() system call does not have a compat
+	 *     implementation for the AMD64 x32 and MIPS n32 ABIs, and
+	 *     the kernel writes out a pointer using the kernel's pointer
+	 *     size, this operation expects a user-space buffer of 8 (not
+	 *     4) bytes on these ABIs."
+	 *
+	 *   Use 64 bit tid_addr as default.
+	 */
+	uint64_t tid_addr = 0;
 
 	if (LIKELY(prctl(PR_GET_TID_ADDRESS, &tid_addr, 0, 0, 0) == 0)) {
-		if (tid_addr) {
+		unsigned long set_tid_addr;
+
+		if (sizeof(void *) == 4)  {
+			set_tid_addr = stress_little_endian() ?
+				(tid_addr & 0xffffffff) : (tid_addr >> 32);
+		} else {
+			set_tid_addr = (unsigned long)tid_addr;
+		}
+
+		if (set_tid_addr) {
 			pid_t tid1, tid2;
 
 			/* Nullify */
 			VOID_RET(pid_t, (pid_t)syscall(__NR_set_tid_address, NULL));
 
 			/* This always succeeds */
-			tid1 = (pid_t)syscall(__NR_set_tid_address, tid_addr);
+			tid1 = (pid_t)syscall(__NR_set_tid_address, set_tid_addr);
 
 			errno = 0;
 			tid2 = shim_gettid();
@@ -205,7 +225,7 @@ static void *stress_pthread_func(void *p
 #endif
 #if defined(HAVE_GET_ROBUST_LIST) &&	\
     defined(HAVE_LINUX_FUTEX_H)
-	struct robust_list_head *head, new_head;
+	struct robust_list_head *head;
 	size_t len;
 #endif
 	const stress_pthread_args_t *spa = (stress_pthread_args_t *)parg;
@@ -230,7 +250,7 @@ static void *stress_pthread_func(void *p
 #if defined(HAVE_SET_ROBUST_LIST) &&	\
     defined(HAVE_LINUX_FUTEX_H)
 		if ((head != NULL) && (len > 0)) {
-			(void)memcpy(&new_head, head, len);
+			struct robust_list_head new_head = *head;
 
 			/* Currently disabled, valgrind complains that head is out of range */
 			if (sys_set_robust_list(&new_head, len) < 0) {
@@ -387,7 +407,7 @@ yield:
 		sigset_t mask;
 		struct timespec timeout;
 
-		(void)memset(&info, 0, sizeof(info));
+		(void)shim_memset(&info, 0, sizeof(info));
 		(void)sigemptyset(&mask);
 		(void)sigaddset(&mask, SIGUSR1);
 
@@ -496,7 +516,7 @@ static int stress_pthread(const stress_a
 		keep_thread_running_flag = true;
 		pthread_count = 0;
 
-		(void)memset(&pthreads, 0, sizeof(pthreads));
+		(void)shim_memset(&pthreads, 0, sizeof(pthreads));
 		ret = pthread_mutex_lock(&mutex);
 		if (ret) {
 			stop_running();
@@ -620,7 +640,7 @@ static int stress_pthread(const stress_a
 			if (pthreads[j].ret)
 				continue;
 
-			(void)memset(&value, 0, sizeof(value));
+			(void)shim_memset(&value, 0, sizeof(value));
 			VOID_RET(int, pthread_sigqueue(pthreads[j].pthread, SIGUSR1, value));
 		}
 #endif
diff -pruN 0.15.07-1/stress-quota.c 0.15.08-1/stress-quota.c
--- 0.15.07-1/stress-quota.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-quota.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_SYS_QUOTA_H)
@@ -188,13 +189,13 @@ static int do_quotas(const stress_args_t
 	char buffer[1024];
 	quotactl_status_t status;
 
-	(void)memset(&status, 0, sizeof(status));
+	(void)shim_memset(&status, 0, sizeof(status));
 
 #if defined(Q_GETQUOTA)
 	if (keep_stressing_flag()) {
 		struct dqblk dqblk;
 
-		(void)memset(&dqblk, 0, sizeof(dqblk));
+		(void)shim_memset(&dqblk, 0, sizeof(dqblk));
 		err = do_quotactl(args, "Q_GETQUOTA", &status,
 			QCMD(Q_GETQUOTA, USRQUOTA),
 			dev, 0, (caddr_t)&dqblk);
@@ -206,7 +207,7 @@ static int do_quotas(const stress_args_t
 	if (keep_stressing_flag()) {
 		struct shim_nextdqblk nextdqblk;
 
-		(void)memset(&nextdqblk, 0, sizeof(nextdqblk));
+		(void)shim_memset(&nextdqblk, 0, sizeof(nextdqblk));
 		err = do_quotactl(args, "Q_GETNEXTQUOTA", &status,
 			QCMD(Q_GETNEXTQUOTA, USRQUOTA),
 			dev, 0, (caddr_t)&nextdqblk);
@@ -218,7 +219,7 @@ static int do_quotas(const stress_args_t
 	if (keep_stressing_flag()) {
 		uint32_t format;
 
-		(void)memset(&format, 0, sizeof(format));
+		(void)shim_memset(&format, 0, sizeof(format));
 		err = do_quotactl(args, "Q_GETFMT", &status,
 			QCMD(Q_GETFMT, USRQUOTA),
 			dev, 0, (caddr_t)&format);
@@ -230,7 +231,7 @@ static int do_quotas(const stress_args_t
 	if (keep_stressing_flag()) {
 		struct dqinfo dqinfo;
 
-		(void)memset(&dqinfo, 0, sizeof(dqinfo));
+		(void)shim_memset(&dqinfo, 0, sizeof(dqinfo));
 		err = do_quotactl(args, "Q_GETINFO", &status,
 			QCMD(Q_GETINFO, USRQUOTA),
 			dev, 0, (caddr_t)&dqinfo);
@@ -243,7 +244,7 @@ static int do_quotas(const stress_args_t
 	if (keep_stressing_flag()) {
 		struct dqstats dqstats;
 
-		(void)memset(&dqstats, 0, sizeof(dqstats));
+		(void)shim_memset(&dqstats, 0, sizeof(dqstats));
 		err = do_quotactl(args, "Q_GETSTATS", &status,
 			QCMD(Q_GETSTATS, USRQUOTA),
 			dev, 0, (caddr_t)&dqstats);
@@ -268,7 +269,7 @@ static int do_quotas(const stress_args_t
 	{
 		struct dqinfo dqinfo;
 
-		(void)memset(&dqinfo, 0, sizeof(dqinfo));
+		(void)shim_memset(&dqinfo, 0, sizeof(dqinfo));
 		VOID_RET(int, quotactl(QCMD(Q_GETQUOTA, USRQUOTA), "", 0, (caddr_t)&dqinfo));
 		VOID_RET(int, quotactl(QCMD(Q_GETQUOTA, USRQUOTA), dev->name, ~0, (caddr_t)&dqinfo));
 		VOID_RET(int, quotactl(QCMD(Q_GETQUOTA, -1), dev->name, ~0, (caddr_t)&dqinfo));
@@ -333,8 +334,8 @@ static int stress_quota(const stress_arg
 	struct dirent *d;
 	struct stat buf;
 
-	(void)memset(mnts, 0, sizeof(mnts));
-	(void)memset(devs, 0, sizeof(devs));
+	(void)shim_memset(mnts, 0, sizeof(mnts));
+	(void)shim_memset(devs, 0, sizeof(devs));
 
 	n_mounts = stress_mount_get(mnts, SIZEOF_ARRAY(mnts));
 
diff -pruN 0.15.07-1/stress-race-sched.c 0.15.08-1/stress-race-sched.c
--- 0.15.07-1/stress-race-sched.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-race-sched.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SCHED_SETAFFINITY) &&					     \
     (defined(_POSIX_PRIORITY_SCHEDULING) || defined(__linux__)) &&	     \
@@ -179,7 +180,7 @@ static void stress_race_sched_setschedul
 	struct sched_param param;
 	const uint32_t i = stress_mwc8modn((uint8_t)SIZEOF_ARRAY(normal_policies));
 
-	(void)memset(&param, 0, sizeof(param));
+	(void)shim_memset(&param, 0, sizeof(param));
 	param.sched_priority = 0;
 	VOID_RET(int, sched_setscheduler(pid, normal_policies[i], &param));
 }
diff -pruN 0.15.07-1/stress-randlist.c 0.15.08-1/stress-randlist.c
--- 0.15.07-1/stress-randlist.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-randlist.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-put.h"
 
 #define STRESS_RANDLIST_DEFAULT_ITEMS	(100000)
@@ -239,7 +240,7 @@ retry:
 
 	do {
 		for (ptr = head; ptr; ptr = ptr->next) {
-			(void)memset(ptr->data, stress_mwc8(), randlist_size);
+			(void)shim_memset(ptr->data, stress_mwc8(), randlist_size);
 			if (!keep_stressing_flag())
 				break;
 		}
diff -pruN 0.15.07-1/stress-rawdev.c 0.15.08-1/stress-rawdev.c
--- 0.15.07-1/stress-rawdev.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rawdev.c	2023-05-21 14:30:06.000000000 +0000
@@ -92,7 +92,7 @@ static void stress_rawdev_sweep(
 	ssize_t ret;
 	double t;
 
-	for (i = 0; i < blks && keep_stressing(args); i += shift_ul(blks, 8)) {
+	for (i = 0; (i < blks) && keep_stressing(args); i += shift_ul(blks, 8)) {
 		const off_t offset = (off_t)i * (off_t)blksz;
 
 		t = stress_time_now();
@@ -106,7 +106,7 @@ static void stress_rawdev_sweep(
 			inc_counter(args);
 		}
 	}
-	for (; i > 0 && keep_stressing(args); i -= shift_ul(blks, 8)) {
+	for (; (i > 0) && keep_stressing(args); i -= shift_ul(blks, 8)) {
 		const off_t offset = (off_t)i * (off_t)blksz;
 
 		t = stress_time_now();
@@ -137,10 +137,10 @@ static void stress_rawdev_wiggle(
 	size_t i;
 	ssize_t ret;
 
-	for (i = shift_ul(blks, 8); i < blks && keep_stressing(args); i += shift_ul(blks, 8)) {
+	for (i = shift_ul(blks, 8); (i < blks) && keep_stressing(args); i += shift_ul(blks, 8)) {
 		unsigned long j;
 
-		for (j = 0; j < shift_ul(blks, 8) && keep_stressing(args); j += shift_ul(blks, 10)) {
+		for (j = 0; (j < shift_ul(blks, 8)) && keep_stressing(args); j += shift_ul(blks, 10)) {
 			const off_t offset = (off_t)(i - j) * (off_t)blksz;
 			double t;
 
@@ -219,7 +219,7 @@ static void stress_rawdev_random(
 {
 	size_t i;
 
-	for (i = 0; i < 256 && keep_stressing(args); i++) {
+	for (i = 0; (i < 256) && keep_stressing(args); i++) {
 		ssize_t ret;
 		const off_t offset = (off_t)blksz * stress_mwc64modn(blks);
 		double t;
@@ -252,7 +252,7 @@ static void stress_rawdev_burst(
 	int i;
 	off_t blk = (off_t)stress_mwc64modn(blks);
 
-	for (i = 0; i < 256 && keep_stressing(args); i++) {
+	for (i = 0; (i < 256) && keep_stressing(args); i++) {
 		ssize_t ret;
 		const off_t offset = blk * (off_t)blksz;
 		double t;
@@ -268,7 +268,8 @@ static void stress_rawdev_burst(
 			inc_counter(args);
 		}
 		blk++;
-		blk %= blks;
+		if (blk >= (off_t)blks)
+			blk = 0;
 	}
 }
 
diff -pruN 0.15.07-1/stress-rawpkt.c 0.15.08-1/stress-rawpkt.c
--- 0.15.07-1/stress-rawpkt.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rawpkt.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-net.h"
 
@@ -273,7 +274,7 @@ static void NORETURN OPTIMIZE3 stress_ra
 	const stress_args_t *args,
 	struct ifreq *hwaddr,
 	struct ifreq *ifaddr,
-	struct ifreq *idx,
+	const struct ifreq *idx,
 	const pid_t ppid,
 	const int port)
 {
@@ -289,11 +290,11 @@ static void NORETURN OPTIMIZE3 stress_ra
 	stress_parent_died_alarm();
 	(void)sched_settings_apply(true);
 
-	(void)memset(&sadr, 0, sizeof(sadr));
-	(void)memset(buf, 0, sizeof(buf));
+	(void)shim_memset(&sadr, 0, sizeof(sadr));
+	(void)shim_memset(buf, 0, sizeof(buf));
 
-	(void)memcpy(eth->h_dest, hwaddr->ifr_addr.sa_data, sizeof(eth->h_dest));
-	(void)memcpy(eth->h_source, hwaddr->ifr_addr.sa_data, sizeof(eth->h_dest));
+	(void)shim_memcpy(eth->h_dest, hwaddr->ifr_addr.sa_data, sizeof(eth->h_dest));
+	(void)shim_memcpy(eth->h_source, hwaddr->ifr_addr.sa_data, sizeof(eth->h_dest));
 	eth->h_proto = htons(ETH_P_IP);
 
 	ip->ihl = 5;		/* Header length in 32 bit words */
@@ -311,7 +312,7 @@ static void NORETURN OPTIMIZE3 stress_ra
 
 	sadr.sll_ifindex = idx->ifr_ifindex;
 	sadr.sll_halen = ETH_ALEN;
-	(void)memcpy(&sadr.sll_addr, eth->h_dest, sizeof(eth->h_dest));
+	(void)shim_memcpy(&sadr.sll_addr, eth->h_dest, sizeof(eth->h_dest));
 
 	if ((fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0) {
 		pr_fail("%s: socket failed, errno=%d (%s)\n",
@@ -397,7 +398,7 @@ static int OPTIMIZE3 stress_rawpkt_serve
 			pr_fail("%s: setsockopt failed to set packet version, errno=%d (%s)\n", args->name, errno, strerror(errno));
 			goto close_fd;
 		}
-		(void)memset(&tp, 0, sizeof(tp));
+		(void)shim_memset(&tp, 0, sizeof(tp));
 		tp.tp_block_size = getpagesize();
 		tp.tp_block_nr = blocknr;
 		tp.tp_frame_size = getpagesize() / blocknr;
@@ -490,7 +491,7 @@ static int stress_rawpkt(const stress_ar
 			args->name, errno, strerror(errno));
 		return EXIT_FAILURE;
 	}
-	(void)memset(&hwaddr, 0, sizeof(hwaddr));
+	(void)shim_memset(&hwaddr, 0, sizeof(hwaddr));
 	(void)shim_strlcpy(hwaddr.ifr_name, "lo", sizeof(hwaddr.ifr_name));
 	if (ioctl(fd, SIOCGIFHWADDR, &hwaddr) < 0) {
 		pr_fail("%s: ioctl SIOCGIFHWADDR on lo failed, errno=%d (%s)\n",
@@ -499,7 +500,7 @@ static int stress_rawpkt(const stress_ar
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(&ifaddr, 0, sizeof(ifaddr));
+	(void)shim_memset(&ifaddr, 0, sizeof(ifaddr));
 	(void)shim_strlcpy(ifaddr.ifr_name, "lo", sizeof(ifaddr.ifr_name));
 	if (ioctl(fd, SIOCGIFADDR, &ifaddr) < 0) {
 		pr_fail("%s: ioctl SIOCGIFADDR on lo failed, errno=%d (%s)\n",
@@ -508,7 +509,7 @@ static int stress_rawpkt(const stress_ar
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(&idx, 0, sizeof(idx));
+	(void)shim_memset(&idx, 0, sizeof(idx));
 	(void)shim_strlcpy(idx.ifr_name, "lo", sizeof(idx.ifr_name));
 	if (ioctl(fd, SIOCGIFINDEX, &idx) < 0) {
 		pr_fail("%s: ioctl SIOCGIFINDEX on lo failed, errno=%d (%s)\n",
diff -pruN 0.15.07-1/stress-rawsock.c 0.15.08-1/stress-rawsock.c
--- 0.15.07-1/stress-rawsock.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rawsock.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-net.h"
 
@@ -69,10 +70,18 @@ typedef struct {
 } stress_raw_packet_t;
 
 static void *rawsock_lock;
+static volatile bool stop_rawsock;
+
+static void MLOCKED_TEXT rawsock_sigalrm_handler(int signum)
+{
+	(void)signum;
+	stop_rawsock = true;
+}
 
 static void stress_rawsock_init(void)
 {
 	rawsock_lock = stress_lock_create();
+	stop_rawsock = false;
 }
 
 static void stress_rawsock_deinit(void)
@@ -103,6 +112,9 @@ static int OPTIMIZE3 stress_rawsock_clie
 	struct sockaddr_in addr;
 
 	stress_parent_died_alarm();
+	if (stress_sighandler(args->name, SIGALRM, rawsock_sigalrm_handler, NULL) < 0)
+		return EXIT_FAILURE;
+
 	(void)sched_settings_apply(true);
 
 	if ((fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) {
@@ -113,12 +125,12 @@ static int OPTIMIZE3 stress_rawsock_clie
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(&addr, 0, sizeof(addr));
+	(void)shim_memset(&addr, 0, sizeof(addr));
 	addr.sin_family = AF_INET;
 	addr.sin_port = rawsock_port;
 	addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 
-	(void)memset(&pkt, 0, sizeof(pkt));
+	(void)shim_memset(&pkt, 0, sizeof(pkt));
 	pkt.iph.version = 4;
 	pkt.iph.ihl = sizeof(struct iphdr) >> 2;
 	pkt.iph.tos = 0;
@@ -132,7 +144,7 @@ static int OPTIMIZE3 stress_rawsock_clie
 	pkt.iph.daddr = addr.sin_addr.s_addr;
 
 	/* Wait for server to start */
-	while (keep_stressing(args)) {
+	while (!stop_rawsock && keep_stressing(args)) {
 		uint32_t ready;
 
 		if (stress_lock_acquire(rawsock_lock) < 0) {
@@ -147,7 +159,7 @@ static int OPTIMIZE3 stress_rawsock_clie
 		shim_usleep(20000);
 	}
 
-	while (keep_stressing(args)) {
+	while (!stop_rawsock && keep_stressing(args)) {
 		ssize_t sret;
 
 		sret = sendto(fd, &pkt, sizeof(pkt), 0,
@@ -175,6 +187,7 @@ static int OPTIMIZE3 stress_rawsock_clie
 		}
 #endif
 	}
+	(void)kill(getppid(), SIGALRM);
 	(void)close(fd);
 	return EXIT_SUCCESS;
 }
@@ -186,28 +199,25 @@ static int OPTIMIZE3 stress_rawsock_serv
 	struct sockaddr_in addr;
 	double t_start, duration = 0.0, bytes = 0.0, rate;
 
-	if (stress_sig_stop_stressing(args->name, SIGALRM) < 0) {
-		rc = EXIT_FAILURE;
-		goto die;
-	}
-	if (!keep_stressing(args))
+	if (stop_rawsock || !keep_stressing(args))
 		goto die;
 
 	if ((fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) {
 		pr_fail("%s: socket failed, errno=%d (%s)\n",
 			args->name, errno, strerror(errno));
 		rc = EXIT_FAILURE;
+		(void)kill(pid, SIGKILL);
 		goto die;
 	}
 
-	(void)memset(&addr, 0, sizeof(addr));
+	(void)shim_memset(&addr, 0, sizeof(addr));
 
 	(void)stress_lock_acquire(rawsock_lock);
 	g_shared->rawsock.ready++;
 	(void)stress_lock_release(rawsock_lock);
 
 	t_start = stress_time_now();
-	while (keep_stressing(args)) {
+	while (!stop_rawsock && keep_stressing(args)) {
 		stress_raw_packet_t ALIGN64 pkt;
 		socklen_t len = sizeof(addr);
 		ssize_t n;
@@ -242,10 +252,8 @@ static int OPTIMIZE3 stress_rawsock_serv
 	rate = (duration > 0.0) ? bytes / duration : 0.0;
 	stress_metrics_set(args, 0, "MB recv'd per sec", rate / (double)MB);
 die:
-	if (pid) {
-		(void)kill(pid, SIGKILL);
-		(void)shim_waitpid(pid, &status, 0);
-	}
+	(void)shim_waitpid(pid, &status, 0);
+
 	/* close recv socket after sender closed */
 	if (fd > -1)
 		(void)close(fd);
@@ -267,7 +275,7 @@ again:
 			shim_usleep(100000);
 			goto again;
 		}
-		if (!keep_stressing(args)) {
+		if (stop_rawsock || !keep_stressing(args)) {
 			return EXIT_SUCCESS;
 		}
 		pr_fail("%s: fork failed, errno=%d (%s)\n",
@@ -275,7 +283,6 @@ again:
 		return EXIT_FAILURE;
 	} else if (pid == 0) {
 		rc = stress_rawsock_client(args, rawsock_port);
-		(void)kill(getppid(), SIGALRM);
 		_exit(rc);
 	} else {
 		rc = stress_rawsock_server(args, pid);
diff -pruN 0.15.07-1/stress-rawudp.c 0.15.08-1/stress-rawudp.c
--- 0.15.07-1/stress-rawudp.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rawudp.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-net.h"
 
@@ -110,7 +111,7 @@ static void NORETURN OPTIMIZE3 stress_ra
 	stress_parent_died_alarm();
 	(void)sched_settings_apply(true);
 
-	(void)memset(buf, 0, sizeof(buf));
+	(void)shim_memset(buf, 0, sizeof(buf));
 
 	s_in.sin_family = AF_INET;
 	s_in.sin_port = (in_port_t)port;
diff -pruN 0.15.07-1/stress-reboot.c 0.15.08-1/stress-reboot.c
--- 0.15.07-1/stress-reboot.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-reboot.c	2023-05-21 14:30:06.000000000 +0000
@@ -67,7 +67,9 @@ static int NORETURN reboot_clone_func(vo
 		VOID_RET(int, shim_reboot((int)SHIM_LINUX_BOOT_MAGIC1,
 			(int)boot_magic[j],
 			(int)SHIM_LINUX_REBOOT_CMD_POWER_OFF, NULL));
-		j = (j + 1) % SIZEOF_ARRAY(boot_magic);
+		j++;
+		if (j >= SIZEOF_ARRAY(boot_magic))
+			j = 0;
 	}
 
 	/* Should never get here */
diff -pruN 0.15.07-1/stress-rename.c 0.15.08-1/stress-rename.c
--- 0.15.07-1/stress-rename.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rename.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_RENAMEAT) &&	\
     defined(O_DIRECTORY)
@@ -224,8 +225,8 @@ static int stress_rename(const stress_ar
 	int tmp_fd;
 #endif
 
-	(void)memset(name1, 0, sizeof(name1));
-	(void)memset(name2, 0, sizeof(name2));
+	(void)shim_memset(name1, 0, sizeof(name1));
+	(void)shim_memset(name2, 0, sizeof(name2));
 
 	if (stress_temp_dir_mk(args->name, args->pid, inst1) < 0)
 		return EXIT_FAILURE;
diff -pruN 0.15.07-1/stress-resched.c 0.15.08-1/stress-resched.c
--- 0.15.07-1/stress-resched.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-resched.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"resched N",		"start N workers that spawn renicing child processes" },
@@ -78,7 +79,7 @@ static void NORETURN stress_resched_chil
 				if (!keep_stressing(args))
 					break;
 
-				(void)memset(&param, 0, sizeof(param));
+				(void)shim_memset(&param, 0, sizeof(param));
 				param.sched_priority = 0;
 				VOID_RET(int, sched_setscheduler(pid, normal_policies[j], &param));
 				VOID_RET(int, shim_sched_yield());
@@ -155,6 +156,9 @@ static int stress_resched(const stress_a
 			args->name, errno, strerror(errno));
 		return EXIT_NO_RESOURCE;
 	}
+	for (i = 0; i < pids_max; i++)
+		pids[i] = -1;
+
 	yields_size = ((sizeof(*yields) * (size_t)pids_max) + args->page_size - 1) & ~(args->page_size - 1);
 	yields = (uint64_t *)mmap(NULL, yields_size, PROT_READ | PROT_WRITE,
 				MAP_ANONYMOUS | MAP_SHARED, -1, 0);
@@ -185,21 +189,7 @@ static int stress_resched(const stress_a
 		}
 	} while (keep_stressing(args));
 
-	/* Kill children */
-	for (i = 0; i < pids_max; i++) {
-		if (pids[i] != -1)
-			(void)kill(pids[i], SIGALRM);
-	}
-
-	/* Reap children */
-	for (i = 0; i < pids_max; i++) {
-		if (pids[i] != -1) {
-			int status;
-
-			VOID_RET(int, waitpid(pids[i], &status, 0));
-		}
-	}
-
+	stress_kill_and_wait_many(args, pids, pids_max, SIGALRM, true);
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
 	/*
diff -pruN 0.15.07-1/stress-resources.c 0.15.08-1/stress-resources.c
--- 0.15.07-1/stress-resources.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-resources.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-resources.h"
 
 #define MIN_MEM_FREE	(16 * MB)
@@ -30,24 +31,6 @@ static const stress_help_t help[] = {
 	{ NULL,	NULL,		   NULL }
 };
 
-static void MLOCKED_TEXT stress_resources_kill(const pid_t *pids, const size_t num_pids)
-{
-	size_t i;
-
-	for (i = 0; i < num_pids; i++) {
-		if (pids[i] > 0)
-			(void)kill(pids[i], SIGALRM);
-	}
-
-	for (i = 0; i < num_pids; i++) {
-		if (pids[i] > 0) {
-			int status;
-
-			(void)shim_waitpid(pids[i], &status, 0);
-		}
-	}
-}
-
 /*
  *  stress_resources()
  *	stress by forking and exiting
@@ -86,7 +69,7 @@ static int stress_resources(const stress
 	do {
 		unsigned int i;
 
-		(void)memset(pids, 0, sizeof(*pids));
+		(void)shim_memset(pids, 0, sizeof(*pids));
 		for (i = 0; i < num_pids; i++) {
 			pid_t pid;
 
@@ -112,7 +95,7 @@ static int stress_resources(const stress
 				break;
 			inc_counter(args);
 		}
-		stress_resources_kill(pids, num_pids);
+		stress_kill_and_wait_many(args, pids, num_pids, SIGALRM, true);
 	} while (keep_stressing(args));
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
diff -pruN 0.15.07-1/stress-ring-pipe.c 0.15.08-1/stress-ring-pipe.c
--- 0.15.07-1/stress-ring-pipe.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-ring-pipe.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_POLL_H)
 #include <poll.h>
@@ -227,7 +228,7 @@ static int stress_ring_pipe(const stress
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
-	(void)memset(buf, 0xa5, STRESS_RING_PIPE_SIZE_MAX);
+	(void)shim_memset(buf, 0xa5, STRESS_RING_PIPE_SIZE_MAX);
 
 	if (stress_pipe_write(args, pipe_fds[0].fds[1], buf, ring_pipe_size) < 0)
 		goto err_deinit;
diff -pruN 0.15.07-1/stress-rlimit.c 0.15.08-1/stress-rlimit.c
--- 0.15.07-1/stress-rlimit.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rlimit.c	2023-05-21 14:30:06.000000000 +0000
@@ -200,7 +200,7 @@ static int stress_rlimit_child(const str
 		if ((stress_time_now() - context->start) > (double)g_opt_timeout)
 			break;
 		/* Check for counter limit reached */
-		if (args->max_ops && get_counter(args) >= args->max_ops)
+		if (args->max_ops && (get_counter(args) >= args->max_ops))
 			break;
 
 		if (ret == 0) {
diff -pruN 0.15.07-1/stress-rmap.c 0.15.08-1/stress-rmap.c
--- 0.15.07-1/stress-rmap.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rmap.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 
 #define RMAP_CHILD_MAX		(16)
@@ -155,7 +156,7 @@ static int stress_rmap(const stress_args
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 
 	for (i = 0; i < MAPPINGS_MAX; i++) {
 		mappings[i] = MAP_FAILED;
@@ -248,30 +249,7 @@ static int stress_rmap(const stress_args
 cleanup:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
-	/*
-	 *  Kill and wait for children
-	 */
-	for (i = 0; i < RMAP_CHILD_MAX; i++) {
-		if (pids[i] <= 0)
-			continue;
-		(void)stress_killpid(pids[i]);
-	}
-	for (i = 0; i < RMAP_CHILD_MAX; i++) {
-		int status, ret;
-
-		if (pids[i] <= 0)
-			continue;
-
-		ret = shim_waitpid(pids[i], &status, 0);
-		if (ret < 0) {
-			if (errno != EINTR)
-				pr_dbg("%s: waitpid(): errno=%d (%s)\n",
-					args->name, errno, strerror(errno));
-			(void)kill(pids[i], SIGTERM);
-			(void)stress_killpid(pids[i]);
-			(void)shim_waitpid(pids[i], &status, 0);
-		}
-	}
+	stress_kill_and_wait_many(args, pids, RMAP_CHILD_MAX, SIGALRM, true);
 
 	for (i = 0; i < MAPPINGS_MAX; i++) {
 		if (mappings[i] != MAP_FAILED)
diff -pruN 0.15.07-1/stress-rotate.c 0.15.08-1/stress-rotate.c
--- 0.15.07-1/stress-rotate.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rotate.c	2023-05-21 14:30:06.000000000 +0000
@@ -198,7 +198,7 @@ static const stress_opt_set_func_t opt_s
 
 stressor_info_t stress_rotate_info = {
 	.stressor = stress_rotate,
-	.class = CLASS_CPU | CLASS_CPU_CACHE,
+	.class = CLASS_CPU,
 	.opt_set_funcs = opt_set_funcs,
 	.help = help
 };
diff -pruN 0.15.07-1/stress-rseq.c 0.15.08-1/stress-rseq.c
--- 0.15.07-1/stress-rseq.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rseq.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 
 #if defined(HAVE_LINUX_RSEQ_H)
@@ -83,12 +84,12 @@ STRESS_PRAGMA_PUSH
 STRESS_PRAGMA_WARN_OFF
 static inline void set_rseq_ptr64(uint64_t value)
 {
-	(void)memcpy((void *)&restartable_seq.rseq_cs, &value, sizeof(value));
+	(void)shim_memcpy((void *)&restartable_seq.rseq_cs, &value, sizeof(value));
 }
 
 static inline void set_rseq_zero(void)
 {
-	(void)memset((void *)&restartable_seq, 0, sizeof(restartable_seq));
+	(void)shim_memset((void *)&restartable_seq, 0, sizeof(restartable_seq));
 }
 
 STRESS_PRAGMA_POP
@@ -241,10 +242,10 @@ static int stress_rseq_oomable(const str
 	struct rseq *misaligned_seq = (struct rseq *)&misaligned_seq_buf[1];
 	struct rseq invalid_seq;
 
-	(void)memcpy((void *)misaligned_seq, (void *)&restartable_seq, sizeof(restartable_seq));
-	(void)memcpy((void *)&invalid_seq, (void *)&restartable_seq, sizeof(restartable_seq));
+	(void)shim_memcpy((void *)misaligned_seq, (void *)&restartable_seq, sizeof(restartable_seq));
+	(void)shim_memcpy((void *)&invalid_seq, (void *)&restartable_seq, sizeof(restartable_seq));
 
-	(void)memset(&sa, 0, sizeof(sa));
+	(void)shim_memset(&sa, 0, sizeof(sa));
 	sa.sa_handler = sigsegv_handler;
 	if (sigaction(SIGSEGV, &sa, NULL) < 0) {
 		pr_inf("%s: failed to set SIGSEGV handler\n", args->name);
diff -pruN 0.15.07-1/stress-rtc.c 0.15.08-1/stress-rtc.c
--- 0.15.07-1/stress-rtc.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-rtc.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_RTC_H)
 #include <linux/rtc.h>
@@ -52,26 +53,8 @@ static const char * const interfaces[] =
 
 static inline int stress_rtc_dev(const stress_args_t *args)
 {
-#if defined(RTC_RD_TIME) || defined(RTC_ALM_READ) || \
-    defined(RTC_WKALM_RD) || defined(RTC_IRQP_READ)
-	struct rtc_time rtc_tm;
-	struct rtc_wkalrm wake_alarm;
-	unsigned long tmp;
-#endif
-#if defined(HAVE_RTC_PARAM) &&		\
-    defined(RTC_PARAM_GET) &&		\
-    defined(RTC_PARAM_SET) &&		\
-    defined(RTC_PARAM_FEATURES)	&& 	\
-    defined(RTC_PARAM_CORRECTION)
-	struct rtc_param param;
-#endif
 	int fd, ret = 0;
 	static bool do_dev = true;
-#if defined(HAVE_SYS_SELECT_H) &&	\
-    defined(HAVE_SELECT)
-	struct timeval timeout;
-	fd_set rfds;
-#endif
 
 	if (!do_dev)
 		return -EACCES;
@@ -82,46 +65,57 @@ static inline int stress_rtc_dev(const s
 	}
 
 #if defined(RTC_RD_TIME)
-	if (ioctl(fd, RTC_RD_TIME, &rtc_tm) < 0) {
-		if ((errno != EINTR) && (errno != ENOTTY)) {
-			pr_fail("%s: ioctl RTC_RD_TIME failed, errno=%d (%s)\n",
-				args->name, errno, strerror(errno));
-			ret = -errno;
-			goto err;
+	{
+		struct rtc_time rtc_tm;
+
+		if (ioctl(fd, RTC_RD_TIME, &rtc_tm) < 0) {
+			if ((errno != EINTR) && (errno != ENOTTY)) {
+				pr_fail("%s: ioctl RTC_RD_TIME failed, errno=%d (%s)\n",
+					args->name, errno, strerror(errno));
+				ret = -errno;
+				goto err;
+			}
+		} else {
+			VOID_RET(int, ioctl(fd, RTC_SET_TIME, &rtc_tm));
 		}
-	} else {
-		VOID_RET(int, ioctl(fd, RTC_SET_TIME, &rtc_tm));
 	}
 #endif
 
 #if defined(RTC_ALM_READ)
-	if (ioctl(fd, RTC_ALM_READ, &rtc_tm) < 0) {
-		if ((errno != EINTR) && (errno != ENOTTY)) {
-			pr_fail("%s: ioctl RTC_ALRM_READ failed, errno=%d (%s)\n",
-				args->name, errno, strerror(errno));
-			ret = -errno;
-			goto err;
-		}
+	{
+		struct rtc_time rtc_tm;
 
-	} else {
+		if (ioctl(fd, RTC_ALM_READ, &rtc_tm) < 0) {
+			if ((errno != EINTR) && (errno != ENOTTY)) {
+				pr_fail("%s: ioctl RTC_ALRM_READ failed, errno=%d (%s)\n",
+					args->name, errno, strerror(errno));
+				ret = -errno;
+				goto err;
+			}
+		} else {
 #if defined(RTC_ALM_SET)
-		VOID_RET(int, ioctl(fd, RTC_ALM_SET, &rtc_tm));
+			VOID_RET(int, ioctl(fd, RTC_ALM_SET, &rtc_tm));
 #endif
+		}
 	}
 #endif
 
 #if defined(RTC_WKALM_RD)
-	if (ioctl(fd, RTC_WKALM_RD, &wake_alarm) < 0) {
-		if ((errno != EINTR) && (errno != ENOTTY)) {
-			pr_fail("%s: ioctl RTC_WKALRM_RD failed, errno=%d (%s)\n",
-				args->name, errno, strerror(errno));
-			ret = -errno;
-			goto err;
-		}
-	} else {
+	{
+		struct rtc_wkalrm wake_alarm;
+
+		if (ioctl(fd, RTC_WKALM_RD, &wake_alarm) < 0) {
+			if ((errno != EINTR) && (errno != ENOTTY)) {
+				pr_fail("%s: ioctl RTC_WKALRM_RD failed, errno=%d (%s)\n",
+					args->name, errno, strerror(errno));
+				ret = -errno;
+				goto err;
+			}
+		} else {
 #if defined(RTC_WKALM_SET)
-		VOID_RET(int, ioctl(fd, RTC_WKALM_SET, &wake_alarm));
+			VOID_RET(int, ioctl(fd, RTC_WKALM_SET, &wake_alarm));
 #endif
+		}
 	}
 #endif
 
@@ -147,54 +141,71 @@ static inline int stress_rtc_dev(const s
 #endif
 
 #if defined(RTC_EPOCH_READ)
-	if (ioctl(fd, RTC_EPOCH_READ, &tmp) < 0) {
-		if ((errno != EINTR) && (errno != ENOTTY)) {
-			pr_fail("%s: ioctl RTC_EPOCH_READ failed, errno=%d (%s)\n",
-				args->name, errno, strerror(errno));
-			ret = -errno;
-			goto err;
-		}
-	} else {
+	{
+		unsigned long tmp;
+
+		if (ioctl(fd, RTC_EPOCH_READ, &tmp) < 0) {
+			if ((errno != EINTR) && (errno != ENOTTY)) {
+				pr_fail("%s: ioctl RTC_EPOCH_READ failed, errno=%d (%s)\n",
+					args->name, errno, strerror(errno));
+				ret = -errno;
+				goto err;
+			}
+		} else {
 #if defined(RTC_EPOCH_SET)
-		VOID_RET(int, ioctl(fd, RTC_EPOCH_SET, tmp));
+			VOID_RET(int, ioctl(fd, RTC_EPOCH_SET, tmp));
 #endif
+		}
 	}
 #endif
 
 #if defined(RTC_IRQP_READ)
-	if (ioctl(fd, RTC_IRQP_READ, &tmp) < 0) {
-		if ((errno != EINTR) && (errno != ENOTTY)) {
-			pr_fail("%s: ioctl RTC_IRQP_READ failed, errno=%d (%s)\n",
-				args->name, errno, strerror(errno));
-			ret = -errno;
-			goto err;
+	{
+		unsigned long tmp;
+
+		if (ioctl(fd, RTC_IRQP_READ, &tmp) < 0) {
+			if ((errno != EINTR) && (errno != ENOTTY)) {
+				pr_fail("%s: ioctl RTC_IRQP_READ failed, errno=%d (%s)\n",
+					args->name, errno, strerror(errno));
+				ret = -errno;
+				goto err;
+			}
+		} else {
+			VOID_RET(int, ioctl(fd, RTC_IRQP_SET, tmp));
 		}
-	} else {
-		VOID_RET(int, ioctl(fd, RTC_IRQP_SET, tmp));
 	}
 #endif
 
 #if defined(HAVE_SYS_SELECT_H) &&	\
     defined(HAVE_SELECT)
-	/*
-	 *  Very short delay select on the device
-	 *  that should normally always timeout because
-	 *  there are no RTC alarm interrupts pending
-	 */
-	timeout.tv_sec = 0;
-	timeout.tv_usec = 1;
-	FD_ZERO(&rfds);
-	FD_SET(fd, &rfds);
-	(void)select(fd + 1, &rfds, NULL, NULL, &timeout);
+	{
+		struct timeval timeout;
+		fd_set rfds;
+
+		/*
+		 *  Very short delay select on the device
+		 *  that should normally always timeout because
+		 *  there are no RTC alarm interrupts pending
+		 */
+		timeout.tv_sec = 0;
+		timeout.tv_usec = 1;
+		FD_ZERO(&rfds);
+		FD_SET(fd, &rfds);
+		(void)select(fd + 1, &rfds, NULL, NULL, &timeout);
+	}
 #endif
 
 #if defined(RTC_VL_READ)
-	if (ioctl(fd, RTC_VL_READ, &tmp) < 0) {
-		if ((errno != EINTR) && (errno != ENOTTY)) {
-			pr_fail("%s: ioctl RTC_VL_READ failed, errno=%d (%s)\n",
-				args->name, errno, strerror(errno));
-			ret = -errno;
-			goto err;
+	{
+		unsigned long tmp;
+
+		if (ioctl(fd, RTC_VL_READ, &tmp) < 0) {
+			if ((errno != EINTR) && (errno != ENOTTY)) {
+				pr_fail("%s: ioctl RTC_VL_READ failed, errno=%d (%s)\n",
+					args->name, errno, strerror(errno));
+				ret = -errno;
+				goto err;
+			}
 		}
 	}
 #endif
@@ -204,25 +215,28 @@ static inline int stress_rtc_dev(const s
     defined(RTC_PARAM_SET) &&		\
     defined(RTC_PARAM_FEATURES) &&	\
     defined(RTC_PARAM_CORRECTION)
+	{
+		struct rtc_param param;
 
-	(void)memset(&param, 0, sizeof(param));
-	param.param = RTC_PARAM_FEATURES;
-	if (ioctl(fd, RTC_PARAM_GET, &param) == 0) {
-		/* Should be EINVAL */
-		VOID_RET(int, ioctl(fd, RTC_PARAM_SET, &param));
-	}
-
-	(void)memset(&param, 0, sizeof(param));
-	param.param = RTC_PARAM_CORRECTION;
-	param.index = 0;
-	if (ioctl(fd, RTC_PARAM_GET, &param) == 0) {
-		VOID_RET(int, ioctl(fd, RTC_PARAM_SET, &param));
-	}
-
-	(void)memset(&param, 0, sizeof(param));
-	param.param = ~0U;
-	if (ioctl(fd, RTC_PARAM_GET, &param) == 0) {
-		VOID_RET(int, ioctl(fd, RTC_PARAM_SET, &param));
+		(void)shim_memset(&param, 0, sizeof(param));
+		param.param = RTC_PARAM_FEATURES;
+		if (ioctl(fd, RTC_PARAM_GET, &param) == 0) {
+			/* Should be EINVAL */
+			VOID_RET(int, ioctl(fd, RTC_PARAM_SET, &param));
+		}
+
+		(void)shim_memset(&param, 0, sizeof(param));
+		param.param = RTC_PARAM_CORRECTION;
+		param.index = 0;
+		if (ioctl(fd, RTC_PARAM_GET, &param) == 0) {
+			VOID_RET(int, ioctl(fd, RTC_PARAM_SET, &param));
+		}
+
+		(void)shim_memset(&param, 0, sizeof(param));
+		param.param = ~0U;
+		if (ioctl(fd, RTC_PARAM_GET, &param) == 0) {
+			VOID_RET(int, ioctl(fd, RTC_PARAM_SET, &param));
+		}
 	}
 #endif
 
@@ -230,7 +244,7 @@ static inline int stress_rtc_dev(const s
 	{
 		char buf[4096];
 
-		(void)memset(buf, 0, sizeof(buf));
+		(void)shim_memset(buf, 0, sizeof(buf));
 		VOID_RET(int, ioctl(fd, 0xff, buf));
 	}
 
diff -pruN 0.15.07-1/stress-schedpolicy.c 0.15.08-1/stress-schedpolicy.c
--- 0.15.07-1/stress-schedpolicy.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-schedpolicy.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(__NR_sched_getattr)
@@ -119,7 +120,7 @@ static int stress_schedpolicy(const stre
 			 *  Only have 1 RT deadline instance running
 			 */
 			if (args->instance == 0) {
-				(void)memset(&attr, 0, sizeof(attr));
+				(void)shim_memset(&attr, 0, sizeof(attr));
 				attr.size = sizeof(attr);
 				attr.sched_flags = 0;
 				attr.sched_nice = 0;
@@ -148,7 +149,7 @@ static int stress_schedpolicy(const stre
 		case SCHED_OTHER:
 #endif
 			/* Exercise illegal policy */
-			(void)memset(&param, 0, sizeof(param));
+			(void)shim_memset(&param, 0, sizeof(param));
 			VOID_RET(int, sched_setscheduler(pid, -1, &param));
 
 			/* Exercise invalid PID */
@@ -236,21 +237,21 @@ static int stress_schedpolicy(const stre
 			n = 0;
 
 			/* Exercise invalid sched_getparam syscall */
-			(void)memset(&param, 0, sizeof(param));
+			(void)shim_memset(&param, 0, sizeof(param));
 			VOID_RET(int, sched_getparam(-1, &param));
 
 #if defined(__linux__)
 			/* Linux allows NULL param, will return EFAULT */
-			(void)memset(&param, 0, sizeof(param));
+			(void)shim_memset(&param, 0, sizeof(param));
 			VOID_RET(int, sched_getparam(pid, NULL));
 #endif
 
 			/* Exercise bad pid, ESRCH error */
-			(void)memset(&param, 0, sizeof(param));
+			(void)shim_memset(&param, 0, sizeof(param));
 			VOID_RET(int, sched_getparam(stress_get_unused_pid_racy(false), &param));
 
 			/* Exercise invalid sched_setparam syscall */
-			(void)memset(&param, 0, sizeof(param));
+			(void)shim_memset(&param, 0, sizeof(param));
 			VOID_RET(int, sched_setparam(-1, &param));
 
 #if defined(__linux__)
@@ -273,7 +274,7 @@ static int stress_schedpolicy(const stre
 		/* Exercise with bad pid, ESRCH error */
 		VOID_RET(int, sched_getscheduler(stress_get_unused_pid_racy(false)));
 
-		(void)memset(&param, 0, sizeof(param));
+		(void)shim_memset(&param, 0, sizeof(param));
 		ret = sched_getparam(pid, &param);
 		if (UNLIKELY((ret < 0) && ((errno != EINVAL) && (errno != EPERM))))
 			pr_fail("%s: sched_getparam failed, errno=%d (%s)\n",
@@ -294,7 +295,7 @@ static int stress_schedpolicy(const stre
 
 			large_attr = calloc(large_attr_size, sizeof(*large_attr));
 			if (large_attr) {
-				(void)memset(large_attr, 0, large_attr_size);
+				(void)shim_memset(large_attr, 0, large_attr_size);
 
 				VOID_RET(int, shim_sched_getattr(pid,
 					(struct shim_sched_attr *)large_attr,
@@ -305,22 +306,22 @@ static int stress_schedpolicy(const stre
 		}
 
 		/* Exercise invalid sched_getattr syscalls */
-		(void)memset(&attr, 0, sizeof(attr));
+		(void)shim_memset(&attr, 0, sizeof(attr));
 		VOID_RET(int, shim_sched_getattr(pid, &attr, sizeof(attr), ~0U));
 
 		/* Exercise -ve pid */
-		(void)memset(&attr, 0, sizeof(attr));
+		(void)shim_memset(&attr, 0, sizeof(attr));
 		VOID_RET(int, shim_sched_getattr(-1, &attr, sizeof(attr), 0));
 
 		/* Exercise bad pid, ESRCH error */
-		(void)memset(&attr, 0, sizeof(attr));
+		(void)shim_memset(&attr, 0, sizeof(attr));
 		VOID_RET(int, shim_sched_getattr(stress_get_unused_pid_racy(false),
 			&attr, sizeof(attr), 0));
 
 		/*
 		 *  Nothing too clever here, just get and set for now
 		 */
-		(void)memset(&attr, 0, sizeof(attr));
+		(void)shim_memset(&attr, 0, sizeof(attr));
 		attr.size = sizeof(attr);
 		ret = shim_sched_getattr(pid, &attr, sizeof(attr), 0);
 		if (UNLIKELY(ret < 0)) {
diff -pruN 0.15.07-1/stress-sctp.c 0.15.08-1/stress-sctp.c
--- 0.15.07-1/stress-sctp.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sctp.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_SYS_UN_H)
@@ -439,7 +440,7 @@ retry:
 			goto retry;
 		}
 #if defined(HAVE_SCTP_EVENT_SUBSCRIBE)
-		(void)memset(&events, 0, sizeof(events));
+		(void)shim_memset(&events, 0, sizeof(events));
 		events.sctp_data_io_event = 1;
 		if (UNLIKELY(setsockopt(fd, SOL_SCTP, SCTP_EVENTS, &events, sizeof(events)) < 0)) {
 			(void)close(fd);
@@ -453,7 +454,7 @@ retry:
 		if (sctp_sched > -1) {
 			struct sctp_assoc_value val;
 
-			(void)memset(&val, 0, sizeof(val));
+			(void)shim_memset(&val, 0, sizeof(val));
 			val.assoc_value = (uint32_t)sctp_sched;
 			(void)setsockopt(fd, SOL_SCTP, SCTP_STREAM_SCHEDULER, &val, sizeof(val));
 		}
@@ -492,7 +493,6 @@ retry:
  */
 static int OPTIMIZE3 stress_sctp_server(
 	const stress_args_t *args,
-	const pid_t pid,
 	const pid_t mypid,
 	const int sctp_port,
 	const int sctp_domain,
@@ -500,7 +500,7 @@ static int OPTIMIZE3 stress_sctp_server(
 	const char *sctp_if)
 {
 	char ALIGN64 buf[SOCKET_BUF];
-	int fd, status;
+	int fd;
 	int so_reuseaddr = 1;
 	socklen_t addr_len = 0;
 	struct sockaddr *addr = NULL;
@@ -572,7 +572,7 @@ static int OPTIMIZE3 stress_sctp_server(
 	if (sctp_sched > -1) {
 		struct sctp_assoc_value val;
 
-		(void)memset(&val, 0, sizeof(val));
+		(void)shim_memset(&val, 0, sizeof(val));
 		val.assoc_value = (uint32_t)sctp_sched;
 		(void)setsockopt(fd, SOL_SCTP, SCTP_STREAM_SCHEDULER, &val, sizeof(val));
 	}
@@ -590,12 +590,12 @@ static int OPTIMIZE3 stress_sctp_server(
 				"ABCDEFGHIJKLMNOPQRSTUVWXYZ_+@:#!";
 			const int c = patterns[index++ & 0x1f];
 
-			(void)memset(buf, c, sizeof(buf));
+			(void)shim_memset(buf, c, sizeof(buf));
 			for (i = 16; i < sizeof(buf); i += 16) {
 				ssize_t ret = sctp_sendmsg(sfd, buf, i,
 						NULL, 0, 0, 0,
 						LOCALTIME_STREAM, 0, 0);
-				if (UNLIKELY(ret < 0)) 
+				if (UNLIKELY(ret < 0))
 					break;
 
 				inc_counter(args);
@@ -610,7 +610,7 @@ die_close:
 die:
 #if defined(AF_UNIX) &&		\
     defined(HAVE_SOCKADDR_UN)
-	if (addr && sctp_domain == AF_UNIX) {
+	if (addr && (sctp_domain == AF_UNIX)) {
 		struct sockaddr_un *addr_un = (struct sockaddr_un *)addr;
 
 		(void)shim_unlink(addr_un->sun_path);
@@ -618,11 +618,6 @@ die:
 #else
 	UNEXPECTED
 #endif
-	if (pid) {
-		(void)kill(pid, SIGKILL);
-		(void)shim_waitpid(pid, &status, 0);
-	}
-
 	return rc;
 }
 
@@ -695,7 +690,11 @@ again:
 		(void)kill(getppid(), SIGALRM);
 		_exit(ret);
 	} else {
-		ret = stress_sctp_server(args, pid, mypid, sctp_port, sctp_domain, sctp_sched, sctp_if);
+		int status;
+
+		ret = stress_sctp_server(args, mypid, sctp_port, sctp_domain, sctp_sched, sctp_if);
+		(void)kill(pid, SIGKILL);
+		(void)shim_waitpid(pid, &status, 0);
 	}
 
 finish:
diff -pruN 0.15.07-1/stress-seal.c 0.15.08-1/stress-seal.c
--- 0.15.07-1/stress-seal.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-seal.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"seal N",	"start N workers performing fcntl SEAL commands" },
@@ -73,7 +74,7 @@ static int stress_seal(const stress_args
 			args->name, page_size);
 		return EXIT_NO_RESOURCE;
 	}
-	(void)memset(buf, 0xff, page_size);
+	(void)shim_memset(buf, 0xff, page_size);
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
@@ -160,7 +161,7 @@ static int stress_seal(const stress_args
 			(void)close(fd);
 			goto err;
 		}
-		(void)memset(ptr, 0xea, page_size);
+		(void)shim_memset(ptr, 0xea, page_size);
 		ret = fcntl(fd, F_ADD_SEALS, F_SEAL_WRITE);
 		if (UNLIKELY((ret == 0) || ((ret < 0) && (errno != EBUSY)))) {
 			pr_fail("%s: fcntl F_ADD_SEALS F_SEAL_WRITE did not fail with EBUSY as expected, errno=%d (%s)\n",
diff -pruN 0.15.07-1/stress-seccomp.c 0.15.08-1/stress-seccomp.c
--- 0.15.07-1/stress-seccomp.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-seccomp.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_AUDIT_H)
 #include <linux/audit.h>
@@ -226,7 +227,7 @@ static int stress_seccomp_set_huge_filte
 	const size_t n_max = ((size_t)1 << bits) - 1;
 	size_t i, j, n = 32, max = 1;
 
-	(void)memset(&huge_prog, 0, sizeof(huge_prog));
+	(void)shim_memset(&huge_prog, 0, sizeof(huge_prog));
 	if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) {
 		pr_fail("%s: prctl PR_SET_NEW_PRIVS failed, errno=%d (%s)\n",
 			args->name, errno, strerror(errno));
diff -pruN 0.15.07-1/stress-secretmem.c 0.15.08-1/stress-secretmem.c
--- 0.15.07-1/stress-secretmem.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-secretmem.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MMAP_MAX	(256*1024)
 
@@ -142,7 +143,7 @@ static int stress_secretmem_child(const
 			 *  touch pages, this will trigger OOM SIGKILL
 			 *  when we run low on secretmem pages
 			 */
-			(void)memset((void *)mappings[n], 0xff, page_size3);
+			(void)shim_memset((void *)mappings[n], 0xff, page_size3);
 
 			/*
 			 *  Make an hole in the 3 page mapping on middle page
diff -pruN 0.15.07-1/stress-seek.c 0.15.08-1/stress-seek.c
--- 0.15.07-1/stress-seek.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-seek.c	2023-05-21 14:30:06.000000000 +0000
@@ -282,7 +282,7 @@ re_read:
 			int i;
 
 			offset = (off_t)stress_mwc64modn(seek_size);
-			for (i = 0; i < 20 && keep_stressing(args); i++) {
+			for (i = 0; (i < 20) && keep_stressing(args); i++) {
 				offset = stress_shim_lseek(fd, offset, SEEK_DATA);
 				if (UNLIKELY(offset < 0))
 					break;
diff -pruN 0.15.07-1/stress-sem-sysv.c 0.15.08-1/stress-sem-sysv.c
--- 0.15.07-1/stress-sem-sysv.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sem-sysv.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SEM_SYSV)
 #include <sys/sem.h>
@@ -229,7 +230,7 @@ static int OPTIMIZE3 stress_semaphore_sy
 				timeout.tv_sec = 1;
 				timeout.tv_nsec = 0;
 				ret = semtimedop(sem_id, &semwait, 1, &timeout);
-				if (ret < 0 && ((errno == ENOSYS) || (errno == EINVAL))) {
+				if ((ret < 0) && ((errno == ENOSYS) || (errno == EINVAL))) {
 					got_semtimedop = false;
 					ret = semop(sem_id, &semwait, 1);
 				}
@@ -270,7 +271,7 @@ timed_out:
 			size_t nsems;
 #endif
 
-			(void)memset(&ds, 0, sizeof(ds));
+			(void)shim_memset(&ds, 0, sizeof(ds));
 
 			s.buf = &ds;
 			if (UNLIKELY(semctl(sem_id, 2, IPC_STAT, &s) < 0)) {
@@ -573,7 +574,7 @@ static int stress_sem_sysv(const stress_
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
-	(void)memset(pids, 0, sizeof(pids));
+	(void)shim_memset(pids, 0, sizeof(pids));
 	for (i = 0; i < semaphore_sysv_procs; i++) {
 		pids[i] = semaphore_sysv_spawn(args);
 		if (!keep_stressing_flag() || pids[i] < 0)
@@ -585,22 +586,7 @@ static int stress_sem_sysv(const stress_
 		pause();
 reap:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
-
-	for (i = 0; i < semaphore_sysv_procs; i++) {
-		if (pids[i] > 0)
-			(void)kill(pids[i], SIGALRM);
-	}
-	for (i = 0; i < semaphore_sysv_procs; i++) {
-		if (pids[i] > 0) {
-			int status;
-
-			(void)shim_waitpid(pids[i], &status, 0);
-			if (WIFEXITED(status) &&
-			    (WEXITSTATUS(status) != EXIT_SUCCESS)) {
-				rc = EXIT_FAILURE;
-			}
-		}
-	}
+	stress_kill_and_wait_many(args, pids, semaphore_sysv_procs, SIGALRM, true);
 
 	return rc;
 }
diff -pruN 0.15.07-1/stress-sem.c 0.15.08-1/stress-sem.c
--- 0.15.07-1/stress-sem.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sem.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pthread.h"
 
 #if defined(HAVE_SEMAPHORE_H)
@@ -112,9 +113,9 @@ do_semwait:
 				/* Attempt a very short timed wait */
 #if defined(CLOCK_REALTIME)
 				if (UNLIKELY(clock_gettime(CLOCK_REALTIME, &ts) < 0))
-					(void)memset(&ts, 0, sizeof(ts));
+					(void)shim_memset(&ts, 0, sizeof(ts));
 #else
-				(void)memset(&ts, 0, sizeof(ts));
+				(void)shim_memset(&ts, 0, sizeof(ts));
 #endif
 				ts.tv_nsec += 10000;
 				if (ts.tv_nsec >= 1000000000) {
@@ -198,7 +199,7 @@ static int stress_sem(const stress_args_
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(sem_pthreads, 0, sizeof(sem_pthreads));
+	(void)shim_memset(sem_pthreads, 0, sizeof(sem_pthreads));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
diff -pruN 0.15.07-1/stress-session.c 0.15.08-1/stress-session.c
--- 0.15.07-1/stress-session.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-session.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define STRESS_SESSION_SUCCESS		(0x00)
 #define STRESS_SESSION_SETSID_FAILED	(0x10)
@@ -204,14 +205,14 @@ static int stress_session(const stress_a
 			ssize_t n;
 			session_error_t error;
 
-			(void)memset(&error, 0, sizeof(error));
+			(void)shim_memset(&error, 0, sizeof(error));
 			n = read(fds[0], &error, sizeof(error));
 
 			(void)shim_waitpid(pid, &status, 0);
 			if (WIFEXITED(status) &&
 			   (WEXITSTATUS(status) != STRESS_SESSION_SUCCESS)) {
 				if ((n < (ssize_t)sizeof(error)) ||
-				   ((n == (ssize_t)sizeof(error)) && error.err == 0)) {
+				   ((n == (ssize_t)sizeof(error)) && (error.err == 0))) {
 					pr_fail("%s: failure in child, %s\n", args->name,
 						stress_session_error(WEXITSTATUS(status)));
 				} else {
diff -pruN 0.15.07-1/stress-set.c 0.15.08-1/stress-set.c
--- 0.15.07-1/stress-set.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-set.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_SYS_FSUID_H)
@@ -252,7 +253,7 @@ static int stress_set(const stress_args_
 			gid_t groups[GIDS_MAX];
 			int n;
 
-			(void)memset(groups, 0, sizeof(groups));
+			(void)shim_memset(groups, 0, sizeof(groups));
 			ret = STRESS_MINIMUM(ret, (int)SIZEOF_ARRAY(groups));
 			n = getgroups(ret, groups);
 			if (n > 0) {
@@ -471,7 +472,7 @@ static int stress_set(const stress_args_
 		 *  Invalid setrlimit syscall with invalid
 		 *  resource attribute resulting in EINVAL error
 		 */
-		(void)memset(&rlim, 0, sizeof(rlim));
+		(void)shim_memset(&rlim, 0, sizeof(rlim));
 		if ((getrlimit((shim_rlimit_resource_t)INT_MAX, &rlim) < 0) && (errno == EINVAL)) {
 			(void)setrlimit((shim_rlimit_resource_t)INT_MAX, &rlim);
 		}
diff -pruN 0.15.07-1/stress-shellsort.c 0.15.08-1/stress-shellsort.c
--- 0.15.07-1/stress-shellsort.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-shellsort.c	2023-05-21 14:30:06.000000000 +0000
@@ -80,7 +80,7 @@ static int shellsort32(void *base, size_
 			register size_t j;
 			const uint32_t temp = array[i];
 
-			for (j = i; j >= gap && compar(&array[j - gap], &temp) > 0; j -= gap) {
+			for (j = i; (j >= gap) && (compar(&array[j - gap], &temp) > 0); j -= gap) {
 				array[j] = array[j - gap];
 			}
 			array[j] = temp;
@@ -102,7 +102,7 @@ static int shellsort8(void *base, size_t
 			register size_t j;
 			const uint8_t temp = array[i];
 
-			for (j = i; j >= gap && compar(&array[j - gap], &temp) > 0; j -= gap) {
+			for (j = i; (j >= gap) && (compar(&array[j - gap], &temp) > 0); j -= gap) {
 				array[j] = array[j - gap];
 			}
 			array[j] = temp;
diff -pruN 0.15.07-1/stress-shm-sysv.c 0.15.08-1/stress-shm-sysv.c
--- 0.15.07-1/stress-shm-sysv.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-shm-sysv.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(HAVE_LINUX_MEMPOLICY_H)
@@ -608,8 +609,8 @@ static int stress_shm_sysv_child(
 		return EXIT_FAILURE;
 	}
 
-	(void)memset(addrs, 0, sizeof(addrs));
-	(void)memset(keys, 0, sizeof(keys));
+	(void)shim_memset(addrs, 0, sizeof(addrs));
+	(void)shim_memset(keys, 0, sizeof(keys));
 	for (i = 0; i < MAX_SHM_SYSV_SEGMENTS; i++)
 		shm_ids[i] = -1;
 
diff -pruN 0.15.07-1/stress-shm.c 0.15.08-1/stress-shm.c
--- 0.15.07-1/stress-shm.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-shm.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_SHM_POSIX_BYTES	(1 * MB)
 #define MAX_SHM_POSIX_BYTES	(1 * GB)
@@ -82,7 +83,7 @@ static int stress_shm_posix_check(
 	uint8_t *ptr, *end = buf + sz;
 	uint8_t val;
 
-	(void)memset(buf, 0xa5, sz);
+	(void)shim_memset(buf, 0xa5, sz);
 
 	for (val = 0, ptr = buf; ptr < end; ptr += page_size, val++) {
 		*ptr = val;
@@ -137,8 +138,8 @@ static int stress_shm_posix_child(
 	/* Make sure this is killable by OOM killer */
 	stress_set_oom_adjustment(args->name, true);
 
-	(void)memset(&msg, 0, sizeof(msg));
-	(void)memset(&sa, 0, sizeof(sa));
+	(void)shim_memset(&msg, 0, sizeof(msg));
+	(void)shim_memset(&sa, 0, sizeof(sa));
 	sa.sa_handler = SIG_IGN;
 #if defined(SA_NOCLDWAIT)
 	sa.sa_flags = SA_NOCLDWAIT;
@@ -179,7 +180,7 @@ static int stress_shm_posix_child(
 			}
 
 			/* Inform parent of the new shm name */
-			(void)memset(&msg, 0, sizeof(msg));
+			(void)shim_memset(&msg, 0, sizeof(msg));
 			msg.index = i;
 			shm_name[SHM_NAME_LEN - 1] = '\0';
 			(void)shim_strlcpy(msg.shm_name, shm_name, SHM_NAME_LEN);
@@ -431,7 +432,7 @@ again:
 				 *  on child death, or child tells us
 				 *  about its demise.
 				 */
-				(void)memset(&msg, 0, sizeof(msg));
+				(void)shim_memset(&msg, 0, sizeof(msg));
 				n = read(pipefds[0], &msg, sizeof(msg));
 				if (n <= 0) {
 					if ((errno == EAGAIN) || (errno == EINTR))
@@ -457,8 +458,7 @@ again:
 			(void)stress_killpid(pid);
 			(void)shim_waitpid(pid, &status, 0);
 			if (WIFSIGNALED(status)) {
-				if ((WTERMSIG(status) == SIGKILL) ||
-				    (WTERMSIG(status) == SIGKILL)) {
+				if (WTERMSIG(status) == SIGKILL) {
 					stress_log_system_mem_info();
 					pr_dbg("%s: assuming killed by OOM killer, "
 						"restarting again (instance %d)\n",
diff -pruN 0.15.07-1/stress-sigchld.c 0.15.08-1/stress-sigchld.c
--- 0.15.07-1/stress-sigchld.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sigchld.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"sigchld N",	 "start N workers that handle SIGCHLD" },
@@ -75,7 +76,7 @@ static int stress_sigchld(const stress_a
 	cld_stopped = 0;
 	cld_continued = 0;
 
-	(void)memset(&sa, 0, sizeof(sa));
+	(void)shim_memset(&sa, 0, sizeof(sa));
 	sa.sa_sigaction = stress_sigchld_handler;
 #if defined(SA_SIGINFO)
 	sa.sa_flags = SA_SIGINFO;
diff -pruN 0.15.07-1/stress-sigfd.c 0.15.08-1/stress-sigfd.c
--- 0.15.07-1/stress-sigfd.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sigfd.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_SIGNALFD_H)
 #include <sys/signalfd.h>
@@ -121,7 +122,7 @@ again:
 		stress_parent_died_alarm();
 		(void)sched_settings_apply(true);
 
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 
 		while (keep_stressing_flag()) {
 			int ret;
diff -pruN 0.15.07-1/stress-sigfpe.c 0.15.08-1/stress-sigfpe.c
--- 0.15.07-1/stress-sigfpe.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sigfpe.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-put.h"
 
 #if defined(HAVE_FENV_H)
@@ -210,7 +211,7 @@ static int stress_sigfpe(const stress_ar
 #endif
 	};
 
-	(void)memset(&action, 0, sizeof action);
+	(void)shim_memset(&action, 0, sizeof action);
 
 #if defined(STRESS_CHECK_SIGINFO)
 	action.sa_sigaction = stress_fpehandler;
diff -pruN 0.15.07-1/stress-sigio.c 0.15.08-1/stress-sigio.c
--- 0.15.07-1/stress-sigio.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sigio.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_SELECT_H)
 #include <sys/select.h>
@@ -156,7 +157,7 @@ again:
 		stress_set_oom_adjustment(args->name, true);
 
 		(void)close(fds[0]);
-		(void)memset(wr_buffer, 0, BUFFER_SIZE);
+		(void)shim_memset(wr_buffer, 0, BUFFER_SIZE);
 
 		stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
diff -pruN 0.15.07-1/stress-signest.c 0.15.08-1/stress-signest.c
--- 0.15.07-1/stress-signest.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-signest.c	2023-05-21 14:30:06.000000000 +0000
@@ -25,6 +25,7 @@ static const stress_help_t help[] = {
 	{ NULL,	NULL,		 NULL }
 };
 
+static bool jmp_env_ok;
 static sigjmp_buf jmp_env;
 
 static const int signals[] = {
@@ -99,6 +100,14 @@ typedef struct {
 
 static volatile stress_signest_info_t signal_info;
 
+static void stress_signest_ignore(void)
+{
+	size_t i;
+
+	for (i = 0; i < SIZEOF_ARRAY(signals); i++)
+		VOID_RET(int, stress_sighandler("signest", signals[i], SIG_IGN, NULL));
+}
+
 static inline ssize_t stress_signest_find(int signum)
 {
 	size_t i;
@@ -133,18 +142,27 @@ static void MLOCKED_TEXT stress_signest_
 			signal_info.stack_depth = delta;
 	}
 
-	if (UNLIKELY(run_time > (double)g_opt_timeout))
-		siglongjmp(jmp_env, 1);
+	if (UNLIKELY(run_time > (double)g_opt_timeout)) {
+		stress_signest_ignore();
+		if (jmp_env_ok)
+			siglongjmp(jmp_env, 1);
+	}
 
-	if (UNLIKELY(signal_info.stop))
-		siglongjmp(jmp_env, 1);
+	if (UNLIKELY(signal_info.stop)) {
+		stress_signest_ignore();
+		if (jmp_env_ok)
+			siglongjmp(jmp_env, 1);
+	}
 
 	if (UNLIKELY(!signal_info.args))
 		goto done;
 
 	inc_counter(signal_info.args);
-	if (UNLIKELY(!keep_stressing(signal_info.args)))
-		siglongjmp(jmp_env, 1);
+	if (UNLIKELY(!keep_stressing(signal_info.args))) {
+		stress_signest_ignore();
+		if (jmp_env_ok)
+			siglongjmp(jmp_env, 1);
+	}
 
 	i = stress_signest_find(signum);
 	if (UNLIKELY((i < 0) || (i == (ssize_t)SIZEOF_ARRAY(signals))))
@@ -153,8 +171,10 @@ static void MLOCKED_TEXT stress_signest_
 	signal_info.signalled |= 1U << i;
 
 	for (; i < (ssize_t)SIZEOF_ARRAY(signals); i++) {
-		if (signal_info.stop || !keep_stressing(signal_info.args))
-			siglongjmp(jmp_env, 1);
+		if (signal_info.stop || !keep_stressing(signal_info.args)) {
+			if (jmp_env_ok)
+				siglongjmp(jmp_env, 1);
+		}
 		(void)raise(signals[i]);
 	}
 
@@ -163,7 +183,6 @@ done:
 	return;
 }
 
-
 /*
  *  stress_signest
  *	stress by generating segmentation faults by
@@ -177,6 +196,7 @@ static int stress_signest(const stress_a
 	char *buf, *ptr;
 	const size_t altstack_size = stress_min_sig_stack_size() * SIZEOF_ARRAY(signals);
 
+	jmp_env_ok = false;
 	altstack = (uint8_t*)mmap(NULL, altstack_size, PROT_READ | PROT_WRITE,
 			MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	if (altstack == MAP_FAILED) {
@@ -209,6 +229,7 @@ static int stress_signest(const stress_a
 			return EXIT_NO_RESOURCE;
 	}
 
+	jmp_env_ok = true;
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
 	do {
@@ -216,7 +237,9 @@ static int stress_signest(const stress_a
 	} while (keep_stressing(args));
 
 finish:
+	jmp_env_ok = false;
 	signal_info.stop = true;
+	stress_signest_ignore();
 
 	for (sz = 1, n = 0, i = 0; i < SIZEOF_ARRAY(signals); i++) {
 		if (signal_info.signalled & (1U << i)) {
diff -pruN 0.15.07-1/stress-sigq.c 0.15.08-1/stress-sigq.c
--- 0.15.07-1/stress-sigq.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sigq.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"sigq N",	"start N workers sending sigqueue signals" },
@@ -61,7 +62,7 @@ static int stress_sigq(const stress_args
 	const uid_t myuid = getuid();
 #endif
 
-	(void)memset(&sa, 0, sizeof(sa));
+	(void)shim_memset(&sa, 0, sizeof(sa));
 	sa.sa_sigaction = stress_sigqhandler;
 	sa.sa_flags = SA_SIGINFO;
 
@@ -101,7 +102,7 @@ again:
 			siginfo_t info;
 			int ret;
 
-			(void)memset(&info, 0, sizeof(info));
+			(void)shim_memset(&info, 0, sizeof(info));
 
 			if (i++ & 1) {
 				ret = sigwaitinfo(&mask, &info);
@@ -135,7 +136,7 @@ again:
 		int status;
 
 		do {
-			(void)memset(&s, 0, sizeof(s));
+			(void)shim_memset(&s, 0, sizeof(s));
 			s.sival_int = 0;
 			(void)sigqueue(pid, SIGUSR1, s);
 
@@ -147,7 +148,7 @@ again:
 				 *  Invalid si_code, the kernel should return
 				 *  -EPERM on Linux.
 				 */
-				(void)memset(&info, 0, sizeof(info));
+				(void)shim_memset(&info, 0, sizeof(info));
 				info.si_signo = SIGUSR1;
 				info.si_code = SI_TKILL;
 				info.si_pid = mypid;
@@ -163,7 +164,7 @@ again:
 		} while (keep_stressing(args));
 
 		pr_dbg("%s: parent sent termination notice\n", args->name);
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 		s.sival_int = 1;
 		(void)sigqueue(pid, SIGUSR1, s);
 		(void)shim_usleep(250);
diff -pruN 0.15.07-1/stress-sigrt.c 0.15.08-1/stress-sigrt.c
--- 0.15.07-1/stress-sigrt.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sigrt.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"sigrt N",	"start N workers sending real time signals" },
@@ -80,7 +81,7 @@ again:
 			for (i = 0; i < MAX_RTPIDS; i++)
 				(void)sigaddset(&mask, i + SIGRTMIN);
 
-			(void)memset(&info, 0, sizeof info);
+			(void)shim_memset(&info, 0, sizeof info);
 
 			while (keep_stressing_flag()) {
 				if (UNLIKELY(sigwaitinfo(&mask, &info) < 0)) {
@@ -92,7 +93,7 @@ again:
 					break;
 
 				if (info.si_value.sival_int != -1) {
-					(void)memset(&s, 0, sizeof(s));
+					(void)shim_memset(&s, 0, sizeof(s));
 					s.sival_int = -1;
 					(void)sigqueue(info.si_value.sival_int, SIGRTMIN, s);
 				}
@@ -108,7 +109,7 @@ again:
 
 	/* Parent */
 	do {
-		(void)memset(&s, 0, sizeof(s));
+		(void)shim_memset(&s, 0, sizeof(s));
 
 		for (i = 0; i < MAX_RTPIDS; i++) {
 			const int pid = pids[(i + 1) % MAX_RTPIDS];
@@ -122,7 +123,7 @@ again:
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
-	(void)memset(&s, 0, sizeof(s));
+	(void)shim_memset(&s, 0, sizeof(s));
 	for (i = 0; i < MAX_RTPIDS; i++) {
 		if (pids[i] > 0) {
 			s.sival_int = 0;
diff -pruN 0.15.07-1/stress-sigsegv.c 0.15.08-1/stress-sigsegv.c
--- 0.15.07-1/stress-sigsegv.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sigsegv.c	2023-05-21 14:30:06.000000000 +0000
@@ -20,6 +20,7 @@
 #include "stress-ng.h"
 #include "core-arch.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 #include "core-cpu-cache.h"
 #include "core-nt-store.h"
@@ -282,7 +283,7 @@ static int stress_sigsegv(const stress_a
 		int ret;
 		struct sigaction action;
 
-		(void)memset(&action, 0, sizeof action);
+		(void)shim_memset(&action, 0, sizeof action);
 #if defined(SA_SIGINFO)
 		action.sa_sigaction = stress_segvhandler;
 #else
@@ -322,7 +323,7 @@ static int stress_sigsegv(const stress_a
 		if (ret) {
 			/* Signal was tripped */
 #if defined(SA_SIGINFO)
-			if (verify && expected_addr && fault_addr && fault_addr != expected_addr) {
+			if (verify && expected_addr && fault_addr && (fault_addr != expected_addr)) {
 				pr_fail("%s: expecting fault address %p, got %p instead\n",
 					args->name, (volatile void *)expected_addr, fault_addr);
 			}
diff -pruN 0.15.07-1/stress-sigsuspend.c 0.15.08-1/stress-sigsuspend.c
--- 0.15.07-1/stress-sigsuspend.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sigsuspend.c	2023-05-21 14:30:06.000000000 +0000
@@ -38,7 +38,6 @@ static int stress_sigsuspend(const stres
 	pid_t pid[MAX_SIGSUSPEND_PIDS];
 	size_t n, i;
 	sigset_t mask, oldmask;
-	int status;
 
 	if (stress_sighandler(args->name, SIGUSR1, stress_sighandler_nop, NULL) < 0)
 		return EXIT_FAILURE;
@@ -86,10 +85,16 @@ again:
 reap:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 	for (i = 0; i < n; i++) {
-		/* terminate child */
-		(void)kill(pid[i], SIGKILL);
-		(void)shim_waitpid(pid[i], &status, 0);
+		if (kill(pid[i], 0) == 0) {
+			int status;
+
+			/* terminate child */
+			force_killed_counter(args);
+			(void)kill(pid[i], SIGKILL);
+			(void)shim_waitpid(pid[i], &status, 0);
+		}
 	}
+
 	(void)stress_lock_destroy(counter_lock);
 
 	return EXIT_SUCCESS;
diff -pruN 0.15.07-1/stress-skiplist.c 0.15.08-1/stress-skiplist.c
--- 0.15.07-1/stress-skiplist.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-skiplist.c	2023-05-21 14:30:06.000000000 +0000
@@ -200,7 +200,7 @@ static void skip_list_free(skip_list_t *
 	skip_node_t *head = list->head;
 	skip_node_t *skip_node = head;
 
-	while (skip_node && skip_node->skip_nodes[1] != head) {
+	while (skip_node && (skip_node->skip_nodes[1] != head)) {
 		skip_node_t *next = skip_node->skip_nodes[1];
 
 		free(skip_node);
diff -pruN 0.15.07-1/stress-sleep.c 0.15.08-1/stress-sleep.c
--- 0.15.07-1/stress-sleep.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sleep.c	2023-05-21 14:30:06.000000000 +0000
@@ -20,6 +20,7 @@
  */
 #include "stress-ng.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 
 #if defined(HAVE_SYS_SELECT_H)
@@ -87,7 +88,8 @@ static void *stress_pthread_func(void *c
 	const stress_args_t *args = ctxt->args;
 	const uint64_t max_ops =
 		args->max_ops ? (args->max_ops / ctxt->sleep_max) + 1 : 0;
-#if defined(HAVE_ASM_X86_TPAUSE)
+#if defined(HAVE_ASM_X86_TPAUSE) &&	\
+    !defined(__PCC__)
 	const bool x86_has_waitpkg = stress_cpu_x86_has_waitpkg();
 #endif
 
@@ -197,7 +199,7 @@ static int stress_sleep(const stress_arg
 	if (stress_sighandler(args->name, SIGALRM, stress_sigalrm_handler, NULL) < 0)
 		return EXIT_FAILURE;
 
-	(void)memset(ctxts, 0, sizeof(ctxts));
+	(void)shim_memset(ctxts, 0, sizeof(ctxts));
 	(void)sigfillset(&set);
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
@@ -233,6 +235,7 @@ static int stress_sleep(const stress_arg
 
 	ret = EXIT_SUCCESS;
 tidy:
+	(void)alarm(0);
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
 	thread_terminate = true;
diff -pruN 0.15.07-1/stress-smi.c 0.15.08-1/stress-smi.c
--- 0.15.07-1/stress-smi.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-smi.c	2023-05-21 14:30:06.000000000 +0000
@@ -19,6 +19,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 #include "core-capabilities.h"
 
@@ -221,8 +222,8 @@ static int stress_smi(const stress_args_
 	}
 
 #if defined(STRESS_ARCH_X86_64)
-	(void)memset(&r1, 0, sizeof(r1));
-	(void)memset(&r2, 0, sizeof(r2));
+	(void)shim_memset(&r1, 0, sizeof(r1));
+	(void)shim_memset(&r2, 0, sizeof(r2));
 #endif
 
 	do {
diff -pruN 0.15.07-1/stress-sock.c 0.15.08-1/stress-sock.c
--- 0.15.07-1/stress-sock.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sock.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_LINUX_SOCKIOS_H)
@@ -270,6 +271,11 @@ static char **stress_get_congestion_cont
 		ctrls[n++] = ctrl;
 	}
 
+	if (n == 0) {
+		free(ctrls);
+		return NULL;
+	}
+
 	/* Shrink ctrls, hopefully should not fail, but check anyhow */
 	tmp = realloc(ctrls, n * sizeof(char *));
 	if (!tmp) {
@@ -323,7 +329,7 @@ static void stress_sock_ioctl(
 	if (!rt) {
 		struct ifconf ifc;
 
-		(void)memset(&ifc, 0, sizeof(ifc));
+		(void)shim_memset(&ifc, 0, sizeof(ifc));
 		VOID_RET(int, ioctl(fd, SIOCGIFCONF, &ifc));
 	}
 #endif
@@ -403,7 +409,7 @@ static void stress_sock_invalid_recv(con
 	case SOCKET_OPT_RECVMSG:
 		vec[0].iov_base = buf;
 		vec[0].iov_len = sizeof(buf);
-		(void)memset(&msg, 0, sizeof(msg));
+		(void)shim_memset(&msg, 0, sizeof(msg));
 		msg.msg_iov = vec;
 		msg.msg_iovlen = 1;
 
@@ -415,7 +421,7 @@ static void stress_sock_invalid_recv(con
 		break;
 #if defined(HAVE_RECVMMSG)
 	case SOCKET_OPT_RECVMMSG:
-		(void)memset(msgvec, 0, sizeof(msgvec));
+		(void)shim_memset(msgvec, 0, sizeof(msgvec));
 		vec[0].iov_base = buf;
 		vec[0].iov_len = sizeof(buf);
 		msgvec[0].msg_hdr.msg_iov = vec;
@@ -777,7 +783,7 @@ retry:
 					vec[j].iov_base = buf;
 					vec[j].iov_len = i;
 				}
-				(void)memset(&msg, 0, sizeof(msg));
+				(void)shim_memset(&msg, 0, sizeof(msg));
 				msg.msg_iov = vec;
 				msg.msg_iovlen = j;
 				n = recvmsg(fd, &msg, 0);
@@ -785,7 +791,7 @@ retry:
 #if defined(HAVE_RECVMMSG)
 			case SOCKET_OPT_RECVMMSG:
 				recvfunc = "recvmmsg";
-				(void)memset(msgvec, 0, sizeof(msgvec));
+				(void)shim_memset(msgvec, 0, sizeof(msgvec));
 				for (j = 0, i = 16; i < MMAP_IO_SIZE; i += 16, j++) {
 					vec[j].iov_base = buf;
 					vec[j].iov_len = i;
@@ -1031,7 +1037,7 @@ static int OPTIMIZE3 stress_sock_server(
 				}
 			}
 #endif
-			(void)memset(buf, 'A' + (get_counter(args) % 26), MMAP_IO_SIZE);
+			(void)shim_memset(buf, stress_ascii64[get_counter(args) & 63], MMAP_IO_SIZE);
 
 			if (sock_opts == SOCKET_OPT_RANDOM)
 				opt = stress_mwc8modn(3);
@@ -1055,7 +1061,7 @@ static int OPTIMIZE3 stress_sock_server(
 					vec[j].iov_base = buf;
 					vec[j].iov_len = i;
 				}
-				(void)memset(&msg, 0, sizeof(msg));
+				(void)shim_memset(&msg, 0, sizeof(msg));
 				msg.msg_iov = vec;
 				msg.msg_iovlen = j;
 				if (UNLIKELY(sendmsg(sfd, &msg, 0) < 0)) {
@@ -1067,7 +1073,7 @@ static int OPTIMIZE3 stress_sock_server(
 				break;
 #if defined(HAVE_SENDMMSG)
 			case SOCKET_OPT_SENDMMSG:
-				(void)memset(msgvec, 0, sizeof(msgvec));
+				(void)shim_memset(msgvec, 0, sizeof(msgvec));
 				for (j = 0, i = 16; i < MMAP_IO_SIZE; i += 16, j++) {
 					vec[j].iov_base = buf;
 					vec[j].iov_len = i;
diff -pruN 0.15.07-1/stress-sockabuse.c 0.15.08-1/stress-sockabuse.c
--- 0.15.07-1/stress-sockabuse.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sockabuse.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_SYS_XATTR_H)
@@ -76,7 +77,7 @@ static void stress_sockabuse_fd(const in
 	struct timespec timespec[2];
 #endif
 
-	(void)memset(&addr, 0, sizeof(addr));
+	(void)shim_memset(&addr, 0, sizeof(addr));
 	VOID_RET(int, connect(fd, &addr, sizeof(addr)));
 	VOID_RET(int, shim_fdatasync(fd));
 	VOID_RET(int, shim_fsync(fd));
@@ -165,7 +166,7 @@ static void stress_sockabuse_fd(const in
 #endif
 	VOID_RET(int, shim_sync_file_range(fd, 0, 1, 0));
 #if defined(HAVE_FUTIMENS)
-	(void)memset(&timespec, 0, sizeof(timespec));
+	(void)shim_memset(&timespec, 0, sizeof(timespec));
 #endif
 }
 
@@ -238,12 +239,11 @@ retry:
  */
 static int stress_sockabuse_server(
 	const stress_args_t *args,
-	const pid_t pid,
 	const pid_t mypid,
 	const int sockabuse_port)
 {
 	char buf[SOCKET_BUF];
-	int fd, status;
+	int fd;
 	int so_reuseaddr = 1;
 	socklen_t addr_len = 0;
 	struct sockaddr *addr = NULL;
@@ -327,7 +327,7 @@ static int stress_sockabuse_server(
 					(void)close(sfd);
 					break;
 				}
-				(void)memset(buf, 'A' + (get_counter(args) % 26), sizeof(buf));
+				(void)shim_memset(buf, stress_ascii64[get_counter(args) & 63], sizeof(buf));
 
 				n = send(sfd, buf, sizeof(buf), 0);
 				if (n < 0) {
@@ -351,10 +351,6 @@ static int stress_sockabuse_server(
 	t2 = stress_time_now();
 
 die:
-	if (pid) {
-		(void)kill(pid, SIGKILL);
-		(void)shim_waitpid(pid, &status, 0);
-	}
 	pr_dbg("%s: %" PRIu64 " messages sent\n", args->name, msgs);
 	dt = t2 - t1;
 	if (dt > 0.0)
@@ -411,16 +407,18 @@ again:
 			args->name, errno, strerror(errno));
 		return EXIT_FAILURE;
 	} else if (pid == 0) {
-		rc = stress_sockabuse_client(args, mypid,
-			sockabuse_port);
+		rc = stress_sockabuse_client(args, mypid, sockabuse_port);
 
 		/* Inform parent we're all done */
 		(void)kill(getppid(), SIGALRM);
 
 		_exit(rc);
 	} else {
-		rc = stress_sockabuse_server(args, pid, mypid,
-			sockabuse_port);
+		int status;
+
+		rc = stress_sockabuse_server(args, mypid, sockabuse_port);
+		(void)kill(pid, SIGKILL);
+		(void)shim_waitpid(pid, &status, 0);
 	}
 finish:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
diff -pruN 0.15.07-1/stress-sockfd.c 0.15.08-1/stress-sockfd.c
--- 0.15.07-1/stress-sockfd.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sockfd.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_SYS_UN_H)
@@ -76,11 +77,11 @@ static inline ssize_t stress_socket_fd_s
 	iov.iov_base = msg_data;
 	iov.iov_len = 1;
 
-	(void)memset(&msg, 0, sizeof(msg));
+	(void)shim_memset(&msg, 0, sizeof(msg));
 	msg.msg_iov = &iov;
 	msg.msg_iovlen = 1;
 
-	(void)memset(ctrl, 0, sizeof(ctrl));
+	(void)shim_memset(ctrl, 0, sizeof(ctrl));
 	msg.msg_control = ctrl;
 	msg.msg_controllen = sizeof(ctrl);
 
@@ -109,11 +110,11 @@ static inline int stress_socket_fd_recv(
 	iov.iov_base = msg_data;
 	iov.iov_len = 1;
 
-	(void)memset(&msg, 0, sizeof(msg));
+	(void)shim_memset(&msg, 0, sizeof(msg));
 	msg.msg_iov = &iov;
 	msg.msg_iovlen = 1;
 
-	(void)memset(ctrl, 0, sizeof(ctrl));
+	(void)shim_memset(ctrl, 0, sizeof(ctrl));
 	msg.msg_control = ctrl;
 	msg.msg_controllen = sizeof(ctrl);
 
@@ -159,7 +160,7 @@ static int OPTIMIZE3 stress_socket_clien
 		socklen_t addr_len = 0;
 		int so_reuseaddr = 1;
 
-		(void)memset(fds, 0, fds_size);
+		(void)shim_memset(fds, 0, fds_size);
 retry:
 		if (!keep_stressing_flag())
 			return EXIT_FAILURE;
@@ -238,12 +239,11 @@ retry:
  */
 static int OPTIMIZE3 stress_socket_server(
 	const stress_args_t *args,
-	const pid_t pid,
 	const pid_t ppid,
 	const ssize_t max_fd,
 	const int socket_fd_port)
 {
-	int fd, status;
+	int fd;
 	int so_reuseaddr = 1;
 	socklen_t addr_len = 0;
 	struct sockaddr *addr = NULL;
@@ -347,11 +347,6 @@ die:
 		(void)shim_unlink(addr_un->sun_path);
 	}
 #endif
-
-	if (pid) {
-		(void)kill(pid, SIGALRM);
-		(void)shim_waitpid(pid, &status, 0);
-	}
 	pr_dbg("%s: %" PRIu64 " messages sent\n", args->name, msgs);
 
 	return rc;
@@ -427,7 +422,11 @@ again:
 
 		_exit(ret);
 	} else {
-		ret = stress_socket_server(args, pid, mypid, max_fd, socket_fd_port);
+		int status;
+
+		ret = stress_socket_server(args, mypid, max_fd, socket_fd_port);
+		(void)kill(pid, SIGALRM);
+		(void)shim_waitpid(pid, &status, 0);
 	}
 
 finish:
diff -pruN 0.15.07-1/stress-sockmany.c 0.15.08-1/stress-sockmany.c
--- 0.15.07-1/stress-sockmany.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sockmany.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_NETINET_TCP_H)
@@ -178,12 +179,11 @@ retry:
 static int OPTIMIZE3 stress_sockmany_server(
 	const stress_args_t *args,
 	const int sockmany_port,
-	const pid_t pid,
 	const pid_t mypid,
 	const char *sockmany_if)
 {
 	char ALIGN64 buf[SOCKET_MANY_BUF];
-	int fd, status;
+	int fd;
 	int so_reuseaddr = 1;
 	socklen_t addr_len = 0;
 	struct sockaddr *addr = NULL;
@@ -268,7 +268,7 @@ static int OPTIMIZE3 stress_sockmany_ser
 #else
 			UNEXPECTED
 #endif
-			(void)memset(buf, 'A' + (msgs % 26), sizeof(buf));
+			(void)shim_memset(buf, stress_ascii64[msgs & 63], sizeof(buf));
 			sret = send(sfd, buf, sizeof(buf), 0);
 			if (UNLIKELY(sret < 0)) {
 				if ((errno != EINTR) && (errno != EPIPE))
@@ -287,11 +287,6 @@ static int OPTIMIZE3 stress_sockmany_ser
 die_close:
 	(void)close(fd);
 die:
-	if (pid) {
-		(void)kill(pid, SIGKILL);
-		(void)shim_waitpid(pid, &status, 0);
-	}
-
 	return rc;
 }
 
@@ -373,7 +368,11 @@ again:
 
 		_exit(rc);
 	} else {
-		rc = stress_sockmany_server(args, sockmany_port, pid, ppid, sockmany_if);
+		int status;
+
+		rc = stress_sockmany_server(args, sockmany_port, ppid, sockmany_if);
+		(void)kill(pid, SIGKILL);
+		(void)shim_waitpid(pid, &status, 0);
 	}
 	pr_dbg("%s: %d sockets opened at one time\n", args->name, sock_fds->max_fd);
 
diff -pruN 0.15.07-1/stress-sockpair.c 0.15.08-1/stress-sockpair.c
--- 0.15.07-1/stress-sockpair.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sockpair.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MAX_SOCKET_PAIRS	(32768)
 #define SOCKET_PAIR_BUF         (4096)	/* Socket pair I/O buffer size */
@@ -134,7 +135,7 @@ static int stress_sockpair_oomable(const
 		(void)close(socket_pair_fds_bad[1]);
 	}
 
-	(void)memset(socket_pair_fds, 0, sizeof(socket_pair_fds));
+	(void)shim_memset(socket_pair_fds, 0, sizeof(socket_pair_fds));
 	errno = 0;
 
 	t = stress_time_now();
diff -pruN 0.15.07-1/stress-softlockup.c 0.15.08-1/stress-softlockup.c
--- 0.15.07-1/stress-softlockup.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-softlockup.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 static const stress_help_t help[] = {
@@ -121,7 +122,7 @@ static int stress_softlockup(const stres
 	const double start = stress_time_now();
 
 	timeout = g_opt_timeout;
-	(void)memset(&param, 0, sizeof(param));
+	(void)shim_memset(&param, 0, sizeof(param));
 
 	if (SIZEOF_ARRAY(policies) == (0)) {
 		if (first_instance) {
@@ -197,7 +198,7 @@ again:
 				goto tidy_ok;
 			(void)usleep(50000);
 			__atomic_load(&g_shared->softlockup_count, &count, __ATOMIC_RELAXED);
-		} while (keep_stressing(args) && count < num_instances);
+		} while (keep_stressing(args) && (count < num_instances));
 #endif
 
 		/*
@@ -245,7 +246,8 @@ again:
 			}
 			drop_niceness();
 			policy++;
-			policy %= SIZEOF_ARRAY(policies);
+			if (policy >= SIZEOF_ARRAY(policies))
+				policy = 0;
 			inc_counter(args);
 
 			/* Ensure we NEVER spin forever */
@@ -258,18 +260,14 @@ tidy_ok:
 tidy:
 		_exit(rc);
 	} else {
-		int status;
-
 		param.sched_priority = policies[0].max_prio;
 		(void)sched_setscheduler(args->pid, policies[0].policy, &param);
 
 		(void)pause();
-		(void)kill(pid, SIGKILL);
+		stress_kill_and_wait(args, pid, SIGALRM, true);
 #if defined(HAVE_ATOMIC)
 		__sync_fetch_and_sub(&g_shared->softlockup_count, 1);
 #endif
-
-		(void)shim_waitpid(pid, &status, 0);
 	}
 finish:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
diff -pruN 0.15.07-1/stress-sparsematrix.c 0.15.08-1/stress-sparsematrix.c
--- 0.15.07-1/stress-sparsematrix.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sparsematrix.c	2023-05-21 14:30:06.000000000 +0000
@@ -17,6 +17,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 
 #if defined(HAVE_SYS_TREE_H)
@@ -402,7 +403,7 @@ static void *qhash_create(const uint64_t
 		free(table);
 		return NULL;
 	}
-	memset(table->nodes, 0xff, (size_t)n * sizeof(sparse_qhash_node_t));
+	(void)shim_memset(table->nodes, 0xff, (size_t)n * sizeof(sparse_qhash_node_t));
 	table->n_nodes = n;
 	table->n = n_prime;
 	table->idx = 0;
@@ -705,7 +706,7 @@ static uint32_t OPTIMIZE3 rb_get(void *h
 {
 	sparse_rb_t node, *found;
 
-	memset(&node, 0xff, sizeof(node));
+	(void)shim_memset(&node, 0xff, sizeof(node));
 	node.xy = ((uint64_t)x << 32) | y;
 
 	found = RB_FIND(sparse_rb_tree, handle, &node);
@@ -827,7 +828,7 @@ static uint32_t OPTIMIZE3 splay_get(void
 {
 	sparse_splay_t node, *found;
 
-	memset(&node, 0xff, sizeof(node));
+	(void)shim_memset(&node, 0xff, sizeof(node));
 	node.xy = ((uint64_t)x << 32) | y;
 
 	found = SPLAY_FIND(sparse_splay_tree, handle, &node);
@@ -865,7 +866,7 @@ static void list_destroy(void *handle, s
 
 	*objmem = 0;
 	while (!CIRCLEQ_EMPTY(y_head)) {
-		sparse_y_list_node_t *y_node = CIRCLEQ_FIRST(y_head);
+		sparse_y_list_node_t *y_node = (sparse_y_list_node_t *)CIRCLEQ_FIRST(y_head);
 
 		sparse_x_list_t *x_head = &y_node->x_head;
 
@@ -889,10 +890,10 @@ static void list_destroy(void *handle, s
 static int OPTIMIZE3 list_put(void *handle, const uint32_t x, const uint32_t y, const uint32_t value)
 {
 	sparse_y_list_t *y_head = (sparse_y_list_t *)handle;
-	sparse_y_list_node_t *y_node, *new_y_node;
+	sparse_y_list_node_t *y_node = NULL, *new_y_node;
 
 	sparse_x_list_t *x_head;
-	sparse_x_list_node_t *x_node, *new_x_node;
+	sparse_x_list_node_t *x_node = NULL, *new_x_node;
 
 	CIRCLEQ_FOREACH(y_node, y_head, sparse_y_list) {
 		if (y_node->y == y) {
@@ -1470,30 +1471,20 @@ static int stress_sparsematrix(const str
 		end = method + 1;
 	}
 
-	pr_lock();
 	for (i = begin; (i < end) && sparsematrix_methods[i].name; i++) {
-		char str[12];
-
-		if (test_info[i].max_objmem) {
-			stress_uint64_to_str(str, sizeof(str), (uint64_t)test_info[i].max_objmem);
-		} else {
-			shim_strlcpy(str, "n/a", sizeof(str));
-		}
-
-		if (test_info[i].skip_no_mem) {
-			pr_inf("%s: %-6s skipped (out of memory)\n",
-				args->name, sparsematrix_methods[i].name);
-		} else {
-			pr_inf("%s: %-8s %8.8s %15.2f get/s %15.2f put/s\n",
-				args->name,
-				sparsematrix_methods[i].name, str,
-				test_info[i].get_duration > 0.0 ?
-					(double)test_info[i].get_ops / test_info[i].get_duration : 0.0,
-				test_info[i].put_duration > 0.0 ?
-					(double)test_info[i].put_ops / test_info[i].put_duration : 0.0);
+		if (!test_info[i].skip_no_mem) {
+			char tmp[32];
+			double rate;
+
+			(void)snprintf(tmp, sizeof(tmp), "%s gets per sec", sparsematrix_methods[i].name);
+			rate = test_info[i].get_duration > 0.0 ? (double)test_info[i].get_ops / test_info[i].get_duration : 0.0;
+			stress_metrics_set(args, (i * 2) + 0, tmp, rate);
+
+			(void)snprintf(tmp, sizeof(tmp), "%s puts per sec", sparsematrix_methods[i].name);
+			rate = test_info[i].put_duration > 0.0 ? (double)test_info[i].put_ops / test_info[i].put_duration : 0.0;
+			stress_metrics_set(args, (i * 2) + 1, tmp, rate);
 		}
 	}
-	pr_unlock();
 
 	rc = EXIT_SUCCESS;
 err:
diff -pruN 0.15.07-1/stress-spawn.c 0.15.08-1/stress-spawn.c
--- 0.15.07-1/stress-spawn.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-spawn.c	2023-05-21 14:30:06.000000000 +0000
@@ -59,6 +59,7 @@ static int stress_spawn_supported(const
 static int stress_spawn(const stress_args_t *args)
 {
 	char *path;
+	char exec_path[PATH_MAX];
 	uint64_t spawn_fails = 0, spawn_calls = 0;
 	static char *argv_new[] = { NULL, "--exec-exit", NULL };
 	static char *env_new[] = { NULL };
@@ -76,7 +77,7 @@ static int stress_spawn(const stress_arg
 	/*
 	 *  Determine our own self as the executable, e.g. run stress-ng
 	 */
-	path = stress_proc_self_exe();
+	path = stress_proc_self_exe(exec_path, sizeof(exec_path));
 	if (!path) {
 		if (args->instance == 0)
 			pr_inf_skip("%s: skipping stressor, can't determine stress-ng "
diff -pruN 0.15.07-1/stress-splice.c 0.15.08-1/stress-splice.c
--- 0.15.07-1/stress-splice.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-splice.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_SPLICE_BYTES	(1 * KB)
 #define MAX_SPLICE_BYTES	(64 * MB)
@@ -122,7 +123,7 @@ static bool stress_splice_non_block_writ
 		return false;
 	if (UNLIKELY(fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0))
 		return false;
-	(void)memset(buffer, 0xa5, sizeof(buffer));
+	(void)shim_memset(buffer, 0xa5, sizeof(buffer));
         if (write(fd, buffer, sizeof(buffer)) < 0)
 		return false;
         if (fcntl(fd, F_SETFL, flags) < 0)
diff -pruN 0.15.07-1/stress-stack.c 0.15.08-1/stress-stack.c
--- 0.15.07-1/stress-stack.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-stack.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define STRESS_DATA_SIZE	(256 * KB)
 
@@ -97,7 +98,7 @@ static void stress_stack_alloc(
 		return;
 
 	if (stack_fill) {
-		(void)memset(data, 0, STRESS_DATA_SIZE);
+		(void)shim_memset(data, 0, STRESS_DATA_SIZE);
 	} else {
 		register size_t i;
 
@@ -228,7 +229,7 @@ static int stress_stack_child(const stre
 		if (!keep_stressing(args))
 			break;
 
-		(void)memset(&new_action, 0, sizeof new_action);
+		(void)shim_memset(&new_action, 0, sizeof new_action);
 		new_action.sa_handler = stress_segvhandler;
 		(void)sigemptyset(&new_action.sa_mask);
 		new_action.sa_flags = SA_ONSTACK;
diff -pruN 0.15.07-1/stress-stackmmap.c 0.15.08-1/stress-stackmmap.c
--- 0.15.07-1/stress-stackmmap.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-stackmmap.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-put.h"
 
 #if defined(HAVE_UCONTEXT_H)
@@ -149,7 +150,7 @@ static int stress_stackmmap(const stress
 		pr_dbg("%s: madvise failed: errno=%d (%s)\n",
 			args->name, errno, strerror(errno));
 	}
-	(void)memset(stack_mmap, 0, MMAPSTACK_SIZE);
+	(void)shim_memset(stack_mmap, 0, MMAPSTACK_SIZE);
 
 #if defined(HAVE_MPROTECT)
 	/*
@@ -161,7 +162,7 @@ static int stress_stackmmap(const stress
 	UNEXPECTED
 #endif
 
-	(void)memset(&c_test, 0, sizeof(c_test));
+	(void)shim_memset(&c_test, 0, sizeof(c_test));
 	if (getcontext(&c_test) < 0) {
 		pr_fail("%s: getcontext failed, errno=%d (%s)\n",
 			args->name, errno, strerror(errno));
@@ -200,9 +201,7 @@ again:
 				if (errno != EINTR)
 					pr_dbg("%s: waitpid(): errno=%d (%s)\n",
 						args->name, errno, strerror(errno));
-				(void)kill(pid, SIGTERM);
-				(void)stress_killpid(pid);
-				(void)shim_waitpid(pid, &status, 0);
+				stress_kill_and_wait(args, pid, SIGTERM, false);
 			}
 		} else {
 			/* Child */
@@ -219,7 +218,7 @@ again:
 			 *  an alternative signal handling stack
 			 *  is required because we ran out of stack
 			 */
-			(void)memset(&new_action, 0, sizeof new_action);
+			(void)shim_memset(&new_action, 0, sizeof new_action);
 			new_action.sa_handler = stress_sig_handler_exit;
 			(void)sigemptyset(&new_action.sa_mask);
 			new_action.sa_flags = SA_ONSTACK;
diff -pruN 0.15.07-1/stress-swap.c 0.15.08-1/stress-swap.c
--- 0.15.07-1/stress-swap.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-swap.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 
 #if defined(__sun__)
@@ -166,7 +167,7 @@ static int stress_swap_set_size(
 	if (bad_flags & SWAP_HDR_BAD_SIGNATURE)
 		signature[0]++;	/* Invalid */
 
-	(void)memset(&swap_info, 0, sizeof(swap_info));
+	(void)shim_memset(&swap_info, 0, sizeof(swap_info));
 	for (i = 0; i < sizeof(swap_info.sws_uuid); i++)
 		swap_info.sws_uuid[i] = stress_mwc8();
 	(void)snprintf((char *)swap_info.sws_volume,
@@ -361,7 +362,7 @@ static int stress_swap(const stress_args
 			for (i = 0, p = ptr; p < p_end; p += page_size, i++) {
 				uintptr_t *up = (uintptr_t *)(uintptr_t)p;
 
-				(void)memset(p, (int)i, page_size);
+				(void)shim_memset(p, (int)i, page_size);
 				*up = (uintptr_t)p;
 			}
 #if defined(MADV_PAGEOUT)
diff -pruN 0.15.07-1/stress-switch.c 0.15.08-1/stress-switch.c
--- 0.15.07-1/stress-switch.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-switch.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_MQUEUE_H)
 #include <mqueue.h>
@@ -143,7 +144,7 @@ static int stress_switch_pipe(
 	if (stress_sig_stop_stressing(args->name, SIGPIPE) < 0)
 		return EXIT_FAILURE;
 
-	(void)memset(pipefds, 0, sizeof(pipefds));
+	(void)shim_memset(pipefds, 0, sizeof(pipefds));
 #if defined(HAVE_PIPE2) &&	\
     defined(O_DIRECT)
 	if (pipe2(pipefds, O_DIRECT) < 0) {
@@ -237,7 +238,7 @@ again:
 
 		/* Parent */
 		(void)close(pipefds[0]);
-		(void)memset(buf, '_', buf_size);
+		(void)shim_memset(buf, '_', buf_size);
 
 		t_start = stress_time_now();
 		do {
@@ -422,7 +423,7 @@ static int stress_switch_mq(
                 return EXIT_FAILURE;
 	}
 
-	(void)memset(&msg, 0, sizeof(msg));
+	(void)shim_memset(&msg, 0, sizeof(msg));
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 again:
 	pid = fork();
diff -pruN 0.15.07-1/stress-sync-file.c 0.15.08-1/stress-sync-file.c
--- 0.15.07-1/stress-sync-file.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sync-file.c	2023-05-21 14:30:06.000000000 +0000
@@ -230,8 +230,8 @@ static int stress_sync_file(const stress
 				continue;
 			break;
 		}
-		for (i = 0; keep_stressing_flag() && i <
-		     (shim_off64_t)sync_file_bytes / (shim_off64_t)(128 * KB); i++) {
+		for (i = 0; keep_stressing_flag() &&
+		     (i < (shim_off64_t)sync_file_bytes / (shim_off64_t)(128 * KB)); i++) {
 			offset = (shim_off64_t)(stress_mwc64modn((uint64_t)sync_file_bytes) & ~((128 * KB) - 1));
 
 			ret = shim_sync_file_range(fd, offset, 128 * KB, mode);
diff -pruN 0.15.07-1/stress-syscall.c 0.15.08-1/stress-syscall.c
--- 0.15.07-1/stress-syscall.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-syscall.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-io-priority.h"
 
 #define SYSCALL_METHOD_ALL	(0)
@@ -593,8 +594,8 @@ static int syscall_socket_measure(const
 	struct mmsghdr msgvec[1];
 #endif
 
-	(void)memset(buffer, 0, sizeof(buffer));
-	(void)memset(&addr, 0, sizeof(addr));
+	(void)shim_memset(buffer, 0, sizeof(buffer));
+	(void)shim_memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_UNIX;
 	(void)snprintf(addr.sun_path, sizeof(addr.sun_path), "/tmp/stress-ng-client-%" PRIdMAX, (intmax_t)getpid());
 
@@ -650,7 +651,7 @@ static int syscall_socket_measure(const
 			break;
 #if defined(HAVE_SENDMMSG)
 		case SOCK_MEASURE_SENDMMSG:
-			(void)memset(msgvec, 0, sizeof(msgvec));
+			(void)shim_memset(msgvec, 0, sizeof(msgvec));
 			vec[0].iov_base = buffer;
 			vec[0].iov_len = sizeof(buffer);
 			msgvec[0].msg_hdr.msg_iov = vec;
@@ -665,7 +666,7 @@ static int syscall_socket_measure(const
 		case SOCK_MEASURE_SENDMSG:
 			vec[0].iov_base = buffer;
 			vec[0].iov_len = sizeof(buffer);
-			(void)memset(&msg, 0, sizeof(msg));
+			(void)shim_memset(&msg, 0, sizeof(msg));
 			msg.msg_iov = vec;
 			msg.msg_iovlen = 1;
 			syscall_shared_info->t1 = syscall_time_now();
@@ -762,7 +763,7 @@ close_sfd_child:
 		case SOCK_MEASURE_RECVMSG:
 			vec[0].iov_base = buffer;
 			vec[0].iov_len = sizeof(buffer);
-			(void)memset(&msg, 0, sizeof(msg));
+			(void)shim_memset(&msg, 0, sizeof(msg));
 			msg.msg_iov = vec;
 			msg.msg_iovlen = 1;
 			syscall_shared_info->t1 = syscall_time_now();
@@ -773,7 +774,7 @@ close_sfd_child:
 			break;
 #if defined(HAVE_RECVMMSG)
 		case SOCK_MEASURE_RECVMMSG:
-			(void)memset(msgvec, 0, sizeof(msgvec));
+			(void)shim_memset(msgvec, 0, sizeof(msgvec));
 			vec[0].iov_base = buffer;
 			vec[0].iov_len = sizeof(buffer);
 			msgvec[0].msg_hdr.msg_iov = vec;
@@ -941,8 +942,8 @@ static int syscall_capget(void)
 	struct __user_cap_data_struct ucd[_LINUX_CAPABILITY_U32S_3];
 	int ret;
 
-	(void)memset(&uch, 0, sizeof uch);
-	(void)memset(ucd, 0, sizeof ucd);
+	(void)shim_memset(&uch, 0, sizeof uch);
+	(void)shim_memset(ucd, 0, sizeof ucd);
 
         uch.version = _LINUX_CAPABILITY_VERSION_3;
         uch.pid = syscall_pid;
@@ -964,8 +965,8 @@ static int syscall_capset(void)
 	struct __user_cap_data_struct ucd[_LINUX_CAPABILITY_U32S_3];
 	int ret;
 
-	(void)memset(&uch, 0, sizeof uch);
-	(void)memset(ucd, 0, sizeof ucd);
+	(void)shim_memset(&uch, 0, sizeof uch);
+	(void)shim_memset(ucd, 0, sizeof ucd);
 
         uch.version = _LINUX_CAPABILITY_VERSION_3;
         uch.pid = syscall_pid;
@@ -1068,7 +1069,7 @@ static int syscall_clock_adjtime(void)
 	int ret;
 	const int clock = clocks[i];
 
-	(void)memset(&t, 0, sizeof(t));
+	(void)shim_memset(&t, 0, sizeof(t));
 	i++;
 	if (i >= SIZEOF_ARRAY(clocks))
 		i = 0;
@@ -1235,7 +1236,7 @@ static int syscall_clone3(void)
 	syscall_shared_info->t2 = ~0ULL;
 	syscall_shared_info->t_set = false;
 
-	(void)memset(&cl_args, 0, sizeof(cl_args));
+	(void)shim_memset(&cl_args, 0, sizeof(cl_args));
 	cl_args.flags = 0;
 	cl_args.pidfd = (uint64_t)(uintptr_t)&pidfd;
 	cl_args.child_tid = (uint64_t)(uintptr_t)&child_tid;
@@ -1411,7 +1412,7 @@ static int syscall_epoll_ctl(void)
 		return -1;
 	}
 
-	(void)memset(&event, 0, sizeof(event));
+	(void)shim_memset(&event, 0, sizeof(event));
 	event.data.fd = fds[1];
 	event.events = EPOLLIN;
 	t1 = syscall_time_now();
@@ -1443,7 +1444,7 @@ static int syscall_epoll_pwait(void)
 		return -1;
 	}
 
-	(void)memset(&event, 0, sizeof(event));
+	(void)shim_memset(&event, 0, sizeof(event));
 	event.data.fd = fds[1];
 	event.events = EPOLLIN;
 	ret = epoll_ctl(fd, EPOLL_CTL_ADD, fds[1], &event);
@@ -1483,7 +1484,7 @@ static int syscall_epoll_wait(void)
 		return -1;
 	}
 
-	(void)memset(&event, 0, sizeof(event));
+	(void)shim_memset(&event, 0, sizeof(event));
 	event.data.fd = fds[1];
 	event.events = EPOLLIN;
 	ret = epoll_ctl(fd, EPOLL_CTL_ADD, fds[1], &event);
@@ -2579,7 +2580,7 @@ static int syscall_io_cancel(void)
 		return -1;
 
 	stress_uint8rnd4((uint8_t *)buffer, sizeof(buffer));
-	(void)memset(&cb, 0, sizeof(cb));
+	(void)shim_memset(&cb, 0, sizeof(cb));
 	cb[0].aio_fildes = syscall_fd;
 	cb[0].aio_lio_opcode = IO_CMD_PWRITE;
 	cb[0].u.c.buf = buffer;
@@ -2751,7 +2752,7 @@ static int syscall_io_submit(void)
 		return -1;
 
 	stress_uint8rnd4((uint8_t *)buffer, sizeof(buffer));
-	(void)memset(&cb, 0, sizeof(cb));
+	(void)shim_memset(&cb, 0, sizeof(cb));
 	cb[0].aio_fildes = syscall_fd;
 	cb[0].aio_lio_opcode = IO_CMD_PWRITE;
 	cb[0].u.c.buf = buffer;
@@ -2794,7 +2795,7 @@ static int syscall_io_uring_setup(void)
 	int fd;
 	struct io_uring_params p[16];
 
-	(void)memset(&p, 0, sizeof(p));
+	(void)shim_memset(&p, 0, sizeof(p));
 	t1 = syscall_time_now();
 	fd = syscall(__NR_io_uring_setup, (unsigned long)SIZEOF_ARRAY(p), &p);
 	t2 = syscall_time_now();
@@ -3163,7 +3164,7 @@ static int syscall_mbind(void)
 	if (buf == MAP_FAILED)
 		return -1;
 
-	(void)memset(node_mask, 0, sizeof(node_mask));
+	(void)shim_memset(node_mask, 0, sizeof(node_mask));
 	STRESS_SETBIT(node_mask, 0);
 	t1 = syscall_time_now();
 	ret = shim_mbind(buf, syscall_2_pages_size, MPOL_BIND, node_mask, sizeof(node_mask) * 8, MPOL_DEFAULT);
@@ -3215,9 +3216,9 @@ static int syscall_migrate_pages(void)
 	unsigned long old_node_mask[NUMA_LONG_BITS];
 	unsigned long new_node_mask[NUMA_LONG_BITS];
 
-	(void)memset(old_node_mask, 0, sizeof(old_node_mask));
+	(void)shim_memset(old_node_mask, 0, sizeof(old_node_mask));
 	STRESS_SETBIT(old_node_mask, 0);
-	(void)memset(new_node_mask, 0, sizeof(new_node_mask));
+	(void)shim_memset(new_node_mask, 0, sizeof(new_node_mask));
 	STRESS_SETBIT(new_node_mask, 0);
 
 	t1 = syscall_time_now();
@@ -3286,7 +3287,7 @@ static int syscall_mknod(void)
 	i++;
 	if (i >= SIZEOF_ARRAY(modes))
 		i = 0;
-	(void)memset((void *)&dev, 0, sizeof(dev));
+	(void)shim_memset((void *)&dev, 0, sizeof(dev));
 	t1 = syscall_time_now();
 	ret = mknod(syscall_tmp_filename, modes[i], dev);
 	t2 = syscall_time_now();
@@ -3315,7 +3316,7 @@ static int syscall_mknodat(void)
 	i++;
 	if (i >= SIZEOF_ARRAY(modes))
 		i = 0;
-	(void)memset((void *)&dev, 0, sizeof(dev));
+	(void)shim_memset((void *)&dev, 0, sizeof(dev));
 	t1 = syscall_time_now();
 	ret = mknodat(syscall_dir_fd, syscall_tmp_filename, modes[i], dev);
 	t2 = syscall_time_now();
@@ -3498,7 +3499,7 @@ static int syscall_move_pages(void)
 	if (buf == MAP_FAILED)
 		return -1;
 
-	(void)memset(buf, 0xff, syscall_page_size);
+	(void)shim_memset(buf, 0xff, syscall_page_size);
 	pages[0] = buf;
 	dest_nodes[0] = 0;
 	status[0] = 0;
@@ -3640,7 +3641,7 @@ static int syscall_mq_notify(void)
 	if (mq >= 0) {
 		struct sigevent sev;
 
-		(void)memset(&sev, 0, sizeof(sev));
+		(void)shim_memset(&sev, 0, sizeof(sev));
 		sev.sigev_notify = SIGEV_SIGNAL;
 		sev.sigev_signo = SIGUSR1;
 
@@ -4053,7 +4054,7 @@ static int syscall_nanosleep(void)
 	struct timespec req, rem;
 	int ret;
 
-	(void)memset((void *)&rem, 0, sizeof(rem));
+	(void)shim_memset((void *)&rem, 0, sizeof(rem));
 	req.tv_sec = 0;
 	req.tv_nsec = 1;
 
@@ -4146,12 +4147,12 @@ static int syscall_open_by_handle_at(voi
 	if (!fp)
 		goto err_free_fhp;
 
-	(void)memset(path, 0, sizeof(path));
+	(void)shim_memset(path, 0, sizeof(path));
 	while (fgets(buffer, sizeof(buffer), fp) != NULL) {
 		ssize_t n;
 		int id;
 
-		(void)memset(path, 0, sizeof(path));
+		(void)shim_memset(path, 0, sizeof(path));
 		n = sscanf(buffer, "%12d %*d %*s %*s %" XSTR(PATH_MAX) "s", &id, path);
 		if ((n == 2) && (id == mount_id))
 			break;
@@ -4534,7 +4535,7 @@ static int syscall_prctl(void)
 		{
 			char name[17];
 
-			(void)memset(name, 0, sizeof name);
+			(void)shim_memset(name, 0, sizeof name);
 			t1 = syscall_time_now();
 			ret = prctl(PR_GET_NAME, name);
 			t2 = syscall_time_now();
@@ -4683,7 +4684,7 @@ static int syscall_process_vm_readv(void
 	local_buf = buf;
 	remote_buf = (void *)(((uintptr_t)buf) + syscall_page_size);
 
-	(void)memset(remote_buf, 0x5a, syscall_page_size);
+	(void)shim_memset(remote_buf, 0x5a, syscall_page_size);
 
 	local[0].iov_base = local_buf;
 	local[0].iov_len = syscall_page_size;
@@ -4714,7 +4715,7 @@ static int syscall_process_vm_writev(voi
 	local_buf = buf;
 	remote_buf = (void *)(((uintptr_t)buf) + syscall_page_size);
 
-	(void)memset(local_buf, 0xa5, syscall_page_size);
+	(void)shim_memset(local_buf, 0xa5, syscall_page_size);
 
 	local[0].iov_base = local_buf;
 	local[0].iov_len = syscall_page_size;
@@ -5176,7 +5177,7 @@ static int syscall_sched_getattr(void)
 	int ret;
 	struct shim_sched_attr attr;
 
-	(void)memset(&attr, 0, sizeof(attr));
+	(void)shim_memset(&attr, 0, sizeof(attr));
 	attr.size = sizeof(attr);
 	t1 = syscall_time_now();
 	ret = shim_sched_getattr(syscall_pid, &attr, sizeof(attr), 0);
@@ -5196,7 +5197,7 @@ static int syscall_sched_getparam(void)
 	int ret;
 	struct sched_param param;
 
-	(void)memset(&param, 0, sizeof(param));
+	(void)shim_memset(&param, 0, sizeof(param));
 	t1 = syscall_time_now();
 	ret = sched_getparam(syscall_pid, &param);
 	t2 = syscall_time_now();
@@ -5311,7 +5312,7 @@ static int syscall_sched_setattr(void)
 	int ret;
 	struct shim_sched_attr attr;
 
-	(void)memset(&attr, 0, sizeof(attr));
+	(void)shim_memset(&attr, 0, sizeof(attr));
 	attr.size = sizeof(attr);
 	ret = shim_sched_getattr(syscall_pid, &attr, sizeof(attr), 0);
 	if (ret < 0)
@@ -5334,7 +5335,7 @@ static int syscall_sched_setparam(void)
 	int ret;
 	struct sched_param param;
 
-	(void)memset(&param, 0, sizeof(param));
+	(void)shim_memset(&param, 0, sizeof(param));
 	ret = sched_getparam(syscall_pid, &param);
 	if (ret < 0)
 		return -1;
@@ -5356,7 +5357,7 @@ static int syscall_sched_setscheduler(vo
 	int policy, ret;
 	struct sched_param param;
 
-	(void)memset(&param, 0, sizeof(param));
+	(void)shim_memset(&param, 0, sizeof(param));
 	policy = sched_getscheduler(syscall_pid);
 	if (policy < 0)
 		return -1;
@@ -5825,7 +5826,7 @@ static int syscall_setrlimit(void)
 	if (ret < 0)
 		return -1;
 
-	(void)memcpy(&new_rlim, &old_rlim, sizeof(new_rlim));
+	(void)shim_memcpy(&new_rlim, &old_rlim, sizeof(new_rlim));
 	new_rlim.rlim_cur = new_rlim.rlim_max;
 	t1 = syscall_time_now();
 	ret = setrlimit(limit, &new_rlim);
@@ -6062,7 +6063,7 @@ static int syscall_sigaction(void)
 	struct sigaction act, old_act;
 	int ret;
 
-	(void)memset(&act, 0, sizeof(act));
+	(void)shim_memset(&act, 0, sizeof(act));
 
 	act.sa_handler = stress_mwc1() ? SIG_DFL : SIG_IGN;
 	act.sa_sigaction = 0;
@@ -6083,7 +6084,7 @@ static int syscall_sigaltstack(void)
 	uint64_t stack[1024];
 	int ret;
 
-	(void)memset(stack, 0, sizeof(stack));
+	(void)shim_memset(stack, 0, sizeof(stack));
 
 	new_ss.ss_sp = (void *)stack;
 	new_ss.ss_size = sizeof(stack);
@@ -6545,7 +6546,7 @@ static int syscall_timer_create(void)
 	timer_t timerid;
 	int ret;
 
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
@@ -6570,7 +6571,7 @@ static int syscall_timer_delete(void)
 	timer_t timerid;
 	int ret;
 
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
@@ -6668,7 +6669,7 @@ static int syscall_timer_gettime(void)
 	timer_t timerid;
 	int ret;
 
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
@@ -6698,7 +6699,7 @@ static int syscall_timer_getoverrun(void
 	timer_t timerid;
 	int ret;
 
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
@@ -6730,7 +6731,7 @@ static int syscall_timer_settime(void)
 	timer_t timerid;
 	int ret;
 
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
@@ -7054,7 +7055,7 @@ static int syscall_vmsplice(void)
 	if (buf == MAP_FAILED)
 		return -1;
 
-	(void)memset(buf, 0xa5, syscall_page_size);
+	(void)shim_memset(buf, 0xa5, syscall_page_size);
 	if (pipe(fds) < 0) {
 		(void)munmap(buf, syscall_page_size);
 		return -1;
@@ -8511,6 +8512,7 @@ static int stress_syscall(const stress_a
 	size_t exercised = 0;
 	size_t i;
 	int syscall_method = SYSCALL_METHOD_FAST75;
+	char exec_path[PATH_MAX];
 	const uint32_t rnd_filenum = stress_mwc32();
 	const double time_end = stress_time_now() + (double)g_opt_timeout;
 
@@ -8530,7 +8532,7 @@ static int stress_syscall(const stress_a
 	syscall_gid = getgid();
 	syscall_sid = getsid(syscall_pid);
 	syscall_umask_mask = umask(0);
-	syscall_exec_prog = stress_proc_self_exe();
+	syscall_exec_prog = stress_proc_self_exe(exec_path, sizeof(exec_path));
 
 	if (stress_sighandler(args->name, SIGUSR1, syscall_sigusr1_handler, NULL) < 0)
 		return EXIT_NO_RESOURCE;
diff -pruN 0.15.07-1/stress-sysfs.c 0.15.08-1/stress-sysfs.c
--- 0.15.07-1/stress-sysfs.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sysfs.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-hash.h"
 #include "core-pthread.h"
@@ -352,7 +353,7 @@ err:
 			 */
 			const char *rom = strstr(path, "rom");
 
-			if (rom && rom[3] == '\0') {
+			if (rom && (rom[3] == '\0')) {
 				if ((fd = open(path, O_RDWR | O_NONBLOCK)) < 0)
 					goto next;
 				/* Enable ROM read */
@@ -675,7 +676,7 @@ static int stress_sysfs(const stress_arg
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(ctxt, 0, sizeof(*ctxt));
+	(void)shim_memset(ctxt, 0, sizeof(*ctxt));
 	shim_strlcpy(ctxt->sysfs_path, signum_path, sizeof(ctxt->sysfs_path));
 
 	ctxt->args = args;
@@ -695,7 +696,7 @@ static int stress_sysfs(const stress_arg
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(pthreads_ret, 0, sizeof(pthreads_ret));
+	(void)shim_memset(pthreads_ret, 0, sizeof(pthreads_ret));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
@@ -789,8 +790,10 @@ again:
 
 			/* Forcefully kill threads */
 			for (i = 0; i < MAX_SYSFS_THREADS; i++) {
-				if (pthreads_ret[i] == 0)
+				if (pthreads_ret[i] == 0) {
+					force_killed_counter(args);
 					(void)pthread_kill(pthreads[i], SIGKILL);
+				}
 			}
 
 			for (i = 0; i < MAX_SYSFS_THREADS; i++) {
diff -pruN 0.15.07-1/stress-sysinfo.c 0.15.08-1/stress-sysinfo.c
--- 0.15.07-1/stress-sysinfo.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sysinfo.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_FS_H)
 #include <linux/fs.h>
@@ -64,7 +65,7 @@ static int stress_sysinfo(const stress_a
 	const int bad_fd = stress_get_bad_fd();
 #endif
 
-	(void)memset(mnts, 0, sizeof(mnts));
+	(void)shim_memset(mnts, 0, sizeof(mnts));
 
 	n_mounts = stress_mount_get(mnts, SIZEOF_ARRAY(mnts));
 	if (n_mounts < 0) {
diff -pruN 0.15.07-1/stress-sysinval.c 0.15.08-1/stress-sysinval.c
--- 0.15.07-1/stress-sysinval.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-sysinval.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"sysinval N",		"start N workers that pass invalid args to syscalls" },
@@ -2341,7 +2342,7 @@ static void hash_table_add(
 	h->hash = hash;
 	h->syscall = syscall_num;
 	h->type = type;
-	(void)memcpy(h->args, args, sizeof(h->args));
+	(void)shim_memcpy(h->args, args, sizeof(h->args));
 	h->next = hash_table->table[hash];
 	hash_table->table[hash] = h;
 	hash_table->index++;
@@ -2512,7 +2513,7 @@ timed_out:
 	}
 
 	if (arg_bitmask & ARG_PTR_WR)
-		(void)memset(page_ptr_wr, 0, args->page_size);
+		(void)shim_memset(page_ptr_wr, 0, args->page_size);
 	/*
 	 *  This should not fail!
 	 */
@@ -2606,7 +2607,7 @@ static inline int stress_do_syscall(cons
 			for (i = 0; keep_stressing(args) && (i < SYSCALL_ARGS_SIZE); i++) {
 				const size_t j = reorder[i];
 
-				(void)memset(current_context->args, 0, sizeof(current_context->args));
+				(void)shim_memset(current_context->args, 0, sizeof(current_context->args));
 				current_context->syscall = stress_syscall_args[j].syscall;
 				current_context->idx = j;
 				current_context->name = stress_syscall_args[j].name;
@@ -2787,14 +2788,14 @@ static int stress_sysinval(const stress_
 	futex_ptrs[0] = (unsigned long)(small_ptr + page_size -1);
 	futex_ptrs[1] = (unsigned long)page_ptr;
 
-	memset(current_context->crash_count, 0, sizeof(current_context->crash_count));
+	(void)shim_memset(current_context->crash_count, 0, sizeof(current_context->crash_count));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
 	rc = stress_oomable_child(args, NULL, stress_sysinval_child, STRESS_OOMABLE_DROP_CAP);
 
-	(void)memset(syscall_exercised, 0, sizeof(syscall_exercised));
-	(void)memset(syscall_unique, 0, sizeof(syscall_unique));
+	(void)shim_memset(syscall_exercised, 0, sizeof(syscall_exercised));
+	(void)shim_memset(syscall_unique, 0, sizeof(syscall_unique));
 	syscalls_exercised = 0;
 	syscalls_unique = 0;
 	syscalls_crashed = 0;
@@ -2842,17 +2843,17 @@ static int stress_sysinval(const stress_
 
 tidy:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
-	if (stress_syscall_exercised && stress_syscall_exercised != MAP_FAILED)
+	if (stress_syscall_exercised && (stress_syscall_exercised != MAP_FAILED))
 		(void)munmap((void *)stress_syscall_exercised, stress_syscall_exercised_sz);
-	if (hash_table && hash_table != MAP_FAILED)
+	if (hash_table && (hash_table != MAP_FAILED))
 		(void)munmap((void *)hash_table, sizeof(*hash_table));
-	if (page_ptr_wr && page_ptr_wr != MAP_FAILED)
+	if (page_ptr_wr && (page_ptr_wr != MAP_FAILED))
 		(void)munmap((void *)page_ptr_wr, page_ptr_wr_size);
-	if (page_ptr && page_ptr != MAP_FAILED)
+	if (page_ptr && (page_ptr != MAP_FAILED))
 		(void)munmap((void *)page_ptr, page_size);
-	if (small_ptr && small_ptr != MAP_FAILED)
+	if (small_ptr && (small_ptr != MAP_FAILED))
 		(void)munmap((void *)small_ptr, small_ptr_size);
-	if (current_context && current_context != MAP_FAILED)
+	if (current_context && (current_context != MAP_FAILED))
 		(void)munmap((void *)current_context, current_context_size);
 	if (sockfds[0] >= 0)
 		(void)close((int)sockfds[0]);
diff -pruN 0.15.07-1/stress-timer.c 0.15.08-1/stress-timer.c
--- 0.15.07-1/stress-timer.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-timer.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_TIMER_FREQ		(1)
 #define MAX_TIMER_FREQ		(100000000)
@@ -162,7 +163,7 @@ static void MLOCKED_TEXT OPTIMIZE3 stres
 cancel:
 	keep_stressing_set_flag(false);
 	/* Cancel timer if we detect no more runs */
-	(void)memset(&timer, 0, sizeof(timer));
+	(void)shim_memset(&timer, 0, sizeof(timer));
 	(void)timer_settime(timerid, 0, &timer, NULL);
 }
 
@@ -199,7 +200,7 @@ static int stress_timer(const stress_arg
 	if (stress_sighandler(args->name, SIGRTMIN, stress_timer_handler, NULL) < 0)
 		return EXIT_FAILURE;
 
-	(void)memset(&sev, 0, sizeof(sev));
+	(void)shim_memset(&sev, 0, sizeof(sev));
 	sev.sigev_notify = SIGEV_SIGNAL;
 	sev.sigev_signo = SIGRTMIN;
 	sev.sigev_value.sival_ptr = &timerid;
@@ -225,11 +226,11 @@ static int stress_timer(const stress_arg
 			n = 0;
 
 			/* Exercise nanosleep on non-permitted timespec object values */
-			(void)memset(&req, 0, sizeof(req));
+			(void)shim_memset(&req, 0, sizeof(req));
 			req.tv_sec = -1;
 			VOID_RET(int, nanosleep(&req, NULL));
 
-			(void)memset(&req, 0, sizeof(req));
+			(void)shim_memset(&req, 0, sizeof(req));
 			req.tv_nsec = STRESS_NANOSECOND;
 			VOID_RET(int, nanosleep(&req, NULL));
 		}
diff -pruN 0.15.07-1/stress-tlb-shootdown.c 0.15.08-1/stress-tlb-shootdown.c
--- 0.15.07-1/stress-tlb-shootdown.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-tlb-shootdown.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"tlb-shootdown N",	"start N workers that force TLB shootdowns" },
@@ -162,7 +163,7 @@ static int stress_tlb_shootdown(const st
 		rc = EXIT_NO_RESOURCE;
 		goto err_munmap_memfd;
 	}
-	(void)memset(mem, 0xff, mmap_size);
+	(void)shim_memset(mem, 0xff, mmap_size);
 
 	if (sched_getaffinity(0, sizeof(proc_mask_initial), &proc_mask_initial) < 0) {
 		pr_fail("%s: sched_getaffinity could not get CPU affinity, errno=%d (%s)\n",
@@ -266,35 +267,9 @@ static int stress_tlb_shootdown(const st
 		inc_counter(args);
 	} while(keep_stressing(args));
 
-	for (i = 0; i < tlb_procs; i++) {
-		int status;
-
-		if (pids[i] == -1)
-			continue;
-
-		ret = waitpid(pids[i], &status, 0);
-		if ((ret < 0) && (errno == EINTR)) {
-			int j;
-
-			/*
-			 * We got interrupted, so assume
-			 * it was the alarm (timedout) or
-			 * SIGINT so force terminate
-			 */
-			for (j = i; j < tlb_procs; j++) {
-				if (pids[j] != -1)
-					(void)kill(pids[j], SIGKILL);
-			}
-
-			/* re-wait on the failed wait */
-			(void)waitpid(pids[i], &status, 0);
-
-			/* and continue waitpid on the pids */
-		}
-	}
-
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
+	stress_kill_and_wait_many(args, pids, tlb_procs, SIGALRM, true);
 err_munmap_mem:
 	(void)munmap(mem, mmap_size);
 err_munmap_memfd:
diff -pruN 0.15.07-1/stress-tmpfs.c 0.15.08-1/stress-tmpfs.c
--- 0.15.07-1/stress-tmpfs.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-tmpfs.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_STATFS_H)
 #include <sys/statfs.h>
@@ -120,7 +121,7 @@ static int stress_tmpfs_open(const stres
 	char *mnts[MAX_MOUNTS];
 	int i, n, fd = -1;
 
-	(void)memset(mnts, 0, sizeof(mnts));
+	(void)shim_memset(mnts, 0, sizeof(mnts));
 
 	*len = 0;
 	n = stress_mount_get(mnts, SIZEOF_ARRAY(mnts));
@@ -139,7 +140,7 @@ static int stress_tmpfs_open(const stres
 			continue;
 		if (!strncmp(mnts[i], "/run/lock", 9))
 			continue;
-		(void)memset(&buf, 0, sizeof(buf));
+		(void)shim_memset(&buf, 0, sizeof(buf));
 		if (statfs(mnts[i], &buf) < 0)
 			continue;
 
@@ -304,7 +305,7 @@ static int stress_tmpfs_child(const stre
 			continue;	/* Try again */
 		}
 		if (tmpfs_mmap_file) {
-			(void)memset(buf, 0xff, sz);
+			(void)shim_memset(buf, 0xff, sz);
 			(void)shim_msync((void *)buf, sz, ms_flags);
 		}
 		(void)stress_madvise_random(buf, sz);
@@ -376,7 +377,7 @@ static int stress_tmpfs_child(const stre
 							pr_fail("%s: mmap'd region of %zu bytes does "
 								"not contain expected data\n", args->name, page_size);
 						if (tmpfs_mmap_file) {
-							(void)memset(mappings[page].addr, (int)n, page_size);
+							(void)shim_memset(mappings[page].addr, (int)n, page_size);
 							(void)shim_msync((void *)mappings[page].addr, page_size, ms_flags);
 						}
 					}
diff -pruN 0.15.07-1/stress-touch.c 0.15.08-1/stress-touch.c
--- 0.15.07-1/stress-touch.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-touch.c	2023-05-21 14:30:06.000000000 +0000
@@ -336,27 +336,9 @@ static int stress_touch(const stress_arg
 
 	keep_stressing_set_flag(false);
 
-	for (i = 0; i < TOUCH_PROCS; i++) {
-		if (pids[i] > 1)
-			(void)kill(pids[i], SIGALRM);
-	}
-	for (i = 0; i < TOUCH_PROCS; i++) {
-		if (pids[i] > 1)  {
-			for (;;) {
-				int status;
-
-				ret = waitpid(pids[i], &status, 0);
-				if (ret == 0)
-					break;
-				if (errno == EINTR)
-					continue;
-				break;
-			}
-		}
-	}
-
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 
+	stress_kill_and_wait_many(args, pids, TOUCH_PROCS, SIGALRM, true);
 	stress_touch_dir_clean(args);
 	(void)stress_temp_dir_rm_args(args);
 	(void)stress_lock_destroy(touch_lock);
diff -pruN 0.15.07-1/stress-tree.c 0.15.08-1/stress-tree.c
--- 0.15.07-1/stress-tree.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-tree.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 #include "core-target-clones.h"
 
@@ -308,7 +309,7 @@ PRAGMA_UNROLL_N(4)
 	for (node = SPLAY_MIN(stress_splay_tree, &splay_root); node; node = next) {
 		next = SPLAY_NEXT(stress_splay_tree, &splay_root, node);
 		SPLAY_REMOVE(stress_splay_tree, &splay_root, node);
-		(void)memset(&node->u.splay, 0, sizeof(node->u.splay));
+		(void)shim_memset(&node->u.splay, 0, sizeof(node->u.splay));
 	}
 	metrics->remove += stress_time_now() - t;
 	metrics->count += (double)n;
@@ -329,7 +330,7 @@ static void OPTIMIZE3 TARGET_CLONES bina
 
 static struct tree_node * OPTIMIZE3 TARGET_CLONES binary_find(
 	struct tree_node *head,
-	struct tree_node *node)
+	const struct tree_node *node)
 {
 	while (head) {
 		if (UNLIKELY(node->value == head->value))
@@ -534,7 +535,7 @@ static void OPTIMIZE3 avl_insert(
 
 static struct tree_node OPTIMIZE3 TARGET_CLONES *avl_find(
 	struct tree_node *head,
-	struct tree_node *node)
+	const struct tree_node *node)
 {
 	while (LIKELY(head != NULL)) {
 		if (UNLIKELY(node->value == head->value))
diff -pruN 0.15.07-1/stress-tsearch.c 0.15.08-1/stress-tsearch.c
--- 0.15.07-1/stress-tsearch.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-tsearch.c	2023-05-21 14:30:06.000000000 +0000
@@ -107,7 +107,7 @@ static int stress_tsearch(const stress_a
 		/* Step #2, find */
 		stress_sort_compare_reset();
 		t = stress_time_now();
-		for (i = 0; keep_stressing_flag() && i < n; i++) {
+		for (i = 0; keep_stressing_flag() && (i < n); i++) {
 			const void **result = tfind(&data[i], &root, stress_sort_cmp_fwd_int32);
 
 			if (g_opt_flags & OPT_FLAGS_VERIFY) {
diff -pruN 0.15.07-1/stress-tun.c 0.15.08-1/stress-tun.c
--- 0.15.07-1/stress-tun.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-tun.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-capabilities.h"
 #include "core-net.h"
 
@@ -125,7 +126,7 @@ static int stress_tun(const stress_args_
 			return EXIT_FAILURE;
 		}
 
-		(void)memset(&ifr, 0, sizeof(ifr));
+		(void)shim_memset(&ifr, 0, sizeof(ifr));
 		ifr.ifr_flags = tun_tap ? IFF_TAP : IFF_TUN;
 
 		ret = ioctl(fd, TUNSETIFF, (void *)&ifr);
@@ -212,7 +213,7 @@ static int stress_tun(const stress_args_
 				goto child_cleanup_fd;
 			}
 
-			(void)memset(&addr, 0, sizeof(addr));
+			(void)shim_memset(&addr, 0, sizeof(addr));
 			addr.sin_family = AF_INET;
 			addr.sin_port = (in_port_t)port;
 			len = sizeof(addr);
@@ -356,7 +357,7 @@ child_cleanup_fd:
 				goto child_reap;
 			}
 
-			(void)memset(&addr, 0, sizeof(addr));
+			(void)shim_memset(&addr, 0, sizeof(addr));
 			addr.sin_family = AF_INET;
 			addr.sin_port = (in_port_t)port;
 			len = sizeof(addr);
diff -pruN 0.15.07-1/stress-udp-flood.c 0.15.08-1/stress-udp-flood.c
--- 0.15.07-1/stress-udp-flood.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-udp-flood.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-net.h"
 
 #if defined(HAVE_LINUX_SOCKIOS_H)
@@ -80,10 +81,6 @@ static int OPTIMIZE3 stress_udp_flood(co
 	char *udp_flood_if = NULL;
 	double bytes = 0.0, duration, t, rate;
 
-	static const char ALIGN64 data[64] =
-		"0123456789ABCDEFGHIJKLMNOPQRSTUV"
-		"WXYZabcdefghijklmnopqrstuvwxyz@!";
-
 	(void)stress_get_setting("udp-flood-domain", &udp_flood_domain);
 	(void)stress_get_setting("udp-flood-if", &udp_flood_if);
 
@@ -132,7 +129,7 @@ static int OPTIMIZE3 stress_udp_flood(co
 		port = reserved_port;
 
 		stress_set_sockaddr_port(udp_flood_domain, port, addr);
-		(void)memset(buf, data[j++ & 63], sz);
+		(void)shim_memset(buf, stress_ascii64[j++ & 63], sz);
 		n = sendto(fd, buf, sz, 0, addr, addr_len);
 		if (LIKELY(n > 0)) {
 			inc_counter(args);
diff -pruN 0.15.07-1/stress-udp.c 0.15.08-1/stress-udp.c
--- 0.15.07-1/stress-udp.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-udp.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 #include "core-net.h"
 
@@ -253,12 +254,12 @@ static int OPTIMIZE3 stress_udp_client(
 			register size_t i;
 
 			for (i = 16; i < sizeof(buf); i += 16, j++) {
-				static char patterns[] ALIGN64 =
+				static const char patterns[] ALIGN64 =
 					"ABCDEFGHIJKLMNOPQRSTUVWXYZ_+@:#!";
 				const int c = patterns[index++ & 0x1f];
 				ssize_t ret;
 
-				(void)memset(buf, c, sizeof(buf));
+				(void)shim_memset(buf, c, sizeof(buf));
 				ret = sendto(fd, buf, i, 0, addr, len);
 				if (UNLIKELY(ret < 0)) {
 					if ((errno == EINTR) || (errno == ENETUNREACH))
@@ -297,7 +298,6 @@ child_die:
 
 static int OPTIMIZE3 stress_udp_server(
 	const stress_args_t *args,
-	const pid_t pid,
 	const pid_t mypid,
 	const int udp_domain,
 	const int udp_proto,
@@ -306,7 +306,7 @@ static int OPTIMIZE3 stress_udp_server(
 	const char *udp_if)
 {
 	char buf[UDP_BUF];
-	int fd, status;
+	int fd;
 #if !defined(__minix__)
 	int so_reuseaddr = 1;
 #endif
@@ -404,10 +404,6 @@ die:
 		(void)shim_unlink(addr_un->sun_path);
 	}
 #endif
-	if (pid) {
-		(void)kill(pid, SIGKILL);
-		(void)shim_waitpid(pid, &status, 0);
-	}
 	return rc;
 }
 
@@ -488,7 +484,11 @@ again:
 		(void)kill(getppid(), SIGALRM);
 		_exit(rc);
 	} else {
-		rc = stress_udp_server(args, pid, mypid, udp_domain, udp_proto, udp_port, udp_gro, udp_if);
+		int status;
+
+		rc = stress_udp_server(args, mypid, udp_domain, udp_proto, udp_port, udp_gro, udp_if);
+		(void)kill(pid, SIGKILL);
+		(void)shim_waitpid(pid, &status, 0);
 	}
 	return rc;
 }
diff -pruN 0.15.07-1/stress-umount.c 0.15.08-1/stress-umount.c
--- 0.15.07-1/stress-umount.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-umount.c	2023-05-21 14:30:06.000000000 +0000
@@ -232,7 +232,6 @@ static int stress_umount(const stress_ar
 {
 	pid_t pids[3] = { -1, -1, -1 };
 	const pid_t mypid = getpid();
-	size_t i;
 	int ret = EXIT_NO_RESOURCE;
 	char pathname[PATH_MAX], realpathname[PATH_MAX];
 
@@ -268,17 +267,8 @@ static int stress_umount(const stress_ar
 
 	ret = EXIT_SUCCESS;
 reap:
-	for (i = 0; i < SIZEOF_ARRAY(pids); i++) {
-		if (pids[i] > 1) {
-			int status;
-
-			(void)kill(pids[i], SIGALRM);
-			(void)waitpid(pids[i], &status, 0);
-		}
-	}
-
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
-
+	stress_kill_and_wait_many(args, pids, SIZEOF_ARRAY(pids), SIGALRM, true);
 	(void)stress_temp_dir_rm_args(args);
 
 	return ret;
diff -pruN 0.15.07-1/stress-unshare.c 0.15.08-1/stress-unshare.c
--- 0.15.07-1/stress-unshare.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-unshare.c	2023-05-21 14:30:06.000000000 +0000
@@ -177,12 +177,11 @@ static int stress_unshare(const stress_a
 	do {
 		size_t n;
 
-		for (n = 0; n < MAX_PIDS; n++) {
-			unshare_info[i].pid = 0;
-		}
+		for (n = 0; n < MAX_PIDS; n++)
+			unshare_info[i].pid = -1;
 
 		for (n = 0; n < MAX_PIDS; n++) {
-			static int index;
+			static size_t index;
 			int clone_flag = 0;
 			const bool do_flag_perm = stress_mwc1();
 
@@ -197,7 +196,8 @@ static int stress_unshare(const stress_a
 			if (do_flag_perm) {
 				clone_flag = clone_flag_perms[index];
 				index++;
-				index %= clone_flag_count;
+				if (index >= clone_flag_count)
+					index = 0;
 			}
 
 			unshare_info[n].pid = fork();
@@ -269,20 +269,8 @@ static int stress_unshare(const stress_a
 			}
 		}
 		for (i = 0; i < n; i++) {
-			int status;
-
-			if (unshare_info[i].pid > 0) {
-				int ret;
-
-				ret = stress_killpid(unshare_info[i].pid);
-				if (ret == 0) {
-					if (shim_waitpid(unshare_info[i].pid, &status, 0) < 0) {
-						if (errno != EINTR)
-							pr_err("%s: waitpid errno=%d (%s)\n",
-								args->name, errno, strerror(errno));
-					}
-				}
-			}
+			if (unshare_info[i].pid > 1)
+				stress_kill_and_wait(args, unshare_info[i].pid, SIGALRM, false);
 		}
 		inc_counter(args);
 	} while (keep_stressing(args));
diff -pruN 0.15.07-1/stress-urandom.c 0.15.08-1/stress-urandom.c
--- 0.15.07-1/stress-urandom.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-urandom.c	2023-05-21 14:30:06.000000000 +0000
@@ -59,6 +59,7 @@ static int stress_urandom(const stress_a
 #endif
 	bool sys_admin = stress_check_capability(SHIM_CAP_SYS_ADMIN);
 	double duration = 0.0, bytes = 0.0, rate;
+	const size_t page_size = args->page_size;
 
 	fd_urnd = open("/dev/urandom", O_RDONLY);
 	if (fd_urnd < 0) {
@@ -235,10 +236,10 @@ next:
 		if (fd_urnd >= 0) {
 			void *ptr;
 
-			ptr = mmap(NULL, args->page_size, PROT_READ,
+			ptr = mmap(NULL, page_size, PROT_READ,
 				MAP_PRIVATE | MAP_ANONYMOUS, fd_urnd, 0);
 			if (ptr != MAP_FAILED)
-				(void)munmap(ptr, args->page_size);
+				(void)munmap(ptr, page_size);
 		}
 
 #if defined(HAVE_SELECT)
@@ -267,20 +268,26 @@ next:
 					 *  single byte in the same way as reading /dev/zero does,
 					 *  as fixed in Linux kernel commit:
 					 *  "random: allow partial reads if later user copies fail"
+					 *
+					 *  mmap 2 pages, make second page read-only then write off
+					 *  the end of the first page.
 					 */
-					ptr = (char *)mmap(NULL, args->page_size, PROT_WRITE,
+					ptr = (char *)mmap(NULL, page_size * 2, PROT_WRITE,
 						MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
 					if (ptr != MAP_FAILED) {
-						double t;
-						/* Exercise 2 byte read on last 1 byte of page */
-
-						t = stress_time_now();
-						ret = read(fd_rnd, ptr + args->page_size - 1, 2);
-						if (ret >= 0) {
-							duration += stress_time_now() - t;
-							bytes += (double)ret;
+						/* unmap last page.. */
+						if (mprotect((void *)(ptr + page_size), page_size, PROT_READ) == 0) {
+							double t;
+
+							/* Exercise 2 byte read on last 1 byte of page */
+							t = stress_time_now();
+							ret = read(fd_rnd, ptr + args->page_size - 1, 2);
+							if (ret >= 0) {
+								duration += stress_time_now() - t;
+								bytes += (double)ret;
+							}
 						}
-						(void)munmap((void *)ptr, args->page_size);
+						(void)munmap((void *)ptr, page_size * 2);
 					}
 #endif
 					if (ret < 0) {
diff -pruN 0.15.07-1/stress-userfaultfd.c 0.15.08-1/stress-userfaultfd.c
--- 0.15.07-1/stress-userfaultfd.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-userfaultfd.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(__NR_userfaultfd)
 #define HAVE_USERFAULTFD
@@ -244,7 +245,7 @@ static int stress_userfaultfd_child(cons
 	size_t sz;
 	uint8_t *data;
 	void *zero_page = NULL;
-	int fd = -1, status, rc = EXIT_SUCCESS, count = 0;
+	int fd = -1, rc = EXIT_SUCCESS, count = 0;
 	const unsigned int uffdio_copy = 1 << _UFFDIO_COPY;
 	const unsigned int uffdio_zeropage = 1 << _UFFDIO_ZEROPAGE;
 	pid_t pid;
@@ -304,7 +305,7 @@ static int stress_userfaultfd_child(cons
 		do_poll = false;
 
 	/* API sanity check */
-	(void)memset(&api, 0, sizeof(api));
+	(void)shim_memset(&api, 0, sizeof(api));
 	api.api = UFFD_API;
 	api.features = 0;
 	if (ioctl(fd, UFFDIO_API, &api) < 0) {
@@ -321,7 +322,7 @@ static int stress_userfaultfd_child(cons
 	}
 
 	/* Register fault handling mode */
-	(void)memset(&reg, 0, sizeof(reg));
+	(void)shim_memset(&reg, 0, sizeof(reg));
 	reg.range.start = (unsigned long)data;
 	reg.range.len = sz;
 	reg.mode = UFFDIO_REGISTER_MODE_MISSING;
@@ -387,7 +388,7 @@ static int stress_userfaultfd_child(cons
 		if (do_poll) {
 			struct pollfd fds[1];
 
-			(void)memset(fds, 0, sizeof fds);
+			(void)shim_memset(fds, 0, sizeof fds);
 			fds[0].fd = fd;
 			fds[0].events = POLLIN;
 			/* wait for 1 second max */
@@ -453,7 +454,7 @@ do_read:
 		rate = (counter > 0.0) ? duration / counter : 0.0;
 		stress_metrics_set(args, 0, "nanosecs per page fault", rate * STRESS_DBL_NANOSECOND);
 
-		(void)memset(&wake, 0, sizeof(wake));
+		(void)shim_memset(&wake, 0, sizeof(wake));
 		wake.start = (uintptr_t)data;
 		wake.len = page_size;
 		VOID_RET(int, ioctl(fd, UFFDIO_WAKE, &wake));
@@ -461,12 +462,8 @@ do_read:
 	} while (keep_stressing(args));
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
-	/* Run it over, zap child */
-	(void)stress_killpid(pid);
-	if (shim_waitpid(pid, &status, 0) < 0) {
-		pr_dbg("%s: waitpid failed, errno = %d (%s)\n",
-			args->name, errno, strerror(errno));
-	}
+
+	stress_kill_and_wait(args, pid, SIGALRM, false);
 unreg:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
 	if (ioctl(fd, UFFDIO_UNREGISTER, &reg) < 0) {
diff -pruN 0.15.07-1/stress-usersyscall.c 0.15.08-1/stress-usersyscall.c
--- 0.15.07-1/stress-usersyscall.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-usersyscall.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"usersyscall N",	"start N workers exercising a userspace system call handler" },
@@ -208,7 +209,7 @@ static int OPTIMIZE3 stress_usersyscall(
 	double duration = 0.0, count = 0.0, rate;
 	int metrics_count = 0;
 
-	(void)memset(&action, 0, sizeof action);
+	(void)shim_memset(&action, 0, sizeof action);
 	action.sa_sigaction = stress_sigsys_handler;
 	(void)sigemptyset(&action.sa_mask);
 	/*
@@ -226,7 +227,7 @@ static int OPTIMIZE3 stress_usersyscall(
 			args->name, errno, strerror(errno));
 		return EXIT_NO_RESOURCE;
 	}
-	(void)memset(&siginfo, 0, sizeof(siginfo));
+	(void)shim_memset(&siginfo, 0, sizeof(siginfo));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
diff -pruN 0.15.07-1/stress-vecfp.c 0.15.08-1/stress-vecfp.c
--- 0.15.07-1/stress-vecfp.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-vecfp.c	2023-05-21 14:30:06.000000000 +0000
@@ -317,7 +317,7 @@ static void stress_vecfp_call_method(
 	const size_t method)
 {
 	double dt, ops;
-	stress_vecfp_funcs_t *func = &stress_vecfp_funcs[method];
+	stress_vecfp_funcs_t *const func = &stress_vecfp_funcs[method];
 
 	dt = func->vecfp_func(args, vecfp_init);
 	func->duration += dt;
@@ -363,7 +363,7 @@ static int stress_set_vecfp_method(const
 
 static int stress_vecfp(const stress_args_t *args)
 {
-	size_t i, max_elements = 0, mmap_size;
+	size_t i, j, max_elements = 0, mmap_size;
 	stress_vecfp_init *vecfp_init;
 	size_t vecfp_method = 0;	/* "all" */
 
@@ -419,25 +419,19 @@ static int stress_vecfp(const stress_arg
 		stress_vecfp_call_method(args, vecfp_init, vecfp_method);
 	} while (keep_stressing(args));
 
-	if (args->instance == 0) {
-		pr_lock();
-		pr_dbg("%s: compute throughput for just stressor instance 0:\n", args->name);
-		pr_dbg("%s: %14.14s %13.13s\n",
-			args->name, "Method", "Mfp-ops/sec");
-		for (i = 1; i < SIZEOF_ARRAY(stress_vecfp_funcs); i++) {
-			const double ops = stress_vecfp_funcs[i].ops;
-			const double duration = stress_vecfp_funcs[i].duration;
-			if (duration > 0.0 && ops > 0.0) {
-				double rate = stress_vecfp_funcs[i].ops / stress_vecfp_funcs[i].duration;
+	for (i = 1, j = 0; i < SIZEOF_ARRAY(stress_vecfp_funcs); i++) {
+		const double rate = (stress_vecfp_funcs[i].ops / stress_vecfp_funcs[i].duration) / 1000000.0;
 
-				pr_dbg("%s: %14.14s %13.3f\n", args->name, stress_vecfp_funcs[i].name, rate / 1000000.0);
-			}
+		if (rate > 0.0) {
+			char buffer[64];
+
+			(void)snprintf(buffer, sizeof(buffer), "%s Mfp-ops/sec", stress_vecfp_funcs[i].name);
+			stress_metrics_set(args, j, buffer, rate);
+			j++;
 		}
-		pr_unlock();
 	}
 
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
-
 	(void)munmap((void *)vecfp_init, mmap_size);
 
 	return EXIT_SUCCESS;
diff -pruN 0.15.07-1/stress-vecshuf.c 0.15.08-1/stress-vecshuf.c
--- 0.15.07-1/stress-vecshuf.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-vecshuf.c	2023-05-21 14:30:06.000000000 +0000
@@ -167,7 +167,7 @@ static void stress_vecshuf_call_method(
 	const size_t method)
 {
 	double dt, ops, bytes;
-	stress_vecshuf_funcs_t *func = &stress_vecshuf_funcs[method];
+	stress_vecshuf_funcs_t *const func = &stress_vecshuf_funcs[method];
 
 	dt = func->vecshuf_func(args, data);
 	func->duration += dt;
diff -pruN 0.15.07-1/stress-vecwide.c 0.15.08-1/stress-vecwide.c
--- 0.15.07-1/stress-vecwide.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-vecwide.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  */
 #include "stress-ng.h"
 #include "core-arch.h"
+#include "core-builtin.h"
 #include "core-pragma.h"
 #include "core-put.h"
 #include "core-target-clones.h"
@@ -67,7 +68,7 @@ typedef struct {
 	uint8_t	res[VEC_MAX_SZ];
 } vec_args_t;
 
-typedef void (*stress_vecwide_func_t)(vec_args_t *vec_args);
+typedef void (*stress_vecwide_func_t)(const vec_args_t *vec_args);
 
 typedef struct {
 	stress_vecwide_func_t	vecwide_func;
@@ -77,7 +78,7 @@ typedef struct {
 } stress_vecwide_funcs_t;
 
 #define STRESS_VECWIDE(name, type)				\
-static void TARGET_CLONES OPTIMIZE3 name (vec_args_t *vec_args) \
+static void TARGET_CLONES OPTIMIZE3 name (const vec_args_t *vec_args) \
 {								\
 	type ALIGN64 a;						\
 	type ALIGN64 b;						\
@@ -88,12 +89,12 @@ static void TARGET_CLONES OPTIMIZE3 name
 	type ALIGN64 res;					\
 	register int i;						\
 								\
-	(void)memcpy(&a, vec_args->a, sizeof(a));		\
-	(void)memcpy(&b, vec_args->b, sizeof(b));		\
-	(void)memcpy(&c, vec_args->c, sizeof(c));		\
-	(void)memcpy(&s, vec_args->s, sizeof(s));		\
-	(void)memcpy(&v23, vec_args->v23, sizeof(s));		\
-	(void)memcpy(&v3, vec_args->v23, sizeof(s));		\
+	(void)shim_memcpy(&a, vec_args->a, sizeof(a));		\
+	(void)shim_memcpy(&b, vec_args->b, sizeof(b));		\
+	(void)shim_memcpy(&c, vec_args->c, sizeof(c));		\
+	(void)shim_memcpy(&s, vec_args->s, sizeof(s));		\
+	(void)shim_memcpy(&v23, vec_args->v23, sizeof(s));	\
+	(void)shim_memcpy(&v3, vec_args->v23, sizeof(s));	\
 								\
 PRAGMA_UNROLL_N(8)						\
 	for (i = 0; i < 2048; i++) {				\
@@ -174,8 +175,8 @@ static int stress_vecwide(const stress_a
 		vec_args->s[i] = stress_mwc8();
 	}
 
-	(void)memset(&vec_args->v23, 23, sizeof(vec_args->v23));
-	(void)memset(&vec_args->v3, 3, sizeof(vec_args->v3));
+	(void)shim_memset(&vec_args->v23, 23, sizeof(vec_args->v23));
+	(void)shim_memset(&vec_args->v3, 3, sizeof(vec_args->v3));
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
diff -pruN 0.15.07-1/stress-verity.c 0.15.08-1/stress-verity.c
--- 0.15.07-1/stress-verity.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-verity.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_LINUX_FS_H)
 #include <linux/fs.h>
@@ -113,7 +114,7 @@ static int stress_verity(const stress_ar
 			const off_t off = (off_t)i * 64 * 1024;
 			ssize_t n;
 
-			(void)memset(block, i, sizeof(block));
+			(void)shim_memset(block, i, sizeof(block));
 			VOID_RET(off_t, lseek(fd, off, SEEK_SET));
 
 			n = write(fd, block, sizeof(block));
@@ -140,7 +141,7 @@ static int stress_verity(const stress_ar
 			goto clean;
 		}
 
-		(void)memset(&enable, 0, sizeof(enable));
+		(void)shim_memset(&enable, 0, sizeof(enable));
 		enable.version = 1;
 		enable.hash_algorithm = hash_algorithms[hash];
 		enable.block_size = (uint32_t)args->page_size;
@@ -228,7 +229,7 @@ static int stress_verity(const stress_ar
 			const off_t off = (off_t)i * 64 * 1024;
 			ssize_t n;
 
-			(void)memset(block, i, sizeof(block));
+			(void)shim_memset(block, i, sizeof(block));
 			VOID_RET(off_t, lseek(fd, off, SEEK_SET));
 
 			n = read(fd, block, sizeof(block));
@@ -251,7 +252,7 @@ static int stress_verity(const stress_ar
 		(void)shim_fsync(fd);
 
 #if defined(FS_IOC_READ_VERITY_METADATA)
-		(void)memset(&md_arg, 0, sizeof(md_arg));
+		(void)shim_memset(&md_arg, 0, sizeof(md_arg));
 		md_arg.metadata_type = 0ULL;
 		md_arg.offset = 0ULL;
 		md_arg.buf_ptr = (uint64_t)(intptr_t)md_buf;
diff -pruN 0.15.07-1/stress-vforkmany.c 0.15.08-1/stress-vforkmany.c
--- 0.15.07-1/stress-vforkmany.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-vforkmany.c	2023-05-21 14:30:06.000000000 +0000
@@ -244,22 +244,7 @@ vfork_again:
 		(void)sleep((unsigned int)g_opt_timeout);
 		*terminate = true;
 
-		for (;;) {
-			int ret, chstatus;
-
-			(void)kill(chpid, SIGALRM);
-			errno = 0;
-			ret = waitpid(chpid, &chstatus, 0);
-
-			/* Reaped? - all done */
-			if (ret >= 0)
-				break;
-			/* Interrupted? - retry */
-			if (errno == EINTR)
-				continue;
-			/* Something went wrong, kill */
-			(void)stress_killpid(chpid);
-		}
+		stress_kill_and_wait(args, chpid, SIGALRM, false);
 	}
 finish:
 	stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
diff -pruN 0.15.07-1/stress-vm-rw.c 0.15.08-1/stress-vm-rw.c
--- 0.15.07-1/stress-vm-rw.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-vm-rw.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_UIO_H)
 #include <sys/uio.h>
@@ -109,7 +110,7 @@ static int OPTIMIZE3 stress_vm_child(voi
 		uint8_t *ptr, *end = buf + ctxt->sz;
 		ssize_t rwret;
 
-		(void)memset(&msg_wr, 0, sizeof(msg_wr));
+		(void)shim_memset(&msg_wr, 0, sizeof(msg_wr));
 		msg_wr.addr = buf;
 		msg_wr.val = 0;
 
@@ -175,7 +176,6 @@ cleanup:
 static int OPTIMIZE3 stress_vm_parent(stress_context_t *ctxt)
 {
 	/* Parent */
-	int status;
 	uint8_t val = 0x10;
 	uint8_t *localbuf;
 	stress_addr_msg_t msg_rd, msg_wr;
@@ -347,8 +347,8 @@ fail:
 	}
 	(void)close(ctxt->pipe_wr[0]);
 	(void)close(ctxt->pipe_rd[1]);
-	(void)stress_killpid(ctxt->pid);
-	(void)shim_waitpid(ctxt->pid, &status, 0);
+	if (ctxt->pid > 1)
+		stress_kill_and_wait(args, ctxt->pid, SIGALRM, false);
 	(void)munmap(localbuf, ctxt->sz);
 
 	return EXIT_SUCCESS;
@@ -394,7 +394,7 @@ static int stress_vm_rw(const stress_arg
 		return EXIT_NO_RESOURCE;
 	}
 
-	(void)memset(stack, 0, sizeof(stack));
+	(void)shim_memset(stack, 0, sizeof(stack));
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 again:
 	ctxt.pid = clone(stress_vm_child, stress_align_stack(stack_top),
diff -pruN 0.15.07-1/stress-vm-segv.c 0.15.08-1/stress-vm-segv.c
--- 0.15.07-1/stress-vm-segv.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-vm-segv.c	2023-05-21 14:30:06.000000000 +0000
@@ -20,18 +20,14 @@
 #include "stress-ng.h"
 #include "core-cpu-cache.h"
 
-#if defined(HAVE_PTRACE)
-#include <sys/ptrace.h>
-#else
-UNEXPECTED
-#endif
-
 static const stress_help_t help[] = {
 	{ NULL,	"vm-segv N",	 "start N workers that unmap their address space" },
 	{ NULL,	"vm-segv-ops N", "stop after N vm-segv unmap'd SEGV faults" },
 	{ NULL,	NULL,		 NULL }
 };
 
+#define MSG_CHILD_STARTED	(0x271efb9c)
+
 static NOINLINE void vm_unmap_child(const size_t page_size)
 {
 	size_t len = ~(size_t)0;
@@ -74,6 +70,14 @@ static int stress_vm_segv(const stress_a
 
 	do {
 		pid_t pid;
+		int fd[2];
+
+		if (pipe(fd) < 0) {
+			pr_inf("%s: pipe failed, errno=%d (%s), skipping stressor\n",
+				args->name, errno, strerror(errno));
+			stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
+			return EXIT_NO_RESOURCE;
+		}
 
 again:
 		pid = fork();
@@ -86,78 +90,64 @@ again:
 				args->name, errno, strerror(errno));
 			return EXIT_NO_RESOURCE;
 		} else if (pid > 0) {
-			int status, ret;
-	
+			int status, ret, msg;
+			ssize_t rret;
+
+			(void)close(fd[1]);
+
 			/* Parent, wait for child */
-			ret = shim_waitpid(pid, &status, 0);
-			if (ret < 0)
+			rret = read(fd[0], &msg, sizeof(msg));
+			if (rret < (ssize_t)sizeof(msg))
 				goto kill_child;
 
-			test_valid = true;
-#if !defined(HAVE_PTRACE)
-			if (WTERMSIG(status) == SIGSEGV) {
-				inc_counter(args);
-				continue;
+			if (msg == MSG_CHILD_STARTED) {
+				test_valid = true;
+			} else {
+				pr_dbg("%s: did not get child start message 0x%x got 0x%x instead\n",
+					args->name, MSG_CHILD_STARTED, msg);
+				goto kill_child;
 			}
-#else
-
-			(void)ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD);
-
-			while (keep_stressing(args)) {
-				(void)ptrace(PTRACE_SYSCALL, pid, 0, 0);
 
-				ret = shim_waitpid(pid, &status, 0);
-				if (ret < 0)
-					goto kill_child;
-				if (WIFSTOPPED(status)) {
-					int signum = WSTOPSIG(status);
-
-					if ((signum & 0x7f) == SIGSEGV) {
-						inc_counter(args);
-						break;
-					}
-					if (signum & 0x80)
-						continue;
-				}
-				if (WIFEXITED(status)) {
-					inc_counter(args);
-					break;
-				}
-			}
-#endif
+			ret = shim_waitpid(pid, &status, 0);
+			if (ret < 0)
+				goto kill_child;
+			if (WTERMSIG(status) == SIGSEGV)
+				inc_counter(args);
 kill_child:
-			(void)kill(pid, SIGTERM);
-			(void)stress_killpid(pid);
-			(void)shim_waitpid(pid, &status, 0);
+			(void)close(fd[0]);
+			stress_kill_and_wait(args, pid, SIGTERM, false);
 		} else {
 			/* Child */
 			sigset_t set;
+			ssize_t wret;
 			const size_t page_size = args->page_size;
+			const int msg = MSG_CHILD_STARTED;
 
 			stress_set_oom_adjustment(args->name, true);
 			stress_process_dumpable(false);
 			(void)sched_settings_apply(true);
 
-#if defined(HAVE_PTRACE)
-			(void)ptrace(PTRACE_TRACEME);
-			(void)kill(getpid(), SIGSTOP);
-#endif
-			(void)sigemptyset(&set);
-			(void)sigaddset(&set, SIGSEGV);
-			(void)sigprocmask(SIG_BLOCK, &set, NULL);
-
-			/*
-			 *  Try to ummap the child's address space, should cause
-			 *  a SIGSEGV at some point..
-			 */
-			vm_unmap_child(page_size);
-
-			/*
-			 *  That failed, so try unmapping this function
-			 */
-			vm_unmap_self(page_size);
+			(void)close(fd[0]);
 
+			wret = write(fd[1], &msg, sizeof(msg));
+			if (wret == (ssize_t)sizeof(msg)) {
+				(void)sigemptyset(&set);
+				(void)sigaddset(&set, SIGSEGV);
+				(void)sigprocmask(SIG_BLOCK, &set, NULL);
+
+				/*
+				 *  Try to ummap the child's address space, should cause
+				 *  a SIGSEGV at some point..
+				 */
+				vm_unmap_child(page_size);
+
+				/*
+				 *  That failed, so try unmapping this function
+				 */
+				vm_unmap_self(page_size);
+			}
 			/* No luck, well that's unexpected.. */
+			(void)close(fd[1]);
 			_exit(EXIT_FAILURE);
 		}
 	} while (keep_stressing(args));
diff -pruN 0.15.07-1/stress-vm-splice.c 0.15.08-1/stress-vm-splice.c
--- 0.15.07-1/stress-vm-splice.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-vm-splice.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #define MIN_VM_SPLICE_BYTES	(4 * KB)
 #define MAX_VM_SPLICE_BYTES	(64 * MB)
@@ -114,7 +115,7 @@ static int stress_vm_splice(const stress
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
-	(void)memset(buf, 0, sz);
+	(void)shim_memset(buf, 0, sz);
 	do {
 		ssize_t ret, n_bytes;
 		struct iovec iov ALIGN64;
diff -pruN 0.15.07-1/stress-vm.c 0.15.08-1/stress-vm.c
--- 0.15.07-1/stress-vm.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-vm.c	2023-05-21 14:30:06.000000000 +0000
@@ -488,14 +488,14 @@ static size_t TARGET_CLONES stress_vm_mo
 		if (UNLIKELY(!keep_stressing_flag()))
 			goto ret;
 		for (ptr = (uint8_t *)buf; ptr < (uint8_t *)buf_end; ptr += stride) {
-			for (j = 0; j < i && ptr < (uint8_t *)buf_end; j++) {
+			for (j = 0; (j < i) && (ptr < (uint8_t *)buf_end); j++) {
 				*ptr++ = compliment;
 				c++;
 			}
 			if (UNLIKELY(!keep_stressing_flag()))
 				goto ret;
 			ptr++;
-			for (j = i + 1; j < stride && ptr < (uint8_t *)buf_end; j++) {
+			for (j = i + 1; (j < stride) && (ptr < (uint8_t *)buf_end); j++) {
 				*ptr++ = compliment;
 				c++;
 			}
@@ -619,7 +619,7 @@ static size_t TARGET_CLONES stress_vm_wa
 	size_t bit_errors = 0;
 	uint64_t c = get_counter(args);
 
-	(void)memset(buf, d1, sz);
+	(void)shim_memset(buf, d1, sz);
 	for (ptr = (uint8_t *)buf; ptr < (uint8_t *)buf_end; ptr += 256) {
 		uint16_t i;
 		uint64_t mask;
@@ -671,7 +671,7 @@ static size_t TARGET_CLONES stress_vm_wa
 
 	sz_mask--;
 
-	(void)memset(buf, d1, sz);
+	(void)shim_memset(buf, d1, sz);
 	for (ptr = (uint8_t *)buf; ptr < (uint8_t *)buf_end; ptr += 256) {
 		uint16_t i;
 		uint64_t mask;
@@ -823,7 +823,7 @@ static size_t TARGET_CLONES stress_vm_in
 	uint64_t c = get_counter(args);
 
 	val++;
-	(void)memset(buf, 0x00, sz);
+	(void)shim_memset(buf, 0x00, sz);
 
 	for (ptr = (uint8_t *)buf; ptr < (uint8_t *)buf_end; ptr++) {
 		*ptr += val;
@@ -873,7 +873,7 @@ static size_t TARGET_CLONES stress_vm_pr
 		return 0;
 #endif
 
-	(void)memset(buf, 0x00, sz);
+	(void)shim_memset(buf, 0x00, sz);
 
 	for (i = 0; i < sz; i++) {
 		ptr[i] += val;
@@ -943,7 +943,7 @@ static size_t TARGET_CLONES stress_vm_sw
 	for (ptr = (uint8_t *)buf; ptr < (uint8_t *)buf_end; ptr += chunk_sz) {
 		const uint8_t val = stress_mwc8();
 
-		(void)memset((void *)ptr, val, chunk_sz);
+		(void)shim_memset((void *)ptr, val, chunk_sz);
 	}
 
 	/* Forward swaps */
@@ -1287,7 +1287,7 @@ static size_t TARGET_CLONES stress_vm_ze
 
 	(void)max_ops;
 
-	(void)memset(buf, 0x00, sz);
+	(void)shim_memset(buf, 0x00, sz);
 	(void)stress_mincore_touch_pages(buf, sz);
 	inject_random_bit_errors(buf, sz);
 	c += sz / 8;
@@ -1306,7 +1306,7 @@ static size_t TARGET_CLONES stress_vm_ze
 			goto abort;
 	}
 
-	(void)memset(buf, 0xff, sz);
+	(void)shim_memset(buf, 0xff, sz);
 	(void)stress_mincore_touch_pages(buf, sz);
 	inject_random_bit_errors(buf, sz);
 	c += sz / 8;
@@ -1349,7 +1349,7 @@ static size_t TARGET_CLONES stress_vm_ga
 	size_t bits_bad = sz / 4096;
 	uint64_t c = get_counter(args);
 
-	(void)memset(buf, 0x00, sz);
+	(void)shim_memset(buf, 0x00, sz);
 
 	stress_mwc_reseed();
 
@@ -1413,7 +1413,7 @@ static size_t TARGET_CLONES stress_vm_ga
 	size_t bits_bad = sz / 4096;
 	uint64_t c = get_counter(args);
 
-	(void)memset(buf, 0xff, sz);
+	(void)shim_memset(buf, 0xff, sz);
 
 	stress_mwc_reseed();
 
@@ -1476,7 +1476,7 @@ static size_t TARGET_CLONES stress_vm_in
 	size_t bit_errors = 0;
 	uint64_t c = get_counter(args);
 
-	(void)memset(buf, val, sz);
+	(void)shim_memset(buf, val, sz);
 	INC_LO_NYBBLE(val);
 	INC_HI_NYBBLE(val);
 
@@ -1625,7 +1625,7 @@ static size_t TARGET_CLONES stress_vm_pr
 	if (sz > (1ULL << 63))
 		return 0;
 #endif
-	(void)memset(buf, 0xff, sz);
+	(void)shim_memset(buf, 0xff, sz);
 
 	for (j = 0; j < 8; j++) {
 		const uint8_t mask = (uint8_t)~(1 << j);
@@ -1687,7 +1687,7 @@ static size_t TARGET_CLONES stress_vm_pr
 		return 0;
 #endif
 
-	(void)memset(buf, 0x00, sz);
+	(void)shim_memset(buf, 0x00, sz);
 
 	for (j = 0; j < 8; j++) {
 		const uint8_t mask = (uint8_t)(1 << j);
@@ -1750,7 +1750,7 @@ static size_t TARGET_CLONES stress_vm_pr
 		return 0;
 #endif
 
-	(void)memset(buf, 0xff, sz);
+	(void)shim_memset(buf, 0xff, sz);
 
 	for (i = 0, j = prime; i < sz; i++, j += prime) {
 		/*
@@ -1823,7 +1823,7 @@ static size_t TARGET_CLONES stress_vm_pr
 		return 0;
 #endif
 
-	(void)memset(buf, 0x00, sz);
+	(void)shim_memset(buf, 0x00, sz);
 
 	for (i = 0, j = prime; i < sz; i++, j += prime) {
 		/*
@@ -3068,7 +3068,7 @@ static int stress_vm_child(const stress_
 		}
 	} while (keep_stressing_vm(args));
 
-	if (vm_keep && buf != NULL)
+	if (vm_keep && (buf != NULL))
 		(void)munmap((void *)buf, buf_sz);
 
 	return rc;
diff -pruN 0.15.07-1/stress-wait.c 0.15.08-1/stress-wait.c
--- 0.15.07-1/stress-wait.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-wait.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 static const stress_help_t help[] = {
 	{ NULL,	"wait N",	"start N workers waiting on child being stop/resumed" },
@@ -320,7 +321,7 @@ static int stress_wait(const stress_args
 		if (options) {
 			siginfo_t info;
 
-			(void)memset(&info, 0, sizeof(info));
+			(void)shim_memset(&info, 0, sizeof(info));
 			wret = waitid(P_PID, (id_t)pid_r, &info, options);
 			if ((wret < 0) && (errno != EINTR) && (errno != ECHILD)) {
 				pr_fail("%s: waitid failed, errno=%d (%s)\n",
diff -pruN 0.15.07-1/stress-waitcpu.c 0.15.08-1/stress-waitcpu.c
--- 0.15.07-1/stress-waitcpu.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-waitcpu.c	2023-05-21 14:30:06.000000000 +0000
@@ -21,6 +21,7 @@
 #include "core-asm-arm.h"
 #include "core-asm-ppc64.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 
 static const stress_help_t help[] = {
@@ -221,7 +222,7 @@ static int stress_waitcpu(const stress_a
 	size_t i;
 	char str[16 * SIZEOF_ARRAY(stress_waitcpu_method)];
 
-	(void)memset(str, 0, sizeof(str));
+	(void)shim_memset(str, 0, sizeof(str));
 
 	for (i = 0; i < SIZEOF_ARRAY(stress_waitcpu_method); i++) {
 		stress_waitcpu_method[i].supported = stress_waitcpu_method[i].waitfunc_supported();
diff -pruN 0.15.07-1/stress-wcs.c 0.15.08-1/stress-wcs.c
--- 0.15.07-1/stress-wcs.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-wcs.c	2023-05-21 14:30:06.000000000 +0000
@@ -71,7 +71,7 @@ static const stress_wcs_method_info_t wc
 static void stress_wcs_fill(wchar_t *wcstr, const size_t len)
 {
 	register size_t i;
-	static wchar_t letters[32] ALIGN64 = {
+	static const wchar_t letters[32] ALIGN64 = {
 		L'a', L'b', L'c', L'd', L'e', L'f', L'g', L'h',
 		L'i', L'j', L'k', L'l', L'm', L'n', L'o', L'p',
 		L'q', L'r', L's', L't', L'u', L'v', L'w', L'x',
@@ -634,6 +634,9 @@ static size_t stress_wcs_all(const stres
 	stress_wcs_args_t info_all = *info;
 	double t;
 
+	if (UNLIKELY(SIZEOF_ARRAY(wcs_methods) < 2))
+		return 0;
+
 	info_all.libc_func = wcs_methods[i].libc_func;
 
 	t = stress_time_now();
@@ -686,7 +689,7 @@ static int stress_wcs(const stress_args_
 	int metrics_count = 0;
 
 	/* No wcs* functions available on this system? */
-	if (SIZEOF_ARRAY(wcs_methods) <= 2)
+	if (SIZEOF_ARRAY(wcs_methods) < 2)
 		return stress_unimplemented(args);
 
 	(void)stress_get_setting("wcs-method", &wcs_method);
@@ -699,6 +702,7 @@ static int stress_wcs(const stress_args_
 	info.strdst = strdst;
 	info.strdstlen = STRDSTLEN;
 	info.failed = false;
+	info.name = args->name;
 
 	stress_wcs_fill(info.str1, info.len1);
 
diff -pruN 0.15.07-1/stress-xattr.c 0.15.08-1/stress-xattr.c
--- 0.15.07-1/stress-xattr.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-xattr.c	2023-05-21 14:30:06.000000000 +0000
@@ -18,6 +18,7 @@
  *
  */
 #include "stress-ng.h"
+#include "core-builtin.h"
 
 #if defined(HAVE_SYS_XATTR_H)
 #include <sys/xattr.h>
@@ -47,7 +48,7 @@ static const stress_help_t help[] = {
     defined(HAVE_LISTXATTR) &&		\
     defined(HAVE_SETXATTR)
 
-#define MAX_XATTRS		(4096)
+#define MAX_XATTRS		(4096)	/* must be a multiple of sizeof(uint32_t) */
 
 /*
  *  stress_xattr
@@ -95,7 +96,7 @@ static int stress_xattr(const stress_arg
 
 	hugevalue = calloc(1, hugevalue_sz);
 	if (hugevalue)
-		(void)memset(hugevalue, 'X', hugevalue_sz - 1);
+		(void)shim_memset(hugevalue, 'X', hugevalue_sz - 1);
 
 	stress_set_proc_state(args->name, STRESS_STATE_RUN);
 
@@ -108,11 +109,16 @@ static int stress_xattr(const stress_arg
 		ssize_t sret;
 		char *buffer;
 		char bad_attrname[32];
+		uint32_t set_xattr_ok[MAX_XATTRS / sizeof(uint32_t)];
+
+		(void)shim_memset(set_xattr_ok, 0, sizeof(set_xattr_ok));
 
 		for (i = 0; i < MAX_XATTRS; i++) {
+			STRESS_CLRBIT(set_xattr_ok, i);
 			(void)snprintf(attrname, sizeof(attrname), "user.var_%d", i);
 			(void)snprintf(value, sizeof(value), "orig-value-%d", i);
 
+			(void)shim_fremovexattr(fd, attrname);
 			ret = shim_fsetxattr(fd, attrname, value, strlen(value), XATTR_CREATE);
 			if (ret < 0) {
 				if ((errno == ENOTSUP) || (errno == ENOSYS)) {
@@ -123,11 +129,14 @@ static int stress_xattr(const stress_arg
 					rc = EXIT_NO_RESOURCE;
 					goto out_close;
 				}
-				if ((errno == ENOSPC) || (errno == EDQUOT) || (errno == E2BIG))
-					break;
-				pr_fail("%s: fsetxattr failed, errno=%d (%s)%s\n",
-					args->name, errno, strerror(errno), fs_type);
-				goto out_close;
+				if ((errno != ENOSPC) && (errno != EDQUOT) && (errno != E2BIG)) {
+					pr_fail("%s: fsetxattr failed, errno=%d (%s)%s\n",
+						args->name, errno, strerror(errno), fs_type);
+					goto out_close;
+				}
+			} else {
+				/* set xattr OK, lets remember that for later */
+				STRESS_SETBIT(set_xattr_ok, i);
 			}
 			if (!keep_stressing(args))
 				goto out_finished;
@@ -221,7 +230,7 @@ static int stress_xattr(const stress_arg
 
 #if defined(XATTR_SIZE_MAX)
 		/* Exercise invalid size argument fsetxattr syscall */
-		(void)memset(large_tmp, 'f', XATTR_SIZE_MAX + 1);
+		(void)shim_memset(large_tmp, 'f', XATTR_SIZE_MAX + 1);
 		ret = shim_fsetxattr(fd, attrname, large_tmp, XATTR_SIZE_MAX + 1,
 			XATTR_CREATE);
 		if (ret >= 0) {
@@ -235,7 +244,7 @@ static int stress_xattr(const stress_arg
 
 #if defined(HAVE_LSETXATTR) && \
     defined(XATTR_SIZE_MAX)
-		(void)memset(large_tmp, 'l', XATTR_SIZE_MAX + 1);
+		(void)shim_memset(large_tmp, 'l', XATTR_SIZE_MAX + 1);
 		ret = shim_lsetxattr(filename, attrname, large_tmp,
 			XATTR_SIZE_MAX + 1, XATTR_CREATE);
 		if (ret >= 0) {
@@ -248,7 +257,7 @@ static int stress_xattr(const stress_arg
 #endif
 
 #if defined(XATTR_SIZE_MAX)
-		(void)memset(large_tmp, 's', XATTR_SIZE_MAX + 1);
+		(void)shim_memset(large_tmp, 's', XATTR_SIZE_MAX + 1);
 		ret = shim_setxattr(filename, attrname, large_tmp,
 			XATTR_SIZE_MAX + 1, XATTR_CREATE);
 		if (ret >= 0) {
@@ -274,6 +283,9 @@ static int stress_xattr(const stress_arg
 				"already exists, errno=%d (%s)%s\n",
 				args->name, errno, strerror(errno), fs_type);
 			goto out_close;
+		} else {
+			if (errno == ENOSPC)
+				STRESS_CLRBIT(set_xattr_ok, i);
 		}
 
 #if defined(HAVE_LSETXATTR)
@@ -285,6 +297,9 @@ static int stress_xattr(const stress_arg
 				"already exists, errno=%d (%s)%s\n",
 				args->name, errno, strerror(errno), fs_type);
 			goto out_close;
+		} else {
+			if (errno == ENOSPC)
+				STRESS_CLRBIT(set_xattr_ok, i);
 		}
 #endif
 		ret = shim_setxattr(filename, attrname, value, strlen(value),
@@ -295,31 +310,39 @@ static int stress_xattr(const stress_arg
 				"already exists, errno=%d (%s)%s\n",
 				args->name, errno, strerror(errno), fs_type);
 			goto out_close;
+		} else {
+			if (errno == ENOSPC)
+				STRESS_CLRBIT(set_xattr_ok, i);
 		}
 
 		for (j = 0; j < i; j++) {
+			if (STRESS_GETBIT(set_xattr_ok, i) == 0)
+				continue;
+
 			(void)snprintf(attrname, sizeof(attrname), "user.var_%d", j);
 			(void)snprintf(value, sizeof(value), "value-%d", j);
 
 			ret = shim_fsetxattr(fd, attrname, value, strlen(value),
 				XATTR_REPLACE);
 			if (ret < 0) {
-				if ((errno == ENOSPC) || (errno == EDQUOT) || (errno == E2BIG))
-					break;
-				pr_fail("%s: fsetxattr failed, errno=%d (%s)%s\n",
-					args->name, errno, strerror(errno), fs_type);
-				goto out_close;
+				STRESS_CLRBIT(set_xattr_ok, i);
+				if ((errno != ENOSPC) && (errno != EDQUOT) && (errno != E2BIG)) {
+					pr_fail("%s: fsetxattr failed, errno=%d (%s)%s\n",
+						args->name, errno, strerror(errno), fs_type);
+					goto out_close;
+				}
 			}
 
 			/* ..and do it again using setxattr */
 			ret = shim_setxattr(filename, attrname, value, strlen(value),
 				XATTR_REPLACE);
 			if (ret < 0) {
-				if ((errno == ENOSPC) || (errno == EDQUOT) || (errno == E2BIG))
-					break;
-				pr_fail("%s: setxattr failed, errno=%d (%s)%s\n",
-					args->name, errno, strerror(errno), fs_type);
-				goto out_close;
+				STRESS_CLRBIT(set_xattr_ok, i);
+				if ((errno != ENOSPC) && (errno != EDQUOT) && (errno != E2BIG)) {
+					pr_fail("%s: setxattr failed, errno=%d (%s)%s\n",
+						args->name, errno, strerror(errno), fs_type);
+					goto out_close;
+				}
 			}
 
 #if defined(HAVE_LSETXATTR)
@@ -327,28 +350,31 @@ static int stress_xattr(const stress_arg
 			ret = shim_lsetxattr(filename, attrname, value, strlen(value),
 				XATTR_REPLACE);
 			if (ret < 0) {
-				if ((errno == ENOSPC) || (errno == EDQUOT) || (errno == E2BIG))
-					break;
-				pr_fail("%s: lsetxattr failed, errno=%d (%s)%s\n",
-					args->name, errno, strerror(errno), fs_type);
-				goto out_close;
+				STRESS_CLRBIT(set_xattr_ok, i);
+				if ((errno != ENOSPC) && (errno != EDQUOT) && (errno != E2BIG)) {
+					pr_fail("%s: lsetxattr failed, errno=%d (%s)%s\n",
+						args->name, errno, strerror(errno), fs_type);
+					goto out_close;
+				}
 			}
 #endif
 			if (!keep_stressing(args))
 				goto out_finished;
 		}
 		for (j = 0; j < i; j++) {
+			if (STRESS_GETBIT(set_xattr_ok, i) == 0)
+				continue;
 			(void)snprintf(attrname, sizeof(attrname), "user.var_%d", j);
 			(void)snprintf(value, sizeof(value), "value-%d", j);
 
-			(void)memset(tmp, 0, sizeof(tmp));
+			(void)shim_memset(tmp, 0, sizeof(tmp));
 			sret = shim_fgetxattr(fd, attrname, tmp, sizeof(tmp));
 			if (sret < 0) {
 				pr_fail("%s: fgetxattr failed, errno=%d (%s)%s\n",
 					args->name, errno, strerror(errno), fs_type);
 				goto out_close;
 			}
-			if (strncmp(value, tmp, (size_t)sret)) {
+			if ((STRESS_GETBIT(set_xattr_ok, j) != 0) && strncmp(value, tmp, (size_t)sret)) {
 				pr_fail("%s: fgetxattr values different %.*s vs %.*s\n",
 					args->name, ret, value, ret, tmp);
 				goto out_close;
@@ -364,7 +390,7 @@ static int stress_xattr(const stress_arg
 					args->name, errno, strerror(errno));
 				goto out_close;
 			}
-			if (strncmp(value, tmp, (size_t)sret)) {
+			if ((STRESS_GETBIT(set_xattr_ok, j) != 0) && strncmp(value, tmp, (size_t)sret)) {
 				pr_fail("%s: getxattr values different %.*s vs %.*s\n",
 					args->name, ret, value, ret, tmp);
 				goto out_close;
@@ -377,14 +403,14 @@ static int stress_xattr(const stress_arg
 					args->name, errno, strerror(errno), fs_type);
 				goto out_close;
 			}
-			if (strncmp(value, tmp, (size_t)sret)) {
+			if ((STRESS_GETBIT(set_xattr_ok, j) != 0) && strncmp(value, tmp, (size_t)sret)) {
 				pr_fail("%s: lgetxattr values different %.*s vs %.*s\n",
 					args->name, ret, value, ret, tmp);
 				goto out_close;
 			}
 
 			/* Invalid attribute name */
-			(void)memset(&bad_attrname, 0, sizeof(bad_attrname));
+			(void)shim_memset(&bad_attrname, 0, sizeof(bad_attrname));
 			VOID_RET(ssize_t, shim_lgetxattr(filename, bad_attrname, tmp, sizeof(tmp)));
 #endif
 			if (!keep_stressing(args))
@@ -397,7 +423,7 @@ static int stress_xattr(const stress_arg
 		VOID_RET(ssize_t, shim_fgetxattr(bad_fd, "user.var_bad", tmp, sizeof(tmp)));
 
 		/* Invalid attribute name */
-		(void)memset(&bad_attrname, 0, sizeof(bad_attrname));
+		(void)shim_memset(&bad_attrname, 0, sizeof(bad_attrname));
 		VOID_RET(ssize_t, shim_fgetxattr(fd, bad_attrname, tmp, sizeof(tmp)));
 
 		/* Exercise fgetxattr syscall having small value buffer */
@@ -458,9 +484,11 @@ static int stress_xattr(const stress_arg
 				break;
 			}
 			if (ret < 0) {
-				pr_fail("%s: %s failed, errno=%d (%s)\n",
-					args->name, errmsg, errno, strerror(errno));
-				goto out_close;
+				if ((errno != ENODATA) && (errno != ENOSPC)) {
+					pr_fail("%s: %s failed, errno=%d (%s)\n",
+						args->name, errmsg, errno, strerror(errno));
+					goto out_close;
+				}
 			}
 			if (!keep_stressing(args))
 				goto out_finished;
@@ -475,7 +503,7 @@ static int stress_xattr(const stress_arg
 		/*
 		 *  Exercise long attribute, ERANGE
 		 */
-		(void)memset(large_tmp, 'X', XATTR_SIZE_MAX + 1);
+		(void)shim_memset(large_tmp, 'X', XATTR_SIZE_MAX + 1);
 		VOID_RET(int, shim_removexattr(filename, large_tmp));
 		VOID_RET(int, shim_lremovexattr(filename, large_tmp));
 		VOID_RET(int, shim_fremovexattr(fd, large_tmp));
diff -pruN 0.15.07-1/stress-zlib.c 0.15.08-1/stress-zlib.c
--- 0.15.07-1/stress-zlib.c	2023-04-13 15:53:13.000000000 +0000
+++ 0.15.08-1/stress-zlib.c	2023-05-21 14:30:06.000000000 +0000
@@ -20,6 +20,7 @@
 #include "stress-ng.h"
 #include "core-arch.h"
 #include "core-asm-x86.h"
+#include "core-builtin.h"
 #include "core-cpu.h"
 #include "core-target-clones.h"
 
@@ -565,7 +566,7 @@ static void OPTIMIZE3 OPTIMIZE_FAST_MATH
 	while (ptr < end) {
 		const double s = sin(theta);
 
-		(void)memcpy((void *)ptr, &s, sizeof(*ptr));
+		(void)shim_memcpy((void *)ptr, &s, sizeof(*ptr));
 
 		theta += dtheta;
 		dtheta += 0.001;
@@ -717,7 +718,7 @@ static void TARGET_CLONES stress_rand_da
 	const float scalar = 256.0F / (float)max;
 
 	(void)args;
-	(void)memset(rows, 0, sizeof(rows));
+	(void)shim_memset(rows, 0, sizeof(rows));
 
 	while (ptr < end) {
 		int64_t rnd;
@@ -1045,7 +1046,7 @@ static void stress_rand_data_morse(
 	(void)args;
 
 	if (!morse_table_init) {
-		(void)memset(morse_table, 0, sizeof(morse_table));
+		(void)shim_memset(morse_table, 0, sizeof(morse_table));
 		for (i = 0; i < (int)SIZEOF_ARRAY(morse); i++)
 			morse_table[tolower((int)morse[i].ch)] = morse[i].str;
 		morse_table_init = true;
@@ -1149,12 +1150,7 @@ static void stress_rand_data_zero(
 {
 	(void)args;
 
-	while (data < data_end) {
-		*data++ = 0;
-		*data++ = 0;
-		*data++ = 0;
-		*data++ = 0;
-	}
+	shim_memset((void *)data, 0, (uintptr_t)data_end - (uintptr_t)data);
 }
 
 static void stress_zlib_random_test(const stress_args_t *args, uint64_t *RESTRICT data, uint64_t *RESTRICT data_end);
@@ -1404,16 +1400,18 @@ static int stress_zlib_inflate(
 	zlib_checksum->pipe_broken = false;
 	zlib_checksum->interrupted = false;
 
-	(void)memset(&stream_inf, 0, sizeof(stream_inf));
+	(void)shim_memset(&stream_inf, 0, sizeof(stream_inf));
 	stream_inf.zalloc = Z_NULL;
 	stream_inf.zfree = Z_NULL;
 	stream_inf.opaque = Z_NULL;
 	stream_inf.avail_in = 0;
 	stream_inf.next_in = Z_NULL;
 
-	pr_dbg("INF: lvl=%d mem-lvl=%d wbits=%d strategy=%d\n",
-		zlib_args.level, zlib_args.mem_level, zlib_args.window_bits,
-		zlib_args.strategy);
+	if (args->instance == 0) {
+		pr_dbg("INF: lvl=%d mem-lvl=%d wbits=%d strategy=%d\n",
+			zlib_args.level, zlib_args.mem_level, zlib_args.window_bits,
+			zlib_args.strategy);
+	}
 	do {
 		ret = inflateInit2(&stream_inf, zlib_args.window_bits);
 		if (ret != Z_OK) {
@@ -1538,7 +1536,7 @@ static int stress_zlib_deflate(
 	zlib_checksum->pipe_broken = false;
 	zlib_checksum->interrupted = false;
 
-	(void)memset(&stream_def, 0, sizeof(stream_def));
+	(void)shim_memset(&stream_def, 0, sizeof(stream_def));
 	stream_def.zalloc = Z_NULL;
 	stream_def.zfree = Z_NULL;
 	stream_def.opaque = Z_NULL;
@@ -1549,9 +1547,11 @@ static int stress_zlib_deflate(
 	if (zlib_args.window_bits > 31)
 		zlib_args.window_bits = zlib_args.window_bits - 32;
 
-	pr_dbg("DEF: lvl=%d mem-lvl=%d wbits=%d strategy=%d stream-bytes=%llu\n",
-		zlib_args.level, zlib_args.mem_level, zlib_args.window_bits,
-		zlib_args.strategy, (unsigned long long)zlib_args.stream_bytes);
+	if (args->instance == 0) {
+		pr_dbg("DEF: lvl=%d mem-lvl=%d wbits=%d strategy=%d stream-bytes=%llu\n",
+			zlib_args.level, zlib_args.mem_level, zlib_args.window_bits,
+			zlib_args.strategy, (unsigned long long)zlib_args.stream_bytes);
+	}
 	do {
 		ret = deflateInit2(&stream_def, zlib_args.level,
 				Z_DEFLATED, zlib_args.window_bits,
@@ -1690,7 +1690,6 @@ zlib_checksum_error:
 static int stress_zlib(const stress_args_t *args)
 {
 	int ret = EXIT_SUCCESS, fds[2];
-	int status;
 	const pid_t parent_pid = getpid();
 	pid_t pid;
 	bool error = false;
@@ -1796,8 +1795,7 @@ again:
 
 	(void)munmap((void *)shared_checksums, sizeof(*shared_checksums));
 
-	(void)kill(pid, SIGKILL);
-	(void)shim_waitpid(pid, &status, 0);
+	stress_kill_and_wait(args, pid, SIGALRM, true);
 
 	return ret;
 }
diff -pruN 0.15.07-1/test/test-builtin-memset.c 0.15.08-1/test/test-builtin-memset.c
--- 0.15.07-1/test/test-builtin-memset.c	1970-01-01 00:00:00.000000000 +0000
+++ 0.15.08-1/test/test-builtin-memset.c	2023-05-21 14:30:06.000000000 +0000
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C)      2023 Colin Ian King
+ *
+ * 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.
+ *
+ */
+
+int main(int argc, char **argv)
+{
+	unsigned long dst;
+
+	__builtin_memset(&dst, 0, sizeof(dst));
+
+	return 0;
+}
+
diff -pruN 0.15.07-1/test/test-rfork.c 0.15.08-1/test/test-rfork.c
--- 0.15.07-1/test/test-rfork.c	1970-01-01 00:00:00.000000000 +0000
+++ 0.15.08-1/test/test-rfork.c	2023-05-21 14:30:06.000000000 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2022-2023 Colin Ian King
+ *
+ * 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.
+ *
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+
+int main(void)
+{
+	pid_t pid = 0;
+
+	pid = rfork(RFPROC);
+	exit((int)pid);
+}
