Skip to content

Commit 489ef4a

Browse files
authored
Merge branch 'master' into goetz_backport_8364235
2 parents bff6f55 + 742e7e9 commit 489ef4a

File tree

170 files changed

+2268
-1674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+2268
-1674
lines changed

make/data/asan/asan_default_options.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ ATTRIBUTE_DEFAULT_VISIBILITY ATTRIBUTE_USED const char* CDECL __asan_default_opt
6767
#endif
6868
"print_suppressions=0,"
6969
"handle_segv=0,"
70+
// A lot of libjsig related tests fail because of the link order check; so better avoid it
71+
"verify_asan_link_order=0,"
7072
// See https://github.com/google/sanitizers/issues/1322. Hopefully this is resolved
7173
// at some point and we can remove this option.
7274
"intercept_tls_get_addr=0";

make/langtools/tools/javacserver/shared/PortFile.java

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -50,17 +50,16 @@ public class PortFile {
5050
// Followed by a 4 byte int, with the port nr.
5151
// Followed by a 8 byte long, with cookie nr.
5252

53-
private String filename;
54-
private File file;
55-
private File stopFile;
53+
private final String filename;
54+
private final File file;
55+
private final File stopFile;
5656
private RandomAccessFile rwfile;
57-
private FileChannel channel;
5857

5958
// FileLock used to solve inter JVM synchronization, lockSem used to avoid
6059
// JVM internal OverlappingFileLockExceptions.
6160
// Class invariant: lock.isValid() <-> lockSem.availablePermits() == 0
6261
private FileLock lock;
63-
private Semaphore lockSem = new Semaphore(1);
62+
private final Semaphore lockSem = new Semaphore(1);
6463

6564
private boolean containsPortInfo;
6665
private int serverPort;
@@ -89,17 +88,18 @@ private void initializeChannel() throws PortFileInaccessibleException {
8988
}
9089
// The rwfile should only be readable by the owner of the process
9190
// and no other! How do we do that on a RandomAccessFile?
92-
channel = rwfile.getChannel();
9391
}
9492

9593
/**
9694
* Lock the port file.
9795
*/
9896
public void lock() throws IOException, InterruptedException {
99-
if (channel == null) {
100-
initializeChannel();
101-
}
10297
lockSem.acquire();
98+
if (rwfile != null) {
99+
throw new IllegalStateException("rwfile not null");
100+
}
101+
initializeChannel();
102+
FileChannel channel = rwfile.getChannel();
103103
lock = channel.lock();
104104
}
105105

@@ -110,8 +110,7 @@ public void lock() throws IOException, InterruptedException {
110110
public void getValues() {
111111
containsPortInfo = false;
112112
if (lock == null) {
113-
// Not locked, remain ignorant about port file contents.
114-
return;
113+
throw new IllegalStateException("Must lock before calling getValues");
115114
}
116115
try {
117116
if (rwfile.length()>0) {
@@ -156,6 +155,9 @@ public long getCookie() {
156155
* Store the values into the locked port file.
157156
*/
158157
public void setValues(int port, long cookie) throws IOException {
158+
if (lock == null) {
159+
throw new IllegalStateException("Must lock before calling setValues");
160+
}
159161
rwfile.seek(0);
160162
// Write the magic nr that identifies a port file.
161163
rwfile.writeInt(magicNr);
@@ -169,19 +171,19 @@ public void setValues(int port, long cookie) throws IOException {
169171
* Delete the port file.
170172
*/
171173
public void delete() throws IOException, InterruptedException {
172-
// Access to file must be closed before deleting.
173-
rwfile.close();
174-
175-
file.delete();
176-
177-
// Wait until file has been deleted (deletes are asynchronous on Windows!) otherwise we
174+
if (!file.exists()) { // file deleted already
175+
return;
176+
}
177+
// Keep trying until file has been deleted, otherwise we
178178
// might shutdown the server and prevent another one from starting.
179-
for (int i = 0; i < 10 && file.exists(); i++) {
179+
for (int i = 0; i < 10 && file.exists() && !file.delete(); i++) {
180180
Thread.sleep(1000);
181181
}
182182
if (file.exists()) {
183183
throw new IOException("Failed to delete file.");
184184
}
185+
// allow some time for late clients to connect
186+
Thread.sleep(1000);
185187
}
186188

187189
/**
@@ -210,10 +212,12 @@ public boolean markedForStop() throws IOException {
210212
*/
211213
public void unlock() throws IOException {
212214
if (lock == null) {
213-
return;
215+
throw new IllegalStateException("Not locked");
214216
}
215217
lock.release();
216218
lock = null;
219+
rwfile.close();
220+
rwfile = null;
217221
lockSem.release();
218222
}
219223

src/hotspot/cpu/x86/macroAssembler_x86_32_exp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
3-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3+
* Copyright (C) 2021, Tencent. All rights reserved.
44
* Intel Math Library (LIBM) Source Code
55
*
66
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

src/hotspot/cpu/x86/macroAssembler_x86_32_log.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
3-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3+
* Copyright (C) 2021, Tencent. All rights reserved.
44
* Intel Math Library (LIBM) Source Code
55
*
66
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

src/hotspot/cpu/x86/macroAssembler_x86_32_pow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
3-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3+
* Copyright (C) 2021, Tencent. All rights reserved.
44
* Intel Math Library (LIBM) Source Code
55
*
66
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

src/hotspot/cpu/x86/stubGenerator_x86_64_exp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
3-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3+
* Copyright (C) 2021, Tencent. All rights reserved.
44
* Intel Math Library (LIBM) Source Code
55
*
66
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

src/hotspot/cpu/x86/stubGenerator_x86_64_log.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
3-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3+
* Copyright (C) 2021, Tencent. All rights reserved.
44
* Intel Math Library (LIBM) Source Code
55
*
66
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

src/hotspot/cpu/x86/stubGenerator_x86_64_pow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved.
3-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3+
* Copyright (C) 2021, Tencent. All rights reserved.
44
* Intel Math Library (LIBM) Source Code
55
*
66
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

src/hotspot/os/aix/os_aix.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ bool os::dll_address_to_library_name(address addr, char* buf,
11081108
return true;
11091109
}
11101110

1111-
static void* dll_load_library(const char *filename, char *ebuf, int ebuflen) {
1111+
static void* dll_load_library(const char *filename, int *eno, char *ebuf, int ebuflen) {
11121112

11131113
log_info(os)("attempting shared library load of %s", filename);
11141114
if (ebuf && ebuflen > 0) {
@@ -1135,7 +1135,7 @@ static void* dll_load_library(const char *filename, char *ebuf, int ebuflen) {
11351135

11361136
void* result;
11371137
const char* error_report = nullptr;
1138-
result = Aix_dlopen(filename, dflags, &error_report);
1138+
result = Aix_dlopen(filename, dflags, eno, &error_report);
11391139
if (result != nullptr) {
11401140
Events::log_dll_message(nullptr, "Loaded shared library %s", filename);
11411141
// Reload dll cache. Don't do this in signal handling.
@@ -1166,12 +1166,13 @@ void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
11661166
const char new_extension[] = ".a";
11671167
STATIC_ASSERT(sizeof(old_extension) >= sizeof(new_extension));
11681168
// First try to load the existing file.
1169-
result = dll_load_library(filename, ebuf, ebuflen);
1169+
int eno=0;
1170+
result = dll_load_library(filename, &eno, ebuf, ebuflen);
11701171
// If the load fails,we try to reload by changing the extension to .a for .so files only.
11711172
// Shared object in .so format dont have braces, hence they get removed for archives with members.
1172-
if (result == nullptr && pointer_to_dot != nullptr && strcmp(pointer_to_dot, old_extension) == 0) {
1173+
if (result == nullptr && eno == ENOENT && pointer_to_dot != nullptr && strcmp(pointer_to_dot, old_extension) == 0) {
11731174
snprintf(pointer_to_dot, sizeof(old_extension), "%s", new_extension);
1174-
result = dll_load_library(file_path, ebuf, ebuflen);
1175+
result = dll_load_library(file_path, &eno, ebuf, ebuflen);
11751176
}
11761177
FREE_C_HEAP_ARRAY(char, file_path);
11771178
return result;

src/hotspot/os/aix/porting_aix.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ static bool search_file_in_LIBPATH(const char* path, struct stat64x* stat) {
10351035
// specific AIX versions for ::dlopen() and ::dlclose(), which handles the struct g_handletable
10361036
// This way we mimic dl handle equality for a library
10371037
// opened a second time, as it is implemented on other platforms.
1038-
void* Aix_dlopen(const char* filename, int Flags, const char** error_report) {
1038+
void* Aix_dlopen(const char* filename, int Flags, int *eno, const char** error_report) {
10391039
assert(error_report != nullptr, "error_report is nullptr");
10401040
void* result;
10411041
struct stat64x libstat;
@@ -1047,6 +1047,7 @@ void* Aix_dlopen(const char* filename, int Flags, const char** error_report) {
10471047
assert(result == nullptr, "dll_load: Could not stat() file %s, but dlopen() worked; Have to improve stat()", filename);
10481048
#endif
10491049
*error_report = "Could not load module .\nSystem error: No such file or directory";
1050+
*eno = ENOENT;
10501051
return nullptr;
10511052
}
10521053
else {
@@ -1090,6 +1091,7 @@ void* Aix_dlopen(const char* filename, int Flags, const char** error_report) {
10901091
p_handletable = new_tab;
10911092
}
10921093
// Library not yet loaded; load it, then store its handle in handle table
1094+
errno = 0;
10931095
result = ::dlopen(filename, Flags);
10941096
if (result != nullptr) {
10951097
g_handletable_used++;
@@ -1101,6 +1103,7 @@ void* Aix_dlopen(const char* filename, int Flags, const char** error_report) {
11011103
}
11021104
else {
11031105
// error analysis when dlopen fails
1106+
*eno = errno;
11041107
*error_report = ::dlerror();
11051108
if (*error_report == nullptr) {
11061109
*error_report = "dlerror returned no error description";

0 commit comments

Comments
 (0)