summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-04-16 20:11:56 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-04-16 20:11:56 -0700
commit440d6635b20037bc9ad46b20817d7b61cef0fc1b (patch)
tree1a5e8962ae974aff248dbf594ae39f237b6c637f /tools/testing
parent0b2f2b1fc0c61e602a6babf580b91f895b0ea80a (diff)
parent70b672833f4025341c11b22c7f83778a5cd611bc (diff)
downloadlinux-next-440d6635b20037bc9ad46b20817d7b61cef0fc1b.tar.gz
linux-next-440d6635b20037bc9ad46b20817d7b61cef0fc1b.zip
Merge tag 'mm-nonmm-stable-2026-04-15-04-20' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull non-MM updates from Andrew Morton: - "pid: make sub-init creation retryable" (Oleg Nesterov) Make creation of init in a new namespace more robust by clearing away some historical cruft which is no longer needed. Also some documentation fixups - "selftests/fchmodat2: Error handling and general" (Mark Brown) Fix and a cleanup for the fchmodat2() syscall selftest - "lib: polynomial: Move to math/ and clean up" (Andy Shevchenko) - "hung_task: Provide runtime reset interface for hung task detector" (Aaron Tomlin) Give administrators the ability to zero out /proc/sys/kernel/hung_task_detect_count - "tools/getdelays: use the static UAPI headers from tools/include/uapi" (Thomas Weißschuh) Teach getdelays to use the in-kernel UAPI headers rather than the system-provided ones - "watchdog/hardlockup: Improvements to hardlockup" (Mayank Rungta) Several cleanups and fixups to the hardlockup detector code and its documentation - "lib/bch: fix undefined behavior from signed left-shifts" (Josh Law) A couple of small/theoretical fixes in the bch code - "ocfs2/dlm: fix two bugs in dlm_match_regions()" (Junrui Luo) - "cleanup the RAID5 XOR library" (Christoph Hellwig) A quite far-reaching cleanup to this code. I can't do better than to quote Christoph: "The XOR library used for the RAID5 parity is a bit of a mess right now. The main file sits in crypto/ despite not being cryptography and not using the crypto API, with the generic implementations sitting in include/asm-generic and the arch implementations sitting in an asm/ header in theory. The latter doesn't work for many cases, so architectures often build the code directly into the core kernel, or create another module for the architecture code. Change this to a single module in lib/ that also contains the architecture optimizations, similar to the library work Eric Biggers has done for the CRC and crypto libraries later. After that it changes to better calling conventions that allow for smarter architecture implementations (although none is contained here yet), and uses static_call to avoid indirection function call overhead" - "lib/list_sort: Clean up list_sort() scheduling workarounds" (Kuan-Wei Chiu) Clean up this library code by removing a hacky thing which was added for UBIFS, which UBIFS doesn't actually need - "Fix bugs in extract_iter_to_sg()" (Christian Ehrhardt) Fix a few bugs in the scatterlist code, add in-kernel tests for the now-fixed bugs and fix a leak in the test itself - "kdump: Enable LUKS-encrypted dump target support in ARM64 and PowerPC" (Coiby Xu) Enable support of the LUKS-encrypted device dump target on arm64 and powerpc - "ocfs2: consolidate extent list validation into block read callbacks" (Joseph Qi) Cleanup, simplify, and make more robust ocfs2's validation of extent list fields (Kernel test robot loves mounting corrupted fs images!) * tag 'mm-nonmm-stable-2026-04-15-04-20' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (127 commits) ocfs2: validate group add input before caching ocfs2: validate bg_bits during freefrag scan ocfs2: fix listxattr handling when the buffer is full doc: watchdog: fix typos etc update Sean's email address ocfs2: use get_random_u32() where appropriate ocfs2: split transactions in dio completion to avoid credit exhaustion ocfs2: remove redundant l_next_free_rec check in __ocfs2_find_path() ocfs2: validate extent block list fields during block read ocfs2: remove empty extent list check in ocfs2_dx_dir_lookup_rec() ocfs2: validate dx_root extent list fields during block read ocfs2: fix use-after-free in ocfs2_fault() when VM_FAULT_RETRY ocfs2: handle invalid dinode in ocfs2_group_extend .get_maintainer.ignore: add Askar ocfs2: validate bg_list extent bounds in discontig groups checkpatch: exclude forward declarations of const structs tools/accounting: handle truncated taskstats netlink messages taskstats: set version in TGID exit notifications ocfs2/heartbeat: fix slot mapping rollback leaks on error paths arm64,ppc64le/kdump: pass dm-crypt keys to kdump kernel ...
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/breakpoints/Makefile4
-rw-r--r--tools/testing/selftests/fchmodat2/fchmodat2_test.c166
-rw-r--r--tools/testing/selftests/ipc/Makefile8
-rw-r--r--tools/testing/selftests/ipc/msgque.c3
-rw-r--r--tools/testing/selftests/prctl/Makefile4
-rw-r--r--tools/testing/selftests/sparc64/Makefile4
-rw-r--r--tools/testing/selftests/thermal/intel/power_floor/Makefile4
-rw-r--r--tools/testing/selftests/thermal/intel/workload_hint/Makefile4
8 files changed, 129 insertions, 68 deletions
diff --git a/tools/testing/selftests/breakpoints/Makefile b/tools/testing/selftests/breakpoints/Makefile
index 9ec2c78de8ca..0b8f5acf7c78 100644
--- a/tools/testing/selftests/breakpoints/Makefile
+++ b/tools/testing/selftests/breakpoints/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
# Taken from perf makefile
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
TEST_GEN_PROGS := step_after_suspend_test
diff --git a/tools/testing/selftests/fchmodat2/fchmodat2_test.c b/tools/testing/selftests/fchmodat2/fchmodat2_test.c
index e397339495f6..8e1b6384b319 100644
--- a/tools/testing/selftests/fchmodat2/fchmodat2_test.c
+++ b/tools/testing/selftests/fchmodat2/fchmodat2_test.c
@@ -9,6 +9,11 @@
#include "kselftest.h"
+struct testdir {
+ char *dirname;
+ int dfd;
+};
+
int sys_fchmodat2(int dfd, const char *filename, mode_t mode, int flags)
{
int ret = syscall(__NR_fchmodat2, dfd, filename, mode, flags);
@@ -16,9 +21,9 @@ int sys_fchmodat2(int dfd, const char *filename, mode_t mode, int flags)
return ret >= 0 ? ret : -errno;
}
-int setup_testdir(void)
+static void setup_testdir(struct testdir *testdir)
{
- int dfd, ret;
+ int ret, dfd;
char dirname[] = "/tmp/ksft-fchmodat2.XXXXXX";
/* Make the top-level directory. */
@@ -26,21 +31,48 @@ int setup_testdir(void)
ksft_exit_fail_msg("%s: failed to create tmpdir\n", __func__);
dfd = open(dirname, O_PATH | O_DIRECTORY);
- if (dfd < 0)
- ksft_exit_fail_msg("%s: failed to open tmpdir\n", __func__);
+ if (dfd < 0) {
+ ksft_perror("failed to open tmpdir");
+ goto err;
+ }
ret = openat(dfd, "regfile", O_CREAT | O_WRONLY | O_TRUNC, 0644);
- if (ret < 0)
- ksft_exit_fail_msg("%s: failed to create file in tmpdir\n",
- __func__);
+ if (ret < 0) {
+ ksft_perror("failed to create file in tmpdir");
+ goto err;
+ }
close(ret);
ret = symlinkat("regfile", dfd, "symlink");
- if (ret < 0)
- ksft_exit_fail_msg("%s: failed to create symlink in tmpdir\n",
- __func__);
+ if (ret < 0) {
+ ksft_perror("symlinkat() failed");
+ goto err_regfile;
+ }
+
+ testdir->dirname = strdup(dirname);
+ if (!testdir->dirname) {
+ ksft_perror("Out of memory");
+ goto err_symlink;
+ }
+ testdir->dfd = dfd;
+
+ return;
+
+err_symlink:
+ unlinkat(testdir->dfd, "symlink", 0);
+err_regfile:
+ unlinkat(testdir->dfd, "regfile", 0);
+err:
+ unlink(dirname);
+ ksft_exit_fail();
+}
- return dfd;
+static void cleanup_testdir(struct testdir *testdir)
+{
+ unlinkat(testdir->dfd, "regfile", 0);
+ unlinkat(testdir->dfd, "symlink", 0);
+ rmdir(testdir->dirname);
+ free(testdir->dirname);
}
int expect_mode(int dfd, const char *filename, mode_t expect_mode)
@@ -48,61 +80,80 @@ int expect_mode(int dfd, const char *filename, mode_t expect_mode)
struct stat st;
int ret = fstatat(dfd, filename, &st, AT_SYMLINK_NOFOLLOW);
- if (ret)
- ksft_exit_fail_msg("%s: %s: fstatat failed\n",
- __func__, filename);
+ if (ret) {
+ ksft_perror("fstatat() failed\n");
+ return 0;
+ }
return (st.st_mode == expect_mode);
}
void test_regfile(void)
{
- int dfd, ret;
-
- dfd = setup_testdir();
-
- ret = sys_fchmodat2(dfd, "regfile", 0640, 0);
-
- if (ret < 0)
- ksft_exit_fail_msg("%s: fchmodat2(noflag) failed\n", __func__);
+ struct testdir testdir;
+ int ret;
- if (!expect_mode(dfd, "regfile", 0100640))
- ksft_exit_fail_msg("%s: wrong file mode bits after fchmodat2\n",
- __func__);
+ setup_testdir(&testdir);
- ret = sys_fchmodat2(dfd, "regfile", 0600, AT_SYMLINK_NOFOLLOW);
+ ret = sys_fchmodat2(testdir.dfd, "regfile", 0640, 0);
- if (ret < 0)
- ksft_exit_fail_msg("%s: fchmodat2(AT_SYMLINK_NOFOLLOW) failed\n",
- __func__);
+ if (ret < 0) {
+ ksft_perror("fchmodat2(noflag) failed");
+ goto out;
+ }
- if (!expect_mode(dfd, "regfile", 0100600))
- ksft_exit_fail_msg("%s: wrong file mode bits after fchmodat2 with nofollow\n",
+ if (!expect_mode(testdir.dfd, "regfile", 0100640)) {
+ ksft_print_msg("%s: wrong file mode bits after fchmodat2\n",
__func__);
-
- ksft_test_result_pass("fchmodat2(regfile)\n");
+ ret = 1;
+ goto out;
+ }
+
+ ret = sys_fchmodat2(testdir.dfd, "regfile", 0600, AT_SYMLINK_NOFOLLOW);
+
+ if (ret < 0) {
+ ksft_perror("fchmodat2(AT_SYMLINK_NOFOLLOW) failed");
+ goto out;
+ }
+
+ if (!expect_mode(testdir.dfd, "regfile", 0100600)) {
+ ksft_print_msg("%s: wrong file mode bits after fchmodat2 with nofollow\n",
+ __func__);
+ ret = 1;
+ }
+
+out:
+ ksft_test_result(ret == 0, "fchmodat2(regfile)\n");
+ cleanup_testdir(&testdir);
}
void test_symlink(void)
{
- int dfd, ret;
+ struct testdir testdir;
+ int ret;
- dfd = setup_testdir();
+ setup_testdir(&testdir);
- ret = sys_fchmodat2(dfd, "symlink", 0640, 0);
+ ret = sys_fchmodat2(testdir.dfd, "symlink", 0640, 0);
- if (ret < 0)
- ksft_exit_fail_msg("%s: fchmodat2(noflag) failed\n", __func__);
+ if (ret < 0) {
+ ksft_perror("fchmodat2(noflag) failed");
+ goto err;
+ }
- if (!expect_mode(dfd, "regfile", 0100640))
- ksft_exit_fail_msg("%s: wrong file mode bits after fchmodat2\n",
- __func__);
+ if (!expect_mode(testdir.dfd, "regfile", 0100640)) {
+ ksft_print_msg("%s: wrong file mode bits after fchmodat2\n",
+ __func__);
+ goto err;
+ }
- if (!expect_mode(dfd, "symlink", 0120777))
- ksft_exit_fail_msg("%s: wrong symlink mode bits after fchmodat2\n",
- __func__);
+ if (!expect_mode(testdir.dfd, "symlink", 0120777)) {
+ ksft_print_msg("%s: wrong symlink mode bits after fchmodat2\n",
+ __func__);
+ goto err;
+ }
- ret = sys_fchmodat2(dfd, "symlink", 0600, AT_SYMLINK_NOFOLLOW);
+ ret = sys_fchmodat2(testdir.dfd, "symlink", 0600, AT_SYMLINK_NOFOLLOW);
/*
* On certain filesystems (xfs or btrfs), chmod operation fails. So we
@@ -111,18 +162,28 @@ void test_symlink(void)
*
* https://sourceware.org/legacy-ml/libc-alpha/2020-02/msg00467.html
*/
- if (ret == 0 && !expect_mode(dfd, "symlink", 0120600))
- ksft_exit_fail_msg("%s: wrong symlink mode bits after fchmodat2 with nofollow\n",
+ if (ret == 0 && !expect_mode(testdir.dfd, "symlink", 0120600)) {
+ ksft_print_msg("%s: wrong symlink mode bits after fchmodat2 with nofollow\n",
__func__);
+ ret = 1;
+ goto err;
+ }
- if (!expect_mode(dfd, "regfile", 0100640))
- ksft_exit_fail_msg("%s: wrong file mode bits after fchmodat2 with nofollow\n",
- __func__);
+ if (!expect_mode(testdir.dfd, "regfile", 0100640)) {
+ ksft_print_msg("%s: wrong file mode bits after fchmodat2 with nofollow\n",
+ __func__);
+ }
if (ret != 0)
ksft_test_result_skip("fchmodat2(symlink)\n");
else
ksft_test_result_pass("fchmodat2(symlink)\n");
+ cleanup_testdir(&testdir);
+ return;
+
+err:
+ ksft_test_result_fail("fchmodat2(symlink)\n");
+ cleanup_testdir(&testdir);
}
#define NUM_TESTS 2
@@ -135,8 +196,5 @@ int main(int argc, char **argv)
test_regfile();
test_symlink();
- if (ksft_get_fail_cnt() + ksft_get_error_cnt() > 0)
- ksft_exit_fail();
- else
- ksft_exit_pass();
+ ksft_finished();
}
diff --git a/tools/testing/selftests/ipc/Makefile b/tools/testing/selftests/ipc/Makefile
index 50e9c299fc4a..fad10f2bb57b 100644
--- a/tools/testing/selftests/ipc/Makefile
+++ b/tools/testing/selftests/ipc/Makefile
@@ -1,12 +1,12 @@
# SPDX-License-Identifier: GPL-2.0
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/i386/)
ifeq ($(ARCH),i386)
- ARCH := x86
+ override ARCH := x86
CFLAGS := -DCONFIG_X86_32 -D__i386__
endif
ifeq ($(ARCH),x86_64)
- ARCH := x86
+ override ARCH := x86
CFLAGS := -DCONFIG_X86_64 -D__x86_64__
endif
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index e107379d185c..82f73cdae120 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -161,6 +161,9 @@ int dump_queue(struct msgque_data *msgque)
ret = msgrcv(msgque->msq_id, &msgque->messages[i].mtype,
MAX_MSG_SIZE, i, IPC_NOWAIT | MSG_COPY);
if (ret < 0) {
+ if (errno == ENOSYS)
+ ksft_exit_skip("MSG_COPY not supported\n");
+
ksft_test_result_fail("Failed to copy IPC message: %m (%d)\n", errno);
return -errno;
}
diff --git a/tools/testing/selftests/prctl/Makefile b/tools/testing/selftests/prctl/Makefile
index 01dc90fbb509..e770e86fad9a 100644
--- a/tools/testing/selftests/prctl/Makefile
+++ b/tools/testing/selftests/prctl/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
ifeq ($(ARCH),x86)
TEST_PROGS := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \
diff --git a/tools/testing/selftests/sparc64/Makefile b/tools/testing/selftests/sparc64/Makefile
index a19531dba4dc..88f7be76f962 100644
--- a/tools/testing/selftests/sparc64/Makefile
+++ b/tools/testing/selftests/sparc64/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/x86_64/x86/)
ifneq ($(ARCH),sparc64)
nothing:
diff --git a/tools/testing/selftests/thermal/intel/power_floor/Makefile b/tools/testing/selftests/thermal/intel/power_floor/Makefile
index 9b88e57dbba5..07463c2160e0 100644
--- a/tools/testing/selftests/thermal/intel/power_floor/Makefile
+++ b/tools/testing/selftests/thermal/intel/power_floor/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
ifeq ($(ARCH),x86)
TEST_GEN_PROGS := power_floor_test
diff --git a/tools/testing/selftests/thermal/intel/workload_hint/Makefile b/tools/testing/selftests/thermal/intel/workload_hint/Makefile
index 37ff3286283b..49e3bc2b20f9 100644
--- a/tools/testing/selftests/thermal/intel/workload_hint/Makefile
+++ b/tools/testing/selftests/thermal/intel/workload_hint/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
ifndef CROSS_COMPILE
-uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+override ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
ifeq ($(ARCH),x86)
TEST_GEN_PROGS := workload_hint_test