Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] igt_core: Avoid exit_subtest in subthread
@ 2023-06-12 17:19 Kamil Konieczny
  2023-06-12 18:35 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kamil Konieczny @ 2023-06-12 17:19 UTC (permalink / raw)
  To: igt-dev

From: Petri Latvala <petri.latvala@intel.com>

If a thread crashes, the signal handler for SIGSEGV and pals try to
make the subtest fail and eventually longjmps out of the
subtest. Naturally this can cause multiple threads to yield subtest
results and other weirdness.

We already check for non-main-thread in igt_fail_assert() but the path
from a signal handler to subtest exit doesn't have such protection.

Cc: Petri Latvala <adrinael@adrinael.net>
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 lib/igt_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index cd9c2002d..1d8e3a6ee 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -1585,6 +1585,11 @@ __noreturn static void exit_subtest(const char *result)
 	struct timespec *thentime = in_dynamic_subtest ? &dynamic_subtest_time : &subtest_time;
 	jmp_buf *jmptarget = in_dynamic_subtest ? &igt_dynamic_jmpbuf : &igt_subtest_jmpbuf;
 
+	if (!igt_thread_is_main()) {
+		igt_thread_fail();
+		pthread_exit(NULL);
+	}
+
 	igt_gettime(&now);
 
 	if (test_multi_fork_child)
-- 
2.39.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-16  9:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12 17:19 [igt-dev] [PATCH i-g-t] igt_core: Avoid exit_subtest in subthread Kamil Konieczny
2023-06-12 18:35 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-06-13  3:24 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-06-13 16:38   ` Kamil Konieczny
2023-06-15 12:58     ` Yedireswarapu, SaiX Nandan
2023-06-15 12:54 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2023-06-16  9:53 ` [igt-dev] [PATCH i-g-t] " Zbigniew Kempczyński

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox