diff --git a/.abf.yml b/.abf.yml index 6b6d42a..2d57429 100644 --- a/.abf.yml +++ b/.abf.yml @@ -1,8 +1,6 @@ sources: - aarch64-port-jdk8u-aarch64-jdk8u102-b14.tar.xz: 41d3f07e4879d07f74e6cb87707147686245f73a - aarch64-port-jdk8u-shenandoah-aarch64-shenandoah-jdk8u102-b14.tar.xz: 5efa8d72712b912f05f195839ce4223d14134748 - e8d009c4e4e7.tar.bz2: f27a6840d4137dea4b509400539b25166fe75de3 - jdk8-jdk8u45-b13-aarch64-jdk8u45-b13.tar.xz: 1f44e78df64b2f8722cf1bf5e3cde65bdd980be9 - jdk8u-jdk8u60-b16.tar.xz: 7b02a21bd45ff54f0fb3286cf36d1a60b6e39b0a - systemtap-tapset-3.1.0.tar.xz: 44b09844ec2e90db08d3d883993e0dbab0c1988a - systemtap-tapset.tar.gz: 44444c943de42c8d08dbf6954cb05a5275d1fa56 + 9ae547861e9f.tar.bz2: 57ce6ce3034a23c25269d1adbc0d8e7ea57cc9bc + aarch64-port-jdk8u-shenandoah-aarch64-shenandoah-jdk8u131-b12-shenandoah-merge-2017-04-20.tar.xz: 7d5825555cb570ad5031a8b975c26162aeb23296 + aarch64-port-jdk8u-aarch64-jdk8u131-b12.tar.xz: f4528bd61fdf4c077895a6ea4a7a564206bce423 + systemtap-tapset-3.4.0pre01.tar.xz: efa1d5ce7cc2a4cf2c657d883bfb487432a588c0 + diff --git a/6515172-pr3346.patch b/6515172-pr3346.patch new file mode 100644 index 0000000..4b8e8a2 --- /dev/null +++ b/6515172-pr3346.patch @@ -0,0 +1,213 @@ +# HG changeset patch +# User shshahma +# Date 1474535080 25200 +# Thu Sep 22 02:04:40 2016 -0700 +# Node ID baf64c88538f477d7f5a0cf90b670108ac312375 +# Parent 62212568179b76b5ebe7b0129ddeed7b268b0bc0 +6515172, PR3346: Runtime.availableProcessors() ignores Linux taskset command +Summary: extract processor count from sched_getaffinity mask +Reviewed-by: dholmes, gthornbr + +diff --git a/src/os/linux/vm/globals_linux.hpp b/src/os/linux/vm/globals_linux.hpp +--- openjdk/hotspot/src/os/linux/vm/globals_linux.hpp ++++ openjdk/hotspot/src/os/linux/vm/globals_linux.hpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2005, 2016, 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 +@@ -47,7 +47,10 @@ + "Load DLLs with executable-stack attribute in the VM Thread") \ + \ + product(bool, UseSHM, false, \ +- "Use SYSV shared memory for large pages") ++ "Use SYSV shared memory for large pages") \ ++ \ ++ diagnostic(bool, PrintActiveCpus, false, \ ++ "Print the number of CPUs detected in os::active_processor_count") + + // + // Defines Linux-specific default values. The flags are available on all +diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp +--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1999, 2016, 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 +@@ -104,6 +104,14 @@ + + PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC + ++#ifndef _GNU_SOURCE ++ #define _GNU_SOURCE ++ #include ++ #undef _GNU_SOURCE ++#else ++ #include ++#endif ++ + // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling + // getrusage() is prepared to handle the associated failure. + #ifndef RUSAGE_THREAD +@@ -5027,12 +5035,42 @@ + } + }; + ++static int os_cpu_count(const cpu_set_t* cpus) { ++ int count = 0; ++ // only look up to the number of configured processors ++ for (int i = 0; i < os::processor_count(); i++) { ++ if (CPU_ISSET(i, cpus)) { ++ count++; ++ } ++ } ++ return count; ++} ++ ++// Get the current number of available processors for this process. ++// This value can change at any time during a process's lifetime. ++// sched_getaffinity gives an accurate answer as it accounts for cpusets. ++// If anything goes wrong we fallback to returning the number of online ++// processors - which can be greater than the number available to the process. + int os::active_processor_count() { +- // Linux doesn't yet have a (official) notion of processor sets, +- // so just return the number of online processors. +- int online_cpus = ::sysconf(_SC_NPROCESSORS_ONLN); +- assert(online_cpus > 0 && online_cpus <= processor_count(), "sanity check"); +- return online_cpus; ++ cpu_set_t cpus; // can represent at most 1024 (CPU_SETSIZE) processors ++ int cpus_size = sizeof(cpu_set_t); ++ int cpu_count = 0; ++ ++ // pid 0 means the current thread - which we have to assume represents the process ++ if (sched_getaffinity(0, cpus_size, &cpus) == 0) { ++ cpu_count = os_cpu_count(&cpus); ++ if (PrintActiveCpus) { ++ tty->print_cr("active_processor_count: sched_getaffinity processor count: %d", cpu_count); ++ } ++ } ++ else { ++ cpu_count = ::sysconf(_SC_NPROCESSORS_ONLN); ++ warning("sched_getaffinity failed (%s)- using online processor count (%d) " ++ "which may exceed available processors", strerror(errno), cpu_count); ++ } ++ ++ assert(cpu_count > 0 && cpu_count <= processor_count(), "sanity check"); ++ return cpu_count; + } + + void os::set_native_thread_name(const char *name) { +diff --git a/test/runtime/os/AvailableProcessors.java b/test/runtime/os/AvailableProcessors.java +new file mode 100644 +--- /dev/null ++++ openjdk/hotspot/test/runtime/os/AvailableProcessors.java +@@ -0,0 +1,103 @@ ++/* ++ * Copyright (c) 2016, 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 ++ * 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. ++ */ ++import java.io.File; ++import com.oracle.java.testlibrary.ProcessTools; ++import com.oracle.java.testlibrary.OutputAnalyzer; ++import java.util.ArrayList; ++ ++/* ++ * @test ++ * @bug 6515172 ++ * @summary Check that availableProcessors reports the correct value when running in a cpuset on linux ++ * @requires os.family == "linux" ++ * @library /testlibrary ++ * @build com.oracle.java.testlibrary.* ++ * @run driver AvailableProcessors ++ */ ++public class AvailableProcessors { ++ ++ static final String SUCCESS_STRING = "Found expected processors: "; ++ ++ public static void main(String[] args) throws Throwable { ++ if (args.length > 0) ++ checkProcessors(Integer.parseInt(args[0])); ++ else { ++ // run ourselves under different cpu configurations ++ // using the taskset command ++ String taskset; ++ final String taskset1 = "/bin/taskset"; ++ final String taskset2 = "/usr/bin/taskset"; ++ if (new File(taskset1).exists()) ++ taskset = taskset1; ++ else if (new File(taskset2).exists()) ++ taskset = taskset2; ++ else { ++ System.out.println("Skipping test: could not find taskset command"); ++ return; ++ } ++ ++ int available = Runtime.getRuntime().availableProcessors(); ++ ++ if (available == 1) { ++ System.out.println("Skipping test: only one processor available"); ++ return; ++ } ++ ++ // Get the java command we want to execute ++ // Enable logging for easier failure diagnosis ++ ProcessBuilder master = ++ ProcessTools.createJavaProcessBuilder(false, ++ "-XX:+UnlockDiagnosticVMOptions", ++ "-XX:+PrintActiveCpus", ++ "AvailableProcessors"); ++ ++ int[] expected = new int[] { 1, available/2, available-1, available }; ++ ++ for (int i : expected) { ++ System.out.println("Testing for " + i + " processors ..."); ++ int max = i - 1; ++ ArrayList cmdline = new ArrayList<>(master.command()); ++ // prepend taskset command ++ cmdline.add(0, "0-" + max); ++ cmdline.add(0, "-c"); ++ cmdline.add(0, taskset); ++ // append expected processor count ++ cmdline.add(String.valueOf(i)); ++ ProcessBuilder pb = new ProcessBuilder(cmdline); ++ System.out.println("Final command line: " + ++ ProcessTools.getCommandLine(pb)); ++ OutputAnalyzer output = ProcessTools.executeProcess(pb); ++ output.shouldContain(SUCCESS_STRING); ++ } ++ } ++ } ++ ++ static void checkProcessors(int expected) { ++ int available = Runtime.getRuntime().availableProcessors(); ++ if (available != expected) ++ throw new Error("Expected " + expected + " processors, but found " ++ + available); ++ else ++ System.out.println(SUCCESS_STRING + available); ++ } ++} diff --git a/8061305-pr3335-rh1423421.patch b/8061305-pr3335-rh1423421.patch new file mode 100644 index 0000000..384c52a --- /dev/null +++ b/8061305-pr3335-rh1423421.patch @@ -0,0 +1,33 @@ +# HG changeset patch +# User ksrini +# Date 1414764176 25200 +# Fri Oct 31 07:02:56 2014 -0700 +# Node ID 9fd9a50e7994a9659c5ef21296d0baee4c2eecff +# Parent fd59a2d4313440077fce3fbf39174755a15d285a +8061305: Javadoc crashes when method name ends with "Property" +Reviewed-by: jjg + +diff --git jdk8/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java jdk8/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java +--- jdk8/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java ++++ jdk8/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java +@@ -656,6 +656,9 @@ + // properties aren't named setA* or getA* + private final Pattern pattern = Pattern.compile("[sg]et\\p{Upper}.*"); + private boolean isPropertyMethod(MethodDoc method) { ++ if (!configuration.javafx) { ++ return false; ++ } + if (!method.name().endsWith("Property")) { + return false; + } +@@ -667,7 +670,9 @@ + if (pattern.matcher(method.name()).matches()) { + return false; + } +- ++ if (method.typeParameters().length > 0) { ++ return false; ++ } + return 0 == method.parameters().length + && !"void".equals(method.returnType().simpleTypeName()); + } diff --git a/8144566-pr3352.patch b/8144566-pr3352.patch new file mode 100644 index 0000000..9a2a294 --- /dev/null +++ b/8144566-pr3352.patch @@ -0,0 +1,911 @@ +# HG changeset patch +# User rpatil +# Date 1474623897 -19800 +# Fri Sep 23 15:14:57 2016 +0530 +# Node ID fb617df8fbac42e962219e45cbd29b15b5ecdc63 +# Parent d41592af9af3790fe5eee30ce686d85cff09c942 +8144566, PR3352: Custom HostnameVerifier disables SNI extension +Reviewed-by: coffeys + +diff --git a/src/share/classes/sun/security/ssl/SSLSocketImpl.java b/src/share/classes/sun/security/ssl/SSLSocketImpl.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1996, 2016, 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 +@@ -220,6 +220,11 @@ + Collections.emptyList(); + Collection sniMatchers = + Collections.emptyList(); ++ // Is the serverNames set to empty with SSLParameters.setServerNames()? ++ private boolean noSniExtension = false; ++ ++ // Is the sniMatchers set to empty with SSLParameters.setSNIMatchers()? ++ private boolean noSniMatcher = false; + + /* + * READ ME * READ ME * READ ME * READ ME * READ ME * READ ME * +@@ -666,6 +671,11 @@ + } + + super.connect(endpoint, timeout); ++ ++ if (host == null || host.length() == 0) { ++ useImplicitHost(false); ++ } ++ + doneConnect(); + } + +@@ -2158,41 +2168,61 @@ + output.r.setVersion(protocolVersion); + } + ++ // ++ // ONLY used by ClientHandshaker for the server hostname during handshaking ++ // + synchronized String getHost() { + // Note that the host may be null or empty for localhost. + if (host == null || host.length() == 0) { +- if (!trustNameService) { +- // If the local name service is not trustworthy, reverse host +- // name resolution should not be performed for endpoint +- // identification. Use the application original specified +- // hostname or IP address instead. +- host = getOriginalHostname(getInetAddress()); +- } else { +- host = getInetAddress().getHostName(); +- } ++ useImplicitHost(true); + } + + return host; + } + + /* +- * Get the original application specified hostname. ++ * Try to set and use the implicit specified hostname + */ +- private static String getOriginalHostname(InetAddress inetAddress) { +- /* +- * Get the original hostname via sun.misc.SharedSecrets. +- */ ++ private synchronized void useImplicitHost(boolean noSniUpdate) { ++ ++ // Note: If the local name service is not trustworthy, reverse ++ // host name resolution should not be performed for endpoint ++ // identification. Use the application original specified ++ // hostname or IP address instead. ++ ++ // Get the original hostname via jdk.internal.misc.SharedSecrets ++ InetAddress inetAddress = getInetAddress(); ++ if (inetAddress == null) { // not connected ++ return; ++ } ++ + JavaNetAccess jna = SharedSecrets.getJavaNetAccess(); + String originalHostname = jna.getOriginalHostName(inetAddress); ++ if ((originalHostname != null) && ++ (originalHostname.length() != 0)) { + +- /* +- * If no application specified hostname, use the IP address. +- */ +- if (originalHostname == null || originalHostname.length() == 0) { +- originalHostname = inetAddress.getHostAddress(); ++ host = originalHostname; ++ if (!noSniUpdate && serverNames.isEmpty() && !noSniExtension) { ++ serverNames = ++ Utilities.addToSNIServerNameList(serverNames, host); ++ ++ if (!roleIsServer && ++ (handshaker != null) && !handshaker.started()) { ++ handshaker.setSNIServerNames(serverNames); ++ } ++ } ++ ++ return; + } + +- return originalHostname; ++ // No explicitly specified hostname, no server name indication. ++ if (!trustNameService) { ++ // The local name service is not trustworthy, use IP address. ++ host = inetAddress.getHostAddress(); ++ } else { ++ // Use the underlying reverse host name resolution service. ++ host = getInetAddress().getHostName(); ++ } + } + + +@@ -2205,6 +2235,10 @@ + this.host = host; + this.serverNames = + Utilities.addToSNIServerNameList(this.serverNames, this.host); ++ ++ if (!roleIsServer && (handshaker != null) && !handshaker.started()) { ++ handshaker.setSNIServerNames(serverNames); ++ } + } + + /** +@@ -2571,8 +2605,21 @@ + // the super implementation does not handle the following parameters + params.setEndpointIdentificationAlgorithm(identificationProtocol); + params.setAlgorithmConstraints(algorithmConstraints); +- params.setSNIMatchers(sniMatchers); +- params.setServerNames(serverNames); ++ ++ if (sniMatchers.isEmpty() && !noSniMatcher) { ++ // 'null' indicates none has been set ++ params.setSNIMatchers(null); ++ } else { ++ params.setSNIMatchers(sniMatchers); ++ } ++ ++ if (serverNames.isEmpty() && !noSniExtension) { ++ // 'null' indicates none has been set ++ params.setServerNames(null); ++ } else { ++ params.setServerNames(serverNames); ++ } ++ + params.setUseCipherSuitesOrder(preferLocalCipherSuites); + + return params; +@@ -2592,11 +2639,13 @@ + + List sniNames = params.getServerNames(); + if (sniNames != null) { ++ noSniExtension = sniNames.isEmpty(); + serverNames = sniNames; + } + + Collection matchers = params.getSNIMatchers(); + if (matchers != null) { ++ noSniMatcher = matchers.isEmpty(); + sniMatchers = matchers; + } + +diff --git a/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java b/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java +new file mode 100644 +--- /dev/null ++++ openjdk/jdk/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java +@@ -0,0 +1,337 @@ ++/* ++ * Copyright (c) 2016, 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 ++ * 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. ++ */ ++ ++// ++// SunJSSE does not support dynamic system properties, no way to re-use ++// system properties in samevm/agentvm mode. ++// ++ ++/** ++ * @test ++ * @bug 8144566 ++ * @summary Custom HostnameVerifier disables SNI extension ++ * @run main/othervm BestEffortOnLazyConnected ++ */ ++ ++import java.io.*; ++import java.nio.*; ++import java.nio.channels.*; ++import java.util.*; ++import java.net.*; ++import javax.net.ssl.*; ++ ++public class BestEffortOnLazyConnected { ++ ++ /* ++ * ============================================================= ++ * Set the various variables needed for the tests, then ++ * specify what tests to run on each side. ++ */ ++ ++ /* ++ * Should we run the client or server in a separate thread? ++ * Both sides can throw exceptions, but do you have a preference ++ * as to which side should be the main thread. ++ */ ++ private static final boolean separateServerThread = true; ++ ++ /* ++ * Where do we find the keystores? ++ */ ++ private static final String pathToStores = "../../../../sun/security/ssl/etc"; ++ private static final String keyStoreFile = "keystore"; ++ private static final String trustStoreFile = "truststore"; ++ private static final String passwd = "passphrase"; ++ ++ /* ++ * Is the server ready to serve? ++ */ ++ private static volatile boolean serverReady = false; ++ ++ /* ++ * Turn on SSL debugging? ++ */ ++ private static final boolean debug = false; ++ ++ /* ++ * the fully qualified domain name of localhost ++ */ ++ private static String hostname = null; ++ ++ /* ++ * If the client or server is doing some kind of object creation ++ * that the other side depends on, and that thread prematurely ++ * exits, you may experience a hang. The test harness will ++ * terminate all hung threads after its timeout has expired, ++ * currently 3 minutes by default, but you might try to be ++ * smart about it.... ++ */ ++ ++ /* ++ * Define the server side of the test. ++ * ++ * If the server prematurely exits, serverReady will be set to true ++ * to avoid infinite hangs. ++ */ ++ private void doServerSide() throws Exception { ++ SSLServerSocketFactory sslssf = ++ (SSLServerSocketFactory) SSLServerSocketFactory.getDefault(); ++ try (SSLServerSocket sslServerSocket = ++ (SSLServerSocket) sslssf.createServerSocket(serverPort)) { ++ ++ serverPort = sslServerSocket.getLocalPort(); ++ ++ /* ++ * Signal Client, we're ready for his connect. ++ */ ++ serverReady = true; ++ ++ try (SSLSocket sslSocket = (SSLSocket)sslServerSocket.accept()) { ++ InputStream sslIS = sslSocket.getInputStream(); ++ OutputStream sslOS = sslSocket.getOutputStream(); ++ ++ sslIS.read(); ++ sslOS.write(85); ++ sslOS.flush(); ++ ++ ExtendedSSLSession session = ++ (ExtendedSSLSession)sslSocket.getSession(); ++ if (session.getRequestedServerNames().isEmpty()) { ++ throw new Exception("No expected Server Name Indication"); ++ } ++ } ++ } ++ } ++ ++ /* ++ * Define the client side of the test. ++ * ++ * If the server prematurely exits, serverReady will be set to true ++ * to avoid infinite hangs. ++ */ ++ private void doClientSide() throws Exception { ++ ++ /* ++ * Wait for server to get started. ++ */ ++ while (!serverReady) { ++ Thread.sleep(50); ++ } ++ ++ SSLSocketFactory sslsf = ++ (SSLSocketFactory) SSLSocketFactory.getDefault(); ++ ++ try (SSLSocket sslSocket = (SSLSocket)sslsf.createSocket()) { ++ ++ sslSocket.connect(new InetSocketAddress(hostname, serverPort), 0); ++ ++ InputStream sslIS = sslSocket.getInputStream(); ++ OutputStream sslOS = sslSocket.getOutputStream(); ++ ++ sslOS.write(280); ++ sslOS.flush(); ++ sslIS.read(); ++ } ++ } ++ ++ ++ /* ++ * ============================================================= ++ * The remainder is just support stuff ++ */ ++ ++ // use any free port by default ++ private volatile int serverPort = 0; ++ ++ private volatile Exception serverException = null; ++ private volatile Exception clientException = null; ++ ++ public static void main(String[] args) throws Exception { ++ String keyFilename = ++ System.getProperty("test.src", ".") + "/" + pathToStores + ++ "/" + keyStoreFile; ++ String trustFilename = ++ System.getProperty("test.src", ".") + "/" + pathToStores + ++ "/" + trustStoreFile; ++ ++ System.setProperty("javax.net.ssl.keyStore", keyFilename); ++ System.setProperty("javax.net.ssl.keyStorePassword", passwd); ++ System.setProperty("javax.net.ssl.trustStore", trustFilename); ++ System.setProperty("javax.net.ssl.trustStorePassword", passwd); ++ ++ if (debug) { ++ System.setProperty("javax.net.debug", "all"); ++ } ++ ++ try { ++ hostname = InetAddress.getLocalHost().getCanonicalHostName(); ++ } catch (UnknownHostException uhe) { ++ System.out.println( ++ "Ignore the test as the local hostname cannot be determined"); ++ ++ return; ++ } ++ ++ System.out.println( ++ "The fully qualified domain name of the local host is " + ++ hostname); ++ // Ignore the test if the hostname does not sound like a domain name. ++ if ((hostname == null) || hostname.isEmpty() || ++ hostname.startsWith("localhost") || ++ Character.isDigit(hostname.charAt(hostname.length() - 1))) { ++ ++ System.out.println("Ignore the test as the local hostname " + ++ "cannot be determined as fully qualified domain name"); ++ ++ return; ++ } ++ ++ /* ++ * Start the tests. ++ */ ++ new BestEffortOnLazyConnected(); ++ } ++ ++ private Thread clientThread = null; ++ private Thread serverThread = null; ++ ++ /* ++ * Primary constructor, used to drive remainder of the test. ++ * ++ * Fork off the other side, then do your work. ++ */ ++ BestEffortOnLazyConnected() throws Exception { ++ try { ++ if (separateServerThread) { ++ startServer(true); ++ startClient(false); ++ } else { ++ startClient(true); ++ startServer(false); ++ } ++ } catch (Exception e) { ++ // swallow for now. Show later ++ } ++ ++ /* ++ * Wait for other side to close down. ++ */ ++ if (separateServerThread) { ++ serverThread.join(); ++ } else { ++ clientThread.join(); ++ } ++ ++ /* ++ * When we get here, the test is pretty much over. ++ * Which side threw the error? ++ */ ++ Exception local; ++ Exception remote; ++ String whichRemote; ++ ++ if (separateServerThread) { ++ remote = serverException; ++ local = clientException; ++ whichRemote = "server"; ++ } else { ++ remote = clientException; ++ local = serverException; ++ whichRemote = "client"; ++ } ++ ++ /* ++ * If both failed, return the curthread's exception, but also ++ * print the remote side Exception ++ */ ++ if ((local != null) && (remote != null)) { ++ System.out.println(whichRemote + " also threw:"); ++ remote.printStackTrace(); ++ System.out.println(); ++ throw local; ++ } ++ ++ if (remote != null) { ++ throw remote; ++ } ++ ++ if (local != null) { ++ throw local; ++ } ++ } ++ ++ private void startServer(boolean newThread) throws Exception { ++ if (newThread) { ++ serverThread = new Thread() { ++ public void run() { ++ try { ++ doServerSide(); ++ } catch (Exception e) { ++ /* ++ * Our server thread just died. ++ * ++ * Release the client, if not active already... ++ */ ++ System.err.println("Server died..."); ++ serverReady = true; ++ serverException = e; ++ } ++ } ++ }; ++ serverThread.start(); ++ } else { ++ try { ++ doServerSide(); ++ } catch (Exception e) { ++ serverException = e; ++ } finally { ++ serverReady = true; ++ } ++ } ++ } ++ ++ private void startClient(boolean newThread) throws Exception { ++ if (newThread) { ++ clientThread = new Thread() { ++ public void run() { ++ try { ++ doClientSide(); ++ } catch (Exception e) { ++ /* ++ * Our client thread just died. ++ */ ++ System.err.println("Client died..."); ++ clientException = e; ++ } ++ } ++ }; ++ clientThread.start(); ++ } else { ++ try { ++ doClientSide(); ++ } catch (Exception e) { ++ clientException = e; ++ } ++ } ++ } ++} +diff --git a/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java b/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java +new file mode 100644 +--- /dev/null ++++ openjdk/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java +@@ -0,0 +1,390 @@ ++/* ++ * Copyright (c) 2016, 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 ++ * 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. ++ */ ++ ++// ++// SunJSSE does not support dynamic system properties, no way to re-use ++// system properties in samevm/agentvm mode. ++// ++ ++/* ++ * @test ++ * @bug 8144566 ++ * @summary Custom HostnameVerifier disables SNI extension ++ * @run main/othervm ImpactOnSNI ++ */ ++ ++import java.io.*; ++import java.net.*; ++import javax.net.ssl.*; ++ ++public class ImpactOnSNI { ++ ++ /* ++ * ============================================================= ++ * Set the various variables needed for the tests, then ++ * specify what tests to run on each side. ++ */ ++ ++ /* ++ * Should we run the client or server in a separate thread? ++ * Both sides can throw exceptions, but do you have a preference ++ * as to which side should be the main thread. ++ */ ++ private static final boolean separateServerThread = true; ++ ++ /* ++ * Where do we find the keystores? ++ */ ++ private static final String pathToStores = ++ "../../../../../../sun/security/ssl/etc"; ++ private static final String keyStoreFile = "keystore"; ++ private static final String trustStoreFile = "truststore"; ++ private static final String passwd = "passphrase"; ++ ++ /* ++ * Is the server ready to serve? ++ */ ++ private static volatile boolean serverReady = false; ++ ++ /* ++ * Is the connection ready to close? ++ */ ++ private static volatile boolean closeReady = false; ++ ++ /* ++ * Turn on SSL debugging? ++ */ ++ private static final boolean debug = false; ++ ++ /* ++ * Message posted ++ */ ++ private static final String postMsg = "HTTP post on a https server"; ++ ++ /* ++ * the fully qualified domain name of localhost ++ */ ++ private static String hostname = null; ++ ++ /* ++ * If the client or server is doing some kind of object creation ++ * that the other side depends on, and that thread prematurely ++ * exits, you may experience a hang. The test harness will ++ * terminate all hung threads after its timeout has expired, ++ * currently 3 minutes by default, but you might try to be ++ * smart about it.... ++ */ ++ ++ /* ++ * Define the server side of the test. ++ * ++ * If the server prematurely exits, serverReady will be set to true ++ * to avoid infinite hangs. ++ */ ++ private void doServerSide() throws Exception { ++ SSLServerSocketFactory sslssf = ++ (SSLServerSocketFactory)SSLServerSocketFactory.getDefault(); ++ try (SSLServerSocket sslServerSocket = ++ (SSLServerSocket)sslssf.createServerSocket(serverPort)) { ++ ++ serverPort = sslServerSocket.getLocalPort(); ++ ++ /* ++ * Signal Client, we're ready for his connect. ++ */ ++ serverReady = true; ++ ++ /* ++ * Accept connections ++ */ ++ try (SSLSocket sslSocket = (SSLSocket)sslServerSocket.accept()) { ++ InputStream sslIS = sslSocket.getInputStream(); ++ OutputStream sslOS = sslSocket.getOutputStream(); ++ BufferedReader br = ++ new BufferedReader(new InputStreamReader(sslIS)); ++ PrintStream ps = new PrintStream(sslOS); ++ ++ // process HTTP POST request from client ++ System.out.println("status line: " + br.readLine()); ++ String msg = null; ++ while ((msg = br.readLine()) != null && msg.length() > 0); ++ ++ msg = br.readLine(); ++ if (msg.equals(postMsg)) { ++ ps.println("HTTP/1.1 200 OK\n\n"); ++ } else { ++ ps.println("HTTP/1.1 500 Not OK\n\n"); ++ } ++ ps.flush(); ++ ++ ExtendedSSLSession session = ++ (ExtendedSSLSession)sslSocket.getSession(); ++ if (session.getRequestedServerNames().isEmpty()) { ++ throw new Exception("No expected Server Name Indication"); ++ } ++ ++ // close the socket ++ while (!closeReady) { ++ Thread.sleep(50); ++ } ++ } ++ } ++ } ++ ++ /* ++ * Define the client side of the test. ++ * ++ * If the server prematurely exits, serverReady will be set to true ++ * to avoid infinite hangs. ++ */ ++ private void doClientSide() throws Exception { ++ /* ++ * Wait for server to get started. ++ */ ++ while (!serverReady) { ++ Thread.sleep(50); ++ } ++ ++ // Send HTTP POST request to server ++ URL url = new URL("https://" + hostname + ":" + serverPort); ++ ++ HttpsURLConnection.setDefaultHostnameVerifier(new NameVerifier()); ++ HttpsURLConnection http = (HttpsURLConnection)url.openConnection(); ++ http.setDoOutput(true); ++ ++ http.setRequestMethod("POST"); ++ PrintStream ps = new PrintStream(http.getOutputStream()); ++ try { ++ ps.println(postMsg); ++ ps.flush(); ++ if (http.getResponseCode() != 200) { ++ throw new RuntimeException("test Failed"); ++ } ++ } finally { ++ ps.close(); ++ http.disconnect(); ++ closeReady = true; ++ } ++ } ++ ++ private static class NameVerifier implements HostnameVerifier { ++ public boolean verify(String hostname, SSLSession session) { ++ return true; ++ } ++ } ++ ++ /* ++ * ============================================================= ++ * The remainder is just support stuff ++ */ ++ ++ // use any free port by default ++ private volatile int serverPort = 0; ++ ++ private volatile Exception serverException = null; ++ private volatile Exception clientException = null; ++ ++ public static void main(String[] args) throws Exception { ++ String keyFilename = ++ System.getProperty("test.src", "./") + "/" + pathToStores + ++ "/" + keyStoreFile; ++ String trustFilename = ++ System.getProperty("test.src", "./") + "/" + pathToStores + ++ "/" + trustStoreFile; ++ ++ System.setProperty("javax.net.ssl.keyStore", keyFilename); ++ System.setProperty("javax.net.ssl.keyStorePassword", passwd); ++ System.setProperty("javax.net.ssl.trustStore", trustFilename); ++ System.setProperty("javax.net.ssl.trustStorePassword", passwd); ++ ++ if (debug) { ++ System.setProperty("javax.net.debug", "all"); ++ } ++ ++ try { ++ hostname = InetAddress.getLocalHost().getCanonicalHostName(); ++ } catch (UnknownHostException uhe) { ++ System.out.println( ++ "Ignore the test as the local hostname cannot be determined"); ++ ++ return; ++ } ++ ++ System.out.println( ++ "The fully qualified domain name of the local host is " + ++ hostname); ++ // Ignore the test if the hostname does not sound like a domain name. ++ if ((hostname == null) || hostname.isEmpty() || ++ hostname.startsWith("localhost") || ++ Character.isDigit(hostname.charAt(hostname.length() - 1))) { ++ ++ System.out.println("Ignore the test as the local hostname " + ++ "cannot be determined as fully qualified domain name"); ++ ++ return; ++ } ++ ++ /* ++ * Start the tests. ++ */ ++ new ImpactOnSNI(); ++ } ++ ++ private Thread clientThread = null; ++ private Thread serverThread = null; ++ ++ /* ++ * Primary constructor, used to drive remainder of the test. ++ * ++ * Fork off the other side, then do your work. ++ */ ++ ImpactOnSNI() throws Exception { ++ Exception startException = null; ++ try { ++ if (separateServerThread) { ++ startServer(true); ++ startClient(false); ++ } else { ++ startClient(true); ++ startServer(false); ++ } ++ } catch (Exception e) { ++ startException = e; ++ } ++ ++ /* ++ * Wait for other side to close down. ++ */ ++ if (separateServerThread) { ++ if (serverThread != null) { ++ serverThread.join(); ++ } ++ } else { ++ if (clientThread != null) { ++ clientThread.join(); ++ } ++ } ++ ++ /* ++ * When we get here, the test is pretty much over. ++ * Which side threw the error? ++ */ ++ Exception local; ++ Exception remote; ++ ++ if (separateServerThread) { ++ remote = serverException; ++ local = clientException; ++ } else { ++ remote = clientException; ++ local = serverException; ++ } ++ ++ Exception exception = null; ++ ++ /* ++ * Check various exception conditions. ++ */ ++ if ((local != null) && (remote != null)) { ++ // If both failed, return the curthread's exception. ++ local.initCause(remote); ++ exception = local; ++ } else if (local != null) { ++ exception = local; ++ } else if (remote != null) { ++ exception = remote; ++ } else if (startException != null) { ++ exception = startException; ++ } ++ ++ /* ++ * If there was an exception *AND* a startException, ++ * output it. ++ */ ++ if (exception != null) { ++ if (exception != startException && startException != null) { ++ exception.addSuppressed(startException); ++ } ++ throw exception; ++ } ++ ++ // Fall-through: no exception to throw! ++ } ++ ++ private void startServer(boolean newThread) throws Exception { ++ if (newThread) { ++ serverThread = new Thread() { ++ @Override ++ public void run() { ++ try { ++ doServerSide(); ++ } catch (Exception e) { ++ /* ++ * Our server thread just died. ++ * ++ * Release the client, if not active already... ++ */ ++ System.err.println("Server died..."); ++ serverReady = true; ++ serverException = e; ++ } ++ } ++ }; ++ serverThread.start(); ++ } else { ++ try { ++ doServerSide(); ++ } catch (Exception e) { ++ serverException = e; ++ } finally { ++ serverReady = true; ++ } ++ } ++ } ++ ++ private void startClient(boolean newThread) throws Exception { ++ if (newThread) { ++ clientThread = new Thread() { ++ @Override ++ public void run() { ++ try { ++ doClientSide(); ++ } catch (Exception e) { ++ /* ++ * Our client thread just died. ++ */ ++ System.err.println("Client died..."); ++ clientException = e; ++ } ++ } ++ }; ++ clientThread.start(); ++ } else { ++ try { ++ doClientSide(); ++ } catch (Exception e) { ++ clientException = e; ++ } ++ } ++ } ++} diff --git a/8153711-pr3313-rh1284948.patch b/8153711-pr3313-rh1284948.patch new file mode 100644 index 0000000..b93fa06 --- /dev/null +++ b/8153711-pr3313-rh1284948.patch @@ -0,0 +1,669 @@ +# HG changeset patch +# User sgehwolf +# Date 1458555849 -3600 +# Mon Mar 21 11:24:09 2016 +0100 +# Node ID 9f6a0864a734ae3fd0eb198768db7cdee53ba0ed +# Parent 1179be40f1e3b59a890e96a5a9d3ff6fc18a2846 +8153711, PR3313: [REDO] JDWP: Memory Leak: GlobalRefs never deleted when processing invokeMethod command +Summary: Delete global references in invoker_completeInvokeRequest() +Reviewed-by: sspitsyn, dsamersoff + +diff --git a/src/share/back/invoker.c b/src/share/back/invoker.c +--- openjdk/jdk/src/share/back/invoker.c ++++ openjdk/jdk/src/share/back/invoker.c +@@ -211,6 +211,62 @@ + return error; + } + ++/* ++ * Delete saved global references - if any - for: ++ * - a potentially thrown Exception ++ * - a returned refernce/array value ++ * See invoker_doInvoke() and invoke* methods where global references ++ * are being saved. ++ */ ++static void ++deletePotentiallySavedGlobalRefs(JNIEnv *env, InvokeRequest *request) ++{ ++ /* Delete potentially saved return value */ ++ if ((request->invokeType == INVOKE_CONSTRUCTOR) || ++ (returnTypeTag(request->methodSignature) == JDWP_TAG(OBJECT)) || ++ (returnTypeTag(request->methodSignature) == JDWP_TAG(ARRAY))) { ++ if (request->returnValue.l != NULL) { ++ tossGlobalRef(env, &(request->returnValue.l)); ++ } ++ } ++ /* Delete potentially saved exception */ ++ if (request->exception != NULL) { ++ tossGlobalRef(env, &(request->exception)); ++ } ++} ++ ++/* ++ * Delete global argument references from the request which got put there before a ++ * invoke request was carried out. See fillInvokeRequest(). ++ */ ++static void ++deleteGlobalArgumentRefs(JNIEnv *env, InvokeRequest *request) ++{ ++ void *cursor; ++ jint argIndex = 0; ++ jvalue *argument = request->arguments; ++ jbyte argumentTag = firstArgumentTypeTag(request->methodSignature, &cursor); ++ ++ if (request->clazz != NULL) { ++ tossGlobalRef(env, &(request->clazz)); ++ } ++ if (request->instance != NULL) { ++ tossGlobalRef(env, &(request->instance)); ++ } ++ /* Delete global argument references */ ++ while (argIndex < request->argumentCount) { ++ if ((argumentTag == JDWP_TAG(OBJECT)) || ++ (argumentTag == JDWP_TAG(ARRAY))) { ++ if (argument->l != NULL) { ++ tossGlobalRef(env, &(argument->l)); ++ } ++ } ++ argument++; ++ argIndex++; ++ argumentTag = nextArgumentTypeTag(&cursor); ++ } ++} ++ + static jvmtiError + fillInvokeRequest(JNIEnv *env, InvokeRequest *request, + jbyte invokeType, jbyte options, jint id, +@@ -320,6 +376,8 @@ + invokeConstructor(JNIEnv *env, InvokeRequest *request) + { + jobject object; ++ ++ JDI_ASSERT_MSG(request->clazz, "Request clazz null"); + object = JNI_FUNC_PTR(env,NewObjectA)(env, request->clazz, + request->method, + request->arguments); +@@ -336,6 +394,7 @@ + case JDWP_TAG(OBJECT): + case JDWP_TAG(ARRAY): { + jobject object; ++ JDI_ASSERT_MSG(request->clazz, "Request clazz null"); + object = JNI_FUNC_PTR(env,CallStaticObjectMethodA)(env, + request->clazz, + request->method, +@@ -424,6 +483,7 @@ + case JDWP_TAG(OBJECT): + case JDWP_TAG(ARRAY): { + jobject object; ++ JDI_ASSERT_MSG(request->instance, "Request instance null"); + object = JNI_FUNC_PTR(env,CallObjectMethodA)(env, + request->instance, + request->method, +@@ -511,6 +571,8 @@ + case JDWP_TAG(OBJECT): + case JDWP_TAG(ARRAY): { + jobject object; ++ JDI_ASSERT_MSG(request->clazz, "Request clazz null"); ++ JDI_ASSERT_MSG(request->instance, "Request instance null"); + object = JNI_FUNC_PTR(env,CallNonvirtualObjectMethodA)(env, + request->instance, + request->clazz, +@@ -607,6 +669,8 @@ + JNIEnv *env; + jboolean startNow; + InvokeRequest *request; ++ jbyte options; ++ jbyte invokeType; + + JDI_ASSERT(thread); + +@@ -623,6 +687,9 @@ + if (startNow) { + request->started = JNI_TRUE; + } ++ options = request->options; ++ invokeType = request->invokeType; ++ + debugMonitorExit(invokerLock); + + if (!startNow) { +@@ -637,7 +704,7 @@ + + JNI_FUNC_PTR(env,ExceptionClear)(env); + +- switch (request->invokeType) { ++ switch (invokeType) { + case INVOKE_CONSTRUCTOR: + invokeConstructor(env, request); + break; +@@ -645,7 +712,7 @@ + invokeStatic(env, request); + break; + case INVOKE_INSTANCE: +- if (request->options & JDWP_INVOKE_OPTIONS(NONVIRTUAL) ) { ++ if (options & JDWP_INVOKE_OPTIONS(NONVIRTUAL) ) { + invokeNonvirtual(env, request); + } else { + invokeVirtual(env, request); +@@ -723,12 +790,23 @@ + } + + /* ++ * At this time, there's no need to retain global references on ++ * arguments since the reply is processed. No one will deal with ++ * this request ID anymore, so we must call deleteGlobalArgumentRefs(). ++ * ++ * We cannot delete saved exception or return value references ++ * since otherwise a deleted handle would escape when writing ++ * the response to the stream. Instead, we clean those refs up ++ * after writing the respone. ++ */ ++ deleteGlobalArgumentRefs(env, request); ++ ++ /* + * Give up the lock before I/O operation + */ + debugMonitorExit(invokerLock); + eventHandler_unlock(); + +- + if (!detached) { + outStream_initReply(&out, id); + (void)outStream_writeValue(env, &out, tag, returnValue); +@@ -736,6 +814,16 @@ + (void)outStream_writeObjectRef(env, &out, exc); + outStream_sendReply(&out); + } ++ ++ /* ++ * Delete potentially saved global references of return value ++ * and exception ++ */ ++ eventHandler_lock(); // for proper lock order ++ debugMonitorEnter(invokerLock); ++ deletePotentiallySavedGlobalRefs(env, request); ++ debugMonitorExit(invokerLock); ++ eventHandler_unlock(); + } + + jboolean +diff --git a/test/com/sun/jdi/oom/@debuggeeVMOptions b/test/com/sun/jdi/oom/@debuggeeVMOptions +new file mode 100644 +--- /dev/null ++++ openjdk/jdk/test/com/sun/jdi/oom/@debuggeeVMOptions +@@ -0,0 +1,1 @@ ++-Xmx40m +\ No newline at end of file +diff --git a/test/com/sun/jdi/oom/OomDebugTest.java b/test/com/sun/jdi/oom/OomDebugTest.java +new file mode 100644 +--- /dev/null ++++ openjdk/jdk/test/com/sun/jdi/oom/OomDebugTest.java +@@ -0,0 +1,417 @@ ++/* ++ * Copyright (c) 2016 Red Hat Inc. ++ * ++ * 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 8153711 ++ * @summary JDWP: Memory Leak (global references not deleted after invokeMethod). ++ * ++ * @author Severin Gehwolf ++ * ++ * @library .. ++ * @run build TestScaffold VMConnection TargetListener TargetAdapter ++ * @run compile -g OomDebugTest.java ++ * @run shell OomDebugTestSetup.sh ++ * @run main OomDebugTest OomDebugTestTarget test1 ++ * @run main OomDebugTest OomDebugTestTarget test2 ++ * @run main OomDebugTest OomDebugTestTarget test3 ++ * @run main OomDebugTest OomDebugTestTarget test4 ++ * @run main OomDebugTest OomDebugTestTarget test5 ++ */ ++import java.io.File; ++import java.io.FileInputStream; ++import java.io.FileNotFoundException; ++import java.io.FileOutputStream; ++import java.io.IOException; ++import java.util.ArrayList; ++import java.util.Arrays; ++import java.util.Collections; ++import java.util.HashSet; ++import java.util.List; ++import java.util.Properties; ++import java.util.Set; ++ ++import com.sun.jdi.ArrayReference; ++import com.sun.jdi.ArrayType; ++import com.sun.jdi.ClassType; ++import com.sun.jdi.Field; ++import com.sun.jdi.InvocationException; ++import com.sun.jdi.Method; ++import com.sun.jdi.ObjectReference; ++import com.sun.jdi.ReferenceType; ++import com.sun.jdi.StackFrame; ++import com.sun.jdi.VMOutOfMemoryException; ++import com.sun.jdi.Value; ++import com.sun.jdi.event.BreakpointEvent; ++import com.sun.jdi.event.ExceptionEvent; ++ ++/***************** Target program **********************/ ++ ++class OomDebugTestTarget { ++ ++ OomDebugTestTarget() { ++ System.out.println("DEBUG: invoked constructor"); ++ } ++ static class FooCls { ++ @SuppressWarnings("unused") ++ private byte[] bytes = new byte[3000000]; ++ }; ++ ++ FooCls fooCls = new FooCls(); ++ byte[] byteArray = new byte[0]; ++ ++ void testMethod(FooCls foo) { ++ System.out.println("DEBUG: invoked 'void testMethod(FooCls)', foo == " + foo); ++ } ++ ++ void testPrimitive(byte[] foo) { ++ System.out.println("DEBUG: invoked 'void testPrimitive(byte[])', foo == " + foo); ++ } ++ ++ byte[] testPrimitiveArrRetval() { ++ System.out.println("DEBUG: invoked 'byte[] testPrimitiveArrRetval()'"); ++ return new byte[3000000]; ++ } ++ ++ FooCls testFooClsRetval() { ++ System.out.println("DEBUG: invoked 'FooCls testFooClsRetval()'"); ++ return new FooCls(); ++ } ++ ++ public void entry() {} ++ ++ public static void main(String[] args){ ++ System.out.println("DEBUG: OomDebugTestTarget.main"); ++ new OomDebugTestTarget().entry(); ++ } ++} ++ ++/***************** Test program ************************/ ++ ++public class OomDebugTest extends TestScaffold { ++ ++ private static final String[] ALL_TESTS = new String[] { ++ "test1", "test2", "test3", "test4", "test5" ++ }; ++ private static final Set ALL_TESTS_SET = new HashSet(); ++ static { ++ ALL_TESTS_SET.addAll(Arrays.asList(ALL_TESTS)); ++ } ++ private static final String TEST_CLASSES = System.getProperty("test.classes", "."); ++ private static final File RESULT_FILE = new File(TEST_CLASSES, "results.properties"); ++ private static final String LAST_TEST = ALL_TESTS[ALL_TESTS.length - 1]; ++ private ReferenceType targetClass; ++ private ObjectReference thisObject; ++ private int failedTests; ++ private final String testMethod; ++ ++ public OomDebugTest(String[] args) { ++ super(args); ++ if (args.length != 2) { ++ throw new RuntimeException("Wrong number of command-line arguments specified."); ++ } ++ this.testMethod = args[1]; ++ } ++ ++ @Override ++ protected void runTests() throws Exception { ++ try { ++ addListener(new TargetAdapter() { ++ ++ @Override ++ public void exceptionThrown(ExceptionEvent event) { ++ String name = event.exception().referenceType().name(); ++ System.err.println("DEBUG: Exception thrown in debuggee was: " + name); ++ } ++ }); ++ /* ++ * Get to the top of entry() ++ * to determine targetClass and mainThread ++ */ ++ BreakpointEvent bpe = startTo("OomDebugTestTarget", "entry", "()V"); ++ targetClass = bpe.location().declaringType(); ++ ++ mainThread = bpe.thread(); ++ ++ StackFrame frame = mainThread.frame(0); ++ thisObject = frame.thisObject(); ++ java.lang.reflect.Method m = findTestMethod(); ++ m.invoke(this); ++ } catch (NoSuchMethodException e) { ++ e.printStackTrace(); ++ failure(); ++ } catch (SecurityException e) { ++ e.printStackTrace(); ++ failure(); ++ } ++ /* ++ * resume the target, listening for events ++ */ ++ listenUntilVMDisconnect(); ++ } ++ ++ private java.lang.reflect.Method findTestMethod() ++ throws NoSuchMethodException, SecurityException { ++ return OomDebugTest.class.getDeclaredMethod(testMethod); ++ } ++ ++ private void failure() { ++ failedTests++; ++ } ++ ++ /* ++ * Test case: Object reference as method parameter. ++ */ ++ @SuppressWarnings("unused") // called via reflection ++ private void test1() throws Exception { ++ System.out.println("DEBUG: ------------> Running test1"); ++ try { ++ Field field = targetClass.fieldByName("fooCls"); ++ ClassType clsType = (ClassType)field.type(); ++ Method constructor = getConstructorForClass(clsType); ++ for (int i = 0; i < 15; i++) { ++ @SuppressWarnings({ "rawtypes", "unchecked" }) ++ ObjectReference objRef = clsType.newInstance(mainThread, ++ constructor, ++ new ArrayList(0), ++ ObjectReference.INVOKE_NONVIRTUAL); ++ if (objRef.isCollected()) { ++ System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP."); ++ continue; ++ } ++ invoke("testMethod", "(LOomDebugTestTarget$FooCls;)V", objRef); ++ } ++ } catch (InvocationException e) { ++ handleFailure(e); ++ } ++ } ++ ++ /* ++ * Test case: Array reference as method parameter. ++ */ ++ @SuppressWarnings("unused") // called via reflection ++ private void test2() throws Exception { ++ System.out.println("DEBUG: ------------> Running test2"); ++ try { ++ Field field = targetClass.fieldByName("byteArray"); ++ ArrayType arrType = (ArrayType)field.type(); ++ ++ for (int i = 0; i < 15; i++) { ++ ArrayReference byteArrayVal = arrType.newInstance(3000000); ++ if (byteArrayVal.isCollected()) { ++ System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP."); ++ continue; ++ } ++ invoke("testPrimitive", "([B)V", byteArrayVal); ++ } ++ } catch (VMOutOfMemoryException e) { ++ defaultHandleOOMFailure(e); ++ } ++ } ++ ++ /* ++ * Test case: Array reference as return value. ++ */ ++ @SuppressWarnings("unused") // called via reflection ++ private void test3() throws Exception { ++ System.out.println("DEBUG: ------------> Running test3"); ++ try { ++ for (int i = 0; i < 15; i++) { ++ invoke("testPrimitiveArrRetval", ++ "()[B", ++ Collections.EMPTY_LIST, ++ vm().mirrorOfVoid()); ++ } ++ } catch (InvocationException e) { ++ handleFailure(e); ++ } ++ } ++ ++ /* ++ * Test case: Object reference as return value. ++ */ ++ @SuppressWarnings("unused") // called via reflection ++ private void test4() throws Exception { ++ System.out.println("DEBUG: ------------> Running test4"); ++ try { ++ for (int i = 0; i < 15; i++) { ++ invoke("testFooClsRetval", ++ "()LOomDebugTestTarget$FooCls;", ++ Collections.EMPTY_LIST, ++ vm().mirrorOfVoid()); ++ } ++ } catch (InvocationException e) { ++ handleFailure(e); ++ } ++ } ++ ++ /* ++ * Test case: Constructor ++ */ ++ @SuppressWarnings({ "unused", "unchecked", "rawtypes" }) // called via reflection ++ private void test5() throws Exception { ++ System.out.println("DEBUG: ------------> Running test5"); ++ try { ++ ClassType type = (ClassType)thisObject.type(); ++ for (int i = 0; i < 15; i++) { ++ type.newInstance(mainThread, ++ findMethod(targetClass, "", "()V"), ++ new ArrayList(0), ++ ObjectReference.INVOKE_NONVIRTUAL); ++ } ++ } catch (InvocationException e) { ++ handleFailure(e); ++ } ++ } ++ ++ private Method getConstructorForClass(ClassType clsType) { ++ List methods = clsType.methodsByName(""); ++ if (methods.size() != 1) { ++ throw new RuntimeException("FAIL. Expected only one, the default, constructor"); ++ } ++ return methods.get(0); ++ } ++ ++ private void handleFailure(InvocationException e) { ++ // There is no good way to see the OOME diagnostic message in the target since the ++ // TestScaffold might throw an exception while trying to print the stack trace. I.e ++ // it might get a a VMDisconnectedException before the stack trace printing finishes. ++ System.err.println("FAILURE: InvocationException thrown. Trying to determine cause..."); ++ defaultHandleOOMFailure(e); ++ } ++ ++ private void defaultHandleOOMFailure(Exception e) { ++ e.printStackTrace(); ++ failure(); ++ } ++ ++ @SuppressWarnings({ "rawtypes", "unchecked" }) ++ void invoke(String methodName, String methodSig, Value value) ++ throws Exception { ++ List args = new ArrayList(1); ++ args.add(value); ++ invoke(methodName, methodSig, args, value); ++ } ++ ++ void invoke(String methodName, ++ String methodSig, ++ @SuppressWarnings("rawtypes") List args, ++ Value value) throws Exception { ++ Method method = findMethod(targetClass, methodName, methodSig); ++ if ( method == null) { ++ failure("FAILED: Can't find method: " ++ + methodName + " for class = " + targetClass); ++ return; ++ } ++ invoke(method, args, value); ++ } ++ ++ @SuppressWarnings({ "rawtypes", "unchecked" }) ++ void invoke(Method method, List args, Value value) throws Exception { ++ thisObject.invokeMethod(mainThread, method, args, 0); ++ System.out.println("DEBUG: Done invoking method via debugger."); ++ } ++ ++ Value fieldValue(String fieldName) { ++ Field field = targetClass.fieldByName(fieldName); ++ return thisObject.getValue(field); ++ } ++ ++ // Determine the pass/fail status on some heuristic and don't fail the ++ // test if < 3 of the total number of tests (currently 5) fail. This also ++ // has the nice side effect that all tests are first attempted and only ++ // all tests ran an overall pass/fail status is determined. ++ private static void determineOverallTestStatus(OomDebugTest oomTest) ++ throws IOException, FileNotFoundException { ++ Properties resultProps = new Properties(); ++ if (!RESULT_FILE.exists()) { ++ RESULT_FILE.createNewFile(); ++ } ++ FileInputStream fin = null; ++ try { ++ fin = new FileInputStream(RESULT_FILE); ++ resultProps.load(fin); ++ resultProps.put(oomTest.testMethod, ++ Integer.toString(oomTest.failedTests)); ++ } finally { ++ if (fin != null) { ++ fin.close(); ++ } ++ } ++ System.out.println("DEBUG: Finished running test '" ++ + oomTest.testMethod + "'."); ++ if (LAST_TEST.equals(oomTest.testMethod)) { ++ System.out.println("DEBUG: Determining overall test status."); ++ Set actualTestsRun = new HashSet(); ++ int totalTests = ALL_TESTS.length; ++ int failedTests = 0; ++ for (Object key: resultProps.keySet()) { ++ actualTestsRun.add((String)key); ++ Object propVal = resultProps.get(key); ++ int value = Integer.parseInt((String)propVal); ++ failedTests += value; ++ } ++ if (!ALL_TESTS_SET.equals(actualTestsRun)) { ++ String errorMsg = "Test failed! Expected to run tests '" ++ + ALL_TESTS_SET + "', but only these were run '" ++ + actualTestsRun + "'"; ++ throw new RuntimeException(errorMsg); ++ } ++ if (failedTests >= 3) { ++ String errorMsg = "Test failed. Expected < 3 sub-tests to fail " ++ + "for a pass. Got " + failedTests ++ + " failed tests out of " + totalTests + "."; ++ throw new RuntimeException(errorMsg); ++ } ++ RESULT_FILE.delete(); ++ System.out.println("All " + totalTests + " tests passed."); ++ } else { ++ System.out.println("DEBUG: More tests to run. Continuing."); ++ FileOutputStream fout = null; ++ try { ++ fout = new FileOutputStream(RESULT_FILE); ++ resultProps.store(fout, "Storing results after test " ++ + oomTest.testMethod); ++ } finally { ++ if (fout != null) { ++ fout.close(); ++ } ++ } ++ } ++ } ++ ++ public static void main(String[] args) throws Exception { ++ System.setProperty("test.vm.opts", "-Xmx40m"); // Set debuggee VM option ++ OomDebugTest oomTest = new OomDebugTest(args); ++ try { ++ oomTest.startTests(); ++ } catch (Throwable e) { ++ System.out.println("DEBUG: Got exception for test run. " + e); ++ e.printStackTrace(); ++ oomTest.failure(); ++ } ++ determineOverallTestStatus(oomTest); ++ } ++ ++} +diff --git a/test/com/sun/jdi/oom/OomDebugTestSetup.sh b/test/com/sun/jdi/oom/OomDebugTestSetup.sh +new file mode 100644 +--- /dev/null ++++ openjdk/jdk/test/com/sun/jdi/oom/OomDebugTestSetup.sh +@@ -0,0 +1,46 @@ ++#!/bin/sh ++# ++# Copyright (c) 2016 Red Hat Inc. ++# 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. ++# ++ ++ ++if [ "${TESTSRC}" = "" ] ++then ++ echo "TESTSRC not set. Test cannot execute. Failed." ++ exit 1 ++fi ++echo "TESTSRC=${TESTSRC}" ++ ++if [ "${TESTJAVA}" = "" ] ++then ++ echo "TESTJAVA not set. Test cannot execute. Failed." ++ exit 1 ++fi ++echo "TESTJAVA=${TESTJAVA}" ++ ++if [ "${TESTCLASSES}" = "" ] ++then ++ echo "TESTCLASSES not set. Test cannot execute. Failed." ++ exit 1 ++fi ++ ++cp ${TESTSRC}/@debuggeeVMOptions ${TESTCLASSES}/ diff --git a/8165231-rh1437545.patch b/8165231-rh1437545.patch new file mode 100644 index 0000000..e0d5be7 --- /dev/null +++ b/8165231-rh1437545.patch @@ -0,0 +1,48 @@ +# HG changeset patch +# User horii +# Date 1473905514 14400 +# Wed Sep 14 22:11:54 2016 -0400 +# Node ID 8d16f74380a78eb76cb33183a64440316393903e +# Parent be698ac288484ab140715ee29ed9335e6ea8a33b +8165231: java.nio.Bits.unaligned() doesn't return true on ppc +Reviewed-by: simonis, coffeys + +diff --git a/src/share/classes/java/nio/Bits.java b/src/share/classes/java/nio/Bits.java +--- openjdk/jdk/src/share/classes/java/nio/Bits.java ++++ openjdk/jdk/src/share/classes/java/nio/Bits.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2000, 2016, 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 +@@ -614,7 +614,8 @@ + String arch = AccessController.doPrivileged( + new sun.security.action.GetPropertyAction("os.arch")); + unaligned = arch.equals("i386") || arch.equals("x86") +- || arch.equals("amd64") || arch.equals("x86_64"); ++ || arch.equals("amd64") || arch.equals("x86_64") ++ || arch.equals("ppc64") || arch.equals("ppc64le"); + unalignedKnown = true; + return unaligned; + } +diff --git a/src/share/classes/sun/security/provider/ByteArrayAccess.java b/src/share/classes/sun/security/provider/ByteArrayAccess.java +--- openjdk/jdk/src/share/classes/sun/security/provider/ByteArrayAccess.java ++++ openjdk/jdk/src/share/classes/sun/security/provider/ByteArrayAccess.java +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2006, 2016, 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 +@@ -94,7 +94,7 @@ + String arch = java.security.AccessController.doPrivileged + (new sun.security.action.GetPropertyAction("os.arch", "")); + return arch.equals("i386") || arch.equals("x86") || arch.equals("amd64") +- || arch.equals("x86_64"); ++ || arch.equals("x86_64") || arch.equals("ppc64") || arch.equals("ppc64le"); + } + + /** diff --git a/8173941-pr3326.patch b/8173941-pr3326.patch new file mode 100644 index 0000000..50e74f6 --- /dev/null +++ b/8173941-pr3326.patch @@ -0,0 +1,77 @@ +# HG changeset patch +# User ysuenaga +# Date 1487123491 18000 +# Tue Feb 14 20:51:31 2017 -0500 +# Node ID 15922b2f31db4857ec84efdf533c41b19e68030b +# Parent 652fe741b8f2bfdacba66d772cc89fe7ec6dea66 +8173941, PR3326: SA does not work if executable is DSO +Reviewed-by: aph, dsamersoff + +diff --git a/agent/src/os/linux/elfmacros.h b/agent/src/os/linux/elfmacros.h +--- openjdk/hotspot/agent/src/os/linux/elfmacros.h ++++ openjdk/hotspot/agent/src/os/linux/elfmacros.h +@@ -33,6 +33,7 @@ + #define ELF_NHDR Elf64_Nhdr + #define ELF_DYN Elf64_Dyn + #define ELF_ADDR Elf64_Addr ++#define ELF_AUXV Elf64_auxv_t + + #define ELF_ST_TYPE ELF64_ST_TYPE + +@@ -45,6 +46,7 @@ + #define ELF_NHDR Elf32_Nhdr + #define ELF_DYN Elf32_Dyn + #define ELF_ADDR Elf32_Addr ++#define ELF_AUXV Elf32_auxv_t + + #define ELF_ST_TYPE ELF32_ST_TYPE + +diff --git a/agent/src/os/linux/ps_core.c b/agent/src/os/linux/ps_core.c +--- openjdk/hotspot/agent/src/os/linux/ps_core.c ++++ openjdk/hotspot/agent/src/os/linux/ps_core.c +@@ -642,6 +642,18 @@ + if (core_handle_prstatus(ph, descdata, notep->n_descsz) != true) { + return false; + } ++ } else if (notep->n_type == NT_AUXV) { ++ // Get first segment from entry point ++ ELF_AUXV *auxv = (ELF_AUXV *)descdata; ++ while (auxv->a_type != AT_NULL) { ++ if (auxv->a_type == AT_ENTRY) { ++ // Set entry point address to address of dynamic section. ++ // We will adjust it in read_exec_segments(). ++ ph->core->dynamic_addr = auxv->a_un.a_val; ++ break; ++ } ++ auxv++; ++ } + } + p = descdata + ROUNDUP(notep->n_descsz, 4); + } +@@ -826,7 +838,13 @@ + + // from PT_DYNAMIC we want to read address of first link_map addr + case PT_DYNAMIC: { +- ph->core->dynamic_addr = exec_php->p_vaddr; ++ if (exec_ehdr->e_type == ET_EXEC) { ++ ph->core->dynamic_addr = exec_php->p_vaddr; ++ } else { // ET_DYN ++ // dynamic_addr has entry point of executable. ++ // Thus we should substract it. ++ ph->core->dynamic_addr += exec_php->p_vaddr - exec_ehdr->e_entry; ++ } + print_debug("address of _DYNAMIC is 0x%lx\n", ph->core->dynamic_addr); + break; + } +@@ -1024,8 +1042,9 @@ + goto err; + } + +- if (read_elf_header(ph->core->exec_fd, &exec_ehdr) != true || exec_ehdr.e_type != ET_EXEC) { +- print_debug("executable file is not a valid ELF ET_EXEC file\n"); ++ if (read_elf_header(ph->core->exec_fd, &exec_ehdr) != true || ++ ((exec_ehdr.e_type != ET_EXEC) && (exec_ehdr.e_type != ET_DYN))) { ++ print_debug("executable file is not a valid ELF file\n"); + goto err; + } + diff --git a/8174164-pr3334-rh1417266.patch b/8174164-pr3334-rh1417266.patch new file mode 100644 index 0000000..494883f --- /dev/null +++ b/8174164-pr3334-rh1417266.patch @@ -0,0 +1,79 @@ +# HG changeset patch +# User roland +# Date 1487208397 28800 +# Wed Feb 15 17:26:37 2017 -0800 +# Node ID a9cbaff50d3d7e3a1d2dbdc0121c470142b87270 +# Parent 15922b2f31db4857ec84efdf533c41b19e68030b +8174164, PR3334, RH1417266: SafePointNode::_replaced_nodes breaks with irreducible loops +Reviewed-by: kvn + +diff --git a/src/share/vm/opto/callnode.hpp b/src/share/vm/opto/callnode.hpp +--- openjdk/hotspot/src/share/vm/opto/callnode.hpp ++++ openjdk/hotspot/src/share/vm/opto/callnode.hpp +@@ -449,8 +449,8 @@ + void delete_replaced_nodes() { + _replaced_nodes.reset(); + } +- void apply_replaced_nodes() { +- _replaced_nodes.apply(this); ++ void apply_replaced_nodes(uint idx) { ++ _replaced_nodes.apply(this, idx); + } + void merge_replaced_nodes_with(SafePointNode* sfpt) { + _replaced_nodes.merge_with(sfpt->_replaced_nodes); +diff --git a/src/share/vm/opto/parse1.cpp b/src/share/vm/opto/parse1.cpp +--- openjdk/hotspot/src/share/vm/opto/parse1.cpp ++++ openjdk/hotspot/src/share/vm/opto/parse1.cpp +@@ -1048,7 +1048,7 @@ + kit.make_dtrace_method_exit(method()); + } + if (_replaced_nodes_for_exceptions) { +- kit.map()->apply_replaced_nodes(); ++ kit.map()->apply_replaced_nodes(_new_idx); + } + // Done with exception-path processing. + ex_map = kit.make_exception_state(ex_oop); +@@ -1069,7 +1069,7 @@ + _exits.add_exception_state(ex_map); + } + } +- _exits.map()->apply_replaced_nodes(); ++ _exits.map()->apply_replaced_nodes(_new_idx); + } + + //-----------------------------create_entry_map------------------------------- +diff --git a/src/share/vm/opto/replacednodes.cpp b/src/share/vm/opto/replacednodes.cpp +--- openjdk/hotspot/src/share/vm/opto/replacednodes.cpp ++++ openjdk/hotspot/src/share/vm/opto/replacednodes.cpp +@@ -91,13 +91,17 @@ + } + + // Perfom node replacement (used when returning to caller) +-void ReplacedNodes::apply(Node* n) { ++void ReplacedNodes::apply(Node* n, uint idx) { + if (is_empty()) { + return; + } + for (int i = 0; i < _replaced_nodes->length(); i++) { + ReplacedNode replaced = _replaced_nodes->at(i); +- n->replace_edge(replaced.initial(), replaced.improved()); ++ // Only apply if improved node was created in a callee to avoid ++ // issues with irreducible loops in the caller ++ if (replaced.improved()->_idx >= idx) { ++ n->replace_edge(replaced.initial(), replaced.improved()); ++ } + } + } + +diff --git a/src/share/vm/opto/replacednodes.hpp b/src/share/vm/opto/replacednodes.hpp +--- openjdk/hotspot/src/share/vm/opto/replacednodes.hpp ++++ openjdk/hotspot/src/share/vm/opto/replacednodes.hpp +@@ -71,7 +71,7 @@ + void record(Node* initial, Node* improved); + void transfer_from(const ReplacedNodes& other, uint idx); + void reset(); +- void apply(Node* n); ++ void apply(Node* n, uint idx); + void merge_with(const ReplacedNodes& other); + bool is_empty() const; + void dump(outputStream *st) const; diff --git a/8174729-pr3336-rh1420518.patch b/8174729-pr3336-rh1420518.patch new file mode 100644 index 0000000..3d67850 --- /dev/null +++ b/8174729-pr3336-rh1420518.patch @@ -0,0 +1,122 @@ +# HG changeset patch +# User adinn +# Date 1487931564 0 +# Fri Feb 24 10:19:24 2017 +0000 +# Node ID d41592af9af3790fe5eee30ce686d85cff09c942 +# Parent 1ac9b0f1bf17fc5935bfa8250550eabc2ffb6785 +8174729, PR3336, RH1420518: Race Condition in java.lang.reflect.WeakCache +Summary: Race can occur between Proxy.getProxyClass and Proxy.isProxyClass +Reviewed-by: mchung + +diff --git a/src/share/classes/java/lang/reflect/WeakCache.java b/src/share/classes/java/lang/reflect/WeakCache.java +--- openjdk/jdk/src/share/classes/java/lang/reflect/WeakCache.java ++++ openjdk/jdk/src/share/classes/java/lang/reflect/WeakCache.java +@@ -239,11 +239,11 @@ + // wrap value with CacheValue (WeakReference) + CacheValue cacheValue = new CacheValue<>(value); + ++ // put into reverseMap ++ reverseMap.put(cacheValue, Boolean.TRUE); ++ + // try replacing us with CacheValue (this should always succeed) +- if (valuesMap.replace(subKey, this, cacheValue)) { +- // put also in reverseMap +- reverseMap.put(cacheValue, Boolean.TRUE); +- } else { ++ if (!valuesMap.replace(subKey, this, cacheValue)) { + throw new AssertionError("Should not reach here"); + } + +diff --git a/test/java/lang/reflect/Proxy/ProxyRace.java b/test/java/lang/reflect/Proxy/ProxyRace.java +new file mode 100644 +--- /dev/null ++++ openjdk/jdk/test/java/lang/reflect/Proxy/ProxyRace.java +@@ -0,0 +1,88 @@ ++/* ++ * Copyright (c) 2017, 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 ++ * 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. ++ */ ++ ++import java.lang.reflect.Proxy; ++import java.util.concurrent.ExecutorService; ++import java.util.concurrent.Executors; ++import java.util.concurrent.Phaser; ++import java.util.concurrent.TimeUnit; ++import java.util.concurrent.atomic.AtomicInteger; ++ ++/** ++ * @test ++ * @bug 8174729 ++ * @summary Proxy.getProxyClass() / Proxy.isProxyClass() race detector ++ * @run main ProxyRace ++ * @author plevart ++ */ ++ ++public class ProxyRace { ++ ++ static final int threads = 8; ++ ++ static volatile ClassLoader classLoader; ++ static volatile boolean terminate; ++ static final AtomicInteger racesDetected = new AtomicInteger(); ++ ++ public static void main(String[] args) throws Exception { ++ ++ Phaser phaser = new Phaser(threads) { ++ @Override ++ protected boolean onAdvance(int phase, int registeredParties) { ++ // install new ClassLoader on each advance ++ classLoader = new CL(); ++ return terminate; ++ } ++ }; ++ ++ ExecutorService exe = Executors.newFixedThreadPool(threads); ++ ++ for (int i = 0; i < threads; i++) { ++ exe.execute(() -> { ++ while (phaser.arriveAndAwaitAdvance() >= 0) { ++ Class proxyClass = Proxy.getProxyClass(classLoader, Runnable.class); ++ if (!Proxy.isProxyClass(proxyClass)) { ++ racesDetected.incrementAndGet(); ++ } ++ } ++ }); ++ } ++ ++ Thread.sleep(5000L); ++ ++ terminate = true; ++ exe.shutdown(); ++ exe.awaitTermination(5L, TimeUnit.SECONDS); ++ ++ System.out.println(racesDetected.get() + " races detected"); ++ if (racesDetected.get() != 0) { ++ throw new RuntimeException(racesDetected.get() + " races detected"); ++ } ++ } ++ ++ static class CL extends ClassLoader { ++ public CL() { ++ super(ClassLoader.getSystemClassLoader()); ++ } ++ } ++} diff --git a/8175097-pr3334-rh1417266.patch b/8175097-pr3334-rh1417266.patch new file mode 100644 index 0000000..e80dd11 --- /dev/null +++ b/8175097-pr3334-rh1417266.patch @@ -0,0 +1,100 @@ +# HG changeset patch +# User roland +# Date 1487286884 28800 +# Thu Feb 16 15:14:44 2017 -0800 +# Node ID 1b4eb44fbfcd0fceb485d89d91eb893d99f5864b +# Parent a9cbaff50d3d7e3a1d2dbdc0121c470142b87270 +8175097, PR3334, RH1417266: [TESTBUG] 8174164 fix missed the test +Reviewed-by: kvn + +diff --git a/test/compiler/c2/TestReplacedNodesOSR.java b/test/compiler/c2/TestReplacedNodesOSR.java +new file mode 100644 +--- /dev/null ++++ openjdk/hotspot/test/compiler/c2/TestReplacedNodesOSR.java +@@ -0,0 +1,86 @@ ++/* ++ * Copyright (c) 2017, Red Hat, Inc. 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 8174164 ++ * @summary SafePointNode::_replaced_nodes breaks with irreducible loops ++ * @run main/othervm -XX:-BackgroundCompilation TestReplacedNodesOSR ++ * ++ */ ++ ++public class TestReplacedNodesOSR { ++ ++ static Object dummy; ++ ++ static interface I { ++ } ++ ++ static class A implements I { ++ } ++ ++ static final class MyException extends Exception { ++ } ++ ++ static final A obj = new A(); ++ static I static_field() { return obj; } ++ ++ // When OSR compiled, this method has an irreducible loop ++ static void test(int v, MyException e) { ++ int i = 0; ++ for (;;) { ++ if (i == 1000) { ++ break; ++ } ++ try { ++ if ((i%2) == 0) { ++ int j = 0; ++ for (;;) { ++ j++; ++ if (i+j != v) { ++ if (j == 1000) { ++ break; ++ } ++ } else { ++ A a = (A)static_field(); ++ // replaced node recorded here ++ throw e; ++ } ++ } ++ } ++ } catch(MyException ex) { ++ } ++ i++; ++ // replaced node applied on return of the method ++ // replaced node used here ++ dummy = static_field(); ++ } ++ } ++ ++ ++ static public void main(String[] args) { ++ for (int i = 0; i < 1000; i++) { ++ test(1100, new MyException()); ++ } ++ } ++} diff --git a/PR3183.patch b/PR3183.patch new file mode 100644 index 0000000..6894438 --- /dev/null +++ b/PR3183.patch @@ -0,0 +1,158 @@ + +# HG changeset patch +# User andrew +# Date 1478057514 0 +# Node ID 1c4d5cb2096ae55106111da200b0bcad304f650c +# Parent 3d53f19b48384e5252f4ec8891f7a3a82d77af2a +PR3183: Support Fedora/RHEL system crypto policy + +diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/classes/java/security/Security.java +--- openjdk/jdk/src/share/classes/java/security/Security.java Wed Oct 26 03:51:39 2016 +0100 ++++ openjdk/jdk/src/share/classes/java/security/Security.java Wed Nov 02 03:31:54 2016 +0000 +@@ -43,6 +43,9 @@ + * implementation-specific location, which is typically the properties file + * {@code lib/security/java.security} in the Java installation directory. + * ++ *

Additional default values of security properties are read from a ++ * system-specific location, if available.

++ * + * @author Benjamin Renaud + */ + +@@ -52,6 +55,10 @@ + private static final Debug sdebug = + Debug.getInstance("properties"); + ++ /* System property file*/ ++ private static final String SYSTEM_PROPERTIES = ++ "/etc/crypto-policies/back-ends/java.config"; ++ + /* The java.security properties */ + private static Properties props; + +@@ -93,6 +100,7 @@ + if (sdebug != null) { + sdebug.println("reading security properties file: " + + propFile); ++ sdebug.println(props.toString()); + } + } catch (IOException e) { + if (sdebug != null) { +@@ -114,6 +122,31 @@ + } + + if ("true".equalsIgnoreCase(props.getProperty ++ ("security.useSystemPropertiesFile"))) { ++ ++ // now load the system file, if it exists, so its values ++ // will win if they conflict with the earlier values ++ try (BufferedInputStream bis = ++ new BufferedInputStream(new FileInputStream(SYSTEM_PROPERTIES))) { ++ props.load(bis); ++ loadedProps = true; ++ ++ if (sdebug != null) { ++ sdebug.println("reading system security properties file " + ++ SYSTEM_PROPERTIES); ++ sdebug.println(props.toString()); ++ } ++ } catch (IOException e) { ++ if (sdebug != null) { ++ sdebug.println ++ ("unable to load security properties from " + ++ SYSTEM_PROPERTIES); ++ e.printStackTrace(); ++ } ++ } ++ } ++ ++ if ("true".equalsIgnoreCase(props.getProperty + ("security.overridePropertiesFile"))) { + + String extraPropFile = System.getProperty +diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-aix +--- openjdk/jdk/src/share/lib/security/java.security-aix Wed Oct 26 03:51:39 2016 +0100 ++++ openjdk/jdk/src/share/lib/security/java.security-aix Wed Nov 02 03:31:54 2016 +0000 +@@ -276,6 +276,13 @@ + security.overridePropertiesFile=true + + # ++# Determines whether this properties file will be appended to ++# using the system properties file stored at ++# /etc/crypto-policies/back-ends/java.config ++# ++security.useSystemPropertiesFile=false ++ ++# + # Determines the default key and trust manager factory algorithms for + # the javax.net.ssl package. + # +diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-linux +--- openjdk/jdk/src/share/lib/security/java.security-linux Wed Oct 26 03:51:39 2016 +0100 ++++ openjdk/jdk/src/share/lib/security/java.security-linux Wed Nov 02 03:31:54 2016 +0000 +@@ -276,6 +276,13 @@ + security.overridePropertiesFile=true + + # ++# Determines whether this properties file will be appended to ++# using the system properties file stored at ++# /etc/crypto-policies/back-ends/java.config ++# ++security.useSystemPropertiesFile=false ++ ++# + # Determines the default key and trust manager factory algorithms for + # the javax.net.ssl package. + # +diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-macosx +--- openjdk/jdk/src/share/lib/security/java.security-macosx Wed Oct 26 03:51:39 2016 +0100 ++++ openjdk/jdk/src/share/lib/security/java.security-macosx Wed Nov 02 03:31:54 2016 +0000 +@@ -279,6 +279,13 @@ + security.overridePropertiesFile=true + + # ++# Determines whether this properties file will be appended to ++# using the system properties file stored at ++# /etc/crypto-policies/back-ends/java.config ++# ++security.useSystemPropertiesFile=false ++ ++# + # Determines the default key and trust manager factory algorithms for + # the javax.net.ssl package. + # +diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-solaris +--- openjdk/jdk/src/share/lib/security/java.security-solaris Wed Oct 26 03:51:39 2016 +0100 ++++ openjdk/jdk/src/share/lib/security/java.security-solaris Wed Nov 02 03:31:54 2016 +0000 +@@ -278,6 +278,13 @@ + security.overridePropertiesFile=true + + # ++# Determines whether this properties file will be appended to ++# using the system properties file stored at ++# /etc/crypto-policies/back-ends/java.config ++# ++security.useSystemPropertiesFile=false ++ ++# + # Determines the default key and trust manager factory algorithms for + # the javax.net.ssl package. + # +diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-windows +--- openjdk/jdk/src/share/lib/security/java.security-windows Wed Oct 26 03:51:39 2016 +0100 ++++ openjdk/jdk/src/share/lib/security/java.security-windows Wed Nov 02 03:31:54 2016 +0000 +@@ -279,6 +279,13 @@ + security.overridePropertiesFile=true + + # ++# Determines whether this properties file will be appended to ++# using the system properties file stored at ++# /etc/crypto-policies/back-ends/java.config ++# ++security.useSystemPropertiesFile=false ++ ++# + # Determines the default key and trust manager factory algorithms for + # the javax.net.ssl package. + # + diff --git a/java-1.8.0-openjdk-remove-intree-libraries.sh b/java-1.8.0-openjdk-remove-intree-libraries.sh old mode 100755 new mode 100644 diff --git a/java-1.8.0-openjdk-size_t.patch b/java-1.8.0-openjdk-size_t.patch index c9c6b97..6e0d762 100644 --- a/java-1.8.0-openjdk-size_t.patch +++ b/java-1.8.0-openjdk-size_t.patch @@ -1,7 +1,7 @@ -diff -up jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -2659,7 +2659,7 @@ void CFLS_LAB::get_from_global_pool(size +diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +@@ -2659,7 +2659,7 @@ if (ResizeOldPLAB && CMSOldPLABResizeQuicker) { size_t multiple = _num_blocks[word_sz]/(CMSOldPLABToleranceFactor*CMSOldPLABNumRefills*n_blks); n_blks += CMSOldPLABReactivityFactor*multiple*n_blks; @@ -10,10 +10,10 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compact } assert(n_blks > 0, "Error"); _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl); -diff -up jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -957,7 +957,7 @@ void ConcurrentMarkSweepGeneration::comp +diff --git a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +@@ -957,7 +957,7 @@ if (free_percentage < desired_free_percentage) { size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); assert(desired_capacity >= capacity(), "invalid expansion size"); @@ -22,7 +22,7 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurr if (PrintGCDetails && Verbose) { size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); gclog_or_tty->print_cr("\nFrom compute_new_size: "); -@@ -6575,7 +6575,7 @@ void CMSCollector::reset(bool asynch) { +@@ -6577,7 +6577,7 @@ HeapWord* curAddr = _markBitMap.startWord(); while (curAddr < _markBitMap.endWord()) { size_t remaining = pointer_delta(_markBitMap.endWord(), curAddr); @@ -31,7 +31,7 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurr _markBitMap.clear_large_range(chunk); if (ConcurrentMarkSweepThread::should_yield() && !foregroundGCIsActive() && -@@ -6873,7 +6873,7 @@ void CMSMarkStack::expand() { +@@ -6875,7 +6875,7 @@ return; } // Double capacity if possible @@ -40,10 +40,10 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurr // Do not give up existing stack until we have managed to // get the double capacity that we desired. ReservedSpace rs(ReservedSpace::allocation_align_size_up( -diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -3902,7 +3902,7 @@ void CMTask::drain_local_queue(bool part +diff --git a/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/src/share/vm/gc_implementation/g1/concurrentMark.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +@@ -3903,7 +3903,7 @@ // of things to do) or totally (at the very end). size_t target_size; if (partially) { @@ -52,7 +52,7 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp.size_ } else { target_size = 0; } -@@ -4728,7 +4728,7 @@ size_t G1PrintRegionLivenessInfoClosure: +@@ -4707,7 +4707,7 @@ // The > 0 check is to deal with the prev and next live bytes which // could be 0. if (*hum_bytes > 0) { @@ -61,10 +61,10 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp.size_ *hum_bytes -= bytes; } return bytes; -diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -1726,7 +1726,7 @@ HeapWord* G1CollectedHeap::expand_and_al +diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +@@ -1726,7 +1726,7 @@ verify_region_sets_optional(); @@ -73,10 +73,22 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp.size ergo_verbose1(ErgoHeapSizing, "attempt heap expansion", ergo_format_reason("allocation request failed") -diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -38,7 +38,7 @@ G1StringDedupQueue::G1StringDedupQueue() +diff --git a/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp b/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp +@@ -117,7 +117,7 @@ + return reserved_size() - committed_size(); + } + +-size_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const { ++uintptr_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const { + return (addr - _low_boundary) / _page_size; + } + +diff --git a/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp b/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp +@@ -38,7 +38,7 @@ _cancel(false), _empty(true), _dropped(0) { @@ -85,22 +97,22 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp.s _queues = NEW_C_HEAP_ARRAY(G1StringDedupWorkerQueue, _nqueues, mtGC); for (size_t i = 0; i < _nqueues; i++) { new (_queues + i) G1StringDedupWorkerQueue(G1StringDedupWorkerQueue::default_segment_size(), _max_cache_size, _max_size); -diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -110,7 +110,7 @@ public: +diff --git a/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp b/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp +@@ -120,7 +120,7 @@ }; - G1StringDedupEntryCache::G1StringDedupEntryCache() { -- _nlists = MAX2(ParallelGCThreads, (size_t)1); -+ _nlists = MAX2(ParallelGCThreads, (uintx)1); - _lists = PaddedArray::create_unfreeable((uint)_nlists); - } - -diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -109,7 +109,7 @@ void HeapRegion::setup_heap_region_size( + G1StringDedupEntryCache::G1StringDedupEntryCache(size_t max_size) : +- _nlists(MAX2(ParallelGCThreads, (size_t)1)), ++ _nlists(MAX2(ParallelGCThreads, (uintx)1)), + _max_list_length(0), + _cached(PaddedArray::create_unfreeable((uint)_nlists)), + _overflowed(PaddedArray::create_unfreeable((uint)_nlists)) { +diff --git a/src/share/vm/gc_implementation/g1/heapRegion.cpp b/src/share/vm/gc_implementation/g1/heapRegion.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +@@ -109,7 +109,7 @@ if (FLAG_IS_DEFAULT(G1HeapRegionSize)) { size_t average_heap_size = (initial_heap_size + max_heap_size) / 2; region_size = MAX2(average_heap_size / HeapRegionBounds::target_number(), @@ -109,10 +121,10 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp.size_t jd } int region_size_log = log2_long((jlong) region_size); -diff -up jdk8/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -194,7 +194,7 @@ bool ParScanThreadState::take_from_overf +diff --git a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +@@ -194,7 +194,7 @@ const size_t num_overflow_elems = of_stack->size(); const size_t space_available = queue->max_elems() - queue->size(); const size_t num_take_elems = MIN3(space_available / 4, @@ -121,10 +133,10 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp num_overflow_elems); // Transfer the most recent num_take_elems from the overflow // stack to our work queue. -diff -up jdk8/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -910,8 +910,8 @@ void PSParallelCompact::initialize_space +diff --git a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp ++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +@@ -910,8 +910,8 @@ void PSParallelCompact::initialize_dead_wood_limiter() { const size_t max = 100; @@ -135,10 +147,10 @@ diff -up jdk8/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallel _dwl_first_term = 1.0 / (sqrt(2.0 * M_PI) * _dwl_std_dev); DEBUG_ONLY(_dwl_initialized = true;) _dwl_adjustment = normal_distribution(1.0); -diff -up jdk8/hotspot/src/share/vm/memory/collectorPolicy.cpp.size_t jdk8/hotspot/src/share/vm/memory/collectorPolicy.cpp ---- jdk8/hotspot/src/share/vm/memory/collectorPolicy.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/memory/collectorPolicy.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -385,7 +385,7 @@ void TwoGenerationCollectorPolicy::initi +diff --git a/src/share/vm/memory/collectorPolicy.cpp b/src/share/vm/memory/collectorPolicy.cpp +--- openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp ++++ openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp +@@ -385,7 +385,7 @@ uintx calculated_size = NewSize + OldSize; double shrink_factor = (double) MaxHeapSize / calculated_size; uintx smaller_new_size = align_size_down((uintx)(NewSize * shrink_factor), _gen_alignment); @@ -147,7 +159,7 @@ diff -up jdk8/hotspot/src/share/vm/memory/collectorPolicy.cpp.size_t jdk8/hotspo _initial_gen0_size = NewSize; // OldSize is already aligned because above we aligned MaxHeapSize to -@@ -433,7 +433,7 @@ void GenCollectorPolicy::initialize_size +@@ -433,7 +433,7 @@ // yield a size that is too small) and bound it by MaxNewSize above. // Ergonomics plays here by previously calculating the desired // NewSize and MaxNewSize. @@ -156,7 +168,7 @@ diff -up jdk8/hotspot/src/share/vm/memory/collectorPolicy.cpp.size_t jdk8/hotspo } assert(max_new_size > 0, "All paths should set max_new_size"); -@@ -455,24 +455,23 @@ void GenCollectorPolicy::initialize_size +@@ -455,24 +455,23 @@ // lower limit. _min_gen0_size = NewSize; desired_new_size = NewSize; @@ -186,7 +198,7 @@ diff -up jdk8/hotspot/src/share/vm/memory/collectorPolicy.cpp.size_t jdk8/hotspo assert(_min_gen0_size > 0, "Sanity check"); _initial_gen0_size = desired_new_size; -@@ -573,7 +572,7 @@ void TwoGenerationCollectorPolicy::initi +@@ -573,7 +572,7 @@ } else { // It's been explicitly set on the command line. Use the // OldSize and then determine the consequences. @@ -195,10 +207,10 @@ diff -up jdk8/hotspot/src/share/vm/memory/collectorPolicy.cpp.size_t jdk8/hotspo _initial_gen1_size = OldSize; // If the user has explicitly set an OldSize that is inconsistent -diff -up jdk8/hotspot/src/share/vm/memory/metaspace.cpp.size_t jdk8/hotspot/src/share/vm/memory/metaspace.cpp ---- jdk8/hotspot/src/share/vm/memory/metaspace.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/memory/metaspace.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -1455,7 +1455,7 @@ void MetaspaceGC::initialize() { +diff --git a/src/share/vm/memory/metaspace.cpp b/src/share/vm/memory/metaspace.cpp +--- openjdk/hotspot/src/share/vm/memory/metaspace.cpp ++++ openjdk/hotspot/src/share/vm/memory/metaspace.cpp +@@ -1455,7 +1455,7 @@ void MetaspaceGC::post_initialize() { // Reset the high-water mark once the VM initialization is done. @@ -207,7 +219,7 @@ diff -up jdk8/hotspot/src/share/vm/memory/metaspace.cpp.size_t jdk8/hotspot/src/ } bool MetaspaceGC::can_expand(size_t word_size, bool is_class) { -@@ -1515,7 +1515,7 @@ void MetaspaceGC::compute_new_size() { +@@ -1515,7 +1515,7 @@ (size_t)MIN2(min_tmp, double(max_uintx)); // Don't shrink less than the initial generation size minimum_desired_capacity = MAX2(minimum_desired_capacity, @@ -216,7 +228,7 @@ diff -up jdk8/hotspot/src/share/vm/memory/metaspace.cpp.size_t jdk8/hotspot/src/ if (PrintGCDetails && Verbose) { gclog_or_tty->print_cr("\nMetaspaceGC::compute_new_size: "); -@@ -1573,7 +1573,7 @@ void MetaspaceGC::compute_new_size() { +@@ -1573,7 +1573,7 @@ const double max_tmp = used_after_gc / minimum_used_percentage; size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx)); maximum_desired_capacity = MAX2(maximum_desired_capacity, @@ -225,7 +237,7 @@ diff -up jdk8/hotspot/src/share/vm/memory/metaspace.cpp.size_t jdk8/hotspot/src/ if (PrintGCDetails && Verbose) { gclog_or_tty->print_cr(" " " maximum_free_percentage: %6.2f" -@@ -3245,7 +3245,7 @@ void Metaspace::global_initialize() { +@@ -3285,7 +3285,7 @@ // on the medium chunk list. The next chunk will be small and progress // from there. This size calculated by -version. _first_class_chunk_word_size = MIN2((size_t)MediumChunk*6, @@ -234,10 +246,10 @@ diff -up jdk8/hotspot/src/share/vm/memory/metaspace.cpp.size_t jdk8/hotspot/src/ _first_class_chunk_word_size = align_word_size_up(_first_class_chunk_word_size); // Arbitrarily set the initial virtual space to a multiple // of the boot class loader size. -diff -up jdk8/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp.size_t jdk8/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp ---- jdk8/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -238,13 +238,13 @@ size_t ThreadLocalAllocBuffer::initial_d +diff --git a/src/share/vm/memory/threadLocalAllocBuffer.cpp b/src/share/vm/memory/threadLocalAllocBuffer.cpp +--- openjdk/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp ++++ openjdk/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp +@@ -238,13 +238,13 @@ size_t init_sz = 0; if (TLABSize > 0) { @@ -254,10 +266,10 @@ diff -up jdk8/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp.size_t jdk8 init_sz = align_object_size(init_sz); } init_sz = MIN2(MAX2(init_sz, min_size()), max_size()); -diff -up jdk8/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp.size_t jdk8/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp ---- jdk8/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp 2015-06-09 10:21:39.000000000 -0400 -@@ -48,7 +48,7 @@ void ObjArrayKlass::objarray_follow_cont +diff --git a/src/share/vm/oops/objArrayKlass.inline.hpp b/src/share/vm/oops/objArrayKlass.inline.hpp +--- openjdk/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp ++++ openjdk/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp +@@ -48,7 +48,7 @@ const size_t beg_index = size_t(index); assert(beg_index < len || len == 0, "index too large"); @@ -266,7 +278,7 @@ diff -up jdk8/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp.size_t jdk8/hot const size_t end_index = beg_index + stride; T* const base = (T*)a->base(); T* const beg = base + beg_index; -@@ -82,7 +82,7 @@ void ObjArrayKlass::objarray_follow_cont +@@ -82,7 +82,7 @@ const size_t beg_index = size_t(index); assert(beg_index < len || len == 0, "index too large"); @@ -275,10 +287,10 @@ diff -up jdk8/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp.size_t jdk8/hot const size_t end_index = beg_index + stride; T* const base = (T*)a->base(); T* const beg = base + beg_index; -diff -up jdk8/hotspot/src/share/vm/runtime/arguments.cpp.size_t jdk8/hotspot/src/share/vm/runtime/arguments.cpp ---- jdk8/hotspot/src/share/vm/runtime/arguments.cpp.size_t 2015-05-19 12:16:26.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/runtime/arguments.cpp 2015-06-09 10:21:39.000000000 -0400 -@@ -1277,7 +1277,7 @@ void Arguments::set_cms_and_parnew_gc_fl +diff --git a/src/share/vm/runtime/arguments.cpp b/src/share/vm/runtime/arguments.cpp +--- openjdk/hotspot/src/share/vm/runtime/arguments.cpp ++++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp +@@ -1283,7 +1283,7 @@ // NewSize was set on the command line and it is larger than // preferred_max_new_size. if (!FLAG_IS_DEFAULT(NewSize)) { // NewSize explicitly set at command-line @@ -287,7 +299,7 @@ diff -up jdk8/hotspot/src/share/vm/runtime/arguments.cpp.size_t jdk8/hotspot/src } else { FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size); } -@@ -1302,8 +1302,8 @@ void Arguments::set_cms_and_parnew_gc_fl +@@ -1308,8 +1308,8 @@ // Unless explicitly requested otherwise, make young gen // at least min_new, and at most preferred_max_new_size. if (FLAG_IS_DEFAULT(NewSize)) { @@ -298,7 +310,7 @@ diff -up jdk8/hotspot/src/share/vm/runtime/arguments.cpp.size_t jdk8/hotspot/src if (PrintGCDetails && Verbose) { // Too early to use gclog_or_tty tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize); -@@ -1313,7 +1313,7 @@ void Arguments::set_cms_and_parnew_gc_fl +@@ -1319,7 +1319,7 @@ // so it's NewRatio x of NewSize. if (FLAG_IS_DEFAULT(OldSize)) { if (max_heap > NewSize) { @@ -307,15 +319,3 @@ diff -up jdk8/hotspot/src/share/vm/runtime/arguments.cpp.size_t jdk8/hotspot/src if (PrintGCDetails && Verbose) { // Too early to use gclog_or_tty tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize); -diff -up jdk8/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp.size_t jdk8/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp ---- jdk8/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp.size_t 2015-06-09 10:35:04.000000000 -0400 -+++ jdk8/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp 2015-06-09 10:33:21.000000000 -0400 -@@ -117,7 +117,7 @@ size_t G1PageBasedVirtualSpace::uncommit - return reserved_size() - committed_size(); - } - --size_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const { -+uintptr_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const { - return (addr - _low_boundary) / _page_size; - } - diff --git a/java-1.8.0-openjdk.spec b/java-1.8.0-openjdk.spec index b374b03..0506f9c 100644 --- a/java-1.8.0-openjdk.spec +++ b/java-1.8.0-openjdk.spec @@ -158,7 +158,7 @@ # note, following three variables are sedded from update_sources if used correctly. Hardcode them rather there. %global project aarch64-port %global repo jdk8u -%global revision aarch64-jdk8u102-b14 +%global revision aarch64-jdk8u131-b12 # eg # jdk8u60-b27 -> jdk8u60 or # aarch64-jdk8u60-b27 -> aarch64-jdk8u60 (dont forget spec escape % by %%) %global whole_update %(VERSION=%{revision}; echo ${VERSION%%-*}) # eg jdk8u60 -> 60 or aarch64-jdk8u60 -> 60 @@ -208,13 +208,6 @@ # not-duplicated scriplets for normal/debug packages %global update_desktop_icons /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : -%global check_sum_presented_in_spec() %{expand: -md5sum %1 -currentMd5sum=`md5sum %1 | sed "s;\\s.*;;"` -specfile=%{_specdir}/%{name}.spec -grep -e md5sum -A 20 $specfile | grep $currentMd5sum -} - %global post_script() %{expand: update-desktop-database %{_datadir}/applications &> /dev/null || : /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : @@ -781,7 +774,7 @@ URL: http://openjdk.java.net/ Source0: %{project}-%{repo}-%{revision}.tar.xz # Additional source needed to build under Mageia -Source1: e8d009c4e4e7.tar.bz2 +Source1: 9ae547861e9f.tar.bz2 # Custom README for -src subpackage Source2: README.src @@ -793,7 +786,7 @@ Source3: mga-add-missing-files.sh # They are based on code contained in the IcedTea7 project. # Systemtap tapsets. Zipped up to keep it small. -Source8: systemtap-tapset-3.1.0.tar.xz +Source8: systemtap-tapset-3.4.0pre01.tar.xz # Desktop files. Adapated from IcedTea. Source9: jconsole.desktop.in @@ -817,7 +810,7 @@ Source20: repackReproduciblePolycies.sh Source100: config.guess Source101: config.sub # shenandoah hotpost -Source999: aarch64-port-jdk8u-shenandoah-aarch64-shenandoah-jdk8u102-b14.tar.xz +Source999: aarch64-port-jdk8u-shenandoah-aarch64-shenandoah-jdk8u131-b12-shenandoah-merge-2017-04-20.tar.xz Source1000: %{name}.rpmlintrc @@ -862,6 +855,9 @@ Patch523: pr2974-rh1337583.patch # PR3083, RH1346460: Regression in SSL debug output without an ECC provider Patch528: pr3083-rh1346460.patch +# 8153711, PR3313, RH1284948: [REDO] JDWP: Memory Leak: GlobalRefs never deleted when processing invokeMethod command +Patch535: 8153711-pr3313-rh1284948.patch + # Arch-specific upstreamable patches # PR2415: JVM -Xmx requirement is too high on s390 Patch100: %{name}-s390-java-opts.patch @@ -891,34 +887,38 @@ Patch507: pr2842-02.patch Patch400: 8154313.patch # S6260348, PR3066: GTK+ L&F JTextComponent not respecting desktop caret blink rate Patch526: 6260348-pr3066.patch -# S8157306, PR3121, RH1360863: Random infrequent null pointer exceptions in javac -Patch531: 8157306-pr3121-rh1360863.patch # S8162384, PR3122, RH1358661: Performance regression: bimorphic inlining may be bypassed by type speculation +# 8061305, PR3335, RH1423421: Javadoc crashes when method name ends with "Property" +Patch538: 8061305-pr3335-rh1423421.patch Patch532: 8162384-pr3122-rh1358661.patch - -# Patches upstream and appearing in 8u111 -# S8159244, PR3074: Partially initialized string object created by C2's string concat optimization may escape -Patch527: 8159244-pr3074.patch +# RH1367357: lcms2: Out-of-bounds read in Type_MLU_Read() +Patch533: rh1367357.patch +# 8174164, PR3334, RH1417266: SafePointNode::_replaced_nodes breaks with irreducible loops" +Patch537: 8174164-pr3334-rh1417266.patch +# 6515172, PR3346: Runtime.availableProcessors() ignores Linux taskset command +Patch542: 6515172-pr3346.patch +# 8144566, PR3352: Custom HostnameVerifier disables SNI extension +Patch544: 8144566-pr3352.patch +# 8165231, RH1437545: java.nio.Bits.unaligned() doesn't return true on ppc +Patch546: 8165231-rh1437545.patch +# 8173941, PR3326: SA does not work if executable is DSO +Patch547: 8173941-pr3326.patch +# 8174729, PR3336, RH1420518: Race Condition in java.lang.reflect.WeakCache +Patch548: 8174729-pr3336-rh1420518.patch +# 8175097, PR3334, RH1417266: [TESTBUG] 8174164 fix missed the test +Patch549: 8175097-pr3334-rh1417266.patch # Patches upstream and appearing in 8u112 -# S8044762, PR2960: com/sun/jdi/OptionTest.java test time out -Patch521: 8044762-pr2960.patch -# S8049226, PR2960: com/sun/jdi/OptionTest.java test times out again -Patch522: 8049226-pr2960.patch -# 8154210: Zero: Better byte behaviour -Patch606: 8154210.patch -# S8158260, PR2991, RH1341258: JVM on PPC64 LE crashes due to an illegal instruction in JITed code -Patch524: 8158260-pr2991-rh1341258.patch # Patches ineligible for 8u # 8043805: Allow using a system-installed libjpeg Patch201: system-libjpeg.patch +# custom securities +Patch207: PR3183.patch # Local fixes # PR1834, RH1022017: Reduce curves reported by SSL to those in NSS Patch525: pr1834-rh1022017.patch -# Temporary fix for typo in CORBA security patch -Patch529: corba_typo_fix.patch # Non-OpenJDK fixes @@ -1208,6 +1208,7 @@ sh %{SOURCE12} %patch201 %patch202 %patch203 +%patch207 %patch1 %patch3 @@ -1221,12 +1222,7 @@ sh %{SOURCE12} %patch501 -# ppc64le fixes -%patch524 - # Zero fixes. -%patch606 - %patch603 %patch601 %patch602 @@ -1245,16 +1241,23 @@ sh %{SOURCE12} #patch516 #patch517 %patch400 -%patch521 -%patch522 %patch523 %patch525 %patch526 -%patch527 %patch528 -%patch529 -%patch531 %patch532 +%patch533 +%patch538 +%patch542 +%patch544 +%patch535 +%patch546 +%patch547 +%patch537 +%patch548 +%patch549 + + # Extract systemtap tapsets %if %{with systap} @@ -1409,52 +1412,6 @@ install -m 644 %{SOURCE11} $JAVA_HOME/jre/lib/security/ #build cycles done -%check - -# We test debug first as it will give better diagnostics on a crash -for suffix in %{rev_build_loop} ; do - -export JAVA_HOME=$(pwd)/%{buildoutputdir $suffix}/images/%{j2sdkimage} - -# check java.security in this build is also in this specfile -%{check_sum_presented_in_spec $JAVA_HOME/jre/lib/security/java.security} - -# Check unlimited policy has been used -$JAVA_HOME/bin/javac -d . %{SOURCE13} -$JAVA_HOME/bin/java TestCryptoLevel - -# Check ECC is working -$JAVA_HOME/bin/javac -d . %{SOURCE14} -$JAVA_HOME/bin/java $(echo $(basename %{SOURCE14})|sed "s|\.java||") - -# Check debug symbols are present and can identify code -SERVER_JVM="$JAVA_HOME/jre/lib/%{archinstall}/server/libjvm.so" -if [ -f "$SERVER_JVM" ] ; then - nm -aCl "$SERVER_JVM" | grep javaCalls.cpp -fi -CLIENT_JVM="$JAVA_HOME/jre/lib/%{archinstall}/client/libjvm.so" -if [ -f "$CLIENT_JVM" ] ; then - nm -aCl "$CLIENT_JVM" | grep javaCalls.cpp -fi -ZERO_JVM="$JAVA_HOME/jre/lib/%{archinstall}/zero/libjvm.so" -if [ -f "$ZERO_JVM" ] ; then - nm -aCl "$ZERO_JVM" | grep javaCalls.cpp -fi - -# Check src.zip has all sources. See RHBZ#1130490 -jar -tf $JAVA_HOME/src.zip | grep 'sun.misc.Unsafe' - -# Check class files include useful debugging information -$JAVA_HOME/bin/javap -l java.lang.Object | grep "Compiled from" -$JAVA_HOME/bin/javap -l java.lang.Object | grep LineNumberTable -$JAVA_HOME/bin/javap -l java.lang.Object | grep LocalVariableTable - -# Check generated class files include useful debugging information -$JAVA_HOME/bin/javap -l java.nio.ByteBuffer | grep "Compiled from" -$JAVA_HOME/bin/javap -l java.nio.ByteBuffer | grep LineNumberTable -$JAVA_HOME/bin/javap -l java.nio.ByteBuffer | grep LocalVariableTable -done - %install STRIP_KEEP_SYMTAB=libjvm* diff --git a/pr1834-rh1022017.patch b/pr1834-rh1022017.patch index 1b3c903..4983884 100644 --- a/pr1834-rh1022017.patch +++ b/pr1834-rh1022017.patch @@ -1,44 +1,28 @@ -diff -r a5c3d9643077 src/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java ---- openjdk/jdk/src/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java Tue Feb 10 16:24:28 2015 +0000 -+++ openjdk/jdk/src/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java Thu May 14 04:01:02 2015 +0100 -@@ -37,25 +37,11 @@ - // the extension value to send in the ClientHello message - static final SupportedEllipticCurvesExtension DEFAULT; - -- private static final boolean fips; -- - static { -- int[] ids; -- fips = SunJSSE.isFIPS(); -- if (fips == false) { -- ids = new int[] { -- // NIST curves first -- // prefer NIST P-256, rest in order of increasing key length -- 23, 1, 3, 19, 21, 6, 7, 9, 10, 24, 11, 12, 25, 13, 14, -- // non-NIST curves -- 15, 16, 17, 2, 18, 4, 5, 20, 8, 22, -- }; -- } else { -- ids = new int[] { -- // same as above, but allow only NIST curves in FIPS mode -- 23, 1, 3, 19, 21, 6, 7, 9, 10, 24, 11, 12, 25, 13, 14, -- }; -- } -+ int[] ids = new int[] { -+ // NSS currently only supports these three NIST curves -+ 23, 24, 25 -+ }; - DEFAULT = new SupportedEllipticCurvesExtension(ids); - } - -@@ -150,10 +136,6 @@ - if ((index <= 0) || (index >= NAMED_CURVE_OID_TABLE.length)) { - return false; - } -- if (fips == false) { -- // in non-FIPS mode, we support all valid indices -- return true; -- } - return DEFAULT.contains(index); - } +diff --git a/src/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java b/src/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java +--- openjdk/jdk/src/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java ++++ openjdk/jdk/src/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java +@@ -168,20 +168,10 @@ + "contains no supported elliptic curves"); + } + } else { // default curves +- int[] ids; +- if (requireFips) { +- ids = new int[] { +- // only NIST curves in FIPS mode +- 23, 24, 25, 9, 10, 11, 12, 13, 14, +- }; +- } else { +- ids = new int[] { +- // NIST curves first +- 23, 24, 25, 9, 10, 11, 12, 13, 14, +- // non-NIST curves +- 22, +- }; +- } ++ int[] ids = new int[] { ++ // NSS currently only supports these three NIST curves ++ 23, 24, 25 ++ }; + idList = new ArrayList<>(ids.length); + for (int curveId : ids) { diff --git a/rh1163501.patch b/rh1163501.patch index 51cd4b9..851529f 100644 --- a/rh1163501.patch +++ b/rh1163501.patch @@ -1,65 +1,54 @@ ---- jdk8/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java Tue Mar 17 00:09:12 2015 +0300 -+++ jdk8/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java Wed Apr 08 14:25:54 2015 +0100 -@@ -1,5 +1,6 @@ +diff --git a/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java b/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java +--- openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java ++++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java +@@ -1,5 +1,6 @@ /* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014 Red Hat Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it -@@ -80,10 +81,10 @@ - * @param random the source of randomness - */ - public void initialize(int keysize, SecureRandom random) { -- if ((keysize < 512) || (keysize > 2048) || (keysize % 64 != 0)) { -+ if ((keysize < 512) || (keysize > 4096) || (keysize % 64 != 0)) { - throw new InvalidParameterException("Keysize must be multiple " - + "of 64, and can only range " -- + "from 512 to 2048 " -+ + "from 512 to 4096 " - + "(inclusive)"); - } - this.pSize = keysize; -@@ -115,11 +116,11 @@ - - params = (DHParameterSpec)algParams; - pSize = params.getP().bitLength(); -- if ((pSize < 512) || (pSize > 2048) || -+ if ((pSize < 512) || (pSize > 4096) || - (pSize % 64 != 0)) { - throw new InvalidAlgorithmParameterException - ("Prime size must be multiple of 64, and can only range " -- + "from 512 to 2048 (inclusive)"); -+ + "from 512 to 4096 (inclusive)"); - } - - // exponent size is optional, could be 0 ---- jdk8/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java Tue Mar 17 00:09:12 2015 +0300 -+++ jdk8/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java Wed Apr 08 14:25:54 2015 +0100 -@@ -1,5 +1,6 @@ - /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2014 Red Hat Inc. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -60,11 +61,11 @@ - +@@ -74,10 +75,10 @@ private static void checkKeySize(int keysize) - throws InvalidAlgorithmParameterException { -- if ((keysize != 2048) && -+ if ((keysize != 2048) && (keysize != 4096) && - ((keysize < 512) || (keysize > 1024) || (keysize % 64 != 0))) { - throw new InvalidAlgorithmParameterException( - "Keysize must be multiple of 64 ranging from " -- + "512 to 1024 (inclusive), or 2048"); -+ + "512 to 1024 (inclusive), or 2048, or 4096"); + throws InvalidParameterException { + +- if ((keysize < 512) || (keysize > 2048) || ((keysize & 0x3F) != 0)) { ++ if ((keysize < 512) || (keysize > 4096) || ((keysize & 0x3F) != 0)) { + throw new InvalidParameterException( + "DH key size must be multiple of 64, and can only range " + +- "from 512 to 2048 (inclusive). " + ++ "from 512 to 4096 (inclusive). " + + "The specific key size " + keysize + " is not supported"); } } +diff --git a/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java b/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java +--- openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java ++++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2014 Red Hat Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -60,11 +61,11 @@ ---- jdk8/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java Tue Mar 17 00:09:12 2015 +0300 -+++ jdk8/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java Wed Apr 08 14:25:54 2015 +0100 -@@ -278,11 +278,11 @@ + private static void checkKeySize(int keysize) + throws InvalidParameterException { +- if ((keysize != 2048) && ++ if ((keysize != 2048) && (keysize != 4096) && + ((keysize < 512) || (keysize > 1024) || (keysize % 64 != 0))) { + throw new InvalidParameterException( + "DH key size must be multiple of 64 and range " + +- "from 512 to 1024 (inclusive), or 2048. " + ++ "from 512 to 1024 (inclusive), or 2048, or 4096. " + + "The specific key size " + keysize + " is not supported"); + } + } +diff --git a/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java b/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java +--- openjdk/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java ++++ openjdk/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java +@@ -285,11 +285,11 @@ // this restriction is in the spec for DSA // since we currently use DSA parameters for DH as well, // it also applies to DH if no parameters are specified @@ -68,21 +57,22 @@ ((keySize > 1024) || ((keySize & 0x3f) != 0))) { throw new InvalidAlgorithmParameterException(algorithm + " key must be multiples of 64 if less than 1024 bits" + -- ", or 2048 bits"); -+ ", or 2048 bits, or 4096 bits"); +- ", or 2048 bits. " + ++ ", or 2048 bits, or 4096 bits. " + + "The specific key size " + + keySize + " is not supported"); } - } - } ---- jdk8/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java Tue Mar 17 00:09:12 2015 +0300 -+++ jdk8/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java Wed Apr 08 14:25:54 2015 +0100 -@@ -1,5 +1,6 @@ +diff --git a/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java b/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java +--- openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java ++++ openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java +@@ -1,5 +1,6 @@ /* * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014 Red Hat Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it -@@ -58,7 +59,7 @@ +@@ -58,7 +59,7 @@ */ private enum Sizes { two56(256), three84(384), five12(512), seven68(768), ten24(1024), @@ -91,7 +81,7 @@ private final int intSize; private final BigInteger bigIntValue; -@@ -130,6 +131,19 @@ +@@ -130,6 +131,19 @@ kp = kpg.generateKeyPair(); checkKeyPair(kp, Sizes.twenty48, Sizes.five12); @@ -111,4 +101,3 @@ System.out.println("OK"); } - diff --git a/rh1367357.patch b/rh1367357.patch new file mode 100644 index 0000000..254be99 --- /dev/null +++ b/rh1367357.patch @@ -0,0 +1,11 @@ +diff --git a/src/share/native/sun/java2d/cmm/lcms/cmstypes.c b/src/share/native/sun/java2d/cmm/lcms/cmstypes.c +--- openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/cmstypes.c ++++ openjdk/jdk/src/share/native/sun/java2d/cmm/lcms/cmstypes.c +@@ -1484,6 +1484,7 @@ + + // Check for overflow + if (Offset < (SizeOfHeader + 8)) goto Error; ++ if ((Offset + Len) > SizeOfTag + 8) goto Error; + + // True begin of the string + BeginOfThisString = Offset - SizeOfHeader - 8;