summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Cheung <ccheung@openjdk.org>2024-01-26 20:11:12 +0000
committerCalvin Cheung <ccheung@openjdk.org>2024-01-26 20:11:12 +0000
commit4338cb3d706b356fdfebc0e0f3da3c3e9b4e6ddc (patch)
treef2e5cc1ef0041d201e744b2a30ac9e6c38a400da
parentb7f38fc54f7121e518db1e19c1ca7e80744b6798 (diff)
8323556: CDS archive space addresses should be randomized with ArchiveRelocationMode=1jdk-22+34
Reviewed-by: coleenp Backport-of: 437342b93e9e66340ac57bd1c6fdc948b3302db0
-rw-r--r--src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp b/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp
index d035ab21093..47b6f1f2f38 100644
--- a/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp
+++ b/src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, Red Hat, Inc. All rights reserved.
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@ static char* reserve_at_eor_compatible_address(size_t size, bool aslr) {
0x7ffc, 0x7ffe, 0x7fff
};
static constexpr int num_immediates = sizeof(immediates) / sizeof(immediates[0]);
- const int start_index = aslr ? os::random() : 0;
+ const int start_index = aslr ? os::next_random((int)os::javaTimeNanos()) : 0;
constexpr int max_tries = 64;
for (int ntry = 0; result == nullptr && ntry < max_tries; ntry ++) {
// As in os::attempt_reserve_memory_between, we alternate between higher and lower