public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Martin Doucha <mdoucha@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/3] cve-2015-3290: Exit after 1000 failures
Date: Mon, 14 Oct 2024 18:02:13 +0200	[thread overview]
Message-ID: <20241014160217.28824-2-mdoucha@suse.cz> (raw)
In-Reply-To: <20241014160217.28824-1-mdoucha@suse.cz>

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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-10-14 16:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-14 16:02 [LTP] [PATCH 1/3] cve-2015-3290: Make stack selector and CPU flags check more verbose Martin Doucha
2024-10-14 16:02 ` Martin Doucha [this message]
2024-10-14 16:02 ` [LTP] [PATCH 3/3] cve-2015-3290: Allow early test exit Martin Doucha
2024-10-15  8:32 ` [LTP] [PATCH 1/3] cve-2015-3290: Make stack selector and CPU flags check more verbose Martin Doucha
2024-10-15 18:57   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241014160217.28824-2-mdoucha@suse.cz \
    --to=mdoucha@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox