Update the stress-ng-0.18.06 upstream

Update the stress-ng-0.18.06 upstream
Include some upstream patches after 0.18.06

Resolves: RHEL-65474
Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
John Kacur 2024-11-06 10:37:35 -05:00
parent e18370f94c
commit 29cd0a335f
11 changed files with 652 additions and 38 deletions

View File

@ -0,0 +1,26 @@
From 9fc2f3ae54d9ce11b8c390d198ed540850f70cb2 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Mon, 4 Nov 2024 11:25:46 +0000
Subject: [PATCH 3/8] README.md: add another kernel commit to the 2024 kernel
bug list
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 40953ac81200..47ec76a3ea91 100644
--- a/README.md
+++ b/README.md
@@ -487,6 +487,7 @@ stress-ng has found various Kernel, QEMU bugs/regressions, and libc bugs; approp
* [cygwin: timer_delete: Fix return value](https://sourceware.org/pipermail/cygwin-patches/2024q4/012803.html)
* [security/keys: fix slab-out-of-bounds in key_task_permission](https://www.spinics.net/lists/kernel/msg5392458.html)
* [sched_ext: Don't hold scx_tasks_lock for too long](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?b07996c7abac0fe3f70bf74b0b3f76eb7852ef5a)
+* [sched/numa: Fix the potential null pointer dereference in task_numa_work()](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?9c70b2a33cd2aa6a5a59c5523ef053bd42265209)
## Kernel improvements that used stress-ng
--
2.47.0

View File

@ -1,33 +0,0 @@
From cdfb0b0656b6fd371cf73333af54530e8de556e1 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Fri, 3 May 2024 10:46:01 +0100
Subject: [PATCH] core-asm-arm.h: declare stress_asm_arm_yield when
HAVE_ASM_ARM_YIELD is defined
Don't declare inlined yield helper if yield is not available
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
core-asm-arm.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/core-asm-arm.h b/core-asm-arm.h
index c275dc8b9bda..152e771811b8 100644
--- a/core-asm-arm.h
+++ b/core-asm-arm.h
@@ -24,10 +24,12 @@
#if defined(STRESS_ARCH_ARM)
+#if defined(HAVE_ASM_ARM_YIELD)
static inline void ALWAYS_INLINE stress_asm_arm_yield(void)
{
__asm__ __volatile__("yield;\n");
}
+#endif
/* #if defined(STRESS_ARCH_ARM) */
#endif
--
2.45.0

View File

@ -0,0 +1,224 @@
From 9b3e9418715b013889e487ac40d14b85a2def7c4 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Mon, 4 Nov 2024 14:29:09 +0000
Subject: [PATCH 4/8] core-shim: add shim to ppoll() and workaround
fortification issues
It appears that ppoll() on 32 bit builds with _FORTIFY_SOURCE > 2 can
cause some issues on some build environments. Workaround this by
adding a shim_ppoll() wrapper with reduced _FORTIFY_SOURCE settings
to workaround this issue.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
core-shim.c | 37 +++++++++++++++++++++++++++++++++++++
core-shim.h | 20 ++++++++++++++++++++
stress-poll.c | 6 +++---
stress-procfs.c | 2 +-
stress-sysbadaddr.c | 8 ++++----
stress-syscall.c | 2 +-
stress-sysfs.c | 2 +-
7 files changed, 67 insertions(+), 10 deletions(-)
diff --git a/core-shim.c b/core-shim.c
index e291f2364640..8f51991137e3 100644
--- a/core-shim.c
+++ b/core-shim.c
@@ -2824,3 +2824,40 @@ int shim_mseal(void *addr, size_t len, unsigned long flags)
return shim_enosys(0, addr, len, flags);
#endif
}
+
+
+/*
+ * shim_ppoll()
+ * shim wrapper for ppoll
+ */
+int shim_ppoll(
+ struct pollfd *fds,
+ nfds_t nfds,
+ const struct timespec *tmo_p,
+ const sigset_t *sigmask)
+{
+
+#if defined(HAVE_PPOLL)
+
+#if defined(_FORTIFY_SOURCE)
+#undef STRESS__FORTIFY_SOURCE
+#define STRESS__FORTIFY_SOURCE _FORTIFY_SOURCE
+#undef _FORTIFY_SOURCE
+#define _FORTIFY_SOURCE 2
+#endif
+
+ return ppoll(fds, nfds, tmo_p, sigmask);
+
+#if defined(STRESS__FORTIFY_SOURCE)
+#undef _FORTIFY_SOURCE
+#define _FORTIFY_SOURCE STRESS__FORTIFY_SOURCE
+#undef STRESS__FORTIFY_SOURCE
+#endif
+
+#elif defined(__NR_ppoll)
+ return (int)syscall(__NR_ppoll, fds, nfds, tmo_p, sigmask);
+#else
+ return shim_enosys(0, fds, nfds, tmo_p, sigmask);
+#endif
+}
+
diff --git a/core-shim.h b/core-shim.h
index 604f187828ac..2ec591f00ba4 100644
--- a/core-shim.h
+++ b/core-shim.h
@@ -23,6 +23,10 @@
#include <sys/uio.h>
#endif
+#if defined(HAVE_POLL_H)
+#include <poll.h>
+#endif
+
#include <dirent.h>
#include <sched.h>
#include <sys/resource.h>
@@ -325,6 +329,20 @@ typedef struct shim_timex {
} shim_timex_t;
#endif
+#if defined(HAVE_PPOLL)
+typedef nfds_t shim_nfds_t;
+
+typedef struct pollfd shim_pollfd_t;
+#else
+typedef unsigned int shim_nfds_t;
+
+typedef struct shim_pollfd {
+ int fd;
+ short events;
+ short revents;
+} shim_pollfd_t;
+#endif
+
/*
* shim_unconstify_ptr()
* some older system calls require non-const void *
@@ -502,5 +520,7 @@ extern int shim_lstat(const char *pathname, struct stat *statbuf);
extern int shim_stat(const char *pathname, struct stat *statbuf);
extern unsigned char shim_dirent_type(const char *path, const struct dirent *d);
extern int shim_mseal(void *addr, size_t len, unsigned long flags);
+extern int shim_ppoll(struct pollfd *fds, nfds_t nfds,
+ const struct timespec *tmo_p, const sigset_t *sigmask);
#endif
diff --git a/stress-poll.c b/stress-poll.c
index 83d6c55c7375..406b106aa365 100644
--- a/stress-poll.c
+++ b/stress-poll.c
@@ -277,7 +277,7 @@ abort:
(void)sigemptyset(&sigmask);
(void)sigaddset(&sigmask, SIGPIPE);
- ret = ppoll(poll_fds, max_fds, &ts, &sigmask);
+ ret = shim_ppoll(poll_fds, max_fds, &ts, &sigmask);
if ((g_opt_flags & OPT_FLAGS_VERIFY) &&
(ret < 0) && (errno != EINTR)) {
pr_fail("%s: ppoll failed, errno=%d (%s)\n",
@@ -298,7 +298,7 @@ abort:
/* Exercise illegal poll timeout */
ts.tv_sec = 0;
ts.tv_nsec = 1999999999;
- VOID_RET(int, ppoll(poll_fds, max_fds, &ts, &sigmask));
+ VOID_RET(int, shim_ppoll(poll_fds, max_fds, &ts, &sigmask));
if (!stress_continue(args))
break;
@@ -317,7 +317,7 @@ abort:
if (LIKELY(setrlimit(RLIMIT_NOFILE, &new_rlim) == 0)) {
ts.tv_sec = 0;
ts.tv_nsec = 0;
- VOID_RET(int, ppoll(poll_fds, max_fds, &ts, &sigmask));
+ VOID_RET(int, shim_ppoll(poll_fds, max_fds, &ts, &sigmask));
(void)setrlimit(RLIMIT_NOFILE, &old_rlim);
if (!stress_continue(args))
diff --git a/stress-procfs.c b/stress-procfs.c
index 90b045e1368b..94dece7494ed 100644
--- a/stress-procfs.c
+++ b/stress-procfs.c
@@ -516,7 +516,7 @@ mmap_test:
fds[0].events = POLLIN;
fds[0].revents = 0;
- VOID_RET(int, ppoll(fds, 1, &ts, &sigmask));
+ VOID_RET(int, shim_ppoll(fds, 1, &ts, &sigmask));
}
#endif
diff --git a/stress-sysbadaddr.c b/stress-sysbadaddr.c
index d77e3f2c9004..e7622bab059c 100644
--- a/stress-sysbadaddr.c
+++ b/stress-sysbadaddr.c
@@ -1515,7 +1515,7 @@ static void bad_ppoll1(stress_bad_addr_t *ba, volatile uint64_t *counter)
sigset_t *ss = (sigset_t *)(inc_addr(addr, sizeof(struct pollfd) + sizeof(struct timespec)));
(*counter)++;
- VOID_RET(int, ppoll((struct pollfd *)addr, (nfds_t)1, ts, ss));
+ VOID_RET(int, shim_ppoll((struct pollfd *)addr, (nfds_t)1, ts, ss));
}
static void bad_ppoll2(stress_bad_addr_t *ba, volatile uint64_t *counter)
@@ -1528,7 +1528,7 @@ static void bad_ppoll2(stress_bad_addr_t *ba, volatile uint64_t *counter)
ts.tv_nsec = 0;
(*counter)++;
- VOID_RET(int, ppoll((struct pollfd *)ba->addr, (nfds_t)16, &ts, &sigmask));
+ VOID_RET(int, shim_ppoll((struct pollfd *)ba->addr, (nfds_t)16, &ts, &sigmask));
}
static void bad_ppoll3(stress_bad_addr_t *ba, volatile uint64_t *counter)
@@ -1543,7 +1543,7 @@ static void bad_ppoll3(stress_bad_addr_t *ba, volatile uint64_t *counter)
(void)sigemptyset(&sigmask);
(*counter)++;
- VOID_RET(int, ppoll(&pfd, (nfds_t)1, (struct timespec *)ba->addr, &sigmask));
+ VOID_RET(int, shim_ppoll(&pfd, (nfds_t)1, (struct timespec *)ba->addr, &sigmask));
}
}
@@ -1560,7 +1560,7 @@ static void bad_ppoll4(stress_bad_addr_t *ba, volatile uint64_t *counter)
ts.tv_nsec = 0;
(*counter)++;
- VOID_RET(int, ppoll(&pfd, (nfds_t)1, &ts, (sigset_t *)ba->addr));
+ VOID_RET(int, shim_ppoll(&pfd, (nfds_t)1, &ts, (sigset_t *)ba->addr));
}
}
#endif
diff --git a/stress-syscall.c b/stress-syscall.c
index 91fa08e7425f..ca75669acb63 100644
--- a/stress-syscall.c
+++ b/stress-syscall.c
@@ -4563,7 +4563,7 @@ static int syscall_ppoll(void)
VOID_RET(int, sigemptyset(&sigmask));
t1 = syscall_time_now();
- ret = ppoll(fds, SIZEOF_ARRAY(fds), &ts, &sigmask);
+ ret = shim_ppoll(fds, SIZEOF_ARRAY(fds), &ts, &sigmask);
t2 = syscall_time_now();
return ret;
}
diff --git a/stress-sysfs.c b/stress-sysfs.c
index 4ee4d8237b87..25f032cbe3eb 100644
--- a/stress-sysfs.c
+++ b/stress-sysfs.c
@@ -328,7 +328,7 @@ static inline bool stress_sys_rw(stress_ctxt_t *ctxt)
ts.tv_nsec = 1000;
(void)sigemptyset(&sigmask);
- VOID_RET(int, ppoll(fds, 1, &ts, &sigmask));
+ VOID_RET(int, shim_ppoll(fds, 1, &ts, &sigmask));
}
#else
UNEXPECTED
--
2.47.0

View File

@ -0,0 +1,104 @@
From 4e832afb77a158a6bb59f7adac6d9db5ecd5a4b8 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Tue, 5 Nov 2024 14:40:21 +0000
Subject: [PATCH 6/8] core-shim: limit _FORTIFY_SOURCE to 2 for ALT linux gcc
for ppoll workaround
Fixes: https://github.com/ColinIanKing/stress-ng/issues/452
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
Makefile | 8 ++++++++
core-shim.c | 40 ++++++++++++++++++++++------------------
2 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/Makefile b/Makefile
index 2661376a258a..cb395115cd64 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,14 @@ ifneq ($(shell $(CC) -v 2>&1 | grep scan-build),)
COMPILER = scan-build
endif
+#
+# check for ALT linux gcc, define HAVE_ALT_LINUX_GCC, see core-shim.c
+# https://github.com/ColinIanKing/stress-ng/issues/452
+#
+ifneq ($(shell $(CC) -v 2>&1 | grep Target | grep "alt-linux"),)
+override CFLAGS += -DHAVE_ALT_LINUX_GCC
+endif
+
KERNEL=$(shell uname -s)
NODENAME=$(shell uname -n)
diff --git a/core-shim.c b/core-shim.c
index a7813474ab86..2f4b88f8188c 100644
--- a/core-shim.c
+++ b/core-shim.c
@@ -19,6 +19,17 @@
*/
#define STRESS_CORE_SHIM
+/*
+ * For ALT Linux gcc use at most _FORTIFY_SOURCE level 2
+ * https://github.com/ColinIanKing/stress-ng/issues/452
+ */
+#if defined(HAVE_ALT_LINUX_GCC) && \
+ defined(_FORTIFY_SOURCE) && \
+ _FORTIFY_SOURCE > 2
+#undef _FORTIFY_SOURCE
+#define _FORTIFY_SOURCE 2
+#endif
+
#include "stress-ng.h"
#include "core-arch.h"
#include "core-attribute.h"
@@ -2825,7 +2836,6 @@ int shim_mseal(void *addr, size_t len, unsigned long flags)
#endif
}
-
/*
* shim_ppoll()
* shim wrapper for ppoll
@@ -2836,26 +2846,20 @@ int shim_ppoll(
const struct timespec *tmo_p,
const sigset_t *sigmask)
{
-
#if defined(HAVE_PPOLL)
-
-#if defined(_FORTIFY_SOURCE)
-#undef STRESS__FORTIFY_SOURCE
-#define STRESS__FORTIFY_SOURCE _FORTIFY_SOURCE
-#undef _FORTIFY_SOURCE
-#define _FORTIFY_SOURCE 2
-#endif
-
return ppoll(fds, nfds, tmo_p, sigmask);
+#elif defined(__NR_ppoll) && defined(_NSIG)
+ struct timespec tval;
-#if defined(STRESS__FORTIFY_SOURCE)
-#undef _FORTIFY_SOURCE
-#define _FORTIFY_SOURCE STRESS__FORTIFY_SOURCE
-#undef STRESS__FORTIFY_SOURCE
-#endif
-
-#elif defined(__NR_ppoll)
- return (int)syscall(__NR_ppoll, fds, nfds, tmo_p, sigmask);
+ /*
+ * The kernel will update the timeout, so use a tmp val
+ * instead
+ */
+ if (tmo_p != NULL) {
+ tval = *tmo_p;
+ tmo_p = &tval;
+ }
+ return (int)syscall(__NR_ppoll, fds, nfds, tmo_p, sigmask, _NSIG / 8);
#else
return shim_enosys(0, fds, nfds, tmo_p, sigmask);
#endif
--
2.47.0

View File

@ -0,0 +1,42 @@
From 15484dc9c24be214059b5bfecccb6f26bd79833c Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Mon, 4 Nov 2024 21:51:19 +0000
Subject: [PATCH 5/8] core-shim: use shim'd types for shim_poll args
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
core-shim.c | 4 ++--
core-shim.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/core-shim.c b/core-shim.c
index 8f51991137e3..a7813474ab86 100644
--- a/core-shim.c
+++ b/core-shim.c
@@ -2831,8 +2831,8 @@ int shim_mseal(void *addr, size_t len, unsigned long flags)
* shim wrapper for ppoll
*/
int shim_ppoll(
- struct pollfd *fds,
- nfds_t nfds,
+ shim_pollfd_t *fds,
+ shim_nfds_t nfds,
const struct timespec *tmo_p,
const sigset_t *sigmask)
{
diff --git a/core-shim.h b/core-shim.h
index 2ec591f00ba4..1ea0910200c1 100644
--- a/core-shim.h
+++ b/core-shim.h
@@ -520,7 +520,7 @@ extern int shim_lstat(const char *pathname, struct stat *statbuf);
extern int shim_stat(const char *pathname, struct stat *statbuf);
extern unsigned char shim_dirent_type(const char *path, const struct dirent *d);
extern int shim_mseal(void *addr, size_t len, unsigned long flags);
-extern int shim_ppoll(struct pollfd *fds, nfds_t nfds,
+extern int shim_ppoll(shim_pollfd_t *fds, shim_nfds_t nfds,
const struct timespec *tmo_p, const sigset_t *sigmask);
#endif
--
2.47.0

View File

@ -0,0 +1,83 @@
From 69d710955063add902754f2bd841f9b12e59cc16 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Fri, 1 Nov 2024 12:56:24 +0000
Subject: [PATCH] core-*, stress-*: fflush opened writable files
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
core-klog.c | 2 ++
stress-jpeg.c | 1 +
stress-ng.c | 1 +
stress-opcode.c | 3 +++
stress-rename.c | 1 +
5 files changed, 8 insertions(+)
diff --git a/core-klog.c b/core-klog.c
index 419e59b6f922..348608c28ac8 100644
--- a/core-klog.c
+++ b/core-klog.c
@@ -223,9 +223,11 @@ log_info:
last_logged = stress_time_now();
}
}
+ (void)fflush(klog_fp);
(void)fclose(klog_fp);
_exit(EXIT_SUCCESS);
}
+ (void)fflush(klog_fp);
(void)fclose(klog_fp);
#endif
}
diff --git a/stress-jpeg.c b/stress-jpeg.c
index 4afe5018bd4b..8a8104f37b2b 100644
--- a/stress-jpeg.c
+++ b/stress-jpeg.c
@@ -316,6 +316,7 @@ PRAGMA_UNROLL_N(8)
(void)jpeg_write_scanlines(&cinfo, row_pointer, (JDIMENSION)y_max);
jpeg_finish_compress(&cinfo);
+ (void)fflush(fp);
(void)fclose(fp);
jpeg_destroy_compress(&cinfo);
t2 = stress_time_now();
diff --git a/stress-ng.c b/stress-ng.c
index a1d38e79cfee..17bd2f42c300 100644
--- a/stress-ng.c
+++ b/stress-ng.c
@@ -3770,6 +3770,7 @@ static void stress_yaml_close(FILE *yaml)
{
if (yaml) {
pr_yaml(yaml, "...\n");
+ (void)fflush(yaml);
(void)fclose(yaml);
}
}
diff --git a/stress-opcode.c b/stress-opcode.c
index cec65ec51cde..c7c1a5b2e653 100644
--- a/stress-opcode.c
+++ b/stress-opcode.c
@@ -513,6 +513,9 @@ again:
* corruption since the child will
* die soon anyhow
*/
+ (void)fflush(stdout);
+ (void)fflush(stderr);
+
(void)fclose(stdin);
(void)fclose(stdout);
(void)fclose(stderr);
diff --git a/stress-rename.c b/stress-rename.c
index 0dee9e75f04a..b0b3d119e5b6 100644
--- a/stress-rename.c
+++ b/stress-rename.c
@@ -267,6 +267,7 @@ restart:
#endif
return rc;
}
+ (void)fflush(fp);
(void)fclose(fp);
while (stress_continue(args)) {
--
2.47.0

View File

@ -0,0 +1,51 @@
From a679a1fa9331e9b07e0c3a87f62cbda2511e9453 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Tue, 5 Nov 2024 16:06:01 +0000
Subject: [PATCH 7/8] core-target-clones: add more power9,10,11 target clone
build time constraints
Adding a gcc check for the builtins for power9,10,11 makes the target clone
built time constraints more conservative.
Fixes: https://github.com/ColinIanKing/stress-ng/issues/451
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
core-target-clones.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/core-target-clones.h b/core-target-clones.h
index 874d590cdc2b..c2166e51f339 100644
--- a/core-target-clones.h
+++ b/core-target-clones.h
@@ -198,21 +198,24 @@
#if defined(STRESS_ARCH_PPC64) && \
defined(HAVE_TARGET_CLONES)
-#if defined(HAVE_TARGET_CLONES_POWER9)
+#if defined(HAVE_TARGET_CLONES_POWER9) && \
+ defined(HAVE_BUILTIN_CPU_IS_POWER10)
#define TARGET_CLONE_POWER9 "cpu=power9",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_POWER9
#endif
-#if defined(HAVE_TARGET_CLONES_POWER10)
+#if defined(HAVE_TARGET_CLONES_POWER10) && \
+ defined(HAVE_BUILTIN_CPU_IS_POWER10)
#define TARGET_CLONE_POWER10 "cpu=power10",
#define TARGET_CLONE_USE
#else
#define TARGET_CLONE_POWER10
#endif
-#if defined(HAVE_TARGET_CLONES_POWER11)
+#if defined(HAVE_TARGET_CLONES_POWER11) && \
+ defined(HAVE_BUILTIN_CPU_IS_POWER11)
#define TARGET_CLONE_POWER11 "cpu=power11",
#define TARGET_CLONE_USE
#else
--
2.47.0

View File

@ -1 +1 @@
SHA512 (stress-ng-0.17.08.tar.gz) = 3df9bb507687839ad9978099bea33bc6923d324c6e6f66d441911670fcd8080e093fd02741ea8516626ae1ba357f42d2c50b6553cb75f48fd5f008e59d469777
SHA512 (stress-ng-0.18.06.tar.xz) = 2b3da9ae31b7b766d7b727552286e3803a5a5099e844705a63d4952897920ed46deb3f657b48bebd97d7ddaaa2ce20a1037915e06f358aa3e041719fd15625b6

View File

@ -0,0 +1,71 @@
From 29f7704ec82e90d487e364a587bb30c264d0706f Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Wed, 6 Nov 2024 11:51:27 +0000
Subject: [PATCH 8/8] stress-brk: ensure the failure sbrk errno is being
checked
The check on errno is using the current value in errno and not the one
from a failed sbrk() call. Save the errno and check this rather than
the current errno.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
stress-brk.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/stress-brk.c b/stress-brk.c
index f71efa364956..ec3d9b417bdb 100644
--- a/stress-brk.c
+++ b/stress-brk.c
@@ -140,6 +140,7 @@ static int OPTIMIZE3 stress_brk_child(stress_args_t *args, void *context)
do {
double t;
+ int saved_errno = 0;
if (stress_brk_abs(ptr, start_ptr) > brk_bytes) {
ptr = start_ptr;
@@ -174,6 +175,7 @@ static int OPTIMIZE3 stress_brk_child(stress_args_t *args, void *context)
tmp = (uintptr_t *)((uintptr_t)ptr - sizeof(uintptr_t));
*tmp = (uintptr_t)tmp;
} else {
+ saved_errno = errno;
if (brk_failed_ptr == ptr) {
brk_failed_count++;
if (brk_failed_count > 32) {
@@ -187,6 +189,7 @@ static int OPTIMIZE3 stress_brk_child(stress_args_t *args, void *context)
} else if (i < 9) {
/* brk to same brk position */
if (UNLIKELY(shim_brk(ptr) < 0)) {
+ saved_errno = errno;
ptr = start_ptr;
i = 0;
}
@@ -194,6 +197,7 @@ static int OPTIMIZE3 stress_brk_child(stress_args_t *args, void *context)
/* Shrink brk by 1 page */
t = stress_time_now();
if (LIKELY(shim_sbrk(-page_size) != (void *)-1)) {
+ saved_errno = errno;
sbrk_shr_duration += stress_time_now() - t;
sbrk_shr_count += 1.0;
ptr -= page_size;
@@ -225,13 +229,13 @@ static int OPTIMIZE3 stress_brk_child(stress_args_t *args, void *context)
}
if (UNLIKELY(ptr == (void *)-1)) {
- if (LIKELY((errno == ENOMEM) || (errno == EAGAIN))) {
+ if (LIKELY((saved_errno == ENOMEM) || (saved_errno == EAGAIN))) {
VOID_RET(int, shim_brk(start_ptr));
i = 0;
} else {
pr_fail("%s: sbrk(%d) failed: errno=%d (%s)\n",
- args->name, (int)page_size, errno,
- strerror(errno));
+ args->name, (int)page_size, saved_errno,
+ strerror(saved_errno));
return EXIT_FAILURE;
}
}
--
2.47.0

View File

@ -0,0 +1,34 @@
From 7937cf205f653eb056588861e35489c4153c5b1c Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.i.king@gmail.com>
Date: Fri, 1 Nov 2024 18:31:57 +0000
Subject: [PATCH 2/6] stress-fp-error: remove duplicated sqrt
The sqrt() is duplictated, remove it. Kudos to Woodrow Shen for spotting
this.
Closes: https://github.com/ColinIanKing/stress-ng/issues/450
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
stress-fp-error.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/stress-fp-error.c b/stress-fp-error.c
index d5eac54c7b95..fe4d80146652 100644
--- a/stress-fp-error.c
+++ b/stress-fp-error.c
@@ -163,11 +163,6 @@ static int stress_fp_error(stress_args_t *args)
stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), (double)NAN,
true, false, EDOM, FE_INVALID, &rc);
#endif
-#if defined(EDOM) && defined(FE_INVALID)
- stress_fp_clear_error();
- stress_fp_check(args, "sqrt(-1.0)", sqrt(-1.0), (double)NAN,
- true, false, EDOM, FE_INVALID, &rc);
-#endif
#if defined(FE_INEXACT)
#if !defined(STRESS_ARCH_ALPHA)
/*
--
2.47.0

View File

@ -1,11 +1,11 @@
Name: stress-ng
Version: 0.17.08
Release: 2%{?dist}
Version: 0.18.06
Release: 1%{?dist}
Summary: Stress test a computer system in various ways
License: GPLv2+
URL: https://github.com/ColinIanKing/%{name}/tarball
Source0: https://github.com/ColinIanKing/%{name}/tarball/%{name}-%{version}.tar.gz
Source0: https://github.com/ColinIanKing/%{name}/tarball/%{name}-%{version}.tar.xz
# Work around for ld.gold error
%undefine _package_note_flags
@ -25,7 +25,14 @@ BuildRequires: zlib-devel
BuildRequires: Judy-devel
# Patches
Patch1: core-asm-arm.h-declare-stress_asm_arm_yield-when-HAV.patch
Patch1: core-stress-fflush-opened-writable-files.patch
Patch2: stress-fp-error-remove-duplicated-sqrt.patch
Patch3: README.md-add-another-kernel-commit-to-the-2024-kern.patch
Patch4: core-shim-add-shim-to-ppoll-and-workaround-fortifica.patch
Patch5: core-shim-use-shim-d-types-for-shim_poll-args.patch
Patch6: core-shim-limit-_FORTIFY_SOURCE-to-2-for-ALT-linux-g.patch
Patch7: core-target-clones-add-more-power9-10-11-target-clon.patch
Patch8: stress-brk-ensure-the-failure-sbrk-errno-is-being-ch.patch
%description
Stress test a computer system in various ways. It was designed to exercise
@ -58,6 +65,11 @@ install -pm 644 bash-completion/%{name} \
%{_datadir}/bash-completion/completions/%{name}
%changelog
* Wed Nov 06 2024 John Kacur <jkacur@redhat.com> - 0.18.06-1
- Update the stress-ng-0.18.06 upstream
- Include some upstream patches after 0.18.06
Resolves: RHEL-65474
* Wed May 29 2024 John Kacur <jkacur@redhat.com> - 0.17.08-2
- Fix missing corresponding macro to apply patch
Resolves: RHEL-33304