view patches/hotspot/hs23/zero_fixes.patch @ 3248:06179516eff2

Update to build against the b39 tarball & April 2016 security fixes. Upstream changes: - S4459600: java -jar fails to run Main-Class if classname followed by whitespace. - S4963723: Implement SHA-224 - S6378099: RFE: Use libfontconfig to create/synthesise a fontconfig.properties - S6414899: P11Digest should support cloning - S6452854: Provide a flag to print the java configuration - S6578658: Request for raw RSA (NONEwithRSA) Signature support in SunMSCAPI - S6604496: Support for CKM_AES_CTR (counter mode) - S6742159: (launcher) improve the java launching mechanism - S6752622: java.awt.Font.getPeer throws "java.lang.InternalError: Not implemented" on Linux - S6753664: Support SHA256 (and higher) in SunMSCAPI - S6758881: (launcher) needs to throw NoClassDefFoundError instead of JavaRuntimeException - S6812738: SSL stress test with GF leads to 32 bit max process size in less than 5 minutes with PCKS11 provider - S6856415: Enabling java security manager will make program thrown wrong exception ( main method not found ) - S6892493: potential memory leaks in 2D font code indentified by parfait. - S6924489: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_OPERATION_NOT_INITIALIZED - S6925851: Localize JRE into pt_BR - S6956398: make ephemeral DH key match the length of the certificate key - S6968053: (launcher) hide exceptions under certain launcher failures - S6977738: Deadlock between java.lang.ClassLoader and java.util.Properties - S6981001: (launcher) EnsureJREInstallation is not being called in order - S7017734: jdk7 message drop 1 translation integration - S7026184: (launcher) Regression: class with unicode name can't be launched by java. - S7033170: Cipher.getMaxAllowedKeyLength(String) throws NoSuchAlgorithmException - S7044060: Need to support NSA Suite B Cryptography algorithms - S7104161: test/sun/tools/jinfo/Basic.sh fails on Ubuntu - S7106773: 512 bits RSA key cannot work with SHA384 and SHA512 - S7125442: jar application located in two bytes character named folder cannot be run with JRE 7 u1/u2 - S7127906: (launcher) convert the launcher regression tests to java - S7141141: Add 3 new test scenarios for testing Main-Class attribute in jar manifest file - S7158988: jvm crashes while debugging on x86_32 and x86_64 - S7189944: (launcher) test/tools/launcher/Arrrrghs.java needs a couple of minor fixes - S7193318: C2: remove number of inputs requirement from Node's new operator - S8002116: This JdbReadTwiceTest.sh gets an exit 1 - S8004007: test/sun/tools/jinfo/Basic.sh fails on when runSA is set to true - S8006935: Need to take care of long secret keys in HMAC/PRF compuation - S8023990: Regression: postscript size increase from 6u18 - S8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events. - S8028537: PPC64: Updated the JDK regression tests to run on AIX - S8036132: Tab characters in test/com/sun/jdi files - S8038963: com/sun/jdi tests fail because cygwin's ps sometimes misses processes - S8039921: SHA1WithDSA with key > 1024 bits not working - S8044419: TEST_BUG: com/sun/jdi/JdbReadTwiceTest.sh fails when run under root - S8059661: Test SoftReference and OOM behavior - S8067364: Printing to Postscript doesn't support dieresis - S8072753: Nondeterministic wrong answer on arithmetic - S8073735: [TEST_BUG] compiler/loopopts/CountedLoopProblem.java got OOME - S8074146: [TEST_BUG] jdb has succeded to read an unreadable file - S8075584: test for 8067364 depends on hardwired text advance - S8087120: [GCC5] java.lang.StackOverflowError on Zero JVM initialization on non x86 platforms. - S8129952: Ensure thread consistency - S8132051: Better byte behavior - S8134297: NPE in GSSNameElement nameType check - S8134650: Xsl transformation gives different results in 8u66 - S8138593: Make DSA more fair - S8141229: [Parfait] Null pointer dereference in cmsstrcasecmp of cmserr.c - S8143002: [Parfait] JNI exception pending in fontpath.c:1300 - S8143167: Better buffering of XML strings - S8144430: Improve JMX connections - S8146477: [TEST_BUG] ClientJSSEServerJSSE.java failing again - S8146494: Better ligature substitution - S8146498: Better device table adjustments - S8146967: [TEST_BUG] javax/security/auth/SubjectDomainCombiner/Optimize.java should use 4-args ProtectionDomain constructor - S8147567: InterpreterRuntime::post_field_access not updated for boolean in JDK-8132051 - S8148446: (tz) Support tzdata2016a - S8148475: Missing SA Bytecode updates. - S8149170: Better byte behavior for native arguments - S8149367: PolicyQualifierInfo/index_Ctor JCk test fails with IOE: Invalid encoding for PolicyQualifierInfo - S8150012: Better byte behavior for reflection - S8150790: 8u75 L10n resource file translation update - S8154210: Zero: Better byte behaviour - S8155261: Zero broken since HS23 update - S8155699: Resolve issues created by backports in OpenJDK 6 b39 - S8155699: Resolve issues created by backports in OpenJDK 6 b39, part 2 - S8155746: Sync Windows export list in make/java/jli/Makefile with make/java/jli/mapfile-vers ChangeLog: 2016-05-03 Andrew John Hughes <gnu.andrew@redhat.com> * Makefile.am: (OPENJDK_DATE): Bump to b39 creation date; 3rd of May, 2016. (OPENJDK_SHA256SUM): Update for b39 tarball. 2016-05-03 Andrew John Hughes <gnu.andrew@member.fsf.org> * patches/openjdk/8039921-sha1_1024plus.patch: Remove further b39 patch missed in earlier batch. 2016-05-03 Andrew John Hughes <gnu.andrew@member.fsf.org> * patches/openjdk/4963723-implement_sha-224.patch, * patches/openjdk/6578658-sunmscapi_nonewithrsa.patch, * patches/openjdk/6753664-sunmscapi_sha-256.patch, * patches/openjdk/6956398-ephemeraldhkeysize.patch, * patches/openjdk/7033170-getmaxallowedkeylength_throws_exception.patch, * patches/openjdk/7044060-support_nsa_suite_b.patch, * patches/openjdk/7106773-512_bits_rsa.patch, * patches/openjdk/8006935-long_keys_in_hmac_prf.patch, * patches/openjdk/8087120-zero_gcc5.patch, * patches/openjdk/p11cipher-6414899-p11digest_should_support_cloning.patch, * patches/openjdk/p11cipher-6604496-support_ckm_aes_ctr.patch, * patches/openjdk/p11cipher-6812738-native_cleanup.patch, * patches/openjdk/p11cipher-6924489-ckr_operation_not_initialized.patch, * patches/pr2486-768_dh.patch, * patches/pr2488-1024_dh.patch: Remove patches upstreamed in b39. * Makefile.am: (ICEDTEA_PATCHES): Remove above patches. * NEWS: Updated. * patches/openjdk/7170638-systemtap.patch: Regenerated due to copyright header change in jni.cpp. 2016-05-03 Andrew John Hughes <gnu.andrew@redhat.com> * patches/hotspot/hs23/zero_fixes.patch: Remove fragments upstreamed in 8155261. * patches/hotspot/hs23/zero_hs22.patch: Likewise. 2016-01-29 Andrew John Hughes <gnu.andrew@redhat.com> * Makefile.am: (OPENJDK_VERSION): Bump to next release, b39.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Wed, 04 May 2016 04:24:30 +0100
parents a4e16f083f3b
children f327eb39d25c
line wrap: on
line source

diff -Nru openjdk.orig/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp openjdk/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
--- openjdk.orig/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	2016-05-03 20:18:13.388935986 +0100
+++ openjdk/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	2016-05-03 20:19:21.099818351 +0100
@@ -36,6 +36,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
+#include "prims/methodHandles.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
@@ -65,6 +66,13 @@
   CALL_VM_NOCHECK_NOFIX(func)                   \
   fixup_after_potential_safepoint()
 
+
+#ifdef z_CPPDEBUG
+#define CPPINT_DEBUG( Z_code_ ) Z_code_
+#else
+#define CPPINT_DEBUG( Z_code_ )
+#endif
+
 int CppInterpreter::normal_entry(methodOop method, intptr_t UNUSED, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
 
@@ -1079,12 +1094,309 @@
     }
     break;
 
-  default:
-    tty->print_cr("unhandled entry_kind %s",
+  case MethodHandles::_adapter_opt_spread_0:
+  case MethodHandles::_adapter_opt_spread_1_ref:
+  case MethodHandles::_adapter_opt_spread_2_ref:
+  case MethodHandles::_adapter_opt_spread_3_ref:
+  case MethodHandles::_adapter_opt_spread_4_ref:
+  case MethodHandles::_adapter_opt_spread_5_ref:
+  case MethodHandles::_adapter_opt_spread_ref:
+  case MethodHandles::_adapter_opt_spread_byte:
+  case MethodHandles::_adapter_opt_spread_char:
+  case MethodHandles::_adapter_opt_spread_short:
+  case MethodHandles::_adapter_opt_spread_int:
+  case MethodHandles::_adapter_opt_spread_long:
+  case MethodHandles::_adapter_opt_spread_float:
+  case MethodHandles::_adapter_opt_spread_double:
+    {
+
+      // spread an array out into a group of arguments
+
+      int arg_slot =
+        java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
+      // Fetch the argument, which we will cast to the required array type.
+      oop arg = VMSLOTS_OBJECT(arg_slot);
+
+      BasicType elem_type      =
+        MethodHandles::ek_adapter_opt_spread_type(entry_kind);
+      int       elem_slots     = 
+        type2size[elem_type];  // 1 or 2
+      int       array_slots    = 
+        1;  // array is always a T_OBJECT
+      int       length_offset  = 
+        arrayOopDesc::length_offset_in_bytes();
+      int       elem0_offset   = 
+        arrayOopDesc::base_offset_in_bytes(elem_type);
+      int       length_constant = 
+        MethodHandles::ek_adapter_opt_spread_count(entry_kind);
+      int       array_length = 0;
+      void      *array_elem0 = NULL;       
+
+      CPPINT_DEBUG( tty->print_cr( \
+        "ENTERING _adapter_opt_spread: %s %d %d 0x%x 0x%x", \
+        type2name(elem_type), arg_slot, length_constant, (char *)arg, stack->sp() ); )
+
+      // If the spread count is -1, the length is "variable" ie controlled
+      // by the array length.
+      // See ek_adapter_opt_spread_count in methodHandles.hpp
+      // If array lenth is 0 or spread count is 0 , we will remove the argslot.
+
+      bool length_can_be_zero = (length_constant == 0);
+      if (length_constant < 0) {
+        // some adapters with variable length must handle the zero case
+        if (!OptimizeMethodHandles ||
+            elem_type != T_OBJECT)
+          length_can_be_zero = true;
+      }
+
+      if (arg == NULL) {
+        CPPINT_DEBUG( tty->print_cr( \
+          "arg NULL implies Array_length == 0, remove slot." ); )
+        // remove arg slot
+        remove_vmslots(arg_slot, 1, THREAD); // doesn't trap
+        vmslots = stack->sp(); // unused, but let the compiler figure that out
+        CPPINT_DEBUG( tty->print_cr( \
+          " >> Would LEAVE _adapter_opt_spread with NPE." ); )
+#ifdef _NOT_DEF_
+	// queue a nullpointer exception for the caller
+        stack->set_sp(calculate_unwind_sp(stack, method_handle));
+        CALL_VM_NOCHECK_NOFIX(
+          throw_exception(
+            thread,
+            vmSymbols::java_lang_NullPointerException()));
+        // NB all oops trashed!
+        assert(HAS_PENDING_EXCEPTION, "should do");
+        return;
+#endif
+      } else {    //  (arg != NULL) 
+        klassOop objKlassOop = arg->klass();
+        klassOop klassOf = java_lang_Class::as_klassOop(
+          java_lang_invoke_AdapterMethodHandle::argument(method_handle));
+
+        if (objKlassOop != klassOf &&
+            !objKlassOop->klass_part()->is_subtype_of(klassOf)) {
+          CPPINT_DEBUG( tty->print_cr( \
+            "CLASS CAST ERROR #1 in _adapter_opt_spread." ); )
+          ResourceMark rm(THREAD);
+          const char* objName = Klass::cast(objKlassOop)->external_name();
+          const char* klassName = Klass::cast(klassOf)->external_name();
+          char* message = SharedRuntime::generate_class_cast_message(
+            objName, klassName);
+
+          stack->set_sp(calculate_unwind_sp(stack, method_handle));
+          CALL_VM_NOCHECK_NOFIX(
+            throw_exception(
+              thread,
+              vmSymbols::java_lang_ClassCastException(), message));
+          // NB all oops trashed!
+          assert(HAS_PENDING_EXCEPTION, "should do");
+          return;
+        }
+
+        // Check the array type.
+
+        klassOop array_klass_oop = NULL;
+        BasicType array_type = java_lang_Class::as_BasicType(
+          java_lang_invoke_AdapterMethodHandle::argument(method_handle),
+            &array_klass_oop);
+        arrayKlassHandle array_klass(THREAD, array_klass_oop);
+
+        assert(array_type == T_OBJECT, "");
+        assert(Klass::cast(array_klass_oop)->oop_is_array(), "");
+        if (!(array_type == T_OBJECT) || 
+            !(Klass::cast(array_klass_oop)->oop_is_array())) {
+          CPPINT_DEBUG( tty->print_cr( \
+            "CLASS CAST ERROR #2 not an array in _adapter_opt_spread." ); )
+          ResourceMark rm(THREAD);
+          const char* objName = Klass::cast(objKlassOop)->external_name();
+          const char* klassName = Klass::cast(klassOf)->external_name();
+          char* message = SharedRuntime::generate_class_cast_message(
+            objName, klassName);
+          stack->set_sp(calculate_unwind_sp(stack, method_handle));
+          CALL_VM_NOCHECK_NOFIX(
+            throw_exception(
+              thread,
+              vmSymbols::java_lang_ClassCastException(), message));
+          // NB all oops trashed!
+          assert(HAS_PENDING_EXCEPTION, "should do");
+          return;
+        }
+
+        klassOop element_klass_oop = NULL;
+        BasicType element_type = 
+          java_lang_Class::as_BasicType(array_klass->component_mirror(),
+            &element_klass_oop);
+        KlassHandle element_klass(THREAD, element_klass_oop);
+	if ((elem_type != T_OBJECT) && (elem_type != element_type)) {
+          CPPINT_DEBUG( tty->print_cr( \
+            "CLASS CAST ERROR #3 invalid type %s != %s in _adapter_opt_spread.", \
+            type2name(elem_type), type2name(element_type)  ); )
+          ResourceMark rm(THREAD);
+          const char* objName = Klass::cast(objKlassOop)->external_name();
+          const char* klassName = Klass::cast(klassOf)->external_name();
+          char* message = SharedRuntime::generate_class_cast_message(
+            objName, klassName);
+          stack->set_sp(calculate_unwind_sp(stack, method_handle));
+          CALL_VM_NOCHECK_NOFIX(
+            throw_exception(
+              thread,
+              vmSymbols::java_lang_ClassCastException(), message));
+          // NB all oops trashed!
+          assert(HAS_PENDING_EXCEPTION, "should do");
+          return;
+        }
+
+        array_length = arrayOop(arg)->length();
+
+        // Check the required length.
+        if (length_constant > 0) { // must match ?
+          if ( array_length != length_constant ) {
+            CPPINT_DEBUG( tty->print_cr( \
+              "ARRY INDEX ERROR #4 invalid array length in _adapter_opt_spread." ); )
+            //fixme  ArrayIndexOutOfBoundsException ?
+            ResourceMark rm(THREAD);
+            const char* objName = Klass::cast(objKlassOop)->external_name();
+            const char* klassName = Klass::cast(klassOf)->external_name();
+            char* message = SharedRuntime::generate_class_cast_message(
+              objName, klassName);
+
+            stack->set_sp(calculate_unwind_sp(stack, method_handle));
+            CALL_VM_NOCHECK_NOFIX(
+              throw_exception(
+                thread,
+                vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message));
+            // NB all oops trashed!
+            assert(HAS_PENDING_EXCEPTION, "should do");
+            return;
+          }
+        // use array_length ?
+        } else { // length_constant == [ -1 or 0 ] 
+          if ( (array_length > 0) || length_can_be_zero ) {
+            // use array_length.
+          } else { // array_length 0 and not length_can_be_zero
+            CPPINT_DEBUG( tty->print_cr( \
+              "ARRY INDEX ERROR #5 arry length 0 in _adapter_opt_spread." ); )
+            //fixme   ArrayIndexOutOfBoundsException ?
+            ResourceMark rm(THREAD);
+            const char* objName = Klass::cast(objKlassOop)->external_name();
+            const char* klassName = Klass::cast(klassOf)->external_name();
+            char* message = SharedRuntime::generate_class_cast_message(
+              objName, klassName);
+
+            stack->set_sp(calculate_unwind_sp(stack, method_handle));
+            CALL_VM_NOCHECK_NOFIX(
+              throw_exception(
+                thread,
+                vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message));
+            // NB all oops trashed!
+            assert(HAS_PENDING_EXCEPTION, "should do");
+            return;
+          }
+        }
+
+        // Array length checked out.  Now insert any required arg slots.
+        // array_length - 1 more slots if array_length > 0
+        // otherwise  if array_length == 0 remove arg_slot.
+
+        if ( array_length > 0 ) {
+          int slots = (array_length * elem_slots) - 1;
+          CPPINT_DEBUG( tty->print_cr( \
+            "array_length %d %d slots needed in _adapter_opt_spread.",\
+              array_length, slots); )
+          debug_only(if (elem_slots == 2) \
+            assert ((slots % 2 == 1)," bad slots calc"));
+          if ( slots > 0 ) {
+            intptr_t *unwind_sp = 
+            calculate_unwind_sp(stack, method_handle);
+            insert_vmslots(arg_slot, slots, THREAD);
+            if (HAS_PENDING_EXCEPTION) {
+              // all oops trashed
+              stack->set_sp(unwind_sp);
+              return;
+            }
+          }
+          vmslots = stack->sp();
+          arg_slot += slots;
+
+          array_elem0 = arrayOop(arg)->base(elem_type);
+
+          // Copy from the array to the new arg slots.
+          // [from native : Beware:  Arguments that are shallow 
+          // on the stack are deep in the array,
+          // and vice versa.  So a downward-growing stack (the usual) 
+          // has to be copied elementwise in reverse order 
+          // from the source array.]
+
+          void * array_elem = array_elem0;
+          int top_slot = arg_slot;
+
+          debug_only(if (elem_slots == 2) \
+            assert ((((ulong)(char *)&vmslots[top_slot]) % \
+              (u_int)type2aelembytes(elem_type) == 0), \
+                " bad arg alignment"));
+
+          CPPINT_DEBUG( tty->print_cr( \
+            "BEGIN ARRY LOOP %d %d 0x%x 0x%x _adapter_opt_spread.",\
+              array_length, top_slot, &vmslots[top_slot], array_elem  ); )
+
+          for (int index = 0; index < array_length; index++) {
+            switch (elem_type) {
+            case T_BYTE:
+              SET_VMSLOTS_INT(*(jint*)array_elem, top_slot);
+              break;
+            case T_CHAR:
+              SET_VMSLOTS_INT(*(jint*)array_elem, top_slot);
+              break;
+            case T_SHORT:
+              SET_VMSLOTS_INT(*(jint*)array_elem, top_slot);
+              break;
+            case T_INT:
+              SET_VMSLOTS_INT(*(jint*)array_elem, top_slot);
+              break;
+            case T_FLOAT:
+              SET_VMSLOTS_FLOAT(*(jfloat*)array_elem,top_slot);
+              break;
+            case T_LONG:
+              SET_VMSLOTS_LONG(*(jlong*)array_elem, top_slot);
+              break;
+            case T_DOUBLE:
+              SET_VMSLOTS_DOUBLE(*(jdouble*)array_elem, top_slot);
+              break;
+            case T_OBJECT:
+              SET_VMSLOTS_OBJECT(*(oopDesc**)array_elem, top_slot);
+              break;
+            default:
+              tty->print_cr("unhandled type %s", type2name(elem_type));
+              ShouldNotReachHere();
+            }
+            array_elem = (void*)((char *)array_elem +
+              type2aelembytes(element_type));
+            top_slot -= elem_slots;
+          }
+          arg_slot++;
+        }
+      }
+      if ((array_length == 0) && (arg != NULL)) {
+        CPPINT_DEBUG( tty->print_cr( \
+          "Array_length == 0, will remove slot." ); )
+        // remove arg slot
+        remove_vmslots(arg_slot, 1, THREAD); // doesn't trap
+         // unused, but let the compiler figure that out
+        vmslots = stack->sp();
+        //
+      }
+      CPPINT_DEBUG( tty->print_cr( \
+        "LEAVING _adapter_opt_spread: %s 0x%x 0x%x \n", \
+          type2name(elem_type), (char *)arg, (char *)stack->sp() ); )
+    }
+        break;
+    default:
+      tty->print_cr("unhandled entry_kind %s",
                   MethodHandles::entry_name(entry_kind));
-    ShouldNotReachHere();
+      ShouldNotReachHere();
   }
 
+
   // Continue along the chain
   if (direct_to_method) {
     if (method == NULL) {
diff -Nru openjdk.orig/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp openjdk/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp
--- openjdk.orig/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp	2013-09-13 00:30:29.930952968 +0100
+++ openjdk/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp	2016-05-03 20:19:21.099818351 +0100
@@ -36,6 +36,8 @@
   _deopt_state = unknown;
 }
 
+inline address  frame::sender_pc()           const { ShouldNotCallThis();  }
+
 inline frame::frame(ZeroFrame* zf, intptr_t* sp) {
   _zeroframe = zf;
   _sp = sp;