Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8345296 aarch64 prctl #32

Open
wants to merge 2 commits into
base: ms-patches/8345296-aarch64-prctl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ms-patches/8345296-aarch64-prctl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title: [JDK-8345296] AArch64: VM crashes with SIGILL when prctl is disallowed
- work_item: 2321375
- author: macarte
- owner: macarte
- contributors:
- macarte
- details:
- From https://github.com/openjdk/jdk17u-dev/pull/3111. We have caught this in some
- prod environments, where prctl is forbidden by the sandboxing mechanism. This fails the JVM.
- Does not apply cleanly, the backport depends on FloatRegister changes from JDK-8339063 which
- are included in src/hotspot/cpu/aarch64/register_aarch64.hpp.
- release_note: Address issues when PRCTL is disabled.
8 changes: 7 additions & 1 deletion src/hotspot/cpu/aarch64/register_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,13 @@ class FloatRegisterImpl: public AbstractRegisterImpl {
max_slots_per_register = 8,
save_slots_per_register = 2,
slots_per_neon_register = 4,
extra_save_slots_per_neon_register = slots_per_neon_register - save_slots_per_register
extra_save_slots_per_neon_register = slots_per_neon_register - save_slots_per_register,
neon_vl = 16,
// VLmax: The maximum sve vector length is determined by the hardware
// sve_vl_min <= VLmax <= sve_vl_max.
sve_vl_min = 16,
// Maximum supported vector length across all CPUs
sve_vl_max = 256
};

// construction
Expand Down
20 changes: 17 additions & 3 deletions src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include "precompiled.hpp"
#include "register_aarch64.hpp"
#include "runtime/arguments.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/java.hpp"
Expand Down Expand Up @@ -400,14 +401,27 @@ void VM_Version::initialize() {
if (FLAG_IS_DEFAULT(UseSVE)) {
FLAG_SET_DEFAULT(UseSVE, (_features & CPU_SVE2) ? 2 : 1);
}
if (UseSVE > 0) {
_initial_sve_vector_length = get_current_sve_vector_length();
}
} else if (UseSVE > 0) {
warning("UseSVE specified, but not supported on current CPU. Disabling SVE.");
FLAG_SET_DEFAULT(UseSVE, 0);
}

if (UseSVE > 0) {
int vl = get_current_sve_vector_length();
if (vl < 0) {
warning("Unable to get SVE vector length on this system. "
"Disabling SVE. Specify -XX:UseSVE=0 to shun this warning.");
FLAG_SET_DEFAULT(UseSVE, 0);
} else if ((vl == 0) || ((vl % FloatRegisterImpl::sve_vl_min) != 0) || !is_power_of_2(vl)) {
warning("Detected SVE vector length (%d) should be a power of two and a multiple of %d. "
"Disabling SVE. Specify -XX:UseSVE=0 to shun this warning.",
vl, FloatRegisterImpl::sve_vl_min);
FLAG_SET_DEFAULT(UseSVE, 0);
} else {
_initial_sve_vector_length = vl;
}
}

// This machine allows unaligned memory accesses
if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
FLAG_SET_DEFAULT(UseUnalignedAccesses, true);
Expand Down