KPluginLoader UBSAN warnings (object has invalid vptr)

Milian Wolff mail at milianw.de
Thu Oct 15 15:22:59 BST 2020


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?

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20201015/987a1f91/attachment.sig>


More information about the kde-core-devel mailing list