From e63d43b26ee5e56e75fe301868f13b46c059ec31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Wed, 3 Jun 2026 11:50:28 +0200 Subject: [PATCH] tests: skip the `SIGEV_THREAD` code path in `test_privcand` under TSAN This particular check leads to a code path in netopeer2-server which starts a background thread via the C library, and that causes a segfault in TSAN's internals. Yay. Fixes: https://github.com/CESNET/netopeer2/issues/1810 Bug: https://github.com/google/sanitizers/issues/1612 --- tests/test_privcand.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_privcand.c b/tests/test_privcand.c index b8fd1ec0..33fc44c8 100644 --- a/tests/test_privcand.c +++ b/tests/test_privcand.c @@ -31,6 +31,14 @@ #include "np2_test.h" #include "np2_test_config.h" +#if defined (__has_feature) +# if __has_feature(thread_sanitizer) +# define NP2_TSAN +# endif +#elif defined (__SANITIZE_THREAD__) +# define NP2_TSAN +#endif + #define UPDATE_RPC(RES_MODE) \ " \n" \ " "RES_MODE"\n" \ @@ -408,6 +416,9 @@ test_pc_basic_commit(void **state) FREE_TEST_VARS(st); } +#ifndef NP2_TSAN +// This test a path in netopeer2 which starts a timer via the C library, and that makes TSAN segfault: +// https://github.com/google/sanitizers/issues/1612 static void test_pc_commit_timeout_runout(void **state) { @@ -478,6 +489,8 @@ test_pc_commit_timeout_runout(void **state) ASSERT_NO_NOTIF(st); } +#endif + static void test_pc_timeout_confirm(void **state) { @@ -929,7 +942,9 @@ main(int argc, char **argv) cmocka_unit_test(test_pc_lock_unlock), cmocka_unit_test_setup_teardown(test_pc_basic_commit, setup_common, teardown_common), +#ifndef NP2_TSAN cmocka_unit_test_setup_teardown(test_pc_commit_timeout_runout, setup_common, teardown_common), +#endif cmocka_unit_test_setup_teardown(test_pc_timeout_confirm, setup_common, teardown_common), cmocka_unit_test_setup_teardown(test_pc_timeout_confirm_modify, setup_common, teardown_common),