[LTP] [PATCH 01/13] tst_test: Add may_kmemleak flag and annotate tests
Cyril Hrubis
chrubis@suse.cz
Wed Jun 24 11:18:48 CEST 2026
This information was so far recoded only in the comment in the cve
runtest file. Move it to the test so that it appears in the metadata.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
include/tst_test.h | 6 +++++-
metadata/metaparse.c | 1 +
testcases/cve/cve-2022-4378.c | 1 +
testcases/cve/cve-2025-21756.c | 1 +
testcases/cve/cve-2025-38236.c | 1 +
testcases/kernel/crypto/af_alg08.c | 1 +
testcases/kernel/syscalls/fsconfig/fsconfig03.c | 1 +
testcases/kernel/syscalls/io_uring/io_uring04.c | 1 +
.../kernel/syscalls/perf_event_open/perf_event_open03.c | 1 +
testcases/network/sockets/xfrm01.c | 1 +
testcases/network/sockets/xfrm02.c | 1 +
testcases/network/sockets/xfrm03.c | 1 +
12 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/include/tst_test.h b/include/tst_test.h
index c69362485..4afe4cbe0 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -353,6 +353,10 @@ struct tst_fs {
* needed for tests that need to create device files since tmpfs
* at /tmp is usually mounted with 'nodev' option.
*
+ * @may_kmemleak: If set the test may cause a kernel memory leak. If such test
+ * fails it's a good idea to reboot before continuing with
+ * subsequent testcases.
+ *
* @restore_wallclock: Saves wall clock at the start of the test and restores
* it at the end with the help of monotonic timers.
* Testcases that modify system wallclock use this to
@@ -575,7 +579,7 @@ struct tst_fs {
unsigned int skip_in_lockdown:1;
unsigned int skip_in_secureboot:1;
unsigned int skip_in_compat:1;
-
+ unsigned int may_kmemleak:1;
int needs_abi_bits;
diff --git a/metadata/metaparse.c b/metadata/metaparse.c
index a0f94511d..532cbe405 100644
--- a/metadata/metaparse.c
+++ b/metadata/metaparse.c
@@ -1141,6 +1141,7 @@ static struct typemap tst_test_typemap[] = {
{.id = "needs_hugetlbfs", .type = DATA_BOOL},
{.id = "needs_cgroup_nsdelegate", .type = DATA_BOOL},
{.id = "needs_cmds", .child = needs_cmds_typemap},
+ {.id = "may_kmemleak", .type = DATA_BOOL},
{}
};
diff --git a/testcases/cve/cve-2022-4378.c b/testcases/cve/cve-2022-4378.c
index 1cb8ea76c..8213d1b20 100644
--- a/testcases/cve/cve-2022-4378.c
+++ b/testcases/cve/cve-2022-4378.c
@@ -86,6 +86,7 @@ static struct tst_test test = {
.tcnt = ARRAY_SIZE(testcase_list),
.setup = setup,
.cleanup = cleanup,
+ .may_kmemleak = 1,
.taint_check = TST_TAINT_W | TST_TAINT_D,
.needs_kconfigs = (const char *[]) {
"CONFIG_USER_NS=y",
diff --git a/testcases/cve/cve-2025-21756.c b/testcases/cve/cve-2025-21756.c
index 80fb84c47..edc6b2aa5 100644
--- a/testcases/cve/cve-2025-21756.c
+++ b/testcases/cve/cve-2025-21756.c
@@ -87,6 +87,7 @@ static void run(void)
static struct tst_test test = {
.test_all = run,
.taint_check = TST_TAINT_W | TST_TAINT_D,
+ .may_kmemleak = 1,
.tags = (const struct tst_tag[]) {
{"linux-git", "fcdd2242c023"},
{"CVE", "2025-21756"},
diff --git a/testcases/cve/cve-2025-38236.c b/testcases/cve/cve-2025-38236.c
index 16582fe64..f6199c06b 100644
--- a/testcases/cve/cve-2025-38236.c
+++ b/testcases/cve/cve-2025-38236.c
@@ -88,6 +88,7 @@ static struct tst_test test = {
.test_all = run,
.setup = setup,
.cleanup = cleanup,
+ .may_kmemleak = 1,
.needs_kconfigs = (const char *[]) {
"CONFIG_AF_UNIX_OOB=y",
NULL
diff --git a/testcases/kernel/crypto/af_alg08.c b/testcases/kernel/crypto/af_alg08.c
index 937ab1758..2de7aba97 100644
--- a/testcases/kernel/crypto/af_alg08.c
+++ b/testcases/kernel/crypto/af_alg08.c
@@ -159,6 +159,7 @@ static struct tst_test test = {
.test_all = run,
.cleanup = cleanup,
.needs_tmpdir = 1,
+ .may_kmemleak = 1,
.tags = (const struct tst_tag[]) {
{"linux-git", "a664bf3d603d"},
{"CVE", "2026-31431"},
diff --git a/testcases/kernel/syscalls/fsconfig/fsconfig03.c b/testcases/kernel/syscalls/fsconfig/fsconfig03.c
index 43fd4c4a8..68f073836 100644
--- a/testcases/kernel/syscalls/fsconfig/fsconfig03.c
+++ b/testcases/kernel/syscalls/fsconfig/fsconfig03.c
@@ -88,6 +88,7 @@ static struct tst_test test = {
.format_device = 1,
.mntpoint = MNTPOINT,
.all_filesystems = 1,
+ .may_kmemleak = 1,
.taint_check = TST_TAINT_W | TST_TAINT_D,
.skip_filesystems = (const char *const []){"fuse", NULL},
.tags = (const struct tst_tag[]) {
diff --git a/testcases/kernel/syscalls/io_uring/io_uring04.c b/testcases/kernel/syscalls/io_uring/io_uring04.c
index 026caf334..f3b44749e 100644
--- a/testcases/kernel/syscalls/io_uring/io_uring04.c
+++ b/testcases/kernel/syscalls/io_uring/io_uring04.c
@@ -344,6 +344,7 @@ static struct tst_test test = {
.timeout = 60,
.forks_child = 1,
.taint_check = TST_TAINT_W | TST_TAINT_D,
+ .may_kmemleak = 1,
.needs_kconfigs = (const char *[]) {
"CONFIG_RDS",
"CONFIG_RDS_TCP",
diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open03.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open03.c
index 389cc3511..cfd563d81 100644
--- a/testcases/kernel/syscalls/perf_event_open/perf_event_open03.c
+++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open03.c
@@ -127,6 +127,7 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.needs_root = 1,
+ .may_kmemleak = 1,
.runtime = 300,
.tags = (const struct tst_tag[]) {
{"linux-git", "7bdb157cdebb"},
diff --git a/testcases/network/sockets/xfrm01.c b/testcases/network/sockets/xfrm01.c
index 2ca77c40f..33905f2a6 100644
--- a/testcases/network/sockets/xfrm01.c
+++ b/testcases/network/sockets/xfrm01.c
@@ -261,6 +261,7 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.needs_tmpdir = 1,
+ .may_kmemleak = 1,
.needs_kconfigs = (const char *[]) {
"CONFIG_USER_NS=y",
"CONFIG_NET_NS=y",
diff --git a/testcases/network/sockets/xfrm02.c b/testcases/network/sockets/xfrm02.c
index cef9e7060..f99b7b53a 100644
--- a/testcases/network/sockets/xfrm02.c
+++ b/testcases/network/sockets/xfrm02.c
@@ -251,6 +251,7 @@ static struct tst_test test = {
.cleanup = cleanup,
.needs_tmpdir = 1,
.forks_child = 1,
+ .may_kmemleak = 1,
.needs_kconfigs = (const char *[]) {
"CONFIG_USER_NS=y",
"CONFIG_NET_NS=y",
diff --git a/testcases/network/sockets/xfrm03.c b/testcases/network/sockets/xfrm03.c
index 676c76e2b..2c83e3ae3 100644
--- a/testcases/network/sockets/xfrm03.c
+++ b/testcases/network/sockets/xfrm03.c
@@ -342,6 +342,7 @@ static struct tst_test test = {
.cleanup = cleanup,
.needs_tmpdir = 1,
.forks_child = 1,
+ .may_kmemleak = 1,
.needs_kconfigs = (const char *[]) {
"CONFIG_USER_NS=y",
"CONFIG_NET_NS=y",
--
2.53.0
More information about the ltp
mailing list