Skip to content

Commit 0a7a72f

Browse files
authored
Merge pull request #2105 from SAP/pr-jdk-11.0.30+2
Merge to tag jdk-11.0.30+2
2 parents 19782a5 + cfbea32 commit 0a7a72f

File tree

11 files changed

+381
-63
lines changed

11 files changed

+381
-63
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -317,48 +317,3 @@ jobs:
317317
platform: windows-x64
318318
bootjdk-platform: windows-x64
319319
runs-on: windows-2025
320-
321-
# Remove bundles so they are not misconstrued as binary distributions from the JDK project
322-
remove-bundles:
323-
name: 'Remove bundle artifacts'
324-
runs-on: ubuntu-22.04
325-
# SapMachine 2022-06-23: On 'pull_request' we only want to run GHA if the PR comes from a remote repo. Otherwise we have the run on 'push' already as a check.
326-
if: ${{ github.event_name != 'pull_request' || github.repository != 'SAP/SapMachine' }}
327-
needs:
328-
- build-linux-x64
329-
- build-linux-x86
330-
- build-linux-x64-hs-nopch
331-
- build-linux-x64-hs-zero
332-
- build-linux-x64-hs-minimal
333-
- build-linux-x64-hs-optimized
334-
- build-linux-cross-compile
335-
- build-macos-x64
336-
- build-macos-aarch64
337-
- build-windows-x64
338-
- build-windows-aarch64
339-
- test-linux-x64
340-
- test-linux-x86
341-
- test-macos-x64
342-
- test-windows-x64
343-
344-
steps:
345-
- name: 'Remove bundle artifacts'
346-
run: |
347-
# Find and remove all bundle artifacts
348-
# See: https://docs.github.com/en/rest/actions/artifacts?apiVersion=2022-11-28
349-
ALL_ARTIFACT_IDS="$(curl -sL \
350-
-H 'Accept: application/vnd.github+json' \
351-
-H 'Authorization: Bearer ${{ github.token }}' \
352-
-H 'X-GitHub-Api-Version: 2022-11-28' \
353-
'${{ github.api_url }}/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts?per_page=100')"
354-
BUNDLE_ARTIFACT_IDS="$(echo "$ALL_ARTIFACT_IDS" | jq -r -c '.artifacts | map(select(.name|startswith("bundles-"))) | .[].id')"
355-
for id in $BUNDLE_ARTIFACT_IDS; do
356-
echo "Removing $id"
357-
curl -sL \
358-
-X DELETE \
359-
-H 'Accept: application/vnd.github+json' \
360-
-H 'Authorization: Bearer ${{ github.token }}' \
361-
-H 'X-GitHub-Api-Version: 2022-11-28' \
362-
"${{ github.api_url }}/repos/${{ github.repository }}/actions/artifacts/$id" \
363-
|| echo "Failed to remove bundle"
364-
done

make/CompileJavaModules.gmk

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,13 @@ jdk.jfr_ADD_JAVAC_FLAGS := -XDstringConcat=inline -Xlint:-exports
531531
################################################################################
532532
# If this is an imported module that has prebuilt classes, only compile
533533
# module-info.java.
534-
ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), )
535-
$(MODULE)_INCLUDE_FILES := module-info.java
534+
ifneq ($(IMPORT_MODULES_CLASSES), )
535+
IMPORT_MODULE_DIR := $(IMPORT_MODULES_CLASSES)/$(MODULE)
536+
ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
537+
$(MODULE)_INCLUDE_FILES := module-info.java
538+
endif
539+
else
540+
IMPORT_MODULE_DIR :=
536541
endif
537542

538543
################################################################################
@@ -638,13 +643,13 @@ endif
638643
# If this is an imported module, copy the pre built classes and resources into
639644
# the modules output dir
640645

641-
ifneq ($(wildcard $(IMPORT_MODULES_CLASSES)/$(MODULE)), )
646+
ifneq ($(wildcard $(IMPORT_MODULE_DIR)), )
642647
$(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker: \
643-
$(call FindFiles, $(IMPORT_MODULES_CLASSES)/$(MODULE))
648+
$(call FindFiles, $(IMPORT_MODULE_DIR))
644649
$(call MakeDir, $(@D))
645650
# Do not delete marker and build meta data files
646651
$(RM) -r $(filter-out $(@D)/_%, $(wildcard $(@D)/*))
647-
$(CP) -R $(IMPORT_MODULES_CLASSES)/$(MODULE)/* $(@D)/
652+
$(CP) -R $(IMPORT_MODULE_DIR)/* $(@D)/
648653
$(TOUCH) $@
649654

650655
TARGETS += $(JDK_OUTPUTDIR)/modules/$(MODULE)/_imported.marker

src/bsd/doc/man/jarsigner.1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,11 @@ Informational warnings include those that are not errors but regarded as bad pra
624624
hasExpiringCert
625625
This jar contains entries whose signer certificate will expire within six months\&.
626626
.TP
627+
internalInconsistenciesDetected
628+
This jar contains internal inconsistencies detected during verification
629+
that may result in different contents when reading via JarFile
630+
and JarInputStream\&.
631+
.TP
627632
noTimestamp
628633
This jar contains signatures that does not include a timestamp\&. Without a timestamp, users may not be able to validate this JAR file after the signer certificate\&'s expiration date (\f3YYYY-MM-DD\fR) or after any future revocation date\&.
629634
.SH EXAMPLES

src/hotspot/os/linux/cgroupSubsystem_linux.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "utilities/globalDefinitions.hpp"
3636

3737
// controller names have to match the *_IDX indices
38-
static const char* cg_controller_name[] = { "cpu", "cpuset", "cpuacct", "memory", "pids" };
38+
static const char* cg_controller_name[] = { "cpuset", "cpu", "cpuacct", "memory", "pids" };
3939

4040
CgroupSubsystem* CgroupSubsystemFactory::create() {
4141
CgroupV1MemoryController* memory = NULL;
@@ -159,9 +159,10 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
159159
char buf[MAXPATHLEN+1];
160160
char *p;
161161
bool is_cgroupsV2;
162-
// true iff all required controllers, memory, cpu, cpuset, cpuacct are enabled
162+
// true iff all required controllers, memory, cpu, cpuacct are enabled
163163
// at the kernel level.
164164
// pids might not be enabled on older Linux distros (SLES 12.1, RHEL 7.1)
165+
// cpuset might not be enabled on newer Linux distros (Fedora 41)
165166
bool all_required_controllers_enabled;
166167

167168
/*
@@ -193,6 +194,7 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
193194
cg_infos[MEMORY_IDX]._hierarchy_id = hierarchy_id;
194195
cg_infos[MEMORY_IDX]._enabled = (enabled == 1);
195196
} else if (strcmp(name, "cpuset") == 0) {
197+
log_debug(os, container)("Detected optional cpuset controller entry in %s", proc_cgroups);
196198
cg_infos[CPUSET_IDX]._name = os::strdup(name);
197199
cg_infos[CPUSET_IDX]._hierarchy_id = hierarchy_id;
198200
cg_infos[CPUSET_IDX]._enabled = (enabled == 1);
@@ -216,8 +218,8 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
216218
is_cgroupsV2 = true;
217219
all_required_controllers_enabled = true;
218220
for (int i = 0; i < CG_INFO_LENGTH; i++) {
219-
// pids controller is optional. All other controllers are required
220-
if (i != PIDS_IDX) {
221+
// pids and cpuset controllers are optional. All other controllers are required
222+
if (i != PIDS_IDX && i != CPUSET_IDX) {
221223
is_cgroupsV2 = is_cgroupsV2 && cg_infos[i]._hierarchy_id == 0;
222224
all_required_controllers_enabled = all_required_controllers_enabled && cg_infos[i]._enabled;
223225
}

src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
import java.io.*;
2929
import java.net.UnknownHostException;
30+
import java.nio.file.Files;
31+
import java.nio.file.Path;
3032
import java.security.cert.CertPathValidatorException;
3133
import java.security.cert.PKIXBuilderParameters;
3234
import java.util.*;
@@ -217,6 +219,8 @@ public static void main(String args[]) throws Exception {
217219
private Throwable chainNotValidatedReason = null;
218220
private Throwable tsaChainNotValidatedReason = null;
219221

222+
private List<String> crossChkWarnings = new ArrayList<>();
223+
220224
PKIXBuilderParameters pkixParameters;
221225
Set<X509Certificate> trustedCerts = new HashSet<>();
222226

@@ -1045,6 +1049,7 @@ void verifyJar(String jarName)
10451049
}
10461050
}
10471051
System.out.println();
1052+
crossCheckEntries(jarName);
10481053

10491054
if (!anySigned) {
10501055
if (disabledAlgFound) {
@@ -1079,6 +1084,143 @@ void verifyJar(String jarName)
10791084
System.exit(1);
10801085
}
10811086

1087+
private void crossCheckEntries(String jarName) throws Exception {
1088+
Set<String> locEntries = new HashSet<>();
1089+
1090+
try (JarFile jarFile = new JarFile(jarName);
1091+
JarInputStream jis = new JarInputStream(
1092+
Files.newInputStream(Path.of(jarName)))) {
1093+
1094+
Manifest cenManifest = jarFile.getManifest();
1095+
Manifest locManifest = jis.getManifest();
1096+
compareManifest(cenManifest, locManifest);
1097+
1098+
JarEntry locEntry;
1099+
while ((locEntry = jis.getNextJarEntry()) != null) {
1100+
String entryName = locEntry.getName();
1101+
locEntries.add(entryName);
1102+
1103+
JarEntry cenEntry = jarFile.getJarEntry(entryName);
1104+
if (cenEntry == null) {
1105+
crossChkWarnings.add(String.format(rb.getString(
1106+
"entry.1.present.when.reading.jarinputstream.but.missing.via.jarfile"),
1107+
entryName));
1108+
continue;
1109+
}
1110+
1111+
try {
1112+
readEntry(jis);
1113+
} catch (SecurityException e) {
1114+
crossChkWarnings.add(String.format(rb.getString(
1115+
"signature.verification.failed.on.entry.1.when.reading.via.jarinputstream"),
1116+
entryName));
1117+
continue;
1118+
}
1119+
1120+
try (InputStream cenInputStream = jarFile.getInputStream(cenEntry)) {
1121+
if (cenInputStream == null) {
1122+
crossChkWarnings.add(String.format(rb.getString(
1123+
"entry.1.present.in.jarfile.but.unreadable"),
1124+
entryName));
1125+
continue;
1126+
} else {
1127+
try {
1128+
readEntry(cenInputStream);
1129+
} catch (SecurityException e) {
1130+
crossChkWarnings.add(String.format(rb.getString(
1131+
"signature.verification.failed.on.entry.1.when.reading.via.jarfile"),
1132+
entryName));
1133+
continue;
1134+
}
1135+
}
1136+
}
1137+
1138+
compareSigners(cenEntry, locEntry);
1139+
}
1140+
1141+
jarFile.stream()
1142+
.map(JarEntry::getName)
1143+
.filter(n -> !locEntries.contains(n) && !n.equals(JarFile.MANIFEST_NAME))
1144+
.forEach(n -> crossChkWarnings.add(String.format(rb.getString(
1145+
"entry.1.present.when.reading.jarfile.but.missing.via.jarinputstream"), n)));
1146+
}
1147+
}
1148+
1149+
private void readEntry(InputStream is) throws IOException {
1150+
is.transferTo(OutputStream.nullOutputStream());
1151+
}
1152+
1153+
private void compareManifest(Manifest cenManifest, Manifest locManifest) {
1154+
if (cenManifest == null) {
1155+
crossChkWarnings.add(rb.getString(
1156+
"manifest.missing.when.reading.jarfile"));
1157+
return;
1158+
}
1159+
if (locManifest == null) {
1160+
crossChkWarnings.add(rb.getString(
1161+
"manifest.missing.when.reading.jarinputstream"));
1162+
return;
1163+
}
1164+
1165+
Attributes cenMainAttrs = cenManifest.getMainAttributes();
1166+
Attributes locMainAttrs = locManifest.getMainAttributes();
1167+
1168+
for (Object key : cenMainAttrs.keySet()) {
1169+
Object cenValue = cenMainAttrs.get(key);
1170+
Object locValue = locMainAttrs.get(key);
1171+
1172+
if (locValue == null) {
1173+
crossChkWarnings.add(String.format(rb.getString(
1174+
"manifest.attribute.1.present.when.reading.jarfile.but.missing.via.jarinputstream"),
1175+
key));
1176+
} else if (!cenValue.equals(locValue)) {
1177+
crossChkWarnings.add(String.format(rb.getString(
1178+
"manifest.attribute.1.differs.jarfile.value.2.jarinputstream.value.3"),
1179+
key, cenValue, locValue));
1180+
}
1181+
}
1182+
1183+
for (Object key : locMainAttrs.keySet()) {
1184+
if (!cenMainAttrs.containsKey(key)) {
1185+
crossChkWarnings.add(String.format(rb.getString(
1186+
"manifest.attribute.1.present.when.reading.jarinputstream.but.missing.via.jarfile"),
1187+
key));
1188+
}
1189+
}
1190+
}
1191+
1192+
private void compareSigners(JarEntry cenEntry, JarEntry locEntry) {
1193+
CodeSigner[] cenSigners = cenEntry.getCodeSigners();
1194+
CodeSigner[] locSigners = locEntry.getCodeSigners();
1195+
1196+
boolean cenHasSigners = cenSigners != null;
1197+
boolean locHasSigners = locSigners != null;
1198+
1199+
if (cenHasSigners && locHasSigners) {
1200+
if (!Arrays.equals(cenSigners, locSigners)) {
1201+
crossChkWarnings.add(String.format(rb.getString(
1202+
"codesigners.different.for.entry.1.when.reading.jarfile.and.jarinputstream"),
1203+
cenEntry.getName()));
1204+
}
1205+
} else if (cenHasSigners) {
1206+
crossChkWarnings.add(String.format(rb.getString(
1207+
"entry.1.is.signed.in.jarfile.but.is.not.signed.in.jarinputstream"),
1208+
cenEntry.getName()));
1209+
} else if (locHasSigners) {
1210+
crossChkWarnings.add(String.format(rb.getString(
1211+
"entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile"),
1212+
locEntry.getName()));
1213+
}
1214+
}
1215+
1216+
private void displayCrossChkWarnings() {
1217+
System.out.println();
1218+
// First is a summary warning
1219+
System.out.println(rb.getString("jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream"));
1220+
// each warning message with prefix "- "
1221+
crossChkWarnings.forEach(warning -> System.out.println("- " + warning));
1222+
}
1223+
10821224
private void displayMessagesAndResult(boolean isSigning) {
10831225
String result;
10841226
List<String> errors = new ArrayList<>();
@@ -1314,13 +1456,19 @@ private void displayMessagesAndResult(boolean isSigning) {
13141456
System.out.println(rb.getString("Warning."));
13151457
warnings.forEach(System.out::println);
13161458
}
1459+
if (!crossChkWarnings.isEmpty()) {
1460+
displayCrossChkWarnings();
1461+
}
13171462
} else {
13181463
if (!errors.isEmpty() || !warnings.isEmpty()) {
13191464
System.out.println();
13201465
System.out.println(rb.getString("Warning."));
13211466
errors.forEach(System.out::println);
13221467
warnings.forEach(System.out::println);
13231468
}
1469+
if (!crossChkWarnings.isEmpty()) {
1470+
displayCrossChkWarnings();
1471+
}
13241472
}
13251473
if (!isSigning && (!errors.isEmpty() || !warnings.isEmpty())) {
13261474
if (! (verbose != null && showcerts)) {

src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,34 @@ public class Resources extends java.util.ListResourceBundle {
324324
{"Cannot.find.environment.variable.",
325325
"Cannot find environment variable: "},
326326
{"Cannot.find.file.", "Cannot find file: "},
327+
{"manifest.missing.when.reading.jarfile",
328+
"Manifest is missing when reading via JarFile"},
329+
{"manifest.missing.when.reading.jarinputstream",
330+
"Manifest is missing when reading via JarInputStream"},
331+
{"manifest.attribute.1.present.when.reading.jarfile.but.missing.via.jarinputstream",
332+
"Manifest main attribute %s is present when reading via JarFile but missing when reading via JarInputStream"},
333+
{"manifest.attribute.1.present.when.reading.jarinputstream.but.missing.via.jarfile",
334+
"Manifest main attribute %s is present when reading via JarInputStream but missing when reading via JarFile"},
335+
{"manifest.attribute.1.differs.jarfile.value.2.jarinputstream.value.3",
336+
"Manifest main attribute %1$s differs: JarFile value = %2$s, JarInputStream value = %3$s"},
337+
{"entry.1.present.when.reading.jarinputstream.but.missing.via.jarfile",
338+
"Entry %s is present when reading via JarInputStream but missing when reading via JarFile"},
339+
{"entry.1.present.when.reading.jarfile.but.missing.via.jarinputstream",
340+
"Entry %s is present when reading via JarFile but missing when reading via JarInputStream"},
341+
{"entry.1.present.in.jarfile.but.unreadable",
342+
"Entry %s is present in JarFile but unreadable"},
343+
{"codesigners.different.for.entry.1.when.reading.jarfile.and.jarinputstream",
344+
"Code signers are different for entry %s when reading from JarFile and JarInputStream"},
345+
{"entry.1.is.signed.in.jarfile.but.is.not.signed.in.jarinputstream",
346+
"Entry %s is signed in JarFile but is not signed in JarInputStream"},
347+
{"entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile",
348+
"Entry %s is signed in JarInputStream but is not signed in JarFile"},
349+
{"jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream",
350+
"This JAR file contains internal inconsistencies that may result in different contents when reading via JarFile and JarInputStream:"},
351+
{"signature.verification.failed.on.entry.1.when.reading.via.jarinputstream",
352+
"Signature verification failed on entry %s when reading via JarInputStream"},
353+
{"signature.verification.failed.on.entry.1.when.reading.via.jarfile",
354+
"Signature verification failed on entry %s when reading via JarFile"},
327355
};
328356

329357
/**

src/linux/doc/man/jarsigner.1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,11 @@ Informational warnings include those that are not errors but regarded as bad pra
624624
hasExpiringCert
625625
This jar contains entries whose signer certificate will expire within six months\&.
626626
.TP
627+
internalInconsistenciesDetected
628+
This jar contains internal inconsistencies detected during verification
629+
that may result in different contents when reading via JarFile
630+
and JarInputStream\&.
631+
.TP
627632
noTimestamp
628633
This jar contains signatures that does not include a timestamp\&. Without a timestamp, users may not be able to validate this JAR file after the signer certificate\&'s expiration date (\f3YYYY-MM-DD\fR) or after any future revocation date\&.
629634
.SH EXAMPLES

src/solaris/doc/sun/man/man1/jarsigner.1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,11 @@ Informational warnings include those that are not errors but regarded as bad pra
624624
hasExpiringCert
625625
This jar contains entries whose signer certificate will expire within six months\&.
626626
.TP
627+
internalInconsistenciesDetected
628+
This jar contains internal inconsistencies detected during verification
629+
that may result in different contents when reading via JarFile
630+
and JarInputStream\&.
631+
.TP
627632
noTimestamp
628633
This jar contains signatures that does not include a timestamp\&. Without a timestamp, users may not be able to validate this JAR file after the signer certificate\&'s expiration date (\f3YYYY-MM-DD\fR) or after any future revocation date\&.
629634
.SH EXAMPLES

0 commit comments

Comments
 (0)