Bug 300050 - crash when modifying PolicyKit actions
Summary: crash when modifying PolicyKit actions
Status: RESOLVED FIXED
Alias: None
Product: policykit-kde-agent-1
Classification: Plasma
Component: kcm_auth (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Dario Freddi
URL:
Keywords:
: 312252 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-15 10:11 UTC by Jaime Torres
Modified: 2013-09-24 16:42 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Debugging patch (1.05 KB, patch)
2013-06-14 08:25 UTC, Jonathan Marten
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaime Torres 2012-05-15 10:11:49 UTC
Application: systemsettings (1.0)
KDE Platform Version: 4.8.3 (4.8.3) (Compiled from sources)
Qt Version: 4.8.2
Operating System: Linux 3.4.0-rc6-1-desktop x86_64
Distribution: "openSUSE 12.2 Milestone 4 (x86_64)"

-- Information about the crash:
- What I was doing when the application crashed:

from systemsettings, in Actions policy, try to modify
org.kde.powerdevil.KDE.Set brightness

when I have another policy window asking me for the password for this action.

The stderr output is:
QDBusArgument: read from a write-only object

The crash can be reproduced every time.

-- Backtrace:
Application: System Settings (systemsettings), signal: Aborted
[Current thread is 1 (Thread 0x7f6781cd87c0 (LWP 17246))]

Thread 2 (Thread 0x7f676b8d2700 (LWP 17265)):
#0  0x00007f677d8c417f in poll () from /lib64/libc.so.6
#1  0x00007f6779a8c694 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f6779a8caf2 in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f676bc0d6d6 in ?? () from /usr/lib64/libgio-2.0.so.0
#4  0x00007f6779aaf025 in ?? () from /usr/lib64/libglib-2.0.so.0
#5  0x00007f677e3a5e0e in start_thread () from /lib64/libpthread.so.0
#6  0x00007f677d8cc2fd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f6781cd87c0 (LWP 17246)):
[KCrash Handler]
#6  0x00007f677d81cd95 in raise () from /lib64/libc.so.6
#7  0x00007f677d81e218 in abort () from /lib64/libc.so.6
#8  0x00007f677e64a6df in qt_message_output (msgType=<optimized out>, buf=<optimized out>) at /g/kdegit/qt/src/corelib/global/qglobal.cpp:2260
#9  0x00007f677e64a844 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, msg=0x7f677eb3d400 "QDBusArgument: read from a write-only object", ap=0x7fff28e82778) at /g/kdegit/qt/src/corelib/global/qglobal.cpp:2306
#10 0x00007f677e64a9d4 in qFatal (msg=<optimized out>) at /g/kdegit/qt/src/corelib/global/qglobal.cpp:2489
#11 0x00007f677eb25382 in QDBusArgumentPrivate::checkRead (d=<optimized out>) at /g/kdegit/qt/src/dbus/qdbusargument.cpp:144
#12 0x00007f677eb253af in QDBusArgumentPrivate::checkReadAndDetach (d=@0x7fff28e82900) at /g/kdegit/qt/src/dbus/qdbusargument.cpp:154
#13 0x00007f677eb28489 in QDBusArgument::beginArray (this=0x7fff28e82900) at /g/kdegit/qt/src/dbus/qdbusargument.cpp:993
#14 0x00007f676e4cfed1 in operator>><QVariant> (arg=..., list=...) at /usr/lib/qt4.5/include/QtDBus/qdbusargument.h:275
#15 0x00007f676e4cf342 in PolkitKde::ActionWidget::reloadPKLAs() (this=0x7f6770fa57e0) at /g/kdegit/extragear/base/polkit-kde-kcmodules-1/polkitactions/ActionWidget.cpp:88
#16 0x00007f676e4cf4e2 in PolkitKde::ActionWidget::setAction(PolkitQt1::ActionDescription const&) (this=0x7f6770fa57e0, action=...) at /g/kdegit/extragear/base/polkit-kde-kcmodules-1/polkitactions/ActionWidget.cpp:240
#17 0x00007f676e4cf8f7 in slotCurrentChanged (this=0x7f6770e9da60, current=...) at /g/kdegit/extragear/base/polkit-kde-kcmodules-1/polkitactions/PolkitActionsKCM.cpp:175
#18 0x00007f677e7733ff in QMetaObject::activate (sender=0x7f6770f15dd0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fff28e82c50) at /g/kdegit/qt/src/corelib/kernel/qobject.cpp:3547
#19 0x00007f677fa80f6a in QItemSelectionModel::currentChanged (this=<optimized out>, _t1=<optimized out>, _t2=<optimized out>) at .moc/debug-shared/moc_qitemselectionmodel.cpp:173
#20 0x00007f677fa8107b in QItemSelectionModel::setCurrentIndex (this=0x7f6770f15dd0, index=<optimized out>, command=...) at /g/kdegit/qt/src/gui/itemviews/qitemselectionmodel.cpp:1175
#21 0x00007f677fa2b2fa in QAbstractItemView::mousePressEvent (this=0x7f6770fa01f0, event=<optimized out>) at /g/kdegit/qt/src/gui/itemviews/qabstractitemview.cpp:1682
#22 0x00007f677f4fb9c7 in QWidget::event (this=0x7f6770fa01f0, event=0x7fff28e83a60) at /g/kdegit/qt/src/gui/kernel/qwidget.cpp:8367
#23 0x00007f677f9013de in QFrame::event (this=0x7f6770fa01f0, e=0x7fff28e83a60) at /g/kdegit/qt/src/gui/widgets/qframe.cpp:557
#24 0x00007f677fa272d3 in QAbstractItemView::viewportEvent (this=0x7f6770fa01f0, event=0x7fff28e83a60) at /g/kdegit/qt/src/gui/itemviews/qabstractitemview.cpp:1644
#25 0x00007f677fa70bc0 in QTreeView::viewportEvent (this=0x7f6770fa01f0, event=0x7fff28e83a60) at /g/kdegit/qt/src/gui/itemviews/qtreeview.cpp:1257
#26 0x00007f677e75be3e in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<optimized out>, receiver=0x7f6770fa0220, event=0x7fff28e83a60) at /g/kdegit/qt/src/corelib/kernel/qcoreapplication.cpp:1025
#27 0x00007f677f4a3201 in QApplicationPrivate::notify_helper (this=0x7f6776c7d700, receiver=0x7f6770fa0220, e=0x7fff28e83a60) at /g/kdegit/qt/src/gui/kernel/qapplication.cpp:4547
#28 0x00007f677f4a8c54 in QApplication::notify (this=<optimized out>, receiver=0x7f6770fa0220, e=0x7fff28e83a60) at /g/kdegit/qt/src/gui/kernel/qapplication.cpp:4094
#29 0x00007f678054a7ae in KApplication::notify (this=0x7fff28e846b0, receiver=0x7f6770fa0220, event=0x7fff28e83a60) at /g/kdegit/kdelibs/kdeui/kernel/kapplication.cpp:311
#30 0x00007f677e75bc4d in QCoreApplication::notifyInternal (this=0x7fff28e846b0, receiver=0x7f6770fa0220, event=0x7fff28e83a60) at /g/kdegit/qt/src/corelib/kernel/qcoreapplication.cpp:915
#31 0x00007f677f4a4642 in QCoreApplication::sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../../../kdegit/qt/src/corelib/kernel/qcoreapplication.h:231
#32 QApplicationPrivate::sendMouseEvent (receiver=0x7f6770fa0220, event=0x7fff28e83a60, alienWidget=0x7f6770fa0220, nativeWidget=0x7f6776cb2b40, buttonDown=0x7f67800894a8, lastMouseReceiver=..., spontaneous=true) at /g/kdegit/qt/src/gui/kernel/qapplication.cpp:3162
#33 0x00007f677f52bd7e in QETWidget::translateMouseEvent (this=0x7f6776cb2b40, event=<optimized out>) at /g/kdegit/qt/src/gui/kernel/qapplication_x11.cpp:4502
#34 0x00007f677f52a641 in QApplication::x11ProcessEvent (this=0x7fff28e846b0, event=0x7fff28e841b0) at /g/kdegit/qt/src/gui/kernel/qapplication_x11.cpp:3625
#35 0x00007f677f551a32 in x11EventSourceDispatch (s=0x7f6776c7b080, callback=0, user_data=0x0) at /g/kdegit/qt/src/gui/kernel/qguieventdispatcher_glib.cpp:146
#36 0x00007f6779a8c2dc in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#37 0x00007f6779a8c6f8 in ?? () from /usr/lib64/libglib-2.0.so.0
#38 0x00007f6779a8c7b4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#39 0x00007f677e78d1c4 in QEventDispatcherGlib::processEvents (this=0x7f6776c3b1e0, flags=<optimized out>) at /g/kdegit/qt/src/corelib/kernel/qeventdispatcher_glib.cpp:424
#40 0x00007f677f5516e6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=<optimized out>) at /g/kdegit/qt/src/gui/kernel/qguieventdispatcher_glib.cpp:204
#41 0x00007f677e75a1af in QEventLoop::processEvents (this=<optimized out>, flags=...) at /g/kdegit/qt/src/corelib/kernel/qeventloop.cpp:149
#42 0x00007f677e75a468 in QEventLoop::exec (this=0x7fff28e84570, flags=...) at /g/kdegit/qt/src/corelib/kernel/qeventloop.cpp:204
#43 0x00007f677e75f9e8 in QCoreApplication::exec () at /g/kdegit/qt/src/corelib/kernel/qcoreapplication.cpp:1187
#44 0x000000000040b5f0 in main (argc=1, argv=0x7fff28e847f8) at /g/kdegit/kde-workspace/systemsettings/app/main.cpp:49

Possible duplicates by query: bug 259677, bug 248664, bug 246638.

Reported using DrKonqi
Comment 1 Jonathan Marten 2013-06-08 19:39:41 UTC
*** Bug 312252 has been marked as a duplicate of this bug. ***
Comment 2 Jonathan Marten 2013-06-08 19:41:15 UTC
Same message and backtrace in bug 312252, for versions:

Application: systemsettings (1.0)
KDE Platform Version: 4.9.95 (Compiled from sources)
Qt Version: 4.8.5
Operating System: Linux 3.7.0-7-generic x86_64
Distribution: Ubuntu 12.10

Confirmed with current trunk.
Comment 3 Jonathan Marten 2013-06-13 17:08:50 UTC
Upon investigation, this happens if the user is not authorised by PolicyKit to perform the action org.kde.polkitkde1.readauthorizations which is used internally by PolkitKde1Helper::retrievePolicies(), in turn used by PolkitKde::ActionWidget::reloadPKLAs().  DBus returns an error in this case, but no check is made.

@reporters: can you check the output of the command:

pkcheck -u -p $$ -a org.kde.polkitkde1.readauthorizations && echo "allowed"

@developers: maybe put a check for reply.isError() in ActionWidget::reloadPKLAs() and show a message box and give up if this happens.
Comment 4 Jaime Torres 2013-06-13 19:26:13 UTC
tried your command:
pkcheck -u -p $$ -a org.kde.polkitkde1.readauthorizations && echo "allowed"

it ask me for root password and (if introduced right) shows 
polkit\56retains_authorization_after_challenge=true
polkit\56temporary_authorization_id=tmpauthz0
allowed

the following times, just
polkit\56temporary_authorization_id=tmpauthz0
allowed
Comment 5 Jonathan Marten 2013-06-13 21:37:29 UTC
Thanks for the results... if my guess is correct, then if this check works then the crash should not happen.  But if it still crashes, then we need a polkit expert.
Comment 6 Jonathan Marten 2013-06-14 08:25:00 UTC
Created attachment 80509 [details]
Debugging patch

If you can compile from source, does applying this patch to polkit-kde-kcmodules avoid the crash?  The settings may not be meaningful in this case, but it should print a debug message on stderr instead of crashing.
Comment 7 Jaime Torres 2013-06-14 14:41:03 UTC
Yes, it avoids the crash, because it does not allows to open the policy.
Simple way to reproduce...
insert a pendrive, the dialog for the mount password is shown, then open systemsettings, Actions policy..
and when I press in the policy, nothing is shown. If I make a change and I want to save it, it says 
"org.freedesktop.DBus.Error.AccessDenied", "Saving implicit policy settings is unauthorized".
In that case, nothing is shown in stderr.
When the policy is opened, it displays all the available policies, like:
......
"org.kde.polkitkde1.changeexplicitauthorizations" 
"org.kde.polkitkde1.changeimplicitauthorizations" 
"org.kde.polkitkde1.changesystemconfiguration" 
"org.kde.polkitkde1.readauthorizations" 
"org.kde.powerdevil.backlighthelper.brightness" 
"org.kde.powerdevil.backlighthelper.setbrightness" 
........
Comment 8 Jonathan Marten 2013-06-18 14:15:59 UTC
https://git.reviewboard.kde.org/r/111093/
Comment 9 Jonathan Marten 2013-09-24 16:42:48 UTC
Git commit 9ad726f709161853932a89205f3f1e0f3f7291ce by Jonathan Marten.
Committed on 24/09/2013 at 16:38.
Pushed by marten into branch 'master'.

Show a diagnostic message if reading policies fails.

The settings displayed will not be meaningful in this case, but
at least it avoids a fatal assert within Qt.
REVIEW:111093

M  +25   -4    polkitactions/ActionWidget.cpp
M  +1    -1    polkitactions/ActionWidget.h

http://commits.kde.org/polkit-kde-kcmodules-1/9ad726f709161853932a89205f3f1e0f3f7291ce