Remove the revert patch and replace it with an upstream fix for power

Remove the revert patch and replace it with an upstream fix for power
Include all of the stress-ng patches available past 0.18.06

Resolves:RHEL-65475
Signed-off-by: John Kacur <jkacur@redhat.com>
This commit is contained in:
John Kacur 2024-11-06 09:29:06 -05:00
parent e3a2c49ace
commit dca8979b00
8 changed files with 531 additions and 88 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,85 +0,0 @@
From 663eceec28815d1eacfcd7908df48fe8781e9311 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Tue, 5 Nov 2024 09:56:31 -0500
Subject: [PATCH] Revert "core-target-clones.h: add power11 to target clones"
This reverts commit 6b78e7450f04bb4251458638303050d7148d6b95.
This fixes a mismatch where gcc support -mtune=power11
Where the distro seems to use
-mcpu=power9 -mtune=power10
resulting in a mismatch.
Until a workaround is available upstream, reverting this patch.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
Makefile.config | 8 --------
core-target-clones.h | 8 --------
2 files changed, 16 deletions(-)
diff --git a/Makefile.config b/Makefile.config
index 2bd9760b8ac9..8f1e0113b0d3 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -1293,7 +1293,6 @@ cpufeatures: \
TARGET_CLONES_PANTHERLAKE \
TARGET_CLONES_POWER9 \
TARGET_CLONES_POWER10 \
- TARGET_CLONES_POWER11 \
TARGET_CLONES_ROCKETLAKE \
TARGET_CLONES_SAPPHIRERAPIDS \
TARGET_CLONES_SKYLAKE_AVX512 \
@@ -1682,9 +1681,6 @@ TARGET_CLONES_POWER9:
TARGET_CLONES_POWER10:
$(call check,test-target-clones,HAVE_TARGET_CLONES_POWER10,target_clones cpu=power attribute (power10),,,'"default$(comma)cpu=power10"')
-TARGET_CLONES_POWER11:
- $(call check,test-target-clones,HAVE_TARGET_CLONES_POWER11,target_clones cpu=power attribute (power11),,,'"default$(comma)cpu=power11"')
-
VECMATH:
$(call check_vecmath,stress-vecmath,HAVE_VECMATH,vector math)
@@ -2257,7 +2253,6 @@ functions: \
BUILTIN_CPOWL \
BUILTIN_CPU_IS_POWER9 \
BUILTIN_CPU_IS_POWER10 \
- BUILTIN_CPU_IS_POWER11 \
BUILTIN_CSIN \
BUILTIN_CSINF \
BUILTIN_CSINL \
@@ -2975,9 +2970,6 @@ BUILTIN_CPU_IS_POWER9:
BUILTIN_CPU_IS_POWER10:
$(call check,test-builtin-cpu-is-power10,HAVE_BUILTIN_CPU_IS_POWER10,__builtin_cpu_is("power10"))
-BUILTIN_CPU_IS_POWER11:
- $(call check,test-builtin-cpu-is-power11,HAVE_BUILTIN_CPU_IS_POWER11,__builtin_cpu_is("power11"))
-
BUILTIN_EXP:
$(call check,test-mathfunc,HAVE_BUILTIN_EXP,__builtin_exp,$(LIB_M),-DMATHFUNC=__builtin_exp)
diff --git a/core-target-clones.h b/core-target-clones.h
index 874d590cdc2b..ebc0ba1b1d64 100644
--- a/core-target-clones.h
+++ b/core-target-clones.h
@@ -212,17 +212,9 @@
#define TARGET_CLONE_POWER10
#endif
-#if defined(HAVE_TARGET_CLONES_POWER11)
-#define TARGET_CLONE_POWER11 "cpu=power11",
-#define TARGET_CLONE_USE
-#else
-#define TARGET_CLONE_POWER11
-#endif
-
#define TARGET_CLONES_ALL \
TARGET_CLONE_POWER9 \
TARGET_CLONE_POWER10 \
- TARGET_CLONE_POWER11 \
"default"
#if defined(TARGET_CLONE_USE)
--
2.47.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,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

@ -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

@ -1,6 +1,6 @@
Name: stress-ng
Version: 0.18.06
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Stress test a computer system in various ways
License: GPL-2.0-or-later
@ -26,8 +26,13 @@ BuildRequires: Judy-devel
# Patches
Patch1: core-stress-fflush-opened-writable-files.patch
Patch2: Revert-core-target-clones.h-add-power11-to-target-cl.patch
Patch3: stress-fp-error-remove-duplicated-sqrt.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
@ -57,6 +62,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-3
- Remove the revert patch and replace it with an upstream fix for power
- Include all of the stress-ng patches available past 0.18.06
Resolves:RHEL-65475
* Tue Nov 05 2024 John Kacur <jkacur@redhat.com> - 0.18.06-2
- Revert a patch to use that creates a gcc flags mismatch on power
- Remove duplicate sqrt function