[LTP] [PATCH 2/3] cve-2015-3290: Exit after 1000 failures
Martin Doucha
mdoucha@suse.cz
Mon Oct 14 18:02:13 CEST 2024
On some kernels, the new error messages may produce millions of lines
of test output. Limit the maximum number of failures to avoid huge test
logs.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
testcases/cve/cve-2015-3290.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/testcases/cve/cve-2015-3290.c b/testcases/cve/cve-2015-3290.c
index 4185c22a7..3bdc0f8f0 100644
--- a/testcases/cve/cve-2015-3290.c
+++ b/testcases/cve/cve-2015-3290.c
@@ -178,8 +178,10 @@ static greg_t *csptr(ucontext_t *ctx)
#endif
#define LDT_SS 0x7
+#define MAX_FAILS 1000
static volatile long expected_rsp;
+static volatile int fail_count;
static int running = 1;
static void set_ldt(void)
@@ -320,11 +322,13 @@ static void try_corrupt_stack(unsigned short *orig_ss)
if (!(flags & (1 << 9))) {
tst_res(TFAIL, "Interrupt flag is disabled (0x%lx)", flags);
+ fail_count++;
}
if (new_ss != LDT_SS) {
tst_res(TFAIL, "Wrong stack selector 0x%lx, expected 0x%x",
new_ss, LDT_SS);
+ fail_count++;
}
}
@@ -417,6 +421,11 @@ static void *child_thread(void *arg)
* the system.
*/
syscall(0x3fffffff);
+
+ if (fail_count >= MAX_FAILS) {
+ tst_res(TINFO, "Too many failures, exiting");
+ break;
+ }
}
for (i = 0; i < ARRAY_SIZE(perf_events); i++)
@@ -456,6 +465,9 @@ static void do_child(void)
free(orig_ss);
free(threads);
+ if (fail_count)
+ exit(1);
+
tst_res(TPASS, "can't corrupt nested NMI state after %ld iterations",
total_iter);
}
--
2.46.0
More information about the ltp
mailing list