Commit 9bc64076 authored by Rocky Automation's avatar Rocky Automation 📺
Browse files

import rteval-loads-1.4-10.el8

parents
SOURCES/linux-5.7.tar.xz
SOURCES/stress-ng-0.11.10.tar.xz
07e40057b78f1c9dd2b042056325d99fcf9f8a08 SOURCES/linux-5.7.tar.xz
40fef9cd9129d41165c4beb0308e6d66cd4c006c SOURCES/stress-ng-0.11.10.tar.xz
From 0a38b72d2ffb722f08c26dd734baef54ff788fde Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Fri, 15 May 2020 23:23:43 +0100
Subject: [PATCH 01/28] stress-hdd: use preadv, preadv2, pwritev, pwritev2
Exercise iovec family of read/write system calls to get more
kernel coverage
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
Makefile.config | 24 ++++++++++++++++++++
stress-hdd.c | 47 +++++++++++++++++++++++++++++++++++++--
test/test-preadv.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
test/test-preadv2.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
test/test-pwritev.c | 14 +++++++++++-
test/test-pwritev2.c | 50 ++++++++++++++++++++++++++++++++++++++++++
6 files changed, 236 insertions(+), 3 deletions(-)
create mode 100644 test/test-preadv.c
create mode 100644 test/test-preadv2.c
create mode 100644 test/test-pwritev2.c
diff --git a/Makefile.config b/Makefile.config
index 0d306e1fbd32..826cf29e8158 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -2233,6 +2233,22 @@ $(info autoconfig: using prctl)
endif
endif
+ifndef $(HAVE_PREADV)
+HAVE_PREADV = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-preadv have_test_prog)
+ifeq ($(HAVE_PREADV),1)
+ CONFIG_CFLAGS += -DHAVE_PREADV
+$(info autoconfig: using preadv)
+endif
+endif
+
+ifndef $(HAVE_PREADV2)
+HAVE_PREADV2 = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-preadv2 have_test_prog)
+ifeq ($(HAVE_PREADV2),1)
+ CONFIG_CFLAGS += -DHAVE_PREADV2
+$(info autoconfig: using preadv2)
+endif
+endif
+
ifndef $(HAVE_PRLIMIT)
HAVE_PRLIMIT = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-prlimit have_test_prog)
ifeq ($(HAVE_PRLIMIT),1)
@@ -2297,6 +2313,14 @@ $(info autoconfig: using pwritev)
endif
endif
+ifndef $(HAVE_PWRITEV2)
+HAVE_PWRITEV2 = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-pwritev2 have_test_prog)
+ifeq ($(HAVE_PWRITEV2),1)
+ CONFIG_CFLAGS += -DHAVE_PWRITEV2
+$(info autoconfig: using pwritev2)
+endif
+endif
+
ifndef $(HAVE_RECVMMSG)
HAVE_RECVMMSG = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-recvmmsg have_test_prog)
ifeq ($(HAVE_RECVMMSG),1)
diff --git a/stress-hdd.c b/stress-hdd.c
index 9bdf881e0f2e..a9a9dad53352 100644
--- a/stress-hdd.c
+++ b/stress-hdd.c
@@ -180,6 +180,9 @@ static ssize_t stress_hdd_write(
size_t i;
uint8_t *data = buf;
const uint64_t sz = hdd_write_size / HDD_IO_VEC_MAX;
+ off_t offset;
+
+ (void)offset;
for (i = 0; i < HDD_IO_VEC_MAX; i++) {
iov[i].iov_base = (void *)data;
@@ -187,7 +190,27 @@ static ssize_t stress_hdd_write(
data += sz;
}
- ret = writev(fd, iov, HDD_IO_VEC_MAX);
+ switch (stress_mwc8() & 3) {
+#if defined(HAVE_PWRITEV2)
+ case 0:
+ /* 25% */
+ ret = pwritev2(fd, iov, HDD_IO_VEC_MAX, -1, 0);
+ break;
+#endif
+#if defined(HAVE_PWRITEV)
+ case 1:
+ /* 25% */
+ offset = lseek(fd, SEEK_CUR, 0);
+ if (offset != (off_t)-1) {
+ ret = pwritev(fd, iov, HDD_IO_VEC_MAX, offset);
+ break;
+ }
+ CASE_FALLTHROUGH;
+#endif
+ default:
+ ret = writev(fd, iov, HDD_IO_VEC_MAX);
+ break;
+ }
} else {
ret = write(fd, buf, count);
}
@@ -229,6 +252,9 @@ static ssize_t stress_hdd_read(
size_t i;
uint8_t *data = buf;
const uint64_t sz = hdd_write_size / HDD_IO_VEC_MAX;
+ off_t offset;
+
+ (void)offset;
for (i = 0; i < HDD_IO_VEC_MAX; i++) {
iov[i].iov_base = (void *)data;
@@ -236,7 +262,24 @@ static ssize_t stress_hdd_read(
data += sz;
}
- return readv(fd, iov, HDD_IO_VEC_MAX);
+ switch (stress_mwc8() & 3) {
+#if defined(HAVE_PREADV2)
+ case 0:
+ /* 25% */
+ return preadv2(fd, iov, HDD_IO_VEC_MAX, -1, 0);
+#endif
+#if defined(HAVE_PREADV)
+ case 1:
+ /* 25% */
+ offset = lseek(fd, SEEK_CUR, 0);
+ if (offset != (off_t)-1)
+ return preadv(fd, iov, HDD_IO_VEC_MAX, offset);
+ CASE_FALLTHROUGH;
+#endif
+ default:
+ /* 50% */
+ return readv(fd, iov, HDD_IO_VEC_MAX);
+ }
} else {
return read(fd, buf, count);
}
diff --git a/test/test-preadv.c b/test/test-preadv.c
new file mode 100644
index 000000000000..6bcfea842a2d
--- /dev/null
+++ b/test/test-preadv.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013-2020 Canonical, Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * This code is a complete clean re-write of the stress tool by
+ * Colin Ian King <colin.king@canonical.com> and attempts to be
+ * backwardly compatible with the stress tool by Amos Waterland
+ * <apw@rossby.metr.ou.edu> but has more stress tests and more
+ * functionality.
+ *
+ */
+#define _GNU_SOURCE
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#define IO_LEN (64)
+
+int main(void)
+{
+ struct iovec iov[1];
+ char data[IO_LEN];
+ int fd, rc;
+
+ fd = open("/dev/zero", O_RDONLY);
+ if (fd < 0)
+ return -1;
+
+ iov[0].iov_base = data;
+ iov[0].iov_len = (size_t)IO_LEN;
+
+ rc = preadv(fd, iov, 1, 0);
+ (void)close(fd);
+
+ return rc;
+}
diff --git a/test/test-preadv2.c b/test/test-preadv2.c
new file mode 100644
index 000000000000..2f87933d2a02
--- /dev/null
+++ b/test/test-preadv2.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013-2020 Canonical, Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * This code is a complete clean re-write of the stress tool by
+ * Colin Ian King <colin.king@canonical.com> and attempts to be
+ * backwardly compatible with the stress tool by Amos Waterland
+ * <apw@rossby.metr.ou.edu> but has more stress tests and more
+ * functionality.
+ *
+ */
+#define _GNU_SOURCE
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#define IO_LEN (64)
+
+int main(void)
+{
+ struct iovec iov[1];
+ char data[IO_LEN];
+ int fd, rc;
+
+ fd = open("/dev/zero", O_RDONLY);
+ if (fd < 0)
+ return -1;
+
+ iov[0].iov_base = data;
+ iov[0].iov_len = (size_t)IO_LEN;
+
+ rc = preadv2(fd, iov, 1, -1, 0);
+ (void)close(fd);
+
+ return rc;
+}
diff --git a/test/test-pwritev.c b/test/test-pwritev.c
index 153f3ff9de09..64d38f403534 100644
--- a/test/test-pwritev.c
+++ b/test/test-pwritev.c
@@ -24,15 +24,27 @@
*/
#define _GNU_SOURCE
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <sys/uio.h>
+#include <unistd.h>
int main(void)
{
struct iovec iov;
char buffer[] = "hello world\n";
+ int fd, rc;
+
+ fd = open("/dev/zero", O_WRONLY);
+ if (fd < 0)
+ return -1;
iov.iov_base = buffer;
iov.iov_len = sizeof(buffer);
- return pwritev(1, &iov, 1, 0);
+ rc = pwritev(fd, &iov, 1, 0);
+ (void)close(fd);
+
+ return rc;
}
diff --git a/test/test-pwritev2.c b/test/test-pwritev2.c
new file mode 100644
index 000000000000..1c7d5f52d477
--- /dev/null
+++ b/test/test-pwritev2.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013-2020 Canonical, Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * This code is a complete clean re-write of the stress tool by
+ * Colin Ian King <colin.king@canonical.com> and attempts to be
+ * backwardly compatible with the stress tool by Amos Waterland
+ * <apw@rossby.metr.ou.edu> but has more stress tests and more
+ * functionality.
+ *
+ */
+#define _GNU_SOURCE
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+int main(void)
+{
+ struct iovec iov;
+ char buffer[] = "hello world\n";
+ int fd, rc;
+
+ fd = open("/dev/zero", O_WRONLY);
+ if (fd < 0)
+ return -1;
+
+ iov.iov_base = buffer;
+ iov.iov_len = sizeof(buffer);
+
+ rc = pwritev2(fd, &iov, 1, -1, 0);
+ (void)close(fd);
+
+ return rc;
+}
--
2.21.3
From 4a46facac166e695fce4de75a04bdbac64b671ed Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Fri, 15 May 2020 23:25:17 +0100
Subject: [PATCH 02/28] syscalls: update preadv/preadv2 and pwritev entries
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
syscalls.txt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/syscalls.txt b/syscalls.txt
index ca40053ecf84..2ca93c4d8509 100644
--- a/syscalls.txt
+++ b/syscalls.txt
@@ -227,8 +227,8 @@ posix_fallocate fallocate
ppoll poll
prctl process name setting
pread readahead
-preadv
-preadv2
+preadv hdd
+preadv2 hdd
prlimit get
/proc proc
process_vm_readv vm_rw
@@ -236,8 +236,8 @@ process_vm_writev vm_rw
pselect6 poll
ptrace ptrace
pwrite readahead, aio
-pwritev ioprio
-pwritev2
+pwritev hdd, ioprio
+pwritev2 hdd
quotactl quota
read pipe, zero, ..
readahead readahead
--
2.21.3
From f4fd8ae1f02e76ff7e7020cab9b5204baf91ec81 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Sun, 17 May 2020 18:37:59 +0100
Subject: [PATCH 03/28] stress-sock: add a few more ioctls to exercise
improve kernel socket ioctl coverage by adding a few more ioctls
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
stress-sock.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/stress-sock.c b/stress-sock.c
index 031e84d98244..beafc46e2469 100644
--- a/stress-sock.c
+++ b/stress-sock.c
@@ -151,6 +151,44 @@ static int stress_set_socket_domain(const char *name)
return ret;
}
+static void stress_sock_ioctl(const int fd)
+{
+#if defined(FIOGETOWN)
+ {
+ int ret, own;
+
+ ret = ioctl(fd, FIOGETOWN, &own);
+ (void)ret;
+ }
+#endif
+#if defined(SIOCGPGRP)
+ {
+ int ret, own;
+
+ ret = ioctl(fd, SIOCGPGRP, &own);
+ (void)ret;
+ }
+#endif
+#if defined(SIOCGIFCONF)
+ {
+ int ret;
+ struct ifconf ifc;
+
+ ret = ioctl(fd, SIOCGIFCONF, &ifc);
+ (void)ret;
+ }
+#endif
+#if defined(SIOCGSTAMP)
+ {
+ int ret;
+ struct timeval tv;
+
+ ret = ioctl(fd, SIOCGSTAMP, &tv);
+ (void)ret;
+ }
+#endif
+}
+
/*
* stress_sock_client()
* client reader
@@ -324,6 +362,8 @@ retry:
break;
}
} while (keep_stressing());
+
+ stress_sock_ioctl(fd);
#if defined(AF_INET) && \
defined(IPPROTO_IP) && \
defined(IP_MTU)
--
2.21.3
From 02fe57f97b44220c55c599aaa700607664c37382 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Mon, 18 May 2020 00:01:27 +0100
Subject: [PATCH 04/28] stress-sem-sysv: exercise some invalid options to get
more kernel coverage
Exercise some of the invalid argument checking to exercise more kernel
paths.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
stress-sem-sysv.c | 122 +++++++++++++++++++++++++++++++++++++++-------
1 file changed, 105 insertions(+), 17 deletions(-)
diff --git a/stress-sem-sysv.c b/stress-sem-sysv.c
index 8c5fd1c95640..3c62d065b4de 100644
--- a/stress-sem-sysv.c
+++ b/stress-sem-sysv.c
@@ -139,12 +139,13 @@ static void stress_semaphore_sysv_get_procinfo(bool *get_procinfo)
* stress_semaphore_sysv_thrash()
* exercise the semaphore
*/
-static void stress_semaphore_sysv_thrash(const stress_args_t *args)
+static int stress_semaphore_sysv_thrash(const stress_args_t *args)
{
const int sem_id = g_shared->sem_sysv.sem_id;
+ int rc = EXIT_SUCCESS;
do {
- int i;
+ int i, ret;
#if defined(__linux__)
bool get_procinfo = true;
#endif
@@ -155,7 +156,7 @@ static void stress_semaphore_sysv_thrash(const stress_args_t *args)
if (clock_gettime(CLOCK_REALTIME, &timeout) < 0) {
pr_fail("%s: clock_gettime failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
- return;
+ return EXIT_NO_RESOURCE;
}
timeout.tv_sec++;
#endif
@@ -184,15 +185,19 @@ static void stress_semaphore_sysv_thrash(const stress_args_t *args)
#endif
if (errno == EAGAIN)
goto timed_out;
- if (errno != EINTR)
+ if (errno != EINTR) {
pr_fail("%s: semop wait failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
+ }
break;
}
if (semop(sem_id, &semsignal, 1) < 0) {
- if (errno != EINTR)
+ if (errno != EINTR) {
pr_fail("%s: semop signal failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
+ }
break;
}
timed_out:
@@ -208,9 +213,11 @@ timed_out:
memset(&ds, 0, sizeof(ds));
s.buf = &ds;
- if (semctl(sem_id, 0, IPC_STAT, &s) < 0)
+ if (semctl(sem_id, 0, IPC_STAT, &s) < 0) {
pr_fail("%s: semctl IPC_STAT failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
+ }
#if defined(GETALL)
/* Avoid zero array size allocation */
@@ -221,11 +228,13 @@ timed_out:
if (semctl(sem_id, 0, GETALL, s) < 0) {
pr_fail("%s: semctl GETALL failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
}
#if defined(SETALL)
if (semctl(sem_id, 0, SETALL, s) < 0) {
pr_fail("%s: semctl SETALL failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
}
#endif
free(s.array);
@@ -239,9 +248,11 @@ timed_out:
stress_semun_t s;
s.buf = &ds;
- if (semctl(sem_id, 0, SEM_STAT, &s) < 0)
+ if (semctl(sem_id, 0, SEM_STAT, &s) < 0) {
pr_fail("%s: semctl SET_STAT failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
+ }
}
#endif
#if defined(IPC_INFO) && defined(__linux__)
@@ -250,9 +261,11 @@ timed_out:
stress_semun_t s;
s.__buf = &si;
- if (semctl(sem_id, 0, IPC_INFO, &s) < 0)
+ if (semctl(sem_id, 0, IPC_INFO, &s) < 0) {
pr_fail("%s: semctl IPC_INFO failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
+ }
}
#endif
#if defined(SEM_INFO) && defined(__linux__)
@@ -261,32 +274,103 @@ timed_out:
stress_semun_t s;
s.__buf = &si;
- if (semctl(sem_id, 0, SEM_INFO, &s) < 0)
+ if (semctl(sem_id, 0, SEM_INFO, &s) < 0) {
pr_fail("%s: semctl SEM_INFO failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
+ }
}
#endif
#if defined(GETVAL)
- if (semctl(sem_id, 0, GETVAL) < 0)
+ if (semctl(sem_id, 0, GETVAL) < 0) {
pr_fail("%s: semctl GETVAL failed, errno=%d (%s)\n",
args->name, errno, strerror(errno));
+ rc = EXIT_FAILURE;
+ }