JDK-8219698 : aarch64: SIGILL triggered when specifying unsupported hardware features
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: openjdk8u292,11,12,13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: aarch64
  • Submitted: 2019-02-26
  • Updated: 2021-02-02
  • Resolved: 2019-02-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 JDK 13
11.0.4Fixed 12.0.2Fixed 13 b10Fixed
Description
One example:

On AArch64 LSE instructions is not supported on ARMv8 platform.
SIGILL is triggered on ARMv8 platform by the following command:

$ java -XX:+UseLSE -version

OpenJDK 64-Bit Server VM warning: UseLSE specified, but not supported on this CPU
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000ffff76b76088, pid=6950, tid=6951
#
# JRE version:  (13.0) (build )
# Java VM: OpenJDK 64-Bit Server VM (13-internal+0-adhoc.yangfei.jdk-jdk, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-aarch64)
# Problematic frame:
# j  java.lang.ThreadGroup.add(Ljava/lang/ThreadGroup;)V+0 java.base
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/yangfei/hs_err_pid6950.log
Could not load hsdis-aarch64.so; library not loadable; PrintAssembly is disabled
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Aborted


Simple fix:

diff -r 1ee9149df76f src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
--- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp    Mon Feb 25 16:05:06 2019 -0800
+++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp    Wed Feb 27 10:44:59 2019 +0800
@@ -258,8 +258,10 @@
   if (FLAG_IS_DEFAULT(UseCRC32)) {
     UseCRC32 = (auxv & HWCAP_CRC32) != 0;
   }
+
   if (UseCRC32 && (auxv & HWCAP_CRC32) == 0) {
     warning("UseCRC32 specified, but not supported on this CPU");
+    FLAG_SET_DEFAULT(UseCRC32, false);
   }

   if (FLAG_IS_DEFAULT(UseAdler32Intrinsics)) {
@@ -277,6 +279,7 @@
   } else {
     if (UseLSE) {
       warning("UseLSE specified, but not supported on this CPU");
+      FLAG_SET_DEFAULT(UseLSE, false);
     }
   }

@@ -291,9 +294,11 @@
   } else {
     if (UseAES) {
       warning("UseAES specified, but not supported on this CPU");
+      FLAG_SET_DEFAULT(UseAES, false);
     }
     if (UseAESIntrinsics) {
       warning("UseAESIntrinsics specified, but not supported on this CPU");
+      FLAG_SET_DEFAULT(UseAESIntrinsics, false);
     }
   }
Comments
Fix Request Backporting this trivial patch saves from crashing the JVM on some hardware when improper JVM option is specified. Patch applies cleanly to 12u and 11u, and builds fine. Raspberry Pi 3 crashes "java -XX:+UseLSE -version" without the patch, and passes fine with the patch.
11-03-2019