KPluginLoader UBSAN warnings (object has invalid vptr)
Albert Astals Cid
aacid at kde.org
Fri Oct 16 08:43:59 BST 2020
El dijous, 15 d’octubre de 2020, a les 16:22:59 CEST, Milian Wolff va escriure:
> Hey all,
>
> I'm finally taking a bit of time to look after KDevelop again. I would most
> notably like to make it ASAN/UBSAN clean. One thing I'm stumbling over are the
> following reports:
>
> ```
> /usr/include/KF5/KCoreAddons/kpluginfactory.h:545:24: runtime error: member
> call on address 0x6030000f2d40 which does not point to an object of type
> 'KPluginFactory'
> 0x6030000f2d40: note: object has invalid vptr
> 33 00 80 0f e0 31 d4 c3 5d 7f 00 00 a0 41 04 00 80 60 00 00 70 2d 0f 00 30
> 60 00 00 00 00 00 00
> ^~~~~~~~~~~~~~~~~~~~~~~
> invalid vptr
> #0 0x7f5dede47d8c in KDevelop::IPlugin*
> KPluginFactory::create<KDevelop::IPlugin>(QObject*, QList<QVariant> const&) /
> usr/include/KF5/KCoreAddons/kpluginfactory.h:545
> #1 0x7f5dede47d8c in
> KDevelop::PluginController::loadPluginInternal(QString const&) /home/milian/
> projects/kf5/src/extragear/kdevelop/kdevelop/kdevplatform/shell/
> plugincontroller.cpp:615
> ```
>
> Or this one:
>
> ```
> /usr/include/qt/QtCore/qobject.h:524:12: runtime error: downcast of address
> 0x6060002922e0 which does not point to an object of type 'IPlugin'
> 0x6060002922e0: note: object has invalid vptr
> 36 00 80 24 b0 2f d4 c3 5d 7f 00 00 a0 42 04 00 80 60 00 00 b0 30 d4 c3 5d
> 7f 00 00 80 fe 06 00
> ^~~~~~~~~~~~~~~~~~~~~~~
> invalid vptr
> #0 0x7f5dede47f20 in KDevelop::IPlugin*
> qobject_cast<KDevelop::IPlugin*>(QObject*) /usr/include/qt/QtCore/qobject.h:
> 524
> #1 0x7f5dede47f20 in KDevelop::IPlugin*
> KPluginFactory::create<KDevelop::IPlugin>(QObject*, QList<QVariant> const&) /
> usr/include/KF5/KCoreAddons/kpluginfactory.h:547
> ```
>
> I have the feeling that this might be a limitation of UBSAN? Or is this an
> actual problem - does anyone know?
>
> Most notably, the kplugin* tests in kcoreaddons are UBSAN clean for me, which
> is quite odd. I would expect them to raise similar warnings, but apparently
> they don't. Or potentially it's simply that KDevelop plugins are way more
> complex - we apparently are using multiple inheritance there for example:
>
> ```
> class IPlugin : public QObject, public KXMLGUIClient
> class AStylePlugin : public KDevelop::IPlugin, public
> KDevelop::ISourceFormatter
> ```
>
> Maybe that's the problem? Does anyone know?
I don't get any of those warnings (on starting kdevelop).
What's your compile flags?
I used
cmake -DCMAKE_BUILD_TYPE=Debug -DECM_ENABLE_SANITIZERS='address;undefined'
with gcc 10.2
About that warning i've seen it once and it was because the object i was casting was still not totally created yet and thus wasn't of the target type at that point.
Cheers,
Albert
More information about the kde-core-devel
mailing list