Fix SSE2-related false positives with thread sanitizer
TSAN has the same issue as ASAN when it comes to the SSE2 usage here. WARNING: ThreadSanitizer: heap-use-after-free (pid=621) Read of size 8 at 0x721000049f78 by main thread: #0 _mm_load_si128(long long __vector(2) const*) /usr/lib64/gcc/x86_64-suse-linux/13/include/emmintrin.h:700 (libQt6Core.so.6+0x2ba056) #1 qustrlen_sse2 qtbase/src/corelib/text/qstring.cpp:431 (libQt6Core.so.6+0x2ba056) [...] Previous write of size 8 at 0x721000049f78 by main thread: #0 realloc <null> (libtsan.so.2+0x5bdbd) #1 QArrayData::reallocateUnaligned(QArrayData*, void*, long long, long long, QArrayData::AllocationOption) qtbase/src/corelib/tools/qarraydata.cpp:244 (libQt6Core.so.6+0x309913) [...] (gcc 13.3.0) Pick-to: 6.7 Change-Id: Id0127d5fb498dcf78bb977e6ff1b6b380ae423c7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 600368279dafa60e788d8e3cd3af5c1915990fbb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
1ffe93ae5d
commit
72c97d17bc
@ -361,7 +361,7 @@ extern "C" void qt_toLatin1_mips_dsp_asm(uchar *dst, const char16_t *src, int le
|
||||
#if defined(__SSE2__) && defined(Q_CC_GNU)
|
||||
// We may overrun the buffer, but that's a false positive:
|
||||
// this won't crash nor produce incorrect results
|
||||
# define ATTRIBUTE_NO_SANITIZE __attribute__((__no_sanitize_address__))
|
||||
# define ATTRIBUTE_NO_SANITIZE __attribute__((__no_sanitize_address__, __no_sanitize_thread__))
|
||||
#else
|
||||
# define ATTRIBUTE_NO_SANITIZE
|
||||
#endif
|
||||
@ -657,7 +657,7 @@ static int ucstrncmp_sse2(const char16_t *a, const Char *b, size_t l)
|
||||
Q_NEVER_INLINE
|
||||
qsizetype QtPrivate::qustrlen(const char16_t *str) noexcept
|
||||
{
|
||||
#if defined(__SSE2__) && !(defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer))
|
||||
#if defined(__SSE2__) && !(defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)) && !(defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer))
|
||||
return qustrlen_sse2(str);
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user