Qt/KDE problems with MIT-SHM when Xorg is not running as root

Hans de Goede hdegoede at redhat.com
Thu Jan 29 01:41:11 PST 2015


Hi,

On 29-01-15 10:33, Martin Gräßlin wrote:
> On Thursday 29 January 2015 10:20:41 Hans de Goede wrote:
>> Hi All,
>>
>> A Fedora user has reported problems with MIT-SHM when the xserver
>> is not running as root. Normal use works fine, but when doing a
>> "su -" and then starting X apps as root MIT-SHM fails, see this
>> screenshot:
>>
>> https://bugzilla.redhat.com/attachment.cgi?id=977933
>>
>> The culprit is this error:
>> "Xerror: BadAccess (Attempt to access private resources denied)"
>>
>> Which makes sense, the shm segment is created by the app running
>> as root, and the Xserver which is running as a normal user thus
>> cannot access it, so far this has never been a problem because
>> X was always running as root :)
>>
>> I'm tempted to call this a feature rather then a bug, and declaring
>> this a Qt/KDE bug. I've written MIT SHM using X11 code in the past,
>> and always installed an error handler, and did an XSync after the
>> attach to check if the xshm-attach succeed, as it will also fail
>> when running over the network. I guess qt/kde is using some other
>> heuristic to determine if it is not running over a network, and
>> assumes that things will just work when not running over the
>> network, rather then doing "proper" error checking here.
>>
>> So to me it seems that Qt/KDE should do "proper" error checking
>> here and simply fallback to a non shm path in this special case.
>
> thanks for letting me know. Sharing my personal opinion on it:
> first of all I consider it an out-of-scope if one runs kcalc as root ;-) That
> basically applies to all KDE applications - I do not think we support running
> them on root. So breakage here is for me a feature and not a bug.

While I agree that running apps as root in general is a bad idea, I would
not go as far as saying that this breakage is desirable :)

> Otherwise it's important to know which application version that is. Whether
> it's Qt 4 or Qt 5. The complete interaction with X11 got rewritten for Qt 5
> from scratch using XCB. From studying the code in the past I know the xshm
> related code supports fallback to non-shm paths. I assume that kcalc is still
> a Qt 4 based application in Fedora. If this problem is solved in Qt 5 I guess
> nobody would care any more about it.

This is on Fedora 21, so KDE4 (4.14), which AFAIK means qt4.

Regards,

Hans


More information about the xorg-devel mailing list