diff --git a/realtime-tests.spec b/realtime-tests.spec index f8d3173..bc753dd 100644 --- a/realtime-tests.spec +++ b/realtime-tests.spec @@ -6,7 +6,7 @@ Name: realtime-tests # Numa argument to make: NUMA=1 # Version: 2.4 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2 URL: https://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git Source0: https://www.kernel.org/pub/linux/utils/rt-tests/rt-tests-%{version}.tar.xz @@ -21,6 +21,9 @@ Requires: bc #Patches Patch1: rt-tests-Remove-arbitrary-num-of-threads-limits.patch +Patch2: rt-tests-hackbench-Add-error-checking-to-connect-and.patch +Patch3: rt-tests-hackbench-Fix-compile-comparison-of-differe.patch +Patch4: rt-tests-hackbench-Fix-compile-warning-about-fall-th.patch %description realtime-tests is a set of programs that test and measure various components of @@ -30,6 +33,9 @@ latency. It also tests the functioning of priority-inheritance mutexes. %prep %setup -q -n rt-tests-%{version} %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build %set_build_flags @@ -80,6 +86,12 @@ latency. It also tests the functioning of priority-inheritance mutexes. %{_mandir}/man8/determine_maximum_mpps.8.* %changelog +* Wed Nov 02 2022 John Kacur - 2.4-4 +- Add error checking in hackbench to connect and getsockname +- Fix compile warnings in hackbench because of comparison of different signs +- Fix compile warnings in hackbench because of warnings about fall through +Resolves: rhbz#bz2115067 + * Fri Oct 07 2022 John Kacur - 2.4-3 - Remove arbitrary limits on number of threads Resolves: rhbz#2129891 diff --git a/rt-tests-hackbench-Add-error-checking-to-connect-and.patch b/rt-tests-hackbench-Add-error-checking-to-connect-and.patch new file mode 100644 index 0000000..2f2dc88 --- /dev/null +++ b/rt-tests-hackbench-Add-error-checking-to-connect-and.patch @@ -0,0 +1,39 @@ +From a3f7cd235a4aaf7771763d3b0b27d96dd4f5f1c1 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Tue, 1 Nov 2022 09:30:40 -0400 +Subject: [PATCH 1/4] rt-tests: hackbench: Add error checking to connect and + getsockname + +Add error checking around the calls connect and getsockname + +Signed-off-by: John Kacur +--- + src/hackbench/hackbench.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c +index 18c928480103..8c6d83520e57 100644 +--- a/src/hackbench/hackbench.c ++++ b/src/hackbench/hackbench.c +@@ -130,14 +130,16 @@ static int inet_socketpair(int fds[2]) + + if (bind(s1, &sin, len) < 0) + barf("bind"); +- getsockname(s1, &sin, &len); ++ if (getsockname(s1, &sin, &len) < 0) ++ barf("getsockname"); + if (listen(s1, 10) < 0) + barf("listen"); + if (ioctl(s2, FIONBIO, &ul) < 0) + barf("ioctl"); + if (ioctl(s1, FIONBIO, &ul) < 0) + barf("ioctl"); +- connect(s2, &sin, len); ++ if (connect(s2, &sin, len) < 0) ++ barf("connect"); + if ((fds[0] = accept(s1, &sin, &len)) < 0) + barf("accept"); + ul = 0; +-- +2.38.1 + diff --git a/rt-tests-hackbench-Fix-compile-comparison-of-differe.patch b/rt-tests-hackbench-Fix-compile-comparison-of-differe.patch new file mode 100644 index 0000000..41c761f --- /dev/null +++ b/rt-tests-hackbench-Fix-compile-comparison-of-differe.patch @@ -0,0 +1,59 @@ +From fb702d9903b7f8b54a7bd51fcbf5f12ce6bc9540 Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Tue, 1 Nov 2022 09:46:01 -0400 +Subject: [PATCH 2/4] rt-tests: hackbench: Fix compile comparison of different + signed ints + +Fix compile warnings about comparisons of integers of different +signedness. + +Signed-off-by: John Kacur +--- + src/hackbench/hackbench.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c +index 8c6d83520e57..dda7690b79a0 100644 +--- a/src/hackbench/hackbench.c ++++ b/src/hackbench/hackbench.c +@@ -200,7 +200,8 @@ static void *sender(struct sender_context *ctx) + /* Now pump to every receiver. */ + for (i = 0; i < loops; i++) { + for (j = 0; j < ctx->num_fds; j++) { +- int ret, done = 0; ++ int ret; ++ size_t done = 0; + + again: + ret = write(ctx->out_fds[j], data + done, sizeof(data)-done); +@@ -231,7 +232,8 @@ static void *receiver(struct receiver_context* ctx) + /* Receive them all */ + for (i = 0; i < ctx->num_packets; i++) { + char data[datasize]; +- int ret, done = 0; ++ int ret; ++ size_t done = 0; + + again: + ret = read(ctx->in_fds[0], data + done, datasize - done); +@@ -289,7 +291,7 @@ static int create_worker(childinfo_t *child, void *ctx, void *(*func)(void *)) + + void signal_workers(childinfo_t *children, unsigned int num_children) + { +- int i; ++ unsigned int i; + printf("signaling %d worker threads to terminate\n", num_children); + for (i=0; i < num_children; i++) { + kill(children[i].pid, SIGTERM); +@@ -517,7 +519,7 @@ int main(int argc, char *argv[]) + if (setjmp(jmpbuf) == 0) { + total_children = 0; + for (i = 0; i < num_groups; i++) { +- int c = group(child_tab, total_children, num_fds, readyfds[1], wakefds[0]); ++ unsigned int c = group(child_tab, total_children, num_fds, readyfds[1], wakefds[0]); + if( c != (num_fds*2) ) { + fprintf(stderr, "%i children started. Expected %i\n", c, num_fds*2); + reap_workers(child_tab, total_children + c, 1); +-- +2.38.1 + diff --git a/rt-tests-hackbench-Fix-compile-warning-about-fall-th.patch b/rt-tests-hackbench-Fix-compile-warning-about-fall-th.patch new file mode 100644 index 0000000..381b34c --- /dev/null +++ b/rt-tests-hackbench-Fix-compile-warning-about-fall-th.patch @@ -0,0 +1,30 @@ +From 4164006a834b93995fb3535508fdf18bff92df7d Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Tue, 1 Nov 2022 09:50:03 -0400 +Subject: [PATCH 3/4] rt-tests: hackbench: Fix compile warning about fall + through + +print_usage_exit(0) never returns, but the compiler doesn't understand +this. In any case it is not harmful to add a break after this statement. +Do so to keep the unhelpful compiler warning from triggering. + +Signed-off-by: John Kacur +--- + src/hackbench/hackbench.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/hackbench/hackbench.c b/src/hackbench/hackbench.c +index dda7690b79a0..69dd5f087fb6 100644 +--- a/src/hackbench/hackbench.c ++++ b/src/hackbench/hackbench.c +@@ -444,6 +444,7 @@ static void process_options(int argc, char *argv[]) + break; + case 'h': + print_usage_exit(0); ++ break; + case 'l': + if (!(argv[optind] && (loops = atoi(optarg)) > 0)) { + fprintf(stderr, "%s: --loops|-l requires an integer > 0\n", argv[0]); +-- +2.38.1 +