Bug 484622 - Forcing GDS mitigation for older CPUs on Linux makes krita crash
Summary: Forcing GDS mitigation for older CPUs on Linux makes krita crash
Status: RESOLVED WORKSFORME
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 5.2.2
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-27 20:06 UTC by bugreporter
Modified: 2024-06-19 03:47 UTC (History)
1 user (show)

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


Attachments
Krita backtrace and disassembly (5.59 KB, text/plain)
2024-03-27 20:06 UTC, bugreporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bugreporter 2024-03-27 20:06:50 UTC
Created attachment 167863 [details]
Krita backtrace and disassembly

When the Gather Data Sampling mitigation is forced on Linux for older CPUs (i.e. Intel Core 6th Gen Skylake) that are affected by the GDS vulnerability, AVX/AVX2 instructions are disabled, because there is no microcode update available.

On affected systems 'lscpu' reports:
…
Vulnerabilities:          
Gather data sampling:   Mitigation; AVX disabled, no microcode
…

This causes Krita to crash, because something is wrong with the CPU feature detection (xsimd function call) in Krita and it's still trying to use VEX instructions. Similar problems were already reported and fixed for pcre2 (regex library) and Babl/Gimp. See the attached gdb backtrace/disassembly and the following pcre2 issue (reported by me) for further information.

https://github.com/PCRE2Project/pcre2/issues/399

Babl/Gimp issue:

https://gitlab.gnome.org/GNOME/babl/-/issues/96#note_2056377

STEPS TO REPRODUCE
1. Force GDS mitigation by adding 'gather_data_sampling=force' as kernel parameter on an affected system (AVX/AVX2 disabled).
2. Start krita and try to open a PNG image.

OBSERVED RESULT

Krita crashes with 'SIGILL, Illegal instruction'.

EXPECTED RESULT

Krita should not crash and open the file.

SOFTWARE/OS VERSIONS
Arch Linux - Linux kernel 6.8.1
krita 5.2.2-8 from the repo (compiled with -march=x86-64)
Comment 1 Dmitry Kazakov 2024-03-28 10:46:07 UTC
I actually wonder if there any use in trying to paint in Krita with AVX disabled...
Comment 2 Dmitry Kazakov 2024-05-20 13:26:38 UTC
The bug should be fixed by this patch:

https://invent.kde.org/dkazakov/krita-deps-management/-/commit/2bd71ad928d79666b4795360e072ca1d0d513117

Corresponding XSIMD bugreport for upstreaming this patch:

https://github.com/xtensor-stack/xsimd/issues/1025

I will link the nightly build in this report when the build is ready.
Comment 3 Dmitry Kazakov 2024-05-20 13:51:28 UTC
Hi, bugreporter!

Could you please test this build on this limited system? It should work fine now (in case you can use word "fine" to the system missing AVX):

https://cdn.kde.org/ci-builds/graphics/krita/master/linux/
Comment 4 Bug Janitor Service 2024-06-04 03:45:46 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2024-06-19 03:47:13 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!