From 4285e3d6db487d85138486d1f7853c7c067c59cd Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 9 Jun 2022 11:48:46 +0000 Subject: [PATCH] 8288023: AArch64: disable PAC-RET when preview is enabled Reviewed-by: rpressler, adinn --- src/hotspot/cpu/aarch64/vm_version_aarch64.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 9f081546d10..0c6a1f7c69e 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -425,9 +425,10 @@ void VM_Version::initialize() { _rop_protection = false; } else if (strcmp(UseBranchProtection, "standard") == 0) { _rop_protection = false; - // Enable PAC if this code has been built with branch-protection and the CPU/OS supports it. + // Enable PAC if this code has been built with branch-protection, the CPU/OS + // supports it, and incompatible preview features aren't enabled. #ifdef __ARM_FEATURE_PAC_DEFAULT - if (VM_Version::supports_paca()) { + if (VM_Version::supports_paca() && !Arguments::enable_preview()) { _rop_protection = true; } #endif @@ -438,6 +439,10 @@ void VM_Version::initialize() { warning("ROP-protection specified, but not supported on this CPU."); // Disable PAC to prevent illegal instruction crashes. _rop_protection = false; + } else if (Arguments::enable_preview()) { + // Not currently compatible with continuation freeze/thaw. + warning("PAC-RET is incompatible with virtual threads preview feature."); + _rop_protection = false; } #else warning("ROP-protection specified, but this VM was built without ROP-protection support.");