QProcess/Unix: detect ASan and TSan dynamically
Fixes: QTBUG-117533 Fixes: QTBUG-117954 Task-number: QTBUG-104493 Change-Id: I09c3950e719e4b259bc7fffd1793ee472c5d5a9a Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> (cherry picked from commit 7c4e271fe73f4775d308d5851c07bc21cdd08570) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 9962441bfd0cbb347cb24a685f14a932c0849bd9)
This commit is contained in:
parent
1dc98ca985
commit
f0e4f50fd1
@ -510,6 +510,10 @@ static QString resolveExecutable(const QString &program)
|
||||
return program;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
__attribute__((weak)) pid_t __interceptor_vfork();
|
||||
}
|
||||
|
||||
static int useForkFlags(const QProcessPrivate::UnixExtras *unixExtras)
|
||||
{
|
||||
#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
|
||||
@ -532,6 +536,12 @@ static int useForkFlags(const QProcessPrivate::UnixExtras *unixExtras)
|
||||
return FFD_USE_FORK;
|
||||
#endif
|
||||
|
||||
// Dynamically detect whether libasan or libtsan are loaded into the
|
||||
// process' memory. We need this because the user's code may be compiled
|
||||
// with ASan or TSan, but not Qt.
|
||||
if (__interceptor_vfork != nullptr)
|
||||
return FFD_USE_FORK;
|
||||
|
||||
if (!unixExtras || !unixExtras->childProcessModifier)
|
||||
return 0; // no modifier was supplied
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user