Skip to content

Commit d9ff140

Browse files
authored
Merge branch 'openjdk:master' into backport-mrserb-bc24a0ce-master
2 parents dca0437 + 42c6c17 commit d9ff140

37 files changed

+2933
-300
lines changed

.github/workflows/submit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ jobs:
15881588
-H 'Accept: application/vnd.github+json' \
15891589
-H 'Authorization: Bearer ${{ github.token }}' \
15901590
-H 'X-GitHub-Api-Version: 2022-11-28' \
1591-
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts'
1591+
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts?per_page=100'
15921592
15931593
- name: Delete transient artifacts
15941594
run: |
@@ -1598,7 +1598,7 @@ jobs:
15981598
-H 'Accept: application/vnd.github+json' \
15991599
-H 'Authorization: Bearer ${{ github.token }}' \
16001600
-H 'X-GitHub-Api-Version: 2022-11-28' \
1601-
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts')"
1601+
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts?per_page=100')"
16021602
BUNDLE_ARTIFACT_IDS="$(echo "$ALL_ARTIFACT_IDS" | jq -r -c '.artifacts | map(select(.name|startswith("transient_"))) | .[].id')"
16031603
for id in $BUNDLE_ARTIFACT_IDS; do
16041604
echo "Removing $id"

SECURITY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# JDK Vulnerabilities
2+
3+
Please follow the process outlined in the [OpenJDK Vulnerability Policy](https://openjdk.org/groups/vulnerability/report) to disclose vulnerabilities in the JDK.

hotspot/src/share/vm/c1/c1_Canonicalizer.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2019, 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
@@ -303,24 +303,20 @@ void Canonicalizer::do_ShiftOp (ShiftOp* x) {
303303
}
304304
if (t2->is_constant()) {
305305
if (t->tag() == intTag) {
306-
int value = t->as_IntConstant()->value();
307-
int shift = t2->as_IntConstant()->value() & 31;
308-
jint mask = ~(~0 << (32 - shift));
309-
if (shift == 0) mask = ~0;
306+
jint value = t->as_IntConstant()->value();
307+
jint shift = t2->as_IntConstant()->value();
310308
switch (x->op()) {
311-
case Bytecodes::_ishl: set_constant(value << shift); return;
312-
case Bytecodes::_ishr: set_constant(value >> shift); return;
313-
case Bytecodes::_iushr: set_constant((value >> shift) & mask); return;
309+
case Bytecodes::_ishl: set_constant(java_shift_left(value, shift)); return;
310+
case Bytecodes::_ishr: set_constant(java_shift_right(value, shift)); return;
311+
case Bytecodes::_iushr: set_constant(java_shift_right_unsigned(value, shift)); return;
314312
}
315313
} else if (t->tag() == longTag) {
316314
jlong value = t->as_LongConstant()->value();
317-
int shift = t2->as_IntConstant()->value() & 63;
318-
jlong mask = ~(~jlong_cast(0) << (64 - shift));
319-
if (shift == 0) mask = ~jlong_cast(0);
315+
jint shift = t2->as_IntConstant()->value();
320316
switch (x->op()) {
321-
case Bytecodes::_lshl: set_constant(value << shift); return;
322-
case Bytecodes::_lshr: set_constant(value >> shift); return;
323-
case Bytecodes::_lushr: set_constant((value >> shift) & mask); return;
317+
case Bytecodes::_lshl: set_constant(java_shift_left(value, shift)); return;
318+
case Bytecodes::_lshr: set_constant(java_shift_right(value, shift)); return;
319+
case Bytecodes::_lushr: set_constant(java_shift_right_unsigned(value, shift)); return;
324320
}
325321
}
326322
}

hotspot/src/share/vm/opto/doCall.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,8 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
892892
tty->print_cr(" Catching every inline exception bci:%d -> handler_bci:%d", bci(), handler_bci);
893893
}
894894
#endif
895+
// If this is a backwards branch in the bytecodes, add safepoint
896+
maybe_add_safepoint(handler_bci);
895897
merge_exception(handler_bci); // jump to handler
896898
return; // No more handling to be done here!
897899
}
@@ -925,6 +927,8 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
925927
tty->cr();
926928
}
927929
#endif
930+
// If this is a backwards branch in the bytecodes, add safepoint
931+
maybe_add_safepoint(handler_bci);
928932
merge_exception(handler_bci);
929933
}
930934
set_control(not_subtype_ctrl);

hotspot/src/share/vm/utilities/globalDefinitions.hpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,42 @@ inline intx byte_size(void* from, void* to) {
12801280
return (address)to - (address)from;
12811281
}
12821282

1283+
#ifdef ASSERT
1284+
#define RHS_MASK_ASSERT(rhs_mask) \
1285+
if (rhs_mask != 31 && rhs_mask != 63) { \
1286+
basic_fatal("rhs_mask assertion failed."); \
1287+
}
1288+
#else
1289+
#define RHS_MASK_ASSERT(rhs_mask)
1290+
#endif
1291+
1292+
// Provide integer shift operations with Java semantics. No overflow
1293+
// issues - left shifts simply discard shifted out bits. No undefined
1294+
// behavior for large or negative shift quantities; instead the actual
1295+
// shift distance is the argument modulo the lhs value's size in bits.
1296+
// No undefined or implementation defined behavior for shifting negative
1297+
// values; left shift discards bits, right shift sign extends. We use
1298+
// the same safe conversion technique as above for java_add and friends.
1299+
#define JAVA_INTEGER_SHIFT_OP(OP, NAME, TYPE, XTYPE) \
1300+
inline TYPE NAME (TYPE lhs, jint rhs) { \
1301+
const uint rhs_mask = (sizeof(TYPE) * 8) - 1; \
1302+
RHS_MASK_ASSERT(rhs_mask) \
1303+
XTYPE xres = static_cast<XTYPE>(lhs); \
1304+
xres OP ## = (rhs & rhs_mask); \
1305+
return reinterpret_cast<TYPE&>(xres); \
1306+
}
1307+
1308+
JAVA_INTEGER_SHIFT_OP(<<, java_shift_left, jint, juint)
1309+
JAVA_INTEGER_SHIFT_OP(<<, java_shift_left, jlong, julong)
1310+
// For signed shift right, assume C++ implementation >> sign extends.
1311+
JAVA_INTEGER_SHIFT_OP(>>, java_shift_right, jint, jint)
1312+
JAVA_INTEGER_SHIFT_OP(>>, java_shift_right, jlong, jlong)
1313+
// For >>> use C++ unsigned >>.
1314+
JAVA_INTEGER_SHIFT_OP(>>, java_shift_right_unsigned, jint, juint)
1315+
JAVA_INTEGER_SHIFT_OP(>>, java_shift_right_unsigned, jlong, julong)
1316+
1317+
#undef JAVA_INTEGER_SHIFT_OP
1318+
12831319
//----------------------------------------------------------------------------------------------------
12841320
// Avoid non-portable casts with these routines (DEPRECATED)
12851321

hotspot/test/compiler/6891750/Test6891750.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2018, 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
@@ -27,7 +27,7 @@
2727
* @bug 6891750
2828
* @summary deopt blob kills values in O5
2929
*
30-
* @run main Test6891750
30+
* @run main/othervm Test6891750
3131
*/
3232

3333
abstract class Base6891750 extends Thread {
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
public class MissingSafepointOnTryCatch version 52:0 {
25+
26+
static Method m:"()V" {
27+
return;
28+
}
29+
30+
static Method test1:"()V" stack 1 {
31+
try t;
32+
invokestatic m:"()V";
33+
return;
34+
35+
catch t java/lang/Throwable;
36+
stack_map class java/lang/Throwable;
37+
athrow;
38+
endtry t;
39+
}
40+
41+
static Method test2:"()V" stack 1 {
42+
try t0;
43+
try t1;
44+
invokestatic m:"()V";
45+
endtry t1;
46+
return;
47+
48+
catch t1 java/lang/Exception;
49+
stack_map class java/lang/Exception;
50+
return;
51+
52+
catch t0 java/lang/Throwable;
53+
stack_map class java/lang/Throwable;
54+
athrow;
55+
endtry t0;
56+
}
57+
58+
public static Method th:"()V"
59+
throws java/lang/Exception
60+
stack 2 locals 0
61+
{
62+
new class java/lang/Exception;
63+
dup;
64+
invokespecial Method java/lang/Exception."<init>":"()V";
65+
athrow;
66+
}
67+
68+
static Method test3:"()V" stack 1 locals 2 {
69+
try t;
70+
invokestatic m:"()V";
71+
iconst_1;
72+
istore_0;
73+
iconst_0;
74+
istore_1;
75+
return;
76+
catch t java/lang/Throwable;
77+
stack_map class java/lang/Throwable;
78+
invokestatic th:"()V";
79+
return;
80+
endtry t;
81+
}
82+
83+
static Method test4:"()V" stack 2 locals 2 {
84+
try t;
85+
invokestatic m:"()V";
86+
iconst_1;
87+
istore_0;
88+
iconst_0;
89+
istore_1;
90+
return;
91+
catch t java/lang/Throwable;
92+
stack_map class java/lang/Throwable;
93+
iconst_1;
94+
istore_0;
95+
invokestatic th:"()V";
96+
return;
97+
endtry t;
98+
}
99+
100+
static Method testInfinite:"()V" stack 1 {
101+
try t;
102+
invokestatic th:"()V";
103+
return;
104+
105+
catch t java/lang/Throwable;
106+
stack_map class java/lang/Throwable;
107+
athrow;
108+
endtry t;
109+
}
110+
111+
} // end Class MissingSafepointOnTryCatch
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 8313626
27+
* @summary assert(false) failed: malformed control flow to missing safepoint on backedge of a try-catch
28+
* @library /test/lib
29+
* @compile MissingSafepointOnTryCatch.jasm
30+
* @run main/othervm -XX:CompileCommand=quiet
31+
* -XX:CompileCommand=compileonly,MissingSafepointOnTryCatch::test*
32+
* -XX:CompileCommand=dontinline,MissingSafepointOnTryCatch::m
33+
* -XX:CompileCommand=inline,MissingSafepointOnTryCatch::th
34+
* -XX:-TieredCompilation -Xcomp TestMissingSafepointOnTryCatch
35+
*/
36+
37+
import jdk.test.lib.Utils;
38+
39+
public class TestMissingSafepointOnTryCatch {
40+
41+
public static void infiniteLoop() {
42+
try {
43+
Thread thread = new Thread() {
44+
public void run() {
45+
MissingSafepointOnTryCatch.testInfinite();
46+
}
47+
};
48+
thread.setDaemon(true);
49+
thread.start();
50+
Thread.sleep(Utils.adjustTimeout(500));
51+
} catch (Exception e) {}
52+
}
53+
54+
public static void main(String[] args) {
55+
try {
56+
// to make sure java/lang/Exception class is resolved
57+
MissingSafepointOnTryCatch.th();
58+
} catch (Exception e) {}
59+
MissingSafepointOnTryCatch.test1();
60+
MissingSafepointOnTryCatch.test2();
61+
MissingSafepointOnTryCatch.test3();
62+
MissingSafepointOnTryCatch.test4();
63+
infiniteLoop();
64+
}
65+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Owner: CN=SSL.com TLS ECC Root CA 2022, O=SSL Corporation, C=US
2+
Issuer: CN=SSL.com TLS ECC Root CA 2022, O=SSL Corporation, C=US
3+
Serial number: 1403f5abfb378b17405be243b2a5d1c4
4+
Valid from: Thu Aug 25 16:33:48 GMT 2022 until: Sun Aug 19 16:33:47 GMT 2046
5+
Signature algorithm name: SHA384withECDSA
6+
Subject Public Key Algorithm: 384-bit EC (secp384r1) key
7+
Version: 3
8+
-----BEGIN CERTIFICATE-----
9+
MIICOjCCAcCgAwIBAgIQFAP1q/s3ixdAW+JDsqXRxDAKBggqhkjOPQQDAzBOMQsw
10+
CQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQDDBxT
11+
U0wuY29tIFRMUyBFQ0MgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzM0OFoXDTQ2
12+
MDgxOTE2MzM0N1owTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jwb3Jh
13+
dGlvbjElMCMGA1UEAwwcU1NMLmNvbSBUTFMgRUNDIFJvb3QgQ0EgMjAyMjB2MBAG
14+
ByqGSM49AgEGBSuBBAAiA2IABEUpNXP6wrgjzhR9qLFNoFs27iosU8NgCTWyJGYm
15+
acCzldZdkkAZDsalE3D07xJRKF3nzL35PIXBz5SQySvOkkJYWWf9lCcQZIxPBLFN
16+
SeR7T5v15wj4A4j3p8OSSxlUgaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSME
17+
GDAWgBSJjy+j6CugFFR781a4Jl9nOAuc0DAdBgNVHQ4EFgQUiY8vo+groBRUe/NW
18+
uCZfZzgLnNAwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2gAMGUCMFXjIlbp
19+
15IkWE8elDIPDAI2wv2sdDJO4fscgIijzPvX6yv/N33w7deedWo1dlJF4AIxAMeN
20+
b0Igj762TVntd00pxCAgRWSGOlDGxK0tk/UYfXLtqc/ErFc2KAhl3zx5Zn6g6g==
21+
-----END CERTIFICATE-----
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Owner: CN=SSL.com TLS RSA Root CA 2022, O=SSL Corporation, C=US
2+
Issuer: CN=SSL.com TLS RSA Root CA 2022, O=SSL Corporation, C=US
3+
Serial number: 6fbedaad73bd0840e28b4dbed4f75b91
4+
Valid from: Thu Aug 25 16:34:22 GMT 2022 until: Sun Aug 19 16:34:21 GMT 2046
5+
Signature algorithm name: SHA256withRSA
6+
Subject Public Key Algorithm: 4096-bit RSA key
7+
Version: 3
8+
-----BEGIN CERTIFICATE-----
9+
MIIFiTCCA3GgAwIBAgIQb77arXO9CEDii02+1PdbkTANBgkqhkiG9w0BAQsFADBO
10+
MQswCQYDVQQGEwJVUzEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMSUwIwYDVQQD
11+
DBxTU0wuY29tIFRMUyBSU0EgUm9vdCBDQSAyMDIyMB4XDTIyMDgyNTE2MzQyMloX
12+
DTQ2MDgxOTE2MzQyMVowTjELMAkGA1UEBhMCVVMxGDAWBgNVBAoMD1NTTCBDb3Jw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