Skip to content

Commit 7d1ea95

Browse files
authored
Merge pull request #1928 from SAP/pr-jdk-11.0.27+2
Merge to tag jdk-11.0.27+2
2 parents 3b9fdf5 + 8322c66 commit 7d1ea95

35 files changed

+652
-409
lines changed

src/java.base/share/classes/sun/security/validator/CADistrustPolicy.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, 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
@@ -69,6 +69,22 @@ void checkDistrust(String variant, X509Certificate[] chain)
6969
}
7070
EntrustTLSPolicy.checkDistrust(chain);
7171
}
72+
},
73+
74+
/**
75+
* Distrust TLS Server certificates anchored by a CAMERFIRMA root CA and
76+
* issued after April 15, 2025. If enabled, this policy is currently
77+
* enforced by the PKIX and SunX509 TrustManager implementations
78+
* of the SunJSSE provider implementation.
79+
*/
80+
CAMERFIRMA_TLS {
81+
void checkDistrust(String variant, X509Certificate[] chain)
82+
throws ValidatorException {
83+
if (!variant.equals(Validator.VAR_TLS_SERVER)) {
84+
return;
85+
}
86+
CamerfirmaTLSPolicy.checkDistrust(chain);
87+
}
7288
};
7389

7490
/**
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Copyright (c) 2025, 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. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package sun.security.validator;
26+
27+
import java.security.cert.X509Certificate;
28+
import java.time.LocalDate;
29+
import java.time.Month;
30+
import java.time.ZoneOffset;
31+
import java.util.Date;
32+
import java.util.Map;
33+
import java.util.Set;
34+
35+
import sun.security.util.Debug;
36+
import sun.security.x509.X509CertImpl;
37+
38+
/**
39+
* This class checks if Camerfirma issued TLS Server certificates should be
40+
* restricted.
41+
*/
42+
final class CamerfirmaTLSPolicy {
43+
44+
private static final Debug debug = Debug.getInstance("certpath");
45+
46+
// SHA-256 certificate fingerprints of distrusted roots
47+
private static final Set<String> FINGERPRINTS = Set.of(
48+
// cacerts alias: camerfirmachamberscommerceca
49+
// DN: CN=Chambers of Commerce Root,
50+
// OU=http://www.chambersign.org,
51+
// O=AC Camerfirma SA CIF A82743287, C=EU
52+
"0C258A12A5674AEF25F28BA7DCFAECEEA348E541E6F5CC4EE63B71B361606AC3",
53+
// cacerts alias: camerfirmachambersca
54+
// DN: CN=Chambers of Commerce Root - 2008,
55+
// O=AC Camerfirma S.A., SERIALNUMBER=A82743287,
56+
// L=Madrid (see current address at www.camerfirma.com/address),
57+
// C=EU
58+
"063E4AFAC491DFD332F3089B8542E94617D893D7FE944E10A7937EE29D9693C0",
59+
// cacerts alias: camerfirmachambersignca
60+
// DN: CN=Global Chambersign Root - 2008,
61+
// O=AC Camerfirma S.A., SERIALNUMBER=A82743287,
62+
// L=Madrid (see current address at www.camerfirma.com/address),
63+
// C=EU
64+
"136335439334A7698016A0D324DE72284E079D7B5220BB8FBD747816EEBEBACA"
65+
);
66+
67+
// Any TLS Server certificate that is anchored by one of the Camerfirma
68+
// roots above and is issued after this date will be distrusted.
69+
private static final LocalDate APRIL_15_2025 =
70+
LocalDate.of(2025, Month.APRIL, 15);
71+
72+
/**
73+
* This method assumes the eeCert is a TLS Server Cert and chains back to
74+
* the anchor.
75+
*
76+
* @param chain the end-entity's certificate chain. The end entity cert
77+
* is at index 0, the trust anchor at index n-1.
78+
* @throws ValidatorException if the certificate is distrusted
79+
*/
80+
static void checkDistrust(X509Certificate[] chain)
81+
throws ValidatorException {
82+
X509Certificate anchor = chain[chain.length-1];
83+
String fp = fingerprint(anchor);
84+
if (fp == null) {
85+
throw new ValidatorException("Cannot generate fingerprint for "
86+
+ "trust anchor of TLS server certificate");
87+
}
88+
if (FINGERPRINTS.contains(fp)) {
89+
Date notBefore = chain[0].getNotBefore();
90+
LocalDate ldNotBefore = LocalDate.ofInstant(notBefore.toInstant(),
91+
ZoneOffset.UTC);
92+
// reject if certificate is issued after April 15, 2025
93+
checkNotBefore(ldNotBefore, APRIL_15_2025, anchor);
94+
}
95+
}
96+
97+
private static String fingerprint(X509Certificate cert) {
98+
return X509CertImpl.getFingerprint("SHA-256", cert);
99+
}
100+
101+
private static void checkNotBefore(LocalDate notBeforeDate,
102+
LocalDate distrustDate, X509Certificate anchor)
103+
throws ValidatorException {
104+
if (notBeforeDate.isAfter(distrustDate)) {
105+
throw new ValidatorException
106+
("TLS Server certificate issued after " + distrustDate +
107+
" and anchored by a distrusted legacy Camerfirma root CA: "
108+
+ anchor.getSubjectX500Principal(),
109+
ValidatorException.T_UNTRUSTED_CERT, anchor);
110+
}
111+
}
112+
113+
private CamerfirmaTLSPolicy() {}
114+
}

src/java.base/share/conf/security/java.security

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,9 @@ jdk.sasl.disabledMechanisms=
12951295
# ENTRUST_TLS : Distrust TLS Server certificates anchored by
12961296
# an Entrust root CA and issued after November 11, 2024.
12971297
#
1298+
# CAMERFIRMA_TLS : Distrust TLS Server certificates anchored by
1299+
# a Camerfirma root CA and issued after April 15, 2025.
1300+
#
12981301
# Leading and trailing whitespace surrounding each value are ignored.
12991302
# Unknown values are ignored. If the property is commented out or set to the
13001303
# empty String, no policies are enforced.
@@ -1306,7 +1309,7 @@ jdk.sasl.disabledMechanisms=
13061309
# jdk.certpath.disabledAlgorithms; those restrictions are still enforced even
13071310
# if this property is not enabled.
13081311
#
1309-
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS
1312+
jdk.security.caDistrustPolicies=SYMANTEC_TLS,ENTRUST_TLS,CAMERFIRMA_TLS
13101313

13111314
#
13121315
# FilePermission path canonicalization

src/jdk.hotspot.agent/macosx/native/libsaproc/ps_core.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -622,11 +622,16 @@ static bool read_core_segments(struct ps_prochandle* ph) {
622622
print_debug("failed to read LC_SEGMENT_64 i = %d!\n", i);
623623
goto err;
624624
}
625-
if (add_map_info(ph, fd, segcmd.fileoff, segcmd.vmaddr, segcmd.vmsize) == NULL) {
626-
print_debug("Failed to add map_info at i = %d\n", i);
627-
goto err;
625+
// The base of the library is offset by a random amount which ends up as a load command with a
626+
// filesize of 0. This must be ignored otherwise the base address of the library is wrong.
627+
if (segcmd.filesize != 0) {
628+
if (add_map_info(ph, fd, segcmd.fileoff, segcmd.vmaddr, segcmd.vmsize) == NULL) {
629+
print_debug("Failed to add map_info at i = %d\n", i);
630+
goto err;
631+
}
628632
}
629-
print_debug("LC_SEGMENT_64 added: nsects=%d fileoff=0x%llx vmaddr=0x%llx vmsize=0x%llx filesize=0x%llx %s\n",
633+
print_debug("LC_SEGMENT_64 %s: nsects=%d fileoff=0x%llx vmaddr=0x%llx vmsize=0x%llx filesize=0x%llx %s\n",
634+
segcmd.filesize == 0 ? "with filesize == 0 ignored" : "added",
630635
segcmd.nsects, segcmd.fileoff, segcmd.vmaddr, segcmd.vmsize,
631636
segcmd.filesize, &segcmd.segname[0]);
632637
} else if (lcmd.cmd == LC_THREAD || lcmd.cmd == LC_UNIXTHREAD) {

test/hotspot/jtreg/ProblemList.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,22 +164,22 @@ runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64
164164

165165
serviceability/dcmd/gc/RunFinalizationTest.java 8227120 generic-all
166166
serviceability/sa/ClhsdbAttach.java 8193639 solaris-all
167-
serviceability/sa/ClhsdbCDSCore.java 8294316,8193639,8267433 solaris-all,macosx-x64
167+
serviceability/sa/ClhsdbCDSCore.java 8193639,8267433 solaris-all,macosx-x64
168168
serviceability/sa/ClhsdbCDSJstackPrintAll.java 8193639 solaris-all
169169
serviceability/sa/CDSJMapClstats.java 8193639 solaris-all
170170
serviceability/sa/ClhsdbField.java 8193639 solaris-all
171-
serviceability/sa/ClhsdbFindPC.java 8294316,8193639,8267433 solaris-all,macosx-x64
171+
serviceability/sa/ClhsdbFindPC.java 8193639,8267433 solaris-all,macosx-x64
172172
serviceability/sa/ClhsdbFlags.java 8193639 solaris-all
173173
serviceability/sa/ClhsdbInspect.java 8193639 solaris-all
174174
serviceability/sa/ClhsdbJdis.java 8193639 solaris-all
175175
serviceability/sa/ClhsdbJhisto.java 8193639 solaris-all
176176
serviceability/sa/ClhsdbJstack.java 8193639 solaris-all
177177
serviceability/sa/ClhsdbLongConstant.java 8193639 solaris-all
178-
serviceability/sa/ClhsdbPmap.java 8294316,8193639,8267433 solaris-all,macosx-x64
178+
serviceability/sa/ClhsdbPmap.java 8193639,8267433 solaris-all,macosx-x64
179179
serviceability/sa/ClhsdbPrintAll.java 8193639 solaris-all
180180
serviceability/sa/ClhsdbPrintAs.java 8193639 solaris-all
181181
serviceability/sa/ClhsdbPrintStatics.java 8193639 solaris-all
182-
serviceability/sa/ClhsdbPstack.java 8294316,8193639,8267433 solaris-all,macosx-x64
182+
serviceability/sa/ClhsdbPstack.java 8193639,8267433 solaris-all,macosx-x64
183183
serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all
184184
serviceability/sa/ClhsdbScanOops.java 8193639 solaris-all
185185
serviceability/sa/ClhsdbSource.java 8193639 solaris-all
@@ -203,8 +203,8 @@ serviceability/sa/TestInstanceKlassSize.java 8193639 solaris-all
203203
serviceability/sa/TestInstanceKlassSizeForInterface.java 8193639 solaris-all
204204
serviceability/sa/TestIntConstant.java 8193639 solaris-all
205205
serviceability/sa/TestJhsdbJstackLock.java 8193639 solaris-all
206-
serviceability/sa/TestJmapCore.java 8294316,8193639,8267433 solaris-all,macosx-x64
207-
serviceability/sa/TestJmapCoreMetaspace.java 8294316,8193639,8267433 solaris-all,macosx-x64
206+
serviceability/sa/TestJmapCore.java 8193639,8267433 solaris-all,macosx-x64
207+
serviceability/sa/TestJmapCoreMetaspace.java 8193639,8267433 solaris-all,macosx-x64
208208
serviceability/sa/TestPrintMdo.java 8193639 solaris-all
209209
serviceability/sa/TestRevPtrsForInvokeDynamic.java 8191270 generic-all
210210
serviceability/sa/TestType.java 8193639 solaris-all

test/jdk/ProblemList.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ java/awt/image/VolatileImage/CustomCompositeTest.java 8199002 windows-all,linux-
445445
java/awt/image/VolatileImage/GradientPaints.java 8199003 linux-all
446446
java/awt/JAWT/JAWT.sh 8197798 windows-all
447447
java/awt/Debug/DumpOnKey/DumpOnKey.java 8202667 windows-all
448-
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java 8202926 linux-all
448+
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java 8339929 linux-all
449449
java/awt/datatransfer/ConstructFlavoredObjectTest/ConstructFlavoredObjectTest.java 8202860 linux-all
450450
java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java 8202882 linux-all
451451
java/awt/Frame/FramesGC/FramesGC.java 8079069 macosx-all

0 commit comments

Comments
 (0)