Skip to content

Commit

Permalink
Merge master jdk-17.0.9+4 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <j9build@ca.ibm.com>
  • Loading branch information
j9build committed Aug 24, 2023
2 parents 830d95b + 59b2b6e commit 4834faf
Show file tree
Hide file tree
Showing 15 changed files with 1,086 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/actions/get-msys2/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ runs:
with:
install: 'autoconf tar unzip zip make'
path-type: minimal
location: msys2
location: ${{ runner.tool_cache }}/msys2

# We can't run bash until this is completed, so stick with pwsh
- name: 'Set MSYS2 path'
run: |
# Prepend msys2/msys64/usr/bin to the PATH
echo "$env:GITHUB_WORKSPACE/msys2/msys64/usr/bin" >> $env:GITHUB_PATH
echo "$env:RUNNER_TOOL_CACHE/msys2/msys64/usr/bin" >> $env:GITHUB_PATH
shell: pwsh
7 changes: 5 additions & 2 deletions .github/workflows/build-cross-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:

- name: 'Create sysroot'
run: >
sudo qemu-debootstrap
sudo debootstrap
--arch=${{ matrix.debian-arch }}
--verbose
--include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev
Expand All @@ -149,7 +149,10 @@ jobs:
# Prepare sysroot and remove unused files to minimize cache
sudo chroot sysroot symlinks -cr .
sudo chown ${USER} -R sysroot
rm -rf sysroot/{dev,proc,run,sys}
rm -rf sysroot/{dev,proc,run,sys,var}
rm -rf sysroot/usr/{sbin,bin,share}
rm -rf sysroot/usr/lib/{apt,gcc,udev,systemd}
rm -rf sysroot/usr/libexec/gcc
if: steps.get-cached-sysroot.outputs.cache-hit != 'true'

- name: 'Configure'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ jobs:
# We need a minimal PATH on Windows
# Set PATH to "", so just GITHUB_PATH is included
PATH: ''
shell: env /usr/bin/bash --login -eo pipefail {0}

- name: 'Build'
id: build
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
- 'hs/tier1 gc'
- 'hs/tier1 runtime'
- 'hs/tier1 serviceability'
- 'lib-test/tier1'

include:
- test-name: 'jdk/tier1 part 1'
Expand Down Expand Up @@ -98,6 +99,10 @@ jobs:
test-suite: 'test/hotspot/jtreg/:tier1_serviceability'
debug-suffix: -debug

- test-name: 'lib-test/tier1'
test-suite: 'test/lib-test/:tier1'
debug-suffix: -debug

steps:
- name: 'Checkout the JDK source'
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion make/conf/jib-profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ var getJibProfilesDependencies = function (input, common) {
jmh: {
organization: common.organization,
ext: "tar.gz",
revision: "1.28+1.0"
revision: "1.35+1.0"
},

jcov: {
Expand Down
6 changes: 3 additions & 3 deletions make/devkit/createJMHBundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
# Create a bundle in the build directory, containing what's needed to
# build and run JMH microbenchmarks from the OpenJDK build.

JMH_VERSION=1.36
COMMONS_MATH3_VERSION=3.2
JOPT_SIMPLE_VERSION=4.6
JMH_VERSION=1.37
COMMONS_MATH3_VERSION=3.6.1
JOPT_SIMPLE_VERSION=5.0.4

BUNDLE_NAME=jmh-$JMH_VERSION.tar.gz

Expand Down
52 changes: 43 additions & 9 deletions src/java.base/share/classes/java/util/zip/ZipFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
import jdk.internal.ref.CleanerFactory;
import jdk.internal.vm.annotation.Stable;
import sun.nio.cs.UTF_8;
import sun.security.action.GetBooleanAction;
import sun.nio.fs.DefaultFileSystemProvider;
import sun.security.action.GetPropertyAction;
import sun.security.util.SignatureFileVerifier;

import static java.util.zip.ZipConstants64.*;
Expand Down Expand Up @@ -123,11 +124,12 @@ public class ZipFile implements ZipConstants, Closeable {
public static final int OPEN_DELETE = 0x4;

/**
* Flag which specifies whether the validation of the Zip64 extra
* fields should be disabled
* Flag to specify whether the Extra ZIP64 validation should be
* disabled.
*/
private static final boolean disableZip64ExtraFieldValidation =
GetBooleanAction.privilegedGetProperty("jdk.util.zip.disableZip64ExtraFieldValidation");
private static final boolean DISABLE_ZIP64_EXTRA_VALIDATION =
getDisableZip64ExtraFieldValidation();

/**
* Opens a zip file for reading.
*
Expand Down Expand Up @@ -1086,6 +1088,21 @@ private int[] getMetaInfVersions() {
}

private static boolean isWindows;
/**
* Returns the value of the System property which indicates whether the
* Extra ZIP64 validation should be disabled.
*/
static boolean getDisableZip64ExtraFieldValidation() {
boolean result;
String value = GetPropertyAction.privilegedGetProperty(
"jdk.util.zip.disableZip64ExtraFieldValidation");
if (value == null) {
result = false;
} else {
result = value.isEmpty() || value.equalsIgnoreCase("true");
}
return result;
}

static {
SharedSecrets.setJavaUtilZipFileAccess(
Expand Down Expand Up @@ -1204,7 +1221,7 @@ private int checkAndAddEntry(int pos, int index)
}

int elen = CENEXT(cen, pos);
if (elen > 0 && !disableZip64ExtraFieldValidation) {
if (elen > 0 && !DISABLE_ZIP64_EXTRA_VALIDATION) {
long extraStartingOffset = pos + CENHDR + nlen;
if ((int)extraStartingOffset != extraStartingOffset) {
zerror("invalid CEN header (bad extra offset)");
Expand Down Expand Up @@ -1248,25 +1265,32 @@ private void checkExtraFields(int cenPos, int startingOffset,
zerror("Invalid CEN header (extra data field size too long)");
}
int currentOffset = startingOffset;
while (currentOffset < extraEndOffset) {
// Walk through each Extra Header. Each Extra Header Must consist of:
// Header ID - 2 bytes
// Data Size - 2 bytes:
while (currentOffset + Integer.BYTES <= extraEndOffset) {
int tag = get16(cen, currentOffset);
currentOffset += Short.BYTES;

int tagBlockSize = get16(cen, currentOffset);
currentOffset += Short.BYTES;
int tagBlockEndingOffset = currentOffset + tagBlockSize;

// The ending offset for this tag block should not go past the
// offset for the end of the extra field
if (tagBlockEndingOffset > extraEndOffset) {
zerror("Invalid CEN header (invalid zip64 extra data field size)");
zerror(String.format(
"Invalid CEN header (invalid extra data field size for " +
"tag: 0x%04x at %d)",
tag, cenPos));
}
currentOffset += Short.BYTES;

if (tag == ZIP64_EXTID) {
// Get the compressed size;
long csize = CENSIZ(cen, cenPos);
// Get the uncompressed size;
long size = CENLEN(cen, cenPos);

checkZip64ExtraFieldValues(currentOffset, tagBlockSize,
csize, size);
}
Expand All @@ -1290,6 +1314,16 @@ private void checkZip64ExtraFieldValues(int off, int blockSize, long csize,
long size)
throws ZipException {
byte[] cen = this.cen;
// if ZIP64_EXTID blocksize == 0, which may occur with some older
// versions of Apache Ant and Commons Compress, validate csize and size
// to make sure neither field == ZIP64_MAGICVAL
if (blockSize == 0) {
if (csize == ZIP64_MAGICVAL || size == ZIP64_MAGICVAL) {
zerror("Invalid CEN header (invalid zip64 extra data field size)");
}
// Only validate the ZIP64_EXTID data if the block size > 0
return;
}
// Validate the Zip64 Extended Information Extra Field (0x0001)
// length.
if (!isZip64ExtBlockSizeValid(blockSize)) {
Expand Down
8 changes: 4 additions & 4 deletions src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2023, 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
Expand Down Expand Up @@ -83,7 +83,7 @@ JNIEXPORT void JNICALL Java_jdk_net_LinuxSocketOptions_setQuickAck0
int optval;
int rv;
optval = (on ? 1 : 0);
rv = setsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &optval, sizeof (optval));
rv = setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &optval, sizeof (optval));
handleError(env, rv, "set option TCP_QUICKACK failed");
}

Expand All @@ -96,7 +96,7 @@ JNIEXPORT jboolean JNICALL Java_jdk_net_LinuxSocketOptions_getQuickAck0
(JNIEnv *env, jobject unused, jint fd) {
int on;
socklen_t sz = sizeof (on);
int rv = getsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &on, &sz);
int rv = getsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, &on, &sz);
handleError(env, rv, "get option TCP_QUICKACK failed");
return on != 0;
}
Expand All @@ -108,7 +108,7 @@ JNIEXPORT jboolean JNICALL Java_jdk_net_LinuxSocketOptions_getQuickAck0
*/
JNIEXPORT jboolean JNICALL Java_jdk_net_LinuxSocketOptions_quickAckSupported0
(JNIEnv *env, jobject unused) {
return socketOptionSupported(SOL_SOCKET, TCP_QUICKACK);
return socketOptionSupported(IPPROTO_TCP, TCP_QUICKACK);
}

/*
Expand Down
14 changes: 13 additions & 1 deletion src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3078,10 +3078,22 @@ private void readExtra(ZipFileSystem zipfs) throws IOException {
int sz = SH(extra, pos + 2);
pos += 4;
if (pos + sz > elen) { // invalid data
throw new ZipException("Invalid CEN header (invalid zip64 extra data field size)");
throw new ZipException(String.format(
"Invalid CEN header (invalid extra data field size for " +
"tag: 0x%04x size: %d)",
tag, sz));
}
switch (tag) {
case EXTID_ZIP64 :
// if ZIP64_EXTID blocksize == 0, which may occur with some older
// versions of Apache Ant and Commons Compress, validate csize
// size, and locoff to make sure the fields != ZIP64_MAGICVAL
if (sz == 0) {
if (csize == ZIP64_MINVAL || size == ZIP64_MINVAL || locoff == ZIP64_MINVAL) {
throw new ZipException("Invalid CEN header (invalid zip64 extra data field size)");
}
break;
}
// Check to see if we have a valid block size
if (!isZip64ExtBlockSizeValid(sz)) {
throw new ZipException("Invalid CEN header (invalid zip64 extra data field size)");
Expand Down
58 changes: 58 additions & 0 deletions test/hotspot/jtreg/compiler/c1/TestLoadIndexedMismatch.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright Amazon.com Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* @test
* @bug 8313402
* @summary C1: Incorrect LoadIndexed value numbering
* @requires vm.compiler1.enabled
* @library /compiler/patches /test/lib
* @build java.base/java.lang.Helper
* @run main/othervm -Xbatch -XX:CompileThreshold=100
* -XX:TieredStopAtLevel=1
* compiler.c1.TestLoadIndexedMismatch
*/

package compiler.c1;

public class TestLoadIndexedMismatch {
static final byte[] ARR = {42, 42};
static final char EXPECTED_CHAR = (char)(42*256 + 42);

public static char work() {
// LoadIndexed (B)
byte b = ARR[0];
// StringUTF16.getChar intrinsic, LoadIndexed (C)
char c = Helper.getChar(ARR, 0);
return c;
}

public static void main(String[] args) {
for (int i = 0; i < 10_000; i++) {
char c = work();
if (c != EXPECTED_CHAR) {
throw new IllegalStateException("Read: " + (int)c + ", expected: " + (int)EXPECTED_CHAR);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public static char[] getChars(byte[] value, int srcBegin, int srcEnd, int dstSiz
return dst;
}

@jdk.internal.vm.annotation.ForceInline
public static char getChar(byte[] value, int index) {
return StringUTF16.getChar(value, index);
}

public static void putCharSB(byte[] val, int index, int c) {
StringUTF16.putCharSB(val, index, c);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023, 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
Expand Down Expand Up @@ -133,7 +133,7 @@ public static void main(String args[]) throws Exception {
// It's ok for ARM not to have symbols, because it does not support NMT detail
// when targeting thumb2. It's also ok for Windows not to have symbols, because
// they are only available if the symbols file is included with the build.
if (Platform.isWindows() || Platform.isARM() || Platform.isRISCV64()) {
if (Platform.isWindows() || Platform.isARM()) {
return; // we are done
}
output.reportDiagnosticSummary();
Expand Down
7 changes: 4 additions & 3 deletions test/jdk/java/util/zip/ZipFile/CorruptedZipFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/* @test
* @bug 4770745 6218846 6218848 6237956
* @bug 4770745 6218846 6218848 6237956 8313765
* @summary test for correct detection and reporting of corrupted zip files
* @author Martin Buchholz
*/
Expand Down Expand Up @@ -113,8 +113,9 @@ public static void main(String[] args) throws Exception {

err.println("corrupted CENEXT 1");
bad = good.clone();
bad[cenpos+CENEXT]++;
checkZipException(bad, ".*invalid zip64 extra data field size.*");
bad[cenpos+CENEXT] = (byte)0xff;
bad[cenpos+CENEXT+1] = (byte)0xff;
checkZipException(bad, ".*extra data field size too long.*");

err.println("corrupted CENEXT 2");
bad = good.clone();
Expand Down
Loading

0 comments on commit 4834faf

Please sign in to comment.