From 94ec17436cbdab52ed85e15ea197b538541b14ca Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 15 Jun 2023 15:16:42 -0700 Subject: [PATCH] QProcess/Unix: disable vfork() under ASan Pick-to: 6.5 6.6 Change-Id: I443cf0c8a76243eead33fffd1768ee771eca2d56 Reviewed-by: Volker Hilsheimer Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_unix.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index ed7c6fbeea7..eeaa52d3fd1 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -515,6 +515,10 @@ static QString resolveExecutable(const QString &program) 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) // 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