summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-06-19 12:02:12 -0700
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-06-21 03:53:16 +0000
commitf298d347f5a03b9bae6f883d77acc42dd3cd7ef3 (patch)
tree5759967282f772cbbc9820b715d425dc680531ba
parentd4a0781cd65c1f3c8ac410a80a9331cf4bd47868 (diff)
qsimd: don't enforce shstk (CET) feature on launch
Clang with -march=tigerlake or -march=sapphirerapids pre-defines __SHSTK__, which QtCore require the feature, even if the OS does not have support for it. That's of no consequence because the compiler does not generate shadow stack operations on its own. Change-Id: Id0fb9ab0089845ee8843fffd16fa1ad910f008b8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit d531c4b65dc47312256f9de2786a852f6ac4c1f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/global/qsimd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/global/qsimd.cpp b/src/corelib/global/qsimd.cpp
index 4630122adc..cc90433567 100644
--- a/src/corelib/global/qsimd.cpp
+++ b/src/corelib/global/qsimd.cpp
@@ -565,6 +565,12 @@ uint64_t QT_MANGLE_NAMESPACE(qDetectCpuFeatures)()
// automatically by compilers, we can just add runtime check.
minFeatureTest &= ~(CpuFeatureAES|CpuFeatureCRC32);
#endif
+#if defined(Q_PROCESSOR_X86_64) && defined(cpu_feature_shstk)
+ // Controlflow Enforcement Technology (CET) is an OS-assisted
+ // hardware-feature, meaning the CPUID bit may be disabled if the OS
+ // doesn't support it, but that's ok.
+ minFeatureTest &= ~CpuFeatureSHSTK;
+#endif
QCpuFeatureType f = detectProcessorFeatures();
// Intentionally NOT qgetenv (this code runs too early)