Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-119279

Use of qCpuHasFeature(ArchHaswell) in AVX2-specific code causes crashes when running under VirtualBox.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • None
    • 5.15.11
    • GUI: Painting
    • None
    • Linux/X11

    Description

      AVX2-specific code in 'qtbase/src/gui/painting/qdrawhelper.cpp' (and possibly elsewhere) relies on additional CPU feature support checks using calls to qCpuHasFeature(ArchHaswell).

      When running under VirtualBox, this function returns false. This is likely expected and correct behaviour, since VirtualBox doesn't fully support all AVX2-expected features to the guest: specifically FMA3 and F16C instructions.

      However, as a result certain codepaths are skipped completely. Amongst undoubtedly causing a number of other issues, this results in no value being set for the qt_memfill32() function pointer. On first use of this function, which is previously set to nullptr, it naturally SIGSEGVs. This probably has other impacts on downstream code, but most notably, crashes KDE Plasmashell on startup.

      To fix this, QtBase must do the following;

      • Improve the logic in certain functions which call qCpuHasFeature(ArchHaswell) to be made more robust to respond to the chance that this test may fail, indicating an incomplete support for AVX2 features.
      • Use finer-grained tested for AVX2 features as required in the code.. i.e. check where and whether dependencies on FMA3 and F16C instructions are really needed.

      This only affects QtBase if built with CPU specific optimisations (i.e. with --march=native in CFLAGS/CXXFLAGS on CPUs that support AVX2), when running under VirtualBox, so it's not surprising this bug was not discovered until now.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              vgt Eirik Aavitsland
              johnsirett3 John Sirett
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes