Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.3.0
-
None
-
ae6f73e8566fa76470937aca737141183929a5ec (qt/qtbase/5.14.2)
Description
QLibraryStore::findOrCreate is mutex-protected, but the caller (QPluginLoader::setFileName) then calls d->loadHints = lh and other setters on "d", which race with other theads, if the same plugin is loaded from multiple threads.
==14794== ==14794== Possible data race during write of size 4 at 0xF5EAAC0 by thread #21 ==14794== Locks held: none ==14794== at 0x6633F78: QPluginLoader::setFileName(QString const&) (qpluginloader.cpp:356) ==14794== by 0x6633230: QPluginLoader::QPluginLoader(QString const&, QObject*) (qpluginloader.cpp:158) ==14794== by 0x5EBEBE7: KPluginLoader::findPlugin(QString const&) (kpluginloader.cpp:59) ==14794== by 0x4ED91DB: KIO::Slave::createSlave(QString const&, QUrl const&, int&, QString&) (slave.cpp:461) ==14794== ==14794== This conflicts with a previous write of size 4 by thread #12 ==14794== Locks held: none ==14794== at 0x6633F78: QPluginLoader::setFileName(QString const&) (qpluginloader.cpp:356) ==14794== by 0x6633230: QPluginLoader::QPluginLoader(QString const&, QObject*) (qpluginloader.cpp:158) ==14794== by 0x5EBEBE7: KPluginLoader::findPlugin(QString const&) (kpluginloader.cpp:59) ==14794== by 0x4ED91DB: KIO::Slave::createSlave(QString const&, QUrl const&, int&, QString&) (slave.cpp:461)
Should the QLibraryStore be turned into a QThreadStorage, i.e. one store per thread?
Attachments
Issue Links
- relates to
-
QTBUG-41107 QImageReader::supportedImageFormats() leads to overwritten memory and crashes when used from a thread
-
- Closed
-
For Gerrit Dashboard: QTBUG-39642 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
87686,3 | Move most of the QLibraryPrivate initialization to its constructor | 5.3 | qt/qtbase | Status: MERGED | +2 | 0 |
90298,4 | Fix a few more race conditions with QLibrary::LoadHints | dev | qt/qtbase | Status: MERGED | +2 | 0 |
90299,3 | Don't store QLibraryPrivate with empty file names in the global store | dev | qt/qtbase | Status: MERGED | +2 | 0 |
285018,3 | QPluginLoader: rework the loading and the caching of instance | 5.14 | qt/qtbase | Status: MERGED | +2 | 0 |
285020,4 | QLibrary: introduce a mutex to protect non-atomic internals | 5.14 | qt/qtbase | Status: MERGED | +2 | 0 |
296034,4 | QLibrary: fix deadlock caused by fix to QTBUG-39642 | 5.14 | qt/qtbase | Status: MERGED | +2 | 0 |