From c5ba3dc43eb5065c28f7578f9c91cbccbfd09b24 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mon, 13 Apr 2020 12:08:12 -0500 Subject: [PATCH 1/6] %build: -no-relocatable (#1823118) --- qt5-qtbase.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index 1f8aae9..d0ac709 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -53,7 +53,7 @@ BuildRequires: pkgconfig(libsystemd) Name: qt5-qtbase Summary: Qt5 - QtBase components Version: 5.14.2 -Release: 2%{?dist} +Release: 3%{?dist} # See LGPL_EXCEPTIONS.txt, for exception details License: LGPLv2 with exceptions or GPLv3 with exceptions @@ -474,6 +474,7 @@ export MAKEFLAGS="%{?_smp_mflags}" %{!?examples:-nomake examples} \ %{!?tests:-nomake tests} \ -no-pch \ + -no-relocatable \ -no-rpath \ -no-separate-debug-info \ %{?no_sse2} \ @@ -1041,6 +1042,9 @@ fi %changelog +* Mon Apr 13 2020 Rex Dieter - 5.14.2-3 +- %%build: -no-relocatable (#1823118) + * Wed Apr 08 2020 Than Ngo - 5.14.2-2 - Fixed bz#1801370 - CVE-2015-9541 XML entity expansion vulnerability via a crafted SVG document From 8d3281a25bd901c641cbec4b637d2a81203d5396 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mon, 13 Apr 2020 12:39:00 -0500 Subject: [PATCH 2/6] -no-feature-relocatable --- qt5-qtbase.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index d0ac709..ba648e9 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -474,7 +474,6 @@ export MAKEFLAGS="%{?_smp_mflags}" %{!?examples:-nomake examples} \ %{!?tests:-nomake tests} \ -no-pch \ - -no-relocatable \ -no-rpath \ -no-separate-debug-info \ %{?no_sse2} \ @@ -490,6 +489,7 @@ export MAKEFLAGS="%{?_smp_mflags}" -system-zlib \ %{?use_gold_linker} \ -no-directfb \ + -no-feature-relocatable \ %{?no_feature_renameat2} \ %{?no_feature_statx} \ QMAKE_CFLAGS_RELEASE="${CFLAGS:-$RPM_OPT_FLAGS}" \ @@ -1043,7 +1043,7 @@ fi %changelog * Mon Apr 13 2020 Rex Dieter - 5.14.2-3 -- %%build: -no-relocatable (#1823118) +- %%build: -no-feature-relocatable (#1823118) * Wed Apr 08 2020 Than Ngo - 5.14.2-2 - Fixed bz#1801370 - CVE-2015-9541 XML entity expansion vulnerability via a crafted SVG document From 6f111ade5948bf47030c876c3c7cd1f55ed14088 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mon, 13 Apr 2020 15:16:21 -0500 Subject: [PATCH 3/6] matching no_relocatable.patch workaround using relocatable heurstics even when building with -no-feature-relocatable --- qt5-qtbase.spec | 6 +++++- ...se-everywhere-src-5.14.2-no_relocatable.patch | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 qtbase-everywhere-src-5.14.2-no_relocatable.patch diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index ba648e9..1c761f9 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -106,6 +106,9 @@ Patch53: qtbase-everywhere-src-5.12.1-qt5gui_cmake_isystem_includes.patch # respect QMAKE_LFLAGS_RELEASE when building qmake Patch54: qtbase-qmake_LFLAGS.patch +# don't use relocatable heuristics to guess prefix when using -no-feature-relocatable +Patch55: qtbase-everywhere-src-5.14.2-no_relocatable.patch + # drop -O3 and make -O2 by default Patch61: qt5-qtbase-cxxflag.patch @@ -384,6 +387,7 @@ Qt5 libraries used for drawing widgets and OpenGL items. %patch52 -p1 -b .moc_macros %patch53 -p1 -b .qt5gui_cmake_isystem_includes %patch54 -p1 -b .qmake_LFLAGS +%patch54 -p1 -b .no_relocatable %patch61 -p1 -b .qt5-qtbase-cxxflag %patch64 -p1 -b .firebird %if 0%{?fedora} > 27 @@ -1043,7 +1047,7 @@ fi %changelog * Mon Apr 13 2020 Rex Dieter - 5.14.2-3 -- %%build: -no-feature-relocatable (#1823118) +- %%build: -no-feature-relocatable + matching patch (#1823118) * Wed Apr 08 2020 Than Ngo - 5.14.2-2 - Fixed bz#1801370 - CVE-2015-9541 XML entity expansion vulnerability via a crafted SVG document diff --git a/qtbase-everywhere-src-5.14.2-no_relocatable.patch b/qtbase-everywhere-src-5.14.2-no_relocatable.patch new file mode 100644 index 0000000..8471d1b --- /dev/null +++ b/qtbase-everywhere-src-5.14.2-no_relocatable.patch @@ -0,0 +1,16 @@ +diff -up qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp.no_relocatable qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp +--- qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp.no_relocatable 2020-03-27 04:49:31.000000000 -0500 ++++ qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp 2020-04-13 15:13:44.075705226 -0500 +@@ -671,8 +671,11 @@ static QString getPrefix( + # if QT_CONFIGURE_CROSSBUILD + if (group == QLibraryInfo::DevicePaths) + return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH); +-# endif ++# elif QT_CONFIG(relocatable) + return getExtPrefixFromHostBinDir(); ++# else ++ return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH); ++# endif + #elif QT_CONFIG(relocatable) + return getRelocatablePrefix(); + #else From d7278533140efd3755909b376139672533cd7f4c Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mon, 13 Apr 2020 17:04:51 -0500 Subject: [PATCH 4/6] fix patch55 --- qt5-qtbase.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index 1c761f9..71faee5 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -387,7 +387,7 @@ Qt5 libraries used for drawing widgets and OpenGL items. %patch52 -p1 -b .moc_macros %patch53 -p1 -b .qt5gui_cmake_isystem_includes %patch54 -p1 -b .qmake_LFLAGS -%patch54 -p1 -b .no_relocatable +%patch55 -p1 -b .no_relocatable %patch61 -p1 -b .qt5-qtbase-cxxflag %patch64 -p1 -b .firebird %if 0%{?fedora} > 27 From d8f1d7a524f3d94af875b7384f7c8217ca2d0bef Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Tue, 14 Apr 2020 09:09:53 -0500 Subject: [PATCH 5/6] patch FTBFS mysteriously, just hard-code for now --- qtbase-everywhere-src-5.14.2-no_relocatable.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qtbase-everywhere-src-5.14.2-no_relocatable.patch b/qtbase-everywhere-src-5.14.2-no_relocatable.patch index 8471d1b..56b9db8 100644 --- a/qtbase-everywhere-src-5.14.2-no_relocatable.patch +++ b/qtbase-everywhere-src-5.14.2-no_relocatable.patch @@ -6,7 +6,7 @@ diff -up qtbase-everywhere-src-5.14.2/src/corelib/global/qlibraryinfo.cpp.no_rel if (group == QLibraryInfo::DevicePaths) return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH); -# endif -+# elif QT_CONFIG(relocatable) ++# elif 0 //QT_CONFIG(relocatable) return getExtPrefixFromHostBinDir(); +# else + return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH); From 70363d088083eb55e461228527117af6a5c24e53 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Tue, 14 Apr 2020 11:25:08 -0500 Subject: [PATCH 6/6] backport "Mutex deadlock in QPluginLoader, Krita fails to start" (QTBUG-83207) --- ...eadlock-caused-by-fix-to-QTBUG-39642.patch | 109 ++++++++++++++++++ qt5-qtbase.spec | 7 +- 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 0044-QLibrary-fix-deadlock-caused-by-fix-to-QTBUG-39642.patch diff --git a/0044-QLibrary-fix-deadlock-caused-by-fix-to-QTBUG-39642.patch b/0044-QLibrary-fix-deadlock-caused-by-fix-to-QTBUG-39642.patch new file mode 100644 index 0000000..d03ec0f --- /dev/null +++ b/0044-QLibrary-fix-deadlock-caused-by-fix-to-QTBUG-39642.patch @@ -0,0 +1,109 @@ +From 276fa8383a7535765be7182883ef4aade17ce013 Mon Sep 17 00:00:00 2001 +From: Thiago Macieira +Date: Thu, 2 Apr 2020 12:08:41 -0300 +Subject: [PATCH 44/49] QLibrary: fix deadlock caused by fix to QTBUG-39642 + +Commit ae6f73e8566fa76470937aca737141183929a5ec inserted a mutex around +the entire load_sys(). We had reasoed that deadlocks would only occur if +the object creation in instance() recursed into its own instance(), +which was already a bug. But we had forgotten that dlopen()/ +LoadLibrary() executes initialization code from the module being loaded, +which could cause a recursion back into the same QPluginLoader or +QLibrary object. This recursion is benign because the module *is* loaded +and dlopen()/LoadLibrary() returns the same handle. + +[ChangeLog][QtCore][QLibrary and QPluginLoader] Fixed a deadlock that +would happen if the plugin or library being loaded has load-time +initialization code (C++ global variables) that recursed back into the +same QLibrary or QPluginLoader object. + +PS: QLibraryPrivate::loadPlugin() updates pluginState outside a mutex +lock, so pluginState should be made an atomic variable. Once that is +done, we'll only need locking the mutex to update errorString (no +locking before loading). + +Fixes: QTBUG-83207 +Task-number: QTBUG-39642 +Change-Id: Ibdc95e9af7bd456a94ecfffd160209304e5ab2eb +Reviewed-by: Volker Hilsheimer +Reviewed-by: David Faure +--- + src/corelib/plugin/qlibrary.cpp | 2 -- + src/corelib/plugin/qlibrary_unix.cpp | 4 ++++ + src/corelib/plugin/qlibrary_win.cpp | 3 +++ + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp +index ddb053c26f..be9d92b204 100644 +--- a/src/corelib/plugin/qlibrary.cpp ++++ b/src/corelib/plugin/qlibrary.cpp +@@ -576,9 +576,7 @@ bool QLibraryPrivate::load() + + Q_TRACE(QLibraryPrivate_load_entry, fileName); + +- mutex.lock(); + bool ret = load_sys(); +- mutex.unlock(); + if (qt_debug_component()) { + if (ret) { + qDebug() << "loaded library" << fileName; +diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp +index 017aa97b66..a5c72f81d9 100644 +--- a/src/corelib/plugin/qlibrary_unix.cpp ++++ b/src/corelib/plugin/qlibrary_unix.cpp +@@ -123,6 +123,7 @@ QStringList QLibraryPrivate::prefixes_sys() + + bool QLibraryPrivate::load_sys() + { ++ QMutexLocker locker(&mutex); + QString attempt; + QFileSystemEntry fsEntry(fileName); + +@@ -213,6 +214,7 @@ bool QLibraryPrivate::load_sys() + } + #endif + ++ locker.unlock(); + bool retry = true; + Handle hnd = nullptr; + for (int prefix = 0; retry && !hnd && prefix < prefixes.size(); prefix++) { +@@ -273,6 +275,8 @@ bool QLibraryPrivate::load_sys() + } + } + #endif ++ ++ locker.relock(); + if (!hnd) { + errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName, qdlerror()); + } +diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp +index 000bf76276..ef58724be8 100644 +--- a/src/corelib/plugin/qlibrary_win.cpp ++++ b/src/corelib/plugin/qlibrary_win.cpp +@@ -78,6 +78,7 @@ bool QLibraryPrivate::load_sys() + // fileName + // + // NB If it's a plugin we do not ever try the ".dll" extension ++ QMutexLocker locker(&mutex); + QStringList attempts; + + if (pluginState != IsAPlugin) +@@ -95,6 +96,7 @@ bool QLibraryPrivate::load_sys() + attempts.prepend(QDir::rootPath() + fileName); + #endif + ++ locker.unlock(); + Handle hnd = nullptr; + for (const QString &attempt : qAsConst(attempts)) { + #ifndef Q_OS_WINRT +@@ -115,6 +117,7 @@ bool QLibraryPrivate::load_sys() + #ifndef Q_OS_WINRT + SetErrorMode(oldmode); + #endif ++ locker.relock(); + if (!hnd) { + errorString = QLibrary::tr("Cannot load library %1: %2").arg( + QDir::toNativeSeparators(fileName), qt_error_string()); +-- +2.25.2 + diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index 71faee5..4df3baf 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -53,7 +53,7 @@ BuildRequires: pkgconfig(libsystemd) Name: qt5-qtbase Summary: Qt5 - QtBase components Version: 5.14.2 -Release: 3%{?dist} +Release: 4%{?dist} # See LGPL_EXCEPTIONS.txt, for exception details License: LGPLv2 with exceptions or GPLv3 with exceptions @@ -129,6 +129,7 @@ Patch80: qtbase-use-wayland-on-gnome.patch ## upstream patches Patch100: qt5-qtbase-CVE-2015-9541.patch +Patch144: 0044-QLibrary-fix-deadlock-caused-by-fix-to-QTBUG-39642.patch # Do not check any files in %%{_qt5_plugindir}/platformthemes/ for requires. # Those themes are there for platform integration. If the required libraries are @@ -401,6 +402,7 @@ Qt5 libraries used for drawing widgets and OpenGL items. ## upstream patches %patch100 -p1 -b .CVE-2015-9541 +%patch144 -p1 -b .0044 # move some bundled libs to ensure they're not accidentally used pushd src/3rdparty @@ -1046,6 +1048,9 @@ fi %changelog +* Tue Apr 14 2020 Rex Dieter - 5.14.2-4 +- backport "Mutex deadlock in QPluginLoader, Krita fails to start" (QTBUG-83207) + * Mon Apr 13 2020 Rex Dieter - 5.14.2-3 - %%build: -no-feature-relocatable + matching patch (#1823118)