]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
thread: Exclude thread_main() from AddressSanitizer
authorTobias Brunner <tobias@strongswan.org>
Tue, 29 Nov 2022 15:51:06 +0000 (16:51 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 2 Dec 2022 13:56:31 +0000 (14:56 +0100)
With GCC 11.3 AddressSanitizer causes the following crash when a thread
is cancelled (e.g. in the test_condvar_cancel test):

==84365==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/asan/asan_thread.cpp:367 "((ptr[0] == kCurrentStackFrameMagic)) != (0)" (0x0, 0x0)
    #0 0x7ff0801b2988 in AsanCheckFailed ../../../../src/libsanitizer/asan/asan_rtl.cpp:74
    #1 0x7ff0801d330e in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) ../../../../src/libsanitizer/sanitizer_common/sanitizer_termination.cpp:78
    #2 0x7ff0801b810c in __asan::AsanThread::GetStackFrameAccessByAddr(unsigned long, __asan::AsanThread::StackFrameAccess*) ../../../../src/libsanitizer/asan/asan_thread.cpp:367
    #3 0x7ff080122e9b in __asan::GetStackAddressInformation(unsigned long, unsigned long, __asan::StackAddressDescription*) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:203
    #4 0x7ff0801242d8 in __asan::AddressDescription::AddressDescription(unsigned long, unsigned long, bool) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:455
    #5 0x7ff0801242d8 in __asan::AddressDescription::AddressDescription(unsigned long, unsigned long, bool) ../../../../src/libsanitizer/asan/asan_descriptions.cpp:439
    #6 0x7ff080126a84 in __asan::ErrorGeneric::ErrorGeneric(unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long) ../../../../src/libsanitizer/asan/asan_errors.cpp:389
    #7 0x7ff0801b1fa5 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) ../../../../src/libsanitizer/asan/asan_report.cpp:476
    #8 0x7ff080148fe8 in __interceptor_sigaltstack ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:9986
    #9 0x7ff0801af473 in __asan::PlatformUnpoisonStacks() ../../../../src/libsanitizer/asan/asan_posix.cpp:44
    #10 0x7ff0801b500c in __asan_handle_no_return ../../../../src/libsanitizer/asan/asan_rtl.cpp:612
    #11 0x7ff07fe04d50 in thread_main /media/sf_scratch/src/libstrongswan/threading/thread.c:321
    #12 0x7ff07d7d4b42 in start_thread nptl/pthread_create.c:442
    #13 0x7ff07d8669ff  (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff)

src/libstrongswan/threading/thread.c

index b4ff4a1dada4e0d260fadea6dab858e06922e841..d132c940aab363f8e48002ec7d5dd11a8a3472cb 100644 (file)
@@ -306,7 +306,11 @@ static void thread_cleanup(private_thread_t *this)
 
 /**
  * Main function wrapper for threads.
+ *
+ * Excluded from AddressSanitizer because some newer versions have an issue that
+ * causes an "AddressSanitizer CHECK failed" error for cancelled threads.
  */
+ADDRESS_SANITIZER_EXCLUDE
 static void *thread_main(private_thread_t *this)
 {
        void *res;