Project

General

Profile

Bug #23464

ARMv8 feature detection broken, leading to illegal instruction crashes

Added by Robin McCorkell 12 months ago. Updated 9 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
build
Target version:
-
Start date:
03/26/2018
Due date:
% Done:

0%

Source:
Tags:
Backport:
luminous
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:

Description

The detection of ARMv8 (AArch64) features in SIMDExt.cmake is broken, incorrectly detecting features as available when the CPU does not support them. This is because the source snippets with inline assembly used for HAVE_ARMV8_CRC and HAVE_ARMV8_CRYPTO compile fine even without the features on the CPU, but the resulting programs then crash. A half-fix would be to replace check_cxx_source_compiles with check_cxx_source_runs.

However, checking for feature availability based on the ability to compile and run inline ASM will not work well, since it entirely ignores the compiler's march settings as to which features are available. For example, on my system I compile with march=armv8-a, that is without +crypto necessary for pmull instructions, yet the crypto snippet in SIMDExt.cmake compiles just fine. The resulting binary crashes on my system however, since I do not have the crypto extension (RPi 3).

So: the current ARM feature checks are broken, but even the simple fix won't improve the situation that the resulting code may not run on the target system specified by march/mcpu/mtune.


Related issues

Copied to Ceph - Backport #24334: luminous: ARMv8 feature detection broken, leading to illegal instruction crashes Resolved

History

#1 Updated by Robin McCorkell 11 months ago

After a little more testing, I have found the problem is caused by the `asm(".arch_extension ...");` directives in the tests in SIMDExt.cmake, which unconditionally enable the selected extension for the architecture. Since we want to detect the architecture features, these directives break the tests.

Removing these directives from the tests causes test compilation to fail if march doesn't list the needed feature, which is the expected behaviour.

GitHub PR incoming

#2 Updated by Kefu Chai 11 months ago

  • Status changed from New to Need Review
  • Assignee set to Robin McCorkell

#5 Updated by Kefu Chai 10 months ago

  • Status changed from Need Review to Pending Backport

#6 Updated by Kefu Chai 10 months ago

  • Assignee changed from Robin McCorkell to Kefu Chai

#7 Updated by Kefu Chai 10 months ago

  • Backport set to luminous

#8 Updated by Nathan Cutler 10 months ago

  • Copied to Backport #24334: luminous: ARMv8 feature detection broken, leading to illegal instruction crashes added

#9 Updated by Nathan Cutler 9 months ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF