QProcess/Unix: disable vfork() under ASan

Pick-to: 6.5 6.6
Change-Id: I443cf0c8a76243eead33fffd1768ee771eca2d56
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Thiago Macieira 2023-06-15 15:16:42 -07:00
parent c4a0a76dec
commit 94ec17436c

View File

@ -515,6 +515,10 @@ static QString resolveExecutable(const QString &program)
static int useForkFlags(const QProcessPrivate::UnixExtras *unixExtras) static int useForkFlags(const QProcessPrivate::UnixExtras *unixExtras)
{ {
#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer)
// ASan writes to global memory, so we mustn't use vfork().
return FFD_USE_FORK;
#endif
#if defined(Q_OS_LINUX) && !QT_CONFIG(forkfd_pidfd) #if defined(Q_OS_LINUX) && !QT_CONFIG(forkfd_pidfd)
// some broken environments are known to have problems with the new Linux // some broken environments are known to have problems with the new Linux
// API, so we have a way for users to opt-out during configure time (see // API, so we have a way for users to opt-out during configure time (see