Bug 457926

Summary: Loading a cursor theme which inherits itself bricks user account
Product: [Plasma] plasmashell Reporter: Anil <cd+kde>
Component: Startup processAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: critical CC: kde, nate, nicolas.fella
Priority: VHI    
Version: 5.25.4   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.25.5
Sentry Crash Report:

Description Anil 2022-08-15 16:46:21 UTC
SUMMARY
I tried installing a mouse theme and ended up not being able to log into my user account.

The culprit appears to be a simple case of infinite recursion. The theme (VS5) contained this index.theme
[Icon Theme]
Name=VS5
Inherits=VS5

Removing the `Inherits`  line fixes the problem. The real issue is that an incorrectly configured theme shouldn't be able to bring down the system, and keep it broken even after reboot.


STEPS TO REPRODUCE
1. Install this theme: https://store.kde.org/p/1829603

OBSERVED RESULT
Kwin crashes. CPU 100%
Upon rebooting, Kwin refuses to log in and you have to use a TTY to delete the theme you just installed


EXPECTED RESULT
Detect recursion and do not use the theme, probably?


SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.19.1-arch2-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® Xe Graphics
Manufacturer: Framework
Product Name: Laptop
System Version: A3

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2022-08-15 17:07:19 UTC
Goodness gracious.

This is clearly an issue in the theme itself and I hope you report it to the developer, but, yeah, installing a broken cursor theme shouldn't produce a pants-on-fire issue like being unable to login.
Comment 2 Bug Janitor Service 2022-08-17 20:21:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2841
Comment 3 Nicolas Fella 2022-08-17 20:22:52 UTC
https://invent.kde.org/plasma/kwin/-/merge_requests/2841 fixes the issue for KWin

However there is the same bug in libwayland-cursor (and possibly its X11 counterpart too) which will affect a lot of apps.

See https://gitlab.freedesktop.org/wayland/wayland/-/issues/317
Comment 4 Vlad Zahorodnii 2022-09-01 08:24:16 UTC
Git commit 2d2f972bff73d522250bf0ebcd0708d344d37483 by Vlad Zahorodnii.
Committed on 01/09/2022 at 07:12.
Pushed by vladz into branch 'master'.

Fix loading xcursor themes with invalid Inherits field

Xcursor loading can get stuck in an infinite recursion if index.theme
file indicates that the theme inherits itself.

In order to prevent that, keep track of the loaded so far themes and
avoid loading already loaded themes.

M  +27   -11   src/xcursortheme.cpp

https://invent.kde.org/plasma/kwin/commit/2d2f972bff73d522250bf0ebcd0708d344d37483
Comment 5 Vlad Zahorodnii 2022-09-01 08:29:46 UTC
Git commit e70b6a19f49d128363e0c5cfd90775800499437d by Vlad Zahorodnii.
Committed on 01/09/2022 at 08:29.
Pushed by vladz into branch 'Plasma/5.25'.

Fix loading xcursor themes with invalid Inherits field

Xcursor loading can get stuck in an infinite recursion if index.theme
file indicates that the theme inherits itself.

In order to prevent that, keep track of the loaded so far themes and
avoid loading already loaded themes.


(cherry picked from commit 2d2f972bff73d522250bf0ebcd0708d344d37483)

M  +27   -11   src/xcursortheme.cpp

https://invent.kde.org/plasma/kwin/commit/e70b6a19f49d128363e0c5cfd90775800499437d