Mercurial > hg > release > icedtea7-2.5
changeset 2750:121ad7411fd1
Bump to icedtea-2.5.3.
2014-10-14 Andrew John Hughes <gnu.andrew@member.fsf.org>
* patches/hotspot/aarch64/20140715-8030763-validate_global_memory_allocation.patch,
* patches/hotspot/aarch64/20140715-8032536-jvm_resolves_wrong_method.patch,
* patches/hotspot/aarch64/20140715-8035119-fix_exceptions_to_bytecode_verification.patch,
* patches/hotspot/aarch64/20140715-8036800-attribute_oom_to_right_code.patch,
* patches/hotspot/aarch64/20140715-8037076-check_constant_pool_constants.patch,
* patches/hotspot/aarch64/20140715-8037157-verify_init_call.patch,
* patches/hotspot/aarch64/20140715-8037167-better_method_signature_resolution.patch,
* patches/hotspot/aarch64/20140715-8043454-8037157_test_case_fix.patch:
Remove patches included in latest AArch64 drop.
* Makefile.am:
(CORBA_CHANGESET): Update to icedtea-2.5.3 tag.
(JAXP_CHANGESET): Likewise.
(JAXWS_CHANGESET): Likewise.
(JDK_CHANGESET): Likewise.
(LANGTOOLS_CHANGESET): Likewise.
(OPENJDK_CHANGESET): Likewise.
(CORBA_SHA256SUM): Likewise.
(JAXP_SHA256SUM): Likewise.
(JAXWS_SHA256SUM): Likewise.
(JDK_SHA256SUM): Likewise.
(LANGTOOLS_SHA256SUM): Likewise.
(OPENJDK_SHA256SUM): Likewise.
(ICEDTEA_PATCHES): Remove old AArch64 security patches and
add new ones from the 2014/10/14 update.
* NEWS: List changes from u71 and AArch64 port. Set release
date to today.
* configure.ac: Bump to 2.5.3.
* hotspot.map.in: Update to icedtea-2.5.3 tag for default.
Update AArch64 to jdk7u60_b04_aarch64_834 tag.
* patches/boot/ecj-multicatch.patch:
Remove defunct RSAClientKeyExchange patch. Add new cases
in CipherInputStream and CipherOutputStream.
* patches/boot/ecj-stringswitch.patch: Add new case in
AnnotationInvocationHandler.
* patches/hotspot/aarch64/20141014-8015256-better_class_accessibility.patch,
* patches/hotspot/aarch64/20141014-8036533-method_for_correct_defaults.patch,
* patches/hotspot/aarch64/20141014-8036805-correct_linker_method_lookup.patch,
* patches/hotspot/aarch64/20141014-8038898-safer_safepoints.patch,
* patches/hotspot/aarch64/20141014-8038903-more_native_monitor_monitoring.patch,
* patches/hotspot/aarch64/20141014-8041717-issue_with_class_file_parser.patch,
* patches/hotspot/aarch64/20141014-8042603-safepointpolloffset.patch,
* patches/hotspot/aarch64/20141014-8044269-analysis_of_archive_files.patch,
* patches/hotspot/aarch64/20141014-8046213-testemptybootstrapmethodsattr_failure.patch,
* patches/hotspot/aarch64/20141014-8050485-super_causes_verifyerror.patch:
OpenJDK 8 version of 2014/10/14 HotSpot security patches for AArch64.
line wrap: on
line diff
--- a/ChangeLog Thu Oct 02 01:04:25 2014 +0100 +++ b/ChangeLog Tue Oct 14 22:11:50 2014 +0100 @@ -1,3 +1,51 @@ +2014-10-14 Andrew John Hughes <gnu.andrew@member.fsf.org> + + * patches/hotspot/aarch64/20140715-8030763-validate_global_memory_allocation.patch, + * patches/hotspot/aarch64/20140715-8032536-jvm_resolves_wrong_method.patch, + * patches/hotspot/aarch64/20140715-8035119-fix_exceptions_to_bytecode_verification.patch, + * patches/hotspot/aarch64/20140715-8036800-attribute_oom_to_right_code.patch, + * patches/hotspot/aarch64/20140715-8037076-check_constant_pool_constants.patch, + * patches/hotspot/aarch64/20140715-8037157-verify_init_call.patch, + * patches/hotspot/aarch64/20140715-8037167-better_method_signature_resolution.patch, + * patches/hotspot/aarch64/20140715-8043454-8037157_test_case_fix.patch: + Remove patches included in latest AArch64 drop. + * Makefile.am: + (CORBA_CHANGESET): Update to icedtea-2.5.3 tag. + (JAXP_CHANGESET): Likewise. + (JAXWS_CHANGESET): Likewise. + (JDK_CHANGESET): Likewise. + (LANGTOOLS_CHANGESET): Likewise. + (OPENJDK_CHANGESET): Likewise. + (CORBA_SHA256SUM): Likewise. + (JAXP_SHA256SUM): Likewise. + (JAXWS_SHA256SUM): Likewise. + (JDK_SHA256SUM): Likewise. + (LANGTOOLS_SHA256SUM): Likewise. + (OPENJDK_SHA256SUM): Likewise. + (ICEDTEA_PATCHES): Remove old AArch64 security patches and + add new ones from the 2014/10/14 update. + * NEWS: List changes from u71 and AArch64 port. Set release + date to today. + * configure.ac: Bump to 2.5.3. + * hotspot.map.in: Update to icedtea-2.5.3 tag for default. + Update AArch64 to jdk7u60_b04_aarch64_834 tag. + * patches/boot/ecj-multicatch.patch: + Remove defunct RSAClientKeyExchange patch. Add new cases + in CipherInputStream and CipherOutputStream. + * patches/boot/ecj-stringswitch.patch: Add new case in + AnnotationInvocationHandler. + * patches/hotspot/aarch64/20141014-8015256-better_class_accessibility.patch, + * patches/hotspot/aarch64/20141014-8036533-method_for_correct_defaults.patch, + * patches/hotspot/aarch64/20141014-8036805-correct_linker_method_lookup.patch, + * patches/hotspot/aarch64/20141014-8038898-safer_safepoints.patch, + * patches/hotspot/aarch64/20141014-8038903-more_native_monitor_monitoring.patch, + * patches/hotspot/aarch64/20141014-8041717-issue_with_class_file_parser.patch, + * patches/hotspot/aarch64/20141014-8042603-safepointpolloffset.patch, + * patches/hotspot/aarch64/20141014-8044269-analysis_of_archive_files.patch, + * patches/hotspot/aarch64/20141014-8046213-testemptybootstrapmethodsattr_failure.patch, + * patches/hotspot/aarch64/20141014-8050485-super_causes_verifyerror.patch: + OpenJDK 8 version of 2014/10/14 HotSpot security patches for AArch64. + 2014-10-01 Andrew John Hughes <gnu.andrew@member.fsf.org> * Makefile.am:
--- a/Makefile.am Thu Oct 02 01:04:25 2014 +0100 +++ b/Makefile.am Tue Oct 14 22:11:50 2014 +0100 @@ -4,19 +4,19 @@ BUILD_VERSION = b32 COMBINED_VERSION = $(JDK_UPDATE_VERSION)-$(BUILD_VERSION) -CORBA_CHANGESET = 090fc686cf0b -JAXP_CHANGESET = a4e4e763970f -JAXWS_CHANGESET = dcb5afbd4d7d -JDK_CHANGESET = 16dfadea81a1 -LANGTOOLS_CHANGESET = 0e3fd42f2696 -OPENJDK_CHANGESET = 6f40002d1813 +CORBA_CHANGESET = 4aed5efcd8df +JAXP_CHANGESET = c903902aadd7 +JAXWS_CHANGESET = d3bef5fd93db +JDK_CHANGESET = 6b81c7cc733e +LANGTOOLS_CHANGESET = a64b8bf851a9 +OPENJDK_CHANGESET = 49dc79ef05ab -CORBA_SHA256SUM = 65b0cb4638f08fe44d7d6d79af042e75747098bf4118003e141e87135ae6dcaa -JAXP_SHA256SUM = 722493ec24c4fb4023f1d65b9334dee3526f0e347c249e074a45421ea870ecc5 -JAXWS_SHA256SUM = f3c2915ae2bdf3c2aab82a0e700c05512850063baf06fb2c2fb5896cabce110e -JDK_SHA256SUM = dc00f5c39eb0fe8ccbf26aafe62e0eccf9785651f3ef8e090db1c62a970802d8 -LANGTOOLS_SHA256SUM = f560c641a6808726ed6cafdf6b1f29e98fc85faea56b1e751696892a2f5a1046 -OPENJDK_SHA256SUM = f2d69cdffd2bb14b744f4e25cb5ef2d0590926d1cb7da5868c2025479b2c74e1 +CORBA_SHA256SUM = 8ceb2cd60782b7fc14b88e3d366f273873fa5436cf0e36b86406c0905b7dc43c +JAXP_SHA256SUM = 2d13a82078f3f2b8831d1e670e5e75719336a56490df64f16ab7647674a272ef +JAXWS_SHA256SUM = 5a63d85307203f1aed1e31459ad5e32687909e0640d424ff6f540d9b1cceeb1e +JDK_SHA256SUM = 40c4dda969be0ecd213e79269184e19cfc32100b83777dc529b3cf4b6aa3e12f +LANGTOOLS_SHA256SUM = 516f6c21719f4b5a2092847c147cde7890c5a30d4aed9425ff667c0164ef1dd0 +OPENJDK_SHA256SUM = 3ba1a30762f5d5890e8ee6af11f52213ab9c574c01f07c75a081c42034f5d5c9 DROP_URL = http://icedtea.classpath.org/download/drops @@ -279,14 +279,16 @@ if WITH_ALT_HSBUILD ICEDTEA_PATCHES += patches/hotspot/aarch64/werror.patch \ - patches/hotspot/aarch64/20140715-8030763-validate_global_memory_allocation.patch \ - patches/hotspot/aarch64/20140715-8032536-jvm_resolves_wrong_method.patch \ - patches/hotspot/aarch64/20140715-8036800-attribute_oom_to_right_code.patch \ - patches/hotspot/aarch64/20140715-8035119-fix_exceptions_to_bytecode_verification.patch \ - patches/hotspot/aarch64/20140715-8037076-check_constant_pool_constants.patch \ - patches/hotspot/aarch64/20140715-8037157-verify_init_call.patch \ - patches/hotspot/aarch64/20140715-8043454-8037157_test_case_fix.patch \ - patches/hotspot/aarch64/20140715-8037167-better_method_signature_resolution.patch + patches/hotspot/aarch64/20141014-8015256-better_class_accessibility.patch \ + patches/hotspot/aarch64/20141014-8036533-method_for_correct_defaults.patch \ + patches/hotspot/aarch64/20141014-8036805-correct_linker_method_lookup.patch \ + patches/hotspot/aarch64/20141014-8038898-safer_safepoints.patch \ + patches/hotspot/aarch64/20141014-8038903-more_native_monitor_monitoring.patch \ + patches/hotspot/aarch64/20141014-8041717-issue_with_class_file_parser.patch \ + patches/hotspot/aarch64/20141014-8042603-safepointpolloffset.patch \ + patches/hotspot/aarch64/20141014-8044269-analysis_of_archive_files.patch \ + patches/hotspot/aarch64/20141014-8046213-testemptybootstrapmethodsattr_failure.patch \ + patches/hotspot/aarch64/20141014-8050485-super_causes_verifyerror.patch if ENABLE_SYSTEMTAP ICEDTEA_PATCHES += \ patches/hotspot/aarch64/systemtap_gc.patch
--- a/NEWS Thu Oct 02 01:04:25 2014 +0100 +++ b/NEWS Tue Oct 14 22:11:50 2014 +0100 @@ -12,13 +12,48 @@ CVE-XXXX-YYYY: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=XXXX-YYYY -New in release 2.5.3 (2014-10-XX): +New in release 2.5.3 (2014-10-14): +* Security fixes + - S8015256: Better class accessibility + - S8022783, CVE-2014-6504: Optimize C2 optimizations + - S8035162: Service printing service + - S8035781: Improve equality for annotations + - S8036805: Correct linker method lookup. + - S8036810: Correct linker field lookup + - S8036936: Use local locales + - S8037066, CVE-2014-6457: Secure transport layer + - S8037846, CVE-2014-6558: Ensure streaming of input cipher streams + - S8038364: Use certificate exceptions correctly + - S8038899: Safer safepoints + - S8038903: More native monitor monitoring + - S8038908: Make Signature more robust + - S8038913: Bolster XML support + - S8039509, CVE-2014-6512: Wrap sockets more thoroughly + - S8039533, CVE-2014-6517: Higher resolution resolvers + - S8041540, CVE-2014-6511: Better use of pages in font processing + - S8041529: Better parameterization of parameter lists + - S8041545: Better validation of generated rasters + - S8041564, CVE-2014-6506: Improved management of logger resources + - S8041717, CVE-2014-6519: Issue with class file parser + - S8042609, CVE-2014-6513: Limit splashiness of splash images + - S8042797, CVE-2014-6502: Avoid strawberries in LogRecord + - S8044274, CVE-2014-6531: Proper property processing * Backports - S4963723: Implement SHA-224 - S7044060: Need to support NSA Suite B Cryptography algorithms - S7122142: (ann) Race condition between isAnnotationPresent and getAnnotations + - S7160837: DigestOutputStream does not turn off digest calculation when "close()" is called - S8006935: Need to take care of long secret keys in HMAC/PRF compuation + - S8012637: Adjust CipherInputStream class to work in AEAD/GCM mode + - S8028192: Use of PKCS11-NSS provider in FIPS mode broken + - S8038000: java.awt.image.RasterFormatException: Incorrect scanline stride + - S8039396: NPE when writing a class descriptor object to a custom ObjectOutputStream + - S8042603: 'SafepointPollOffset' was not declared in static member function 'static bool Arguments::check_vm_args_consistency()' + - S8042850: Extra unused entries in ICU ScriptCodes enum + - S8052162: REGRESSION: sun/java2d/cmm/ColorConvertOp tests fail since 7u71 b01 + - S8053963: (dc) Use DatagramChannel.receive() instead of read() in connect() + - S8055176: 7u71 l10n resource file translation update * Bug fixes - PR1988: C++ Interpreter should no longer be used on ppc64 - PR1989: Make jdk_generic_profile.sh handle missing programs better and be more verbose @@ -29,6 +64,31 @@ - PR2009: Checksum of policy JAR files changes on every build - PR2025: LCMS_CFLAGS & LCMS_LIBS should not be used unless SYSTEM_LCMS is enabled - RH1015432: java-1.7.0-openjdk: Fails on PPC with StackOverflowError (revised comprehensive fix) +* AArch64 port + - AArch64 C2 instruct for smull + - Add frame anchor fences. + - Add MacroAssembler::maybe_isb() + - Add missing instruction synchronization barriers and cache flushes. + - Add support for a few simple intrinsics + - Add support for builtin crc32 instructions + - Add support for Neon implementation of CRC32 + - All address constants are 48 bits in size. + - array load must only read 32 bits + - Define uabs(). Use it everywhere an absolute value is wanted. + - Fast string comparison + - Fast String.equals() + - Fix register usage in generate_verify_oop(). + - Fix thinko in Atomic::xchg_ptr. + - Fix typo in fsqrts + - Improve C1 performance improvements in ic_cache checks + - Performance improvement and ease of use changes pulled from upstream + - Remove obsolete C1 patching code. + - Replace hotspot jtreg test suite with tests from jdk7u + - S8024648: 7141246 breaks Zero port + - Save intermediate state before removing C1 patching code. + - Unwind native AArch64 frames. + - Use 2- and 3-instruction immediate form of movoop and mov_metadata in C2-generated code. + - Various concurrency fixes. New in release 2.5.2 (2014-08-29):
--- a/configure.ac Thu Oct 02 01:04:25 2014 +0100 +++ b/configure.ac Tue Oct 14 22:11:50 2014 +0100 @@ -1,4 +1,4 @@ -AC_INIT([icedtea], [2.5.3pre02], [distro-pkg-dev@openjdk.java.net]) +AC_INIT([icedtea], [2.5.3], [distro-pkg-dev@openjdk.java.net]) AM_INIT_AUTOMAKE([1.9 tar-pax foreign]) AM_MAINTAINER_MODE([enable]) AC_CONFIG_FILES([Makefile])
--- a/hotspot.map.in Thu Oct 02 01:04:25 2014 +0100 +++ b/hotspot.map.in Tue Oct 14 22:11:50 2014 +0100 @@ -1,3 +1,3 @@ # version type(drop/hg) url changeset sha256sum -default drop http://icedtea.classpath.org/download/drops/icedtea7/@ICEDTEA_RELEASE@ 7ce2690d2182 a46fa777ee7bdf5ef60231b105745e1c4e4cddc356cdc677b615a843705499b5 -aarch64 drop http://icedtea.classpath.org/download/drops/aarch64/2.5.1 a03843f2ff15 e88ca1ef9eeafa9bac7f0e5277a927129288547f241f0ed1e53969c6888177f2 +default drop http://icedtea.classpath.org/download/drops/icedtea7/@ICEDTEA_RELEASE@ 1d0d98e7c981 8c8e1f7e97f47fe4029e0b0ba42b3515474adabe64e1fbee15c0e2e22a13aa28 +aarch64 drop http://icedtea.classpath.org/download/drops/aarch64/@ICEDTEA_RELEASE@ 116bc9da35de b9e7f67079184310450c9b461b492f340aa7824c27079b430c8f25b58b327ec5
--- a/patches/boot/ecj-multicatch.patch Thu Oct 02 01:04:25 2014 +0100 +++ b/patches/boot/ecj-multicatch.patch Tue Oct 14 22:11:50 2014 +0100 @@ -1,6 +1,38 @@ +diff -Nru openjdk-boot.orig/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java openjdk-boot/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java +--- openjdk-boot.orig/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java 2014-05-12 22:18:02.000000000 +0100 ++++ openjdk-boot/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java 2014-10-14 19:21:56.737171023 +0100 +@@ -145,7 +145,9 @@ + final String name = c.name(); + ei = new EncodingInfo(name, name); + _encodingInfos.putEncoding(normalizedEncoding, ei); +- } catch (IllegalCharsetNameException | UnsupportedCharsetException x) { ++ } catch (IllegalCharsetNameException x) { ++ ei = new EncodingInfo(null,null); ++ } catch (UnsupportedCharsetException x) { + ei = new EncodingInfo(null,null); + } + } +diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java openjdk-boot/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java +--- openjdk-boot.orig/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java 2014-10-14 19:21:56.733170968 +0100 +@@ -402,7 +402,13 @@ + try { + ServerNotifForwarder.checkMBeanPermission(this.mBeanServer, + candidate.getObjectName(),"addNotificationListener"); +- } catch (InstanceNotFoundException | SecurityException e) { ++ } catch (InstanceNotFoundException e) { ++ if (logger.debugOn()) { ++ logger.debug("fetchNotifications", "candidate: " + candidate + " skipped. exception " + e); ++ } ++ ++nextSeq; ++ continue; ++ } catch (SecurityException e) { + if (logger.debugOn()) { + logger.debug("fetchNotifications", "candidate: " + candidate + " skipped. exception " + e); + } diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/io/PrintStream.java openjdk-boot/jdk/src/share/classes/java/io/PrintStream.java ---- openjdk-boot.orig/jdk/src/share/classes/java/io/PrintStream.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/io/PrintStream.java 2013-04-04 13:42:21.263677653 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/java/io/PrintStream.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/io/PrintStream.java 2014-10-14 19:21:56.729170913 +0100 @@ -91,7 +91,10 @@ requireNonNull(csn, "charsetName"); try { @@ -14,8 +46,8 @@ throw new UnsupportedEncodingException(csn); } diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/io/PrintWriter.java openjdk-boot/jdk/src/share/classes/java/io/PrintWriter.java ---- openjdk-boot.orig/jdk/src/share/classes/java/io/PrintWriter.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/io/PrintWriter.java 2013-04-04 13:42:21.275677843 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/java/io/PrintWriter.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/io/PrintWriter.java 2014-10-14 19:21:56.729170913 +0100 @@ -85,7 +85,10 @@ Objects.requireNonNull(csn, "charsetName"); try { @@ -29,9 +61,9 @@ throw new UnsupportedEncodingException(csn); } diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java openjdk-boot/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java ---- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java 2013-04-04 13:42:21.315678473 +0100 -@@ -747,7 +747,9 @@ +--- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java 2014-10-14 19:21:56.729170913 +0100 +@@ -748,7 +748,9 @@ Class<?> fieldType = Wrapper.forBasicType(types.charAt(index)).primitiveType(); try { return LOOKUP.findGetter(cbmhClass, fieldName, fieldType); @@ -42,7 +74,7 @@ throw newInternalError(e); } } -@@ -801,7 +803,13 @@ +@@ -802,7 +804,13 @@ static MethodHandle makeCbmhCtor(Class<? extends BoundMethodHandle> cbmh, String types) { try { return linkConstructor(LOOKUP.findConstructor(cbmh, MethodType.fromMethodDescriptorString(makeSignature(types, true), null))); @@ -58,8 +90,8 @@ } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/LambdaForm.java openjdk-boot/jdk/src/share/classes/java/lang/invoke/LambdaForm.java ---- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/LambdaForm.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/LambdaForm.java 2013-04-04 13:42:21.323678600 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/LambdaForm.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/LambdaForm.java 2014-10-14 19:21:56.729170913 +0100 @@ -456,9 +456,11 @@ traceInterpreter("compileToBytecode", this); isCompiled = true; @@ -89,9 +121,9 @@ Name n = new Name(zcon).newIndex(0); assert(n.type == ALL_TYPES.charAt(tn)); diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java ---- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java 2013-04-04 13:34:02.223748460 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java 2013-04-04 13:42:21.323678600 +0100 -@@ -263,7 +263,12 @@ +--- openjdk-boot.orig/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java 2014-10-14 19:21:18.664639686 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java 2014-10-14 19:21:56.729170913 +0100 +@@ -264,7 +264,12 @@ continue; } throw new InternalError(err); @@ -106,8 +138,8 @@ // ignore exotic ops the JVM cares about; we just wont issue them //System.err.println("warning: "+err); diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/management/ManagementFactory.java openjdk-boot/jdk/src/share/classes/java/lang/management/ManagementFactory.java ---- openjdk-boot.orig/jdk/src/share/classes/java/lang/management/ManagementFactory.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/lang/management/ManagementFactory.java 2013-04-04 13:42:21.279677906 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/java/lang/management/ManagementFactory.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/lang/management/ManagementFactory.java 2014-10-14 19:21:56.729170913 +0100 @@ -606,7 +606,9 @@ // create an MXBean proxy return JMX.newMXBeanProxy(connection, objName, mxbeanInterface, @@ -119,9 +151,71 @@ throw new IllegalArgumentException(e); } } +diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/ProcessBuilder.java openjdk-boot/jdk/src/share/classes/java/lang/ProcessBuilder.java +--- openjdk-boot.orig/jdk/src/share/classes/java/lang/ProcessBuilder.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/lang/ProcessBuilder.java 2014-10-14 19:21:56.737171023 +0100 +@@ -1030,10 +1030,10 @@ + dir, + redirects, + redirectErrorStream); +- } catch (IOException | IllegalArgumentException e) { ++ } catch (IOException e) { + String exceptionInfo = ": " + e.getMessage(); + Throwable cause = e; +- if ((e instanceof IOException) && security != null) { ++ if (security != null) { + // Can not disclose the fail reason for read-protected files. + try { + security.checkRead(prog); +@@ -1045,6 +1045,16 @@ + // It's much easier for us to create a high-quality error + // message than the low-level C code which found the problem. + throw new IOException( ++ "Cannot run program \"" + prog + "\"" ++ + (dir == null ? "" : " (in directory \"" + dir + "\")") ++ + exceptionInfo, ++ cause); ++ } catch (IllegalArgumentException e) { ++ String exceptionInfo = ": " + e.getMessage(); ++ Throwable cause = e; ++ // It's much easier for us to create a high-quality error ++ // message than the low-level C code which found the problem. ++ throw new IOException( + "Cannot run program \"" + prog + "\"" + + (dir == null ? "" : " (in directory \"" + dir + "\")") + + exceptionInfo, +diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/reflect/Proxy.java openjdk-boot/jdk/src/share/classes/java/lang/reflect/Proxy.java +--- openjdk-boot.orig/jdk/src/share/classes/java/lang/reflect/Proxy.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/lang/reflect/Proxy.java 2014-10-14 19:21:56.733170968 +0100 +@@ -762,7 +762,9 @@ + private static Object newInstance(Constructor<?> cons, InvocationHandler h) { + try { + return cons.newInstance(new Object[] {h} ); +- } catch (IllegalAccessException | InstantiationException e) { ++ } catch (IllegalAccessException e) { ++ throw new InternalError(e.toString()); ++ } catch (InstantiationException e) { + throw new InternalError(e.toString()); + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); +diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/nio/charset/Charset.java openjdk-boot/jdk/src/share/classes/java/nio/charset/Charset.java +--- openjdk-boot.orig/jdk/src/share/classes/java/nio/charset/Charset.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/nio/charset/Charset.java 2014-10-14 19:21:56.737171023 +0100 +@@ -440,8 +440,9 @@ + } catch (ClassNotFoundException x) { + // Extended charsets not available + // (charsets.jar not present) +- } catch (InstantiationException | +- IllegalAccessException x) { ++ } catch (InstantiationException x) { ++ throw new Error(x); ++ } catch (IllegalAccessException x) { + throw new Error(x); + } + return null; diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/util/Formatter.java openjdk-boot/jdk/src/share/classes/java/util/Formatter.java ---- openjdk-boot.orig/jdk/src/share/classes/java/util/Formatter.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/util/Formatter.java 2013-04-04 13:42:21.283677969 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/java/util/Formatter.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/util/Formatter.java 2014-10-14 19:21:56.729170913 +0100 @@ -1857,7 +1857,10 @@ Objects.requireNonNull(csn, "charsetName"); try { @@ -135,8 +229,8 @@ throw new UnsupportedEncodingException(csn); } diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/util/Scanner.java openjdk-boot/jdk/src/share/classes/java/util/Scanner.java ---- openjdk-boot.orig/jdk/src/share/classes/java/util/Scanner.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/util/Scanner.java 2013-04-04 13:42:21.299678221 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/java/util/Scanner.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/java/util/Scanner.java 2014-10-14 19:21:56.733170968 +0100 @@ -633,7 +633,10 @@ Objects.requireNonNull(csn, "charsetName"); try { @@ -160,9 +254,54 @@ throw new IllegalArgumentException(charsetName); } } +diff -Nru openjdk-boot.orig/jdk/src/share/classes/javax/crypto/CipherInputStream.java openjdk-boot/jdk/src/share/classes/javax/crypto/CipherInputStream.java +--- openjdk-boot.orig/jdk/src/share/classes/javax/crypto/CipherInputStream.java 2014-10-14 19:58:01.679349189 +0100 ++++ openjdk-boot/jdk/src/share/classes/javax/crypto/CipherInputStream.java 2014-10-14 19:58:59.096156147 +0100 +@@ -110,7 +110,10 @@ + done = true; + try { + obuffer = cipher.doFinal(); +- } catch (IllegalBlockSizeException | BadPaddingException e) { ++ } catch (IllegalBlockSizeException e) { ++ obuffer = null; ++ throw new IOException(e); ++ } catch (BadPaddingException e) { + obuffer = null; + throw new IOException(e); + } +@@ -314,7 +317,14 @@ + cipher.doFinal(); + } + } +- catch (BadPaddingException | IllegalBlockSizeException ex) { ++ catch (BadPaddingException ex) { ++ /* If no data has been read from the stream to be en/decrypted, ++ we supress any exceptions, and close quietly. */ ++ if (read) { ++ throw new IOException(ex); ++ } ++ } ++ catch (IllegalBlockSizeException ex) { + /* If no data has been read from the stream to be en/decrypted, + we supress any exceptions, and close quietly. */ + if (read) { +diff -Nru openjdk-boot.orig/jdk/src/share/classes/javax/crypto/CipherOutputStream.java openjdk-boot/jdk/src/share/classes/javax/crypto/CipherOutputStream.java +--- openjdk-boot.orig/jdk/src/share/classes/javax/crypto/CipherOutputStream.java 2014-10-14 19:57:56.383275536 +0100 ++++ openjdk-boot/jdk/src/share/classes/javax/crypto/CipherOutputStream.java 2014-10-14 19:59:16.160397935 +0100 +@@ -208,7 +208,9 @@ + closed = true; + try { + obuffer = cipher.doFinal(); +- } catch (IllegalBlockSizeException | BadPaddingException e) { ++ } catch (IllegalBlockSizeException e) { ++ obuffer = null; ++ } catch (BadPaddingException e) { + obuffer = null; + } + try { diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/invoke/util/ValueConversions.java openjdk-boot/jdk/src/share/classes/sun/invoke/util/ValueConversions.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/invoke/util/ValueConversions.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/invoke/util/ValueConversions.java 2013-04-04 13:42:21.303678284 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/invoke/util/ValueConversions.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/invoke/util/ValueConversions.java 2014-10-14 19:21:56.733170968 +0100 @@ -482,7 +482,9 @@ FILL_NEW_TYPED_ARRAY = IMPL_LOOKUP .findStatic(THIS_CLASS, "fillNewTypedArray", @@ -175,8 +314,8 @@ } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/rmi/server/ActivationGroupImpl.java openjdk-boot/jdk/src/share/classes/sun/rmi/server/ActivationGroupImpl.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/server/ActivationGroupImpl.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/rmi/server/ActivationGroupImpl.java 2013-04-04 13:42:21.327678663 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/server/ActivationGroupImpl.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/rmi/server/ActivationGroupImpl.java 2014-10-14 19:21:56.733170968 +0100 @@ -296,7 +296,16 @@ active.put(id, entry); return entry.mobj; @@ -196,9 +335,9 @@ * or code recompiled and user forgot to provide * activatable constructor? diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java openjdk-boot/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java 2013-04-04 13:42:21.327678663 +0100 -@@ -261,11 +261,14 @@ +--- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/rmi/server/LoaderHandler.java 2014-10-14 19:21:56.733170968 +0100 +@@ -262,11 +262,14 @@ annotation = urlsToPath(urls); } @@ -215,8 +354,8 @@ * to be thrown by openConnection() and getPermission(). If it * does happen, forget about this class loader's URLs and diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java openjdk-boot/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java 2013-04-04 13:42:21.331678726 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java 2014-10-14 19:21:56.733170968 +0100 @@ -208,7 +208,9 @@ return initialSocket; @@ -240,8 +379,8 @@ } catch (SocketException e) { if (eagerHttpFallback) { diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java openjdk-boot/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java 2013-04-04 13:42:21.335678789 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java 2014-10-14 19:21:56.733170968 +0100 @@ -623,7 +623,10 @@ try { TCPEndpoint.shedConnectionCaches(); @@ -255,8 +394,8 @@ // or shed fails non-catastrophically } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/internal/PAData.java openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/PAData.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/internal/PAData.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/PAData.java 2013-04-04 13:42:21.303678284 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/security/krb5/internal/PAData.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/security/krb5/internal/PAData.java 2014-10-14 19:21:56.733170968 +0100 @@ -280,7 +280,9 @@ .append(info.getSalt()) .append('\n'); @@ -279,9 +418,35 @@ sb.append("\t <Unparseable PA-ETYPE-INFO>\n"); } } +diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/Handshaker.java openjdk-boot/jdk/src/share/classes/sun/security/ssl/Handshaker.java +--- openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/Handshaker.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/security/ssl/Handshaker.java 2014-10-14 19:21:56.737171023 +0100 +@@ -1061,8 +1061,7 @@ + KeyGenerator kg = JsseJce.getKeyGenerator(masterAlg); + kg.init(spec); + return kg.generateKey(); +- } catch (InvalidAlgorithmParameterException | +- NoSuchAlgorithmException iae) { ++ } catch (InvalidAlgorithmParameterException iae) { + // unlikely to happen, otherwise, must be a provider exception + // + // For RSA premaster secrets, do not signal a protocol error +@@ -1070,6 +1069,12 @@ + if (debug != null && Debug.isOn("handshake")) { + System.out.println("RSA master secret generation error:"); + iae.printStackTrace(System.out); ++ } ++ throw new ProviderException(iae); ++ } catch (NoSuchAlgorithmException iae) { ++ if (debug != null && Debug.isOn("handshake")) { ++ System.out.println("RSA master secret generation error:"); ++ iae.printStackTrace(System.out); + } + throw new ProviderException(iae); + } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java openjdk-boot/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java 2013-04-04 13:42:21.307678347 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/security/util/UntrustedCertificates.java 2014-10-14 19:21:56.733170968 +0100 @@ -65,7 +65,10 @@ throw new RuntimeException("Duplicate untrusted certificate: " + cert.getSubjectX500Principal()); @@ -295,8 +460,8 @@ "Incorrect untrusted certificate: " + alias, e); } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/text/bidi/BidiBase.java openjdk-boot/jdk/src/share/classes/sun/text/bidi/BidiBase.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/text/bidi/BidiBase.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/text/bidi/BidiBase.java 2013-04-04 13:42:21.311678410 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/text/bidi/BidiBase.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/text/bidi/BidiBase.java 2014-10-14 19:21:56.733170968 +0100 @@ -3478,7 +3478,9 @@ try { Field f = clazz.getField(name); @@ -309,8 +474,8 @@ } } diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/tools/jcmd/JCmd.java openjdk-boot/jdk/src/share/classes/sun/tools/jcmd/JCmd.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/tools/jcmd/JCmd.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/tools/jcmd/JCmd.java 2013-04-04 13:42:21.311678410 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/tools/jcmd/JCmd.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/tools/jcmd/JCmd.java 2014-10-14 19:21:56.733170968 +0100 @@ -94,7 +94,7 @@ && mainClass.indexOf(arg.getProcessSubstring()) != -1) { pids.add(vmd.id()); @@ -355,8 +520,8 @@ private static String getMainClass(VirtualMachineDescriptor vmd) diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/tools/jconsole/Resources.java openjdk-boot/jdk/src/share/classes/sun/tools/jconsole/Resources.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/tools/jconsole/Resources.java 2013-04-03 14:18:05.000000000 +0100 -+++ openjdk-boot/jdk/src/share/classes/sun/tools/jconsole/Resources.java 2013-04-04 13:42:21.315678473 +0100 +--- openjdk-boot.orig/jdk/src/share/classes/sun/tools/jconsole/Resources.java 2014-10-02 03:17:19.000000000 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/tools/jconsole/Resources.java 2014-10-14 19:21:56.733170968 +0100 @@ -129,7 +129,9 @@ private static void setFieldValue(Field field, String value) { try { @@ -387,145 +552,3 @@ // Missing VK is okay return 0; } -diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/reflect/Proxy.java openjdk-boot/jdk/src/share/classes/java/lang/reflect/Proxy.java ---- openjdk-boot.orig/jdk/src/share/classes/java/lang/reflect/Proxy.java 2013-04-04 18:27:48.018006729 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/lang/reflect/Proxy.java 2013-04-04 18:28:12.750398303 +0100 -@@ -738,7 +738,9 @@ - private static Object newInstance(Constructor<?> cons, InvocationHandler h) { - try { - return cons.newInstance(new Object[] {h} ); -- } catch (IllegalAccessException | InstantiationException e) { -+ } catch (IllegalAccessException e) { -+ throw new InternalError(e.toString()); -+ } catch (InstantiationException e) { - throw new InternalError(e.toString()); - } catch (InvocationTargetException e) { - Throwable t = e.getCause(); -diff -Nru openjdk-boot.orig/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java openjdk-boot/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java ---- openjdk-boot.orig/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java 2013-06-27 15:56:57.456088537 +0100 -+++ openjdk-boot/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java 2013-06-27 16:02:12.857102777 +0100 -@@ -402,7 +402,13 @@ - try { - ServerNotifForwarder.checkMBeanPermission(this.mBeanServer, - candidate.getObjectName(),"addNotificationListener"); -- } catch (InstanceNotFoundException | SecurityException e) { -+ } catch (InstanceNotFoundException e) { -+ if (logger.debugOn()) { -+ logger.debug("fetchNotifications", "candidate: " + candidate + " skipped. exception " + e); -+ } -+ ++nextSeq; -+ continue; -+ } catch (SecurityException e) { - if (logger.debugOn()) { - logger.debug("fetchNotifications", "candidate: " + candidate + " skipped. exception " + e); - } -diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/lang/ProcessBuilder.java openjdk-boot/jdk/src/share/classes/java/lang/ProcessBuilder.java ---- openjdk-boot.orig/jdk/src/share/classes/java/lang/ProcessBuilder.java 2013-06-27 15:56:27.295609027 +0100 -+++ openjdk-boot/jdk/src/share/classes/java/lang/ProcessBuilder.java 2013-06-27 16:00:59.631938678 +0100 -@@ -1024,10 +1024,10 @@ - dir, - redirects, - redirectErrorStream); -- } catch (IOException | IllegalArgumentException e) { -+ } catch (IOException e) { - String exceptionInfo = ": " + e.getMessage(); - Throwable cause = e; -- if ((e instanceof IOException) && security != null) { -+ if (security != null) { - // Can not disclose the fail reason for read-protected files. - try { - security.checkRead(prog); -@@ -1039,6 +1039,16 @@ - // It's much easier for us to create a high-quality error - // message than the low-level C code which found the problem. - throw new IOException( -+ "Cannot run program \"" + prog + "\"" -+ + (dir == null ? "" : " (in directory \"" + dir + "\")") -+ + exceptionInfo, -+ cause); -+ } catch (IllegalArgumentException e) { -+ String exceptionInfo = ": " + e.getMessage(); -+ Throwable cause = e; -+ // It's much easier for us to create a high-quality error -+ // message than the low-level C code which found the problem. -+ throw new IOException( - "Cannot run program \"" + prog + "\"" - + (dir == null ? "" : " (in directory \"" + dir + "\")") - + exceptionInfo, -diff -Nru openjdk-boot.orig/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java openjdk-boot/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java ---- openjdk-boot.orig/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java 2013-07-12 17:05:47.376339879 +0100 -+++ openjdk-boot/jaxp/src/com/sun/org/apache/xml/internal/serializer/Encodings.java 2013-07-12 17:06:19.304846651 +0100 -@@ -145,7 +145,9 @@ - final String name = c.name(); - ei = new EncodingInfo(name, name); - _encodingInfos.putEncoding(normalizedEncoding, ei); -- } catch (IllegalCharsetNameException | UnsupportedCharsetException x) { -+ } catch (IllegalCharsetNameException x) { -+ ei = new EncodingInfo(null,null); -+ } catch (UnsupportedCharsetException x) { - ei = new EncodingInfo(null,null); - } - } -diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/nio/charset/Charset.java openjdk-boot/jdk/src/share/classes/java/nio/charset/Charset.java ---- openjdk-boot.orig/jdk/src/share/classes/java/nio/charset/Charset.java 2013-12-26 22:36:18.267285222 +0000 -+++ openjdk-boot/jdk/src/share/classes/java/nio/charset/Charset.java 2013-12-26 22:36:43.439705661 +0000 -@@ -440,8 +440,9 @@ - } catch (ClassNotFoundException x) { - // Extended charsets not available - // (charsets.jar not present) -- } catch (InstantiationException | -- IllegalAccessException x) { -+ } catch (InstantiationException x) { -+ throw new Error(x); -+ } catch (IllegalAccessException x) { - throw new Error(x); - } - return null; ---- openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/Handshaker.java 2014-01-16 00:34:01.264963408 +0000 -+++ openjdk-boot/jdk/src/share/classes/sun/security/ssl/Handshaker.java 2014-01-16 00:35:24.562264096 +0000 -@@ -1051,8 +1051,7 @@ - KeyGenerator kg = JsseJce.getKeyGenerator(masterAlg); - kg.init(spec); - return kg.generateKey(); -- } catch (InvalidAlgorithmParameterException | -- NoSuchAlgorithmException iae) { -+ } catch (InvalidAlgorithmParameterException iae) { - // unlikely to happen, otherwise, must be a provider exception - // - // For RSA premaster secrets, do not signal a protocol error -@@ -1060,6 +1059,12 @@ - if (debug != null && Debug.isOn("handshake")) { - System.out.println("RSA master secret generation error:"); - iae.printStackTrace(System.out); -+ } -+ throw new ProviderException(iae); -+ } catch (NoSuchAlgorithmException iae) { -+ if (debug != null && Debug.isOn("handshake")) { -+ System.out.println("RSA master secret generation error:"); -+ iae.printStackTrace(System.out); - } - throw new ProviderException(iae); - } -diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java openjdk-boot/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java ---- openjdk-boot.orig/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java 2014-01-16 00:34:14.005162368 +0000 -+++ openjdk-boot/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java 2014-01-16 00:36:09.446964834 +0000 -@@ -271,12 +271,17 @@ - kg.init(new TlsRsaPremasterSecretParameterSpec( - version.major, version.minor, encodedSecret), generator); - return kg.generateKey(); -- } catch (InvalidAlgorithmParameterException | -- NoSuchAlgorithmException iae) { -+ } catch (InvalidAlgorithmParameterException iae) { - // unlikely to happen, otherwise, must be a provider exception - if (debug != null && Debug.isOn("handshake")) { - System.out.println("RSA premaster secret generation error:"); - iae.printStackTrace(System.out); -+ } -+ throw new RuntimeException("Could not generate dummy secret", iae); -+ } catch (NoSuchAlgorithmException iae) { -+ if (debug != null && Debug.isOn("handshake")) { -+ System.out.println("RSA premaster secret generation error:"); -+ iae.printStackTrace(System.out); - } - throw new RuntimeException("Could not generate dummy secret", iae); - }
--- a/patches/boot/ecj-stringswitch.patch Thu Oct 02 01:04:25 2014 +0100 +++ b/patches/boot/ecj-stringswitch.patch Tue Oct 14 22:11:50 2014 +0100 @@ -555,3 +555,24 @@ } throw new IllegalArgumentException( +diff -Nru openjdk-boot.orig/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java openjdk-boot/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java +--- openjdk-boot.orig/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java 2014-10-14 19:33:10.606587037 +0100 ++++ openjdk-boot/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java 2014-10-14 19:34:06.831372783 +0100 +@@ -64,14 +64,12 @@ + if (paramTypes.length != 0) + throw new AssertionError("Too many parameters for an annotation method"); + +- switch(member) { +- case "toString": ++ if ("toString".equals(member)) + return toStringImpl(); +- case "hashCode": ++ if ("hashCode".equals(member)) + return hashCodeImpl(); +- case "annotationType": ++ if ("annotationType".equals(member)) + return type; +- } + + // Handle annotation member accessors + Object result = memberValues.get(member);
--- a/patches/hotspot/aarch64/20140715-8030763-validate_global_memory_allocation.patch Thu Oct 02 01:04:25 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -# HG changeset patch -# User hseigel -# Date 1392308897 18000 -# Thu Feb 13 11:28:17 2014 -0500 -# Node ID 5656140324ed3a86860f5bf43f5cab8c99374d9d -# Parent bf4dc2e29b5cfb724e9289347146ad6df37d011b -8030763: Validate global memory allocation -Summary: Add length checks where necessary -Reviewed-by: coleenp, mschoene - -diff -r bf4dc2e29b5c -r 5656140324ed src/os/bsd/vm/os_bsd.cpp ---- openjdk/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Feb 12 11:33:30 2014 -0800 -+++ openjdk/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Feb 13 11:28:17 2014 -0500 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1999, 2014, 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 -@@ -1115,10 +1115,6 @@ - ::abort(); - } - --// unused on bsd for now. --void os::set_error_file(const char *logfile) {} -- -- - // This method is a copy of JDK's sysGetLastErrorString - // from src/solaris/hpi/src/system_md.c - -@@ -1808,6 +1804,7 @@ - // determine if this is a legacy image or modules image - // modules image doesn't have "jre" subdirectory - len = strlen(buf); -+ assert(len < buflen, "Ran out of buffer space"); - jrelib_p = buf + len; - - // Add the appropriate library subdir -@@ -1841,7 +1838,7 @@ - } - } - -- strcpy(saved_jvm_path, buf); -+ strncpy(saved_jvm_path, buf, MAXPATHLEN); - } - - void os::print_jni_name_prefix_on(outputStream* st, int args_size) { -diff -r bf4dc2e29b5c -r 5656140324ed src/os/linux/vm/os_linux.cpp ---- openjdk/hotspot/src/os/linux/vm/os_linux.cpp Wed Feb 12 11:33:30 2014 -0800 -+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp Thu Feb 13 11:28:17 2014 -0500 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1999, 2014, 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 -@@ -1572,9 +1572,6 @@ - ::abort(); - } - --// unused on linux for now. --void os::set_error_file(const char *logfile) {} -- - - // This method is a copy of JDK's sysGetLastErrorString - // from src/solaris/hpi/src/system_md.c -@@ -2399,6 +2396,7 @@ - // determine if this is a legacy image or modules image - // modules image doesn't have "jre" subdirectory - len = strlen(buf); -+ assert(len < buflen, "Ran out of buffer room"); - jrelib_p = buf + len; - snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); - if (0 != access(buf, F_OK)) { -@@ -2419,7 +2417,7 @@ - } - } - -- strcpy(saved_jvm_path, buf); -+ strncpy(saved_jvm_path, buf, MAXPATHLEN); - } - - void os::print_jni_name_prefix_on(outputStream* st, int args_size) { -diff -r bf4dc2e29b5c -r 5656140324ed src/os/solaris/vm/os_solaris.cpp ---- openjdk/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Feb 12 11:33:30 2014 -0800 -+++ openjdk/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Feb 13 11:28:17 2014 -0500 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1997, 2014, 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 -@@ -1788,9 +1788,6 @@ - ::abort(); // dump core (for debugging) - } - --// unused --void os::set_error_file(const char *logfile) {} -- - // DLL functions - - const char* os::dll_file_extension() { return ".so"; } -@@ -2474,6 +2471,7 @@ - // determine if this is a legacy image or modules image - // modules image doesn't have "jre" subdirectory - len = strlen(buf); -+ assert(len < buflen, "Ran out of buffer space"); - jrelib_p = buf + len; - snprintf(jrelib_p, buflen-len, "/jre/lib/%s", cpu_arch); - if (0 != access(buf, F_OK)) { -@@ -2492,7 +2490,7 @@ - } - } - -- strcpy(saved_jvm_path, buf); -+ strncpy(saved_jvm_path, buf, MAXPATHLEN); - } - - -diff -r bf4dc2e29b5c -r 5656140324ed src/os/windows/vm/os_windows.cpp ---- openjdk/hotspot/src/os/windows/vm/os_windows.cpp Wed Feb 12 11:33:30 2014 -0800 -+++ openjdk/hotspot/src/os/windows/vm/os_windows.cpp Thu Feb 13 11:28:17 2014 -0500 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1997, 2014, 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 -@@ -1819,7 +1819,8 @@ - // libjvm.so is installed there (append a fake suffix - // hotspot/libjvm.so). - char* java_home_var = ::getenv("JAVA_HOME"); -- if (java_home_var != NULL && java_home_var[0] != 0) { -+ if (java_home_var != NULL && java_home_var[0] != 0 && -+ strlen(java_home_var) < (size_t)buflen) { - - strncpy(buf, java_home_var, buflen); - -@@ -1837,9 +1838,9 @@ - } - - if(buf[0] == '\0') { -- GetModuleFileName(vm_lib_handle, buf, buflen); -- } -- strcpy(saved_jvm_path, buf); -+ GetModuleFileName(vm_lib_handle, buf, buflen); -+ } -+ strncpy(saved_jvm_path, buf, MAX_PATH); - } - - -@@ -2290,19 +2291,8 @@ - } - - */ --#endif //_WIN64 -- -- --// Fatal error reporting is single threaded so we can make this a --// static and preallocated. If it's more than MAX_PATH silently ignore --// it. --static char saved_error_file[MAX_PATH] = {0}; -- --void os::set_error_file(const char *logfile) { -- if (strlen(logfile) <= MAX_PATH) { -- strncpy(saved_error_file, logfile, MAX_PATH); -- } --} -+#endif // _WIN64 -+ - - static inline void report_error(Thread* t, DWORD exception_code, - address addr, void* siginfo, void* context) { -diff -r bf4dc2e29b5c -r 5656140324ed src/share/vm/compiler/compileBroker.cpp ---- openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp Wed Feb 12 11:33:30 2014 -0800 -+++ openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp Thu Feb 13 11:28:17 2014 -0500 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1999, 2014, 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 -@@ -2089,6 +2089,7 @@ - ResourceMark rm; - char* method_name = method->name()->as_C_string(); - strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length); -+ _last_method_compiled[CompileBroker::name_buffer_length - 1] = '\0'; // ensure null terminated - char current_method[CompilerCounters::cmname_buffer_length]; - size_t maxLen = CompilerCounters::cmname_buffer_length; - -diff -r bf4dc2e29b5c -r 5656140324ed src/share/vm/runtime/os.hpp ---- openjdk/hotspot/src/share/vm/runtime/os.hpp Wed Feb 12 11:33:30 2014 -0800 -+++ openjdk/hotspot/src/share/vm/runtime/os.hpp Thu Feb 13 11:28:17 2014 -0500 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1997, 2014, 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 -@@ -470,9 +470,6 @@ - // run cmd in a separate process and return its exit code; or -1 on failures - static int fork_and_exec(char *cmd); - -- // Set file to send error reports. -- static void set_error_file(const char *logfile); -- - // os::exit() is merged with vm_exit() - // static void exit(int num); - -diff -r bf4dc2e29b5c -r 5656140324ed src/share/vm/utilities/vmError.cpp ---- openjdk/hotspot/src/share/vm/utilities/vmError.cpp Wed Feb 12 11:33:30 2014 -0800 -+++ openjdk/hotspot/src/share/vm/utilities/vmError.cpp Thu Feb 13 11:28:17 2014 -0500 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2003, 2014, 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 -@@ -975,7 +975,6 @@ - if (fd != -1) { - out.print_raw("# An error report file with more information is saved as:\n# "); - out.print_raw_cr(buffer); -- os::set_error_file(buffer); - - log.set_fd(fd); - } else {
--- a/patches/hotspot/aarch64/20140715-8032536-jvm_resolves_wrong_method.patch Thu Oct 02 01:04:25 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -# HG changeset patch -# User hseigel -# Date 1393965993 18000 -# Tue Mar 04 15:46:33 2014 -0500 -# Node ID c02077c4b79c0e7a29f439a1e6eb753a6c314b00 -# Parent c28dffbb1d7489ba206e80a3be0a954a9df6277e -8032536: JVM resolves wrong method in some unusual cases -Summary: Handle package private case -Reviewed-by: coleenp, acorn, jdn - -diff -r c28dffbb1d74 -r c02077c4b79c src/share/vm/oops/klassVtable.cpp ---- openjdk/hotspot/src/share/vm/oops/klassVtable.cpp Wed Feb 26 22:07:40 2014 -0800 -+++ openjdk/hotspot/src/share/vm/oops/klassVtable.cpp Tue Mar 04 15:46:33 2014 -0500 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1997, 2014, 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 -@@ -249,6 +249,17 @@ - // For bytecodes not produced by javac together it is possible that a method does not override - // the superclass's method, but might indirectly override a super-super class's vtable entry - // If none found, return a null superk, else return the superk of the method this does override -+// For public and protected methods: if they override a superclass, they will -+// also be overridden themselves appropriately. -+// Private methods do not override and are not overridden. -+// Package Private methods are trickier: -+// e.g. P1.A, pub m -+// P2.B extends A, package private m -+// P1.C extends B, public m -+// P1.C.m needs to override P1.A.m and can not override P2.B.m -+// Therefore: all package private methods need their own vtable entries for -+// them to be the root of an inheritance overriding decision -+// Package private methods may also override other vtable entries - InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method, - int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) { - InstanceKlass* superk = initialsuper; -@@ -396,8 +407,11 @@ - target_classname, THREAD)) - != (InstanceKlass*)NULL)))) - { -- // overriding, so no new entry -- allocate_new = false; -+ // Package private methods always need a new entry to root their own -+ // overriding. They may also override other methods. -+ if (!target_method()->is_package_private()) { -+ allocate_new = false; -+ } - - if (checkconstraints) { - // Override vtable entry if passes loader constraint check -@@ -541,8 +555,9 @@ - AccessFlags class_flags, - TRAPS) { - if (class_flags.is_interface()) { -- // Interfaces do not use vtables, so there is no point to assigning -- // a vtable index to any of their methods. If we refrain from doing this, -+ // Interfaces do not use vtables, except for java.lang.Object methods, -+ // so there is no point to assigning -+ // a vtable index to any of their local methods. If we refrain from doing this, - // we can use Method::_vtable_index to hold the itable index - return false; - } -@@ -580,6 +595,12 @@ - return true; - } - -+ // Package private methods always need a new entry to root their own -+ // overriding. This allows transitive overriding to work. -+ if (target_method()->is_package_private()) { -+ return true; -+ } -+ - // search through the super class hierarchy to see if we need - // a new entry - ResourceMark rm;
--- a/patches/hotspot/aarch64/20140715-8035119-fix_exceptions_to_bytecode_verification.patch Thu Oct 02 01:04:25 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -# HG changeset patch -# User hseigel -# Date 1395065875 14400 -# Mon Mar 17 10:17:55 2014 -0400 -# Node ID aff11567504cdbf0d24cb23a97f9829af47a86f4 -# Parent cc7a96a360d08b926aea788ea6a5dd6dbd963f99 -8035119: Fix exceptions to bytecode verification -Summary: Prevent ctor calls to super() and this() from avoidable code (try blocks, if stmts, etc.) -Reviewed-by: coleenp, acorn, mschoene - -diff -r cc7a96a360d0 -r aff11567504c src/share/vm/classfile/stackMapTable.cpp ---- openjdk/hotspot/src/share/vm/classfile/stackMapTable.cpp Tue Mar 11 14:02:23 2014 -0700 -+++ openjdk/hotspot/src/share/vm/classfile/stackMapTable.cpp Mon Mar 17 10:17:55 2014 -0400 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2003, 2014, 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 -@@ -134,6 +134,7 @@ - } - // check if uninitialized objects exist on backward branches - check_new_object(frame, target, CHECK_VERIFY(frame->verifier())); -+ frame->verifier()->update_furthest_jump(target); - } - - void StackMapTable::check_new_object( -diff -r cc7a96a360d0 -r aff11567504c src/share/vm/classfile/verifier.cpp ---- openjdk/hotspot/src/share/vm/classfile/verifier.cpp Tue Mar 11 14:02:23 2014 -0700 -+++ openjdk/hotspot/src/share/vm/classfile/verifier.cpp Mon Mar 17 10:17:55 2014 -0400 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1998, 2014, 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 -@@ -632,6 +632,9 @@ - bool no_control_flow = false; // Set to true when there is no direct control - // flow from current instruction to the next - // instruction in sequence -+ -+ set_furthest_jump(0); -+ - Bytecodes::Code opcode; - while (!bcs.is_last_bytecode()) { - // Check for recursive re-verification before each bytecode. -@@ -2245,6 +2248,29 @@ - "Bad <init> method call"); - return; - } -+ -+ // Make sure that this call is not jumped over. -+ if (bci < furthest_jump()) { -+ verify_error(ErrorContext::bad_code(bci), -+ "Bad <init> method call from inside of a branch"); -+ return; -+ } -+ -+ // Make sure that this call is not done from within a TRY block because -+ // that can result in returning an incomplete object. Simply checking -+ // (bci >= start_pc) also ensures that this call is not done after a TRY -+ // block. That is also illegal because this call must be the first Java -+ // statement in the constructor. -+ ExceptionTable exhandlers(_method()); -+ int exlength = exhandlers.length(); -+ for(int i = 0; i < exlength; i++) { -+ if (bci >= exhandlers.start_pc(i)) { -+ verify_error(ErrorContext::bad_code(bci), -+ "Bad <init> method call from after the start of a try block"); -+ return; -+ } -+ } -+ - current_frame->initialize_object(type, current_type()); - *this_uninit = true; - } else if (type.is_uninitialized()) { -diff -r cc7a96a360d0 -r aff11567504c src/share/vm/classfile/verifier.hpp ---- openjdk/hotspot/src/share/vm/classfile/verifier.hpp Tue Mar 11 14:02:23 2014 -0700 -+++ openjdk/hotspot/src/share/vm/classfile/verifier.hpp Mon Mar 17 10:17:55 2014 -0400 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1998, 2014, 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 -@@ -258,6 +258,9 @@ - - ErrorContext _error_context; // contains information about an error - -+ // Used to detect illegal jumps over calls to super() nd this() in ctors. -+ int32_t _furthest_jump; -+ - void verify_method(methodHandle method, TRAPS); - char* generate_code_data(methodHandle m, u4 code_length, TRAPS); - void verify_exception_handler_table(u4 code_length, char* code_data, -@@ -403,6 +406,20 @@ - Symbol* create_temporary_symbol(const char *s, int length, TRAPS); - - TypeOrigin ref_ctx(const char* str, TRAPS); -+ -+ // Keep track of the furthest branch done in a method to make sure that -+ // there are no branches over calls to super() or this() from inside of -+ // a constructor. -+ int32_t furthest_jump() { return _furthest_jump; } -+ -+ void set_furthest_jump(int32_t target) { -+ _furthest_jump = target; -+ } -+ -+ void update_furthest_jump(int32_t target) { -+ if (target > _furthest_jump) _furthest_jump = target; -+ } -+ - }; - - inline int ClassVerifier::change_sig_to_verificationType(
--- a/patches/hotspot/aarch64/20140715-8036800-attribute_oom_to_right_code.patch Thu Oct 02 01:04:25 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -# HG changeset patch -# User hseigel -# Date 1395252171 14400 -# Wed Mar 19 14:02:51 2014 -0400 -# Node ID 5f7e12f5b4e5a40417a3579c01e233511058a76c -# Parent aff11567504cdbf0d24cb23a97f9829af47a86f4 -8036800: Attribute OOM to correct part of code -Summary: checks that the attribute_length does not exceed the length of remaining data in the class file -Reviewed-by: coleenp, ahgross - -diff -r aff11567504c -r 5f7e12f5b4e5 src/share/vm/classfile/classFileParser.cpp ---- openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Mar 17 10:17:55 2014 -0400 -+++ openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp Wed Mar 19 14:02:51 2014 -0400 -@@ -2770,18 +2770,19 @@ - ClassFileStream* cfs = stream(); - u1* current_start = cfs->current(); - -- cfs->guarantee_more(2, CHECK); // length -- int attribute_array_length = cfs->get_u2_fast(); -- -- guarantee_property(_max_bootstrap_specifier_index < attribute_array_length, -- "Short length on BootstrapMethods in class file %s", -- CHECK); -- - guarantee_property(attribute_byte_length > sizeof(u2), - "Invalid BootstrapMethods attribute length %u in class file %s", - attribute_byte_length, - CHECK); - -+ cfs->guarantee_more(attribute_byte_length, CHECK); -+ -+ int attribute_array_length = cfs->get_u2_fast(); -+ -+ guarantee_property(_max_bootstrap_specifier_index < attribute_array_length, -+ "Short length on BootstrapMethods in class file %s", -+ CHECK); -+ - // The attribute contains a counted array of counted tuples of shorts, - // represending bootstrap specifiers: - // length*{bootstrap_method_index, argument_count*{argument_index}}
--- a/patches/hotspot/aarch64/20140715-8037076-check_constant_pool_constants.patch Thu Oct 02 01:04:25 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -# HG changeset patch -# User coleenp -# Date 1395254743 14400 -# Wed Mar 19 14:45:43 2014 -0400 -# Node ID 0297e36d24a18dc9e7bc79740c2d7509ad1b6110 -# Parent 5f7e12f5b4e5a40417a3579c01e233511058a76c -8037076: Check constant pool constants -Summary: Fix events log string. -Reviewed-by: kvn, mschoene - -diff -r 5f7e12f5b4e5 -r 0297e36d24a1 src/share/vm/utilities/events.cpp ---- openjdk/hotspot/src/share/vm/utilities/events.cpp Wed Mar 19 14:02:51 2014 -0400 -+++ openjdk/hotspot/src/share/vm/utilities/events.cpp Wed Mar 19 14:45:43 2014 -0400 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1997, 2014, 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 -@@ -82,7 +82,7 @@ - va_start(ap, format); - // Save a copy of begin message and log it. - _buffer.printv(format, ap); -- Events::log(NULL, _buffer); -+ Events::log(NULL, "%s", (const char*)_buffer); - va_end(ap); - } - } -@@ -91,6 +91,6 @@ - if (LogEvents) { - // Append " done" to the begin message and log it - _buffer.append(" done"); -- Events::log(NULL, _buffer); -+ Events::log(NULL, "%s", (const char*)_buffer); - } - }
--- a/patches/hotspot/aarch64/20140715-8037157-verify_init_call.patch Thu Oct 02 01:04:25 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -# HG changeset patch -# User hseigel -# Date 1396877251 14400 -# Mon Apr 07 09:27:31 2014 -0400 -# Node ID b5ae226b7516460566347e45980e01b10a02b47d -# Parent 0037e964ce486c009984171f004259263628079f -8037157: Verify <init> call -Summary: Check for null method -Reviewed-by: coleenp, acorn, mschoene - -diff -r 0037e964ce48 -r b5ae226b7516 src/share/vm/classfile/verifier.cpp ---- openjdk/hotspot/src/share/vm/classfile/verifier.cpp Thu Apr 03 11:46:36 2014 -0700 -+++ openjdk/hotspot/src/share/vm/classfile/verifier.cpp Mon Apr 07 09:27:31 2014 -0400 -@@ -2307,6 +2307,11 @@ - Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method( - vmSymbols::object_initializer_name(), - cp->signature_ref_at(bcs->get_index_u2())); -+ if (m == NULL) { -+ verify_error(ErrorContext::bad_code(bci), -+ "Call to missing <init> method"); -+ return; -+ } - instanceKlassHandle mh(THREAD, m->method_holder()); - if (m->is_protected() && !mh->is_same_class_package(_klass())) { - bool assignable = current_type().is_assignable_from(
--- a/patches/hotspot/aarch64/20140715-8037167-better_method_signature_resolution.patch Thu Oct 02 01:04:25 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -# HG changeset patch -# User acorn -# Date 1395340600 25200 -# Thu Mar 20 11:36:40 2014 -0700 -# Node ID f0d759a6a2309a1c149d530b29db24eda885f267 -# Parent 2b2cc89121dbc0013dbbf338330ccb1c59dc8f13 -8037167: Better method signature resolution -Reviewed-by: mschoene, hseigel, lfoltan - -diff -r 2b2cc89121db -r f0d759a6a230 src/share/vm/classfile/classFileParser.cpp ---- openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp Thu Mar 20 10:06:22 2014 -0700 -+++ openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp Thu Mar 20 11:36:40 2014 -0700 -@@ -931,7 +931,7 @@ - "Wrong size %u for field's Signature attribute in class file %s", - attribute_length, CHECK); - } -- generic_signature_index = cfs->get_u2(CHECK); -+ generic_signature_index = parse_generic_signature_attribute(CHECK); - } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) { - runtime_visible_annotations_length = attribute_length; - runtime_visible_annotations = cfs->get_u1_buffer(); -@@ -2305,8 +2305,7 @@ - "Invalid Signature attribute length %u in class file %s", - method_attribute_length, CHECK_(nullHandle)); - } -- cfs->guarantee_more(2, CHECK_(nullHandle)); // generic_signature_index -- generic_signature_index = cfs->get_u2_fast(); -+ generic_signature_index = parse_generic_signature_attribute(CHECK_(nullHandle)); - } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) { - runtime_visible_annotations_length = method_attribute_length; - runtime_visible_annotations = cfs->get_u1_buffer(); -@@ -2616,6 +2615,17 @@ - return method_ordering; - } - -+// Parse generic_signature attribute for methods and fields -+u2 ClassFileParser::parse_generic_signature_attribute(TRAPS) { -+ ClassFileStream* cfs = stream(); -+ cfs->guarantee_more(2, CHECK_0); // generic_signature_index -+ u2 generic_signature_index = cfs->get_u2_fast(); -+ check_property( -+ valid_symbol_at(generic_signature_index), -+ "Invalid Signature attribute at constant pool index %u in class file %s", -+ generic_signature_index, CHECK_0); -+ return generic_signature_index; -+} - - void ClassFileParser::parse_classfile_sourcefile_attribute(TRAPS) { - ClassFileStream* cfs = stream(); -diff -r 2b2cc89121db -r f0d759a6a230 src/share/vm/classfile/classFileParser.hpp ---- openjdk/hotspot/src/share/vm/classfile/classFileParser.hpp Thu Mar 20 10:06:22 2014 -0700 -+++ openjdk/hotspot/src/share/vm/classfile/classFileParser.hpp Thu Mar 20 11:36:40 2014 -0700 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 1997, 2014, 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 -@@ -266,6 +266,7 @@ - u1* parse_stackmap_table(u4 code_attribute_length, TRAPS); - - // Classfile attribute parsing -+ u2 parse_generic_signature_attribute(TRAPS); - void parse_classfile_sourcefile_attribute(TRAPS); - void parse_classfile_source_debug_extension_attribute(int length, TRAPS); - u2 parse_classfile_inner_classes_attribute(u1* inner_classes_attribute_start,
--- a/patches/hotspot/aarch64/20140715-8043454-8037157_test_case_fix.patch Thu Oct 02 01:04:25 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -# HG changeset patch -# User hseigel -# Date 1401278966 14400 -# Wed May 28 08:09:26 2014 -0400 -# Node ID e6b7384074325d5a4ede728d6928ecb7f1cc1326 -# Parent eb984acb23fe8243620a2c1e8a935ad936221dba -8043454: Test case for 8037157 should not throw a VerifyError -Summary: Don't throw VerifyError if method is NULL. -Reviewed-by: acorn, lfoltan, mschoene - -diff -r eb984acb23fe -r e6b738407432 src/share/vm/classfile/verifier.cpp ---- openjdk/hotspot/src/share/vm/classfile/verifier.cpp Mon Jun 02 08:21:50 2014 -0700 -+++ openjdk/hotspot/src/share/vm/classfile/verifier.cpp Wed May 28 08:09:26 2014 -0400 -@@ -2307,21 +2307,19 @@ - Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method( - vmSymbols::object_initializer_name(), - cp->signature_ref_at(bcs->get_index_u2())); -- if (m == NULL) { -- verify_error(ErrorContext::bad_code(bci), -- "Call to missing <init> method"); -- return; -- } -- instanceKlassHandle mh(THREAD, m->method_holder()); -- if (m->is_protected() && !mh->is_same_class_package(_klass())) { -- bool assignable = current_type().is_assignable_from( -- objectref_type, this, CHECK_VERIFY(this)); -- if (!assignable) { -- verify_error(ErrorContext::bad_type(bci, -- TypeOrigin::cp(new_class_index, objectref_type), -- TypeOrigin::implicit(current_type())), -- "Bad access to protected <init> method"); -- return; -+ // Do nothing if method is not found. Let resolution detect the error. -+ if (m != NULL) { -+ instanceKlassHandle mh(THREAD, m->method_holder()); -+ if (m->is_protected() && !mh->is_same_class_package(_klass())) { -+ bool assignable = current_type().is_assignable_from( -+ objectref_type, this, CHECK_VERIFY(this)); -+ if (!assignable) { -+ verify_error(ErrorContext::bad_type(bci, -+ TypeOrigin::cp(new_class_index, objectref_type), -+ TypeOrigin::implicit(current_type())), -+ "Bad access to protected <init> method"); -+ return; -+ } - } - } - }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8015256-better_class_accessibility.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,209 @@ +# HG changeset patch +# User coleenp +# Date 1399583989 14400 +# Thu May 08 17:19:49 2014 -0400 +# Node ID 671021ba6f79fadfb510be047b23dcdabe35160d +# Parent 9580ebccfdc392c93c79633bdc207139de511438 +8015256: Better class accessibility +Summary: Improve protection domain check in forName() +Reviewed-by: mchung, acorn, jdn + +diff -r 9580ebccfdc3 -r 671021ba6f79 make/bsd/makefiles/mapfile-vers-debug +--- openjdk/hotspot/make/bsd/makefiles/mapfile-vers-debug Thu Sep 11 07:28:58 2014 -0400 ++++ openjdk/hotspot/make/bsd/makefiles/mapfile-vers-debug Thu May 08 17:19:49 2014 -0400 +@@ -1,5 +1,5 @@ + # +-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2002, 2014, 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 +@@ -82,6 +82,7 @@ + _JVM_EnableCompiler + _JVM_Exit + _JVM_FillInStackTrace ++ _JVM_FindClassFromCaller + _JVM_FindClassFromClass + _JVM_FindClassFromClassLoader + _JVM_FindClassFromBootLoader +diff -r 9580ebccfdc3 -r 671021ba6f79 make/bsd/makefiles/mapfile-vers-product +--- openjdk/hotspot/make/bsd/makefiles/mapfile-vers-product Thu Sep 11 07:28:58 2014 -0400 ++++ openjdk/hotspot/make/bsd/makefiles/mapfile-vers-product Thu May 08 17:19:49 2014 -0400 +@@ -1,5 +1,5 @@ + # +-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2002, 2014, 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 +@@ -82,6 +82,7 @@ + _JVM_EnableCompiler + _JVM_Exit + _JVM_FillInStackTrace ++ _JVM_FindClassFromCaller + _JVM_FindClassFromClass + _JVM_FindClassFromClassLoader + _JVM_FindClassFromBootLoader +diff -r 9580ebccfdc3 -r 671021ba6f79 make/linux/makefiles/mapfile-vers-debug +--- openjdk/hotspot/make/linux/makefiles/mapfile-vers-debug Thu Sep 11 07:28:58 2014 -0400 ++++ openjdk/hotspot/make/linux/makefiles/mapfile-vers-debug Thu May 08 17:19:49 2014 -0400 +@@ -1,5 +1,5 @@ + # +-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2002, 2014, 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 +@@ -84,6 +84,7 @@ + JVM_EnableCompiler; + JVM_Exit; + JVM_FillInStackTrace; ++ JVM_FindClassFromCaller; + JVM_FindClassFromClass; + JVM_FindClassFromClassLoader; + JVM_FindClassFromBootLoader; +diff -r 9580ebccfdc3 -r 671021ba6f79 make/linux/makefiles/mapfile-vers-product +--- openjdk/hotspot/make/linux/makefiles/mapfile-vers-product Thu Sep 11 07:28:58 2014 -0400 ++++ openjdk/hotspot/make/linux/makefiles/mapfile-vers-product Thu May 08 17:19:49 2014 -0400 +@@ -1,5 +1,5 @@ + # +-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2002, 2014, 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 +@@ -84,6 +84,7 @@ + JVM_EnableCompiler; + JVM_Exit; + JVM_FillInStackTrace; ++ JVM_FindClassFromCaller; + JVM_FindClassFromClass; + JVM_FindClassFromClassLoader; + JVM_FindClassFromBootLoader; +diff -r 9580ebccfdc3 -r 671021ba6f79 make/solaris/makefiles/mapfile-vers +--- openjdk/hotspot/make/solaris/makefiles/mapfile-vers Thu Sep 11 07:28:58 2014 -0400 ++++ openjdk/hotspot/make/solaris/makefiles/mapfile-vers Thu May 08 17:19:49 2014 -0400 +@@ -1,5 +1,5 @@ + # +-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. ++# Copyright (c) 2000, 2014, 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 +@@ -84,6 +84,7 @@ + JVM_EnableCompiler; + JVM_Exit; + JVM_FillInStackTrace; ++ JVM_FindClassFromCaller; + JVM_FindClassFromClass; + JVM_FindClassFromClassLoader; + JVM_FindClassFromBootLoader; +diff -r 9580ebccfdc3 -r 671021ba6f79 src/share/vm/prims/jvm.cpp +--- openjdk/hotspot/src/share/vm/prims/jvm.cpp Thu Sep 11 07:28:58 2014 -0400 ++++ openjdk/hotspot/src/share/vm/prims/jvm.cpp Thu May 08 17:19:49 2014 -0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2014, 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 +@@ -777,6 +777,7 @@ + return (jclass) JNIHandles::make_local(env, k->java_mirror()); + JVM_END + ++// Not used; JVM_FindClassFromCaller replaces this. + JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name, + jboolean init, jobject loader, + jboolean throwError)) +@@ -803,6 +804,42 @@ + return result; + JVM_END + ++// Find a class with this name in this loader, using the caller's protection domain. ++JVM_ENTRY(jclass, JVM_FindClassFromCaller(JNIEnv* env, const char* name, ++ jboolean init, jobject loader, ++ jclass caller)) ++ JVMWrapper2("JVM_FindClassFromCaller %s throws ClassNotFoundException", name); ++ // Java libraries should ensure that name is never null... ++ if (name == NULL || (int)strlen(name) > Symbol::max_length()) { ++ // It's impossible to create this class; the name cannot fit ++ // into the constant pool. ++ THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); ++ } ++ ++ TempNewSymbol h_name = SymbolTable::new_symbol(name, CHECK_NULL); ++ ++ oop loader_oop = JNIHandles::resolve(loader); ++ oop from_class = JNIHandles::resolve(caller); ++ oop protection_domain = NULL; ++ // If loader is null, shouldn't call ClassLoader.checkPackageAccess; otherwise get ++ // NPE. Put it in another way, the bootstrap class loader has all permission and ++ // thus no checkPackageAccess equivalence in the VM class loader. ++ // The caller is also passed as NULL by the java code if there is no security ++ // manager to avoid the performance cost of getting the calling class. ++ if (from_class != NULL && loader_oop != NULL) { ++ protection_domain = java_lang_Class::as_Klass(from_class)->protection_domain(); ++ } ++ ++ Handle h_loader(THREAD, loader_oop); ++ Handle h_prot(THREAD, protection_domain); ++ jclass result = find_class_from_class_loader(env, h_name, init, h_loader, ++ h_prot, false, THREAD); ++ ++ if (TraceClassResolution && result != NULL) { ++ trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result))); ++ } ++ return result; ++JVM_END + + JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name, + jboolean init, jclass from)) +@@ -3966,10 +4003,15 @@ + + // Shared JNI/JVM entry points ////////////////////////////////////////////////////////////// + +-jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Handle loader, Handle protection_domain, jboolean throwError, TRAPS) { ++jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, ++ Handle loader, Handle protection_domain, ++ jboolean throwError, TRAPS) { + // Security Note: + // The Java level wrapper will perform the necessary security check allowing +- // us to pass the NULL as the initiating class loader. ++ // us to pass the NULL as the initiating class loader. The VM is responsible for ++ // the checkPackageAccess relative to the initiating class loader via the ++ // protection_domain. The protection_domain is passed as NULL by the java code ++ // if there is no security manager in 3-arg Class.forName(). + Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL); + + KlassHandle klass_handle(THREAD, klass); +diff -r 9580ebccfdc3 -r 671021ba6f79 src/share/vm/prims/jvm.h +--- openjdk/hotspot/src/share/vm/prims/jvm.h Thu Sep 11 07:28:58 2014 -0400 ++++ openjdk/hotspot/src/share/vm/prims/jvm.h Thu May 08 17:19:49 2014 -0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2014, 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 +@@ -417,6 +417,19 @@ + JVM_FindClassFromBootLoader(JNIEnv *env, const char *name); + + /* ++ * Find a class from a given class loader. Throws ClassNotFoundException. ++ * name: name of class ++ * init: whether initialization is done ++ * loader: class loader to look up the class. This may not be the same as the caller's ++ * class loader. ++ * caller: initiating class. The initiating class may be null when a security ++ * manager is not installed. ++ */ ++JNIEXPORT jclass JNICALL ++JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init, ++ jobject loader, jclass caller); ++ ++/* + * Find a class from a given class. + */ + JNIEXPORT jclass JNICALL
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8036533-method_for_correct_defaults.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,291 @@ +# HG changeset patch +# User hseigel +# Date 1412453060 -3600 +# Sat Oct 04 21:04:20 2014 +0100 +# Node ID f26d56905af0d3d8584d7ebc1e77c0515742286c +# Parent 671021ba6f79fadfb510be047b23dcdabe35160d +8036533: Method for correct defaults +8036156: Limit default method hierarchy +Summary: Fix protected access checks +Reviewed-by: coleenp, lfoltan, acorn, ahgross + +diff -r 671021ba6f79 -r f26d56905af0 src/share/vm/classfile/stackMapFrame.cpp +--- openjdk/hotspot/src/share/vm/classfile/stackMapFrame.cpp Thu May 08 17:19:49 2014 -0400 ++++ openjdk/hotspot/src/share/vm/classfile/stackMapFrame.cpp Sat Oct 04 21:04:20 2014 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2014, 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 +@@ -163,7 +163,7 @@ + VerificationType* from, VerificationType* to, int32_t len, TRAPS) const { + int32_t i = 0; + for (i = 0; i < len; i++) { +- if (!to[i].is_assignable_from(from[i], verifier(), THREAD)) { ++ if (!to[i].is_assignable_from(from[i], verifier(), false, THREAD)) { + break; + } + } +@@ -260,7 +260,7 @@ + } + VerificationType top = _stack[--_stack_size]; + bool subtype = type.is_assignable_from( +- top, verifier(), CHECK_(VerificationType::bogus_type())); ++ top, verifier(), false, CHECK_(VerificationType::bogus_type())); + if (!subtype) { + verifier()->verify_error( + ErrorContext::bad_type(_offset, stack_top_ctx(), +@@ -280,7 +280,7 @@ + return VerificationType::bogus_type(); + } + bool subtype = type.is_assignable_from(_locals[index], +- verifier(), CHECK_(VerificationType::bogus_type())); ++ verifier(), false, CHECK_(VerificationType::bogus_type())); + if (!subtype) { + verifier()->verify_error( + ErrorContext::bad_type(_offset, +@@ -303,14 +303,14 @@ + "get long/double overflows locals"); + return; + } +- bool subtype = type1.is_assignable_from(_locals[index], verifier(), CHECK); ++ bool subtype = type1.is_assignable_from(_locals[index], verifier(), false, CHECK); + if (!subtype) { + verifier()->verify_error( + ErrorContext::bad_type(_offset, + TypeOrigin::local(index, this), TypeOrigin::implicit(type1)), + "Bad local variable type"); + } else { +- subtype = type2.is_assignable_from(_locals[index + 1], verifier(), CHECK); ++ subtype = type2.is_assignable_from(_locals[index + 1], verifier(), false, CHECK); + if (!subtype) { + /* Unreachable? All local store routines convert a split long or double + * into a TOP during the store. So we should never end up seeing an +diff -r 671021ba6f79 -r f26d56905af0 src/share/vm/classfile/stackMapFrame.hpp +--- openjdk/hotspot/src/share/vm/classfile/stackMapFrame.hpp Thu May 08 17:19:49 2014 -0400 ++++ openjdk/hotspot/src/share/vm/classfile/stackMapFrame.hpp Sat Oct 04 21:04:20 2014 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2014, 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 +@@ -238,7 +238,7 @@ + if (_stack_size != 0) { + VerificationType top = _stack[_stack_size - 1]; + bool subtype = type.is_assignable_from( +- top, verifier(), CHECK_(VerificationType::bogus_type())); ++ top, verifier(), false, CHECK_(VerificationType::bogus_type())); + if (subtype) { + --_stack_size; + return top; +@@ -253,9 +253,9 @@ + assert(type2.is_long() || type2.is_double(), "must be long/double_2"); + if (_stack_size >= 2) { + VerificationType top1 = _stack[_stack_size - 1]; +- bool subtype1 = type1.is_assignable_from(top1, verifier(), CHECK); ++ bool subtype1 = type1.is_assignable_from(top1, verifier(), false, CHECK); + VerificationType top2 = _stack[_stack_size - 2]; +- bool subtype2 = type2.is_assignable_from(top2, verifier(), CHECK); ++ bool subtype2 = type2.is_assignable_from(top2, verifier(), false, CHECK); + if (subtype1 && subtype2) { + _stack_size -= 2; + return; +diff -r 671021ba6f79 -r f26d56905af0 src/share/vm/classfile/verificationType.cpp +--- openjdk/hotspot/src/share/vm/classfile/verificationType.cpp Thu May 08 17:19:49 2014 -0400 ++++ openjdk/hotspot/src/share/vm/classfile/verificationType.cpp Sat Oct 04 21:04:20 2014 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2014, 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 +@@ -42,7 +42,8 @@ + } + + bool VerificationType::is_reference_assignable_from( +- const VerificationType& from, ClassVerifier* context, TRAPS) const { ++ const VerificationType& from, ClassVerifier* context, ++ bool from_field_is_protected, TRAPS) const { + instanceKlassHandle klass = context->current_class(); + if (from.is_null()) { + // null is assignable to any reference +@@ -62,9 +63,11 @@ + Handle(THREAD, klass->protection_domain()), true, CHECK_false); + KlassHandle this_class(THREAD, obj); + +- if (this_class->is_interface()) { +- // We treat interfaces as java.lang.Object, including +- // java.lang.Cloneable and java.io.Serializable ++ if (this_class->is_interface() && (!from_field_is_protected || ++ from.name() != vmSymbols::java_lang_Object())) { ++ // If we are not trying to access a protected field or method in ++ // java.lang.Object then we treat interfaces as java.lang.Object, ++ // including java.lang.Cloneable and java.io.Serializable. + return true; + } else if (from.is_object()) { + Klass* from_class = SystemDictionary::resolve_or_fail( +@@ -76,7 +79,8 @@ + VerificationType comp_this = get_component(context, CHECK_false); + VerificationType comp_from = from.get_component(context, CHECK_false); + if (!comp_this.is_bogus() && !comp_from.is_bogus()) { +- return comp_this.is_assignable_from(comp_from, context, CHECK_false); ++ return comp_this.is_assignable_from(comp_from, context, ++ from_field_is_protected, CHECK_false); + } + } + return false; +diff -r 671021ba6f79 -r f26d56905af0 src/share/vm/classfile/verificationType.hpp +--- openjdk/hotspot/src/share/vm/classfile/verificationType.hpp Thu May 08 17:19:49 2014 -0400 ++++ openjdk/hotspot/src/share/vm/classfile/verificationType.hpp Sat Oct 04 21:04:20 2014 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2014, 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 +@@ -265,7 +265,8 @@ + // is assignable to another. Returns true if one can assign 'from' to + // this. + bool is_assignable_from( +- const VerificationType& from, ClassVerifier* context, TRAPS) const { ++ const VerificationType& from, ClassVerifier* context, ++ bool from_field_is_protected, TRAPS) const { + if (equals(from) || is_bogus()) { + return true; + } else { +@@ -286,7 +287,9 @@ + return from.is_integer(); + default: + if (is_reference() && from.is_reference()) { +- return is_reference_assignable_from(from, context, CHECK_false); ++ return is_reference_assignable_from(from, context, ++ from_field_is_protected, ++ CHECK_false); + } else { + return false; + } +@@ -308,7 +311,8 @@ + private: + + bool is_reference_assignable_from( +- const VerificationType&, ClassVerifier*, TRAPS) const; ++ const VerificationType&, ClassVerifier*, bool from_field_is_protected, ++ TRAPS) const; + }; + + #endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP +diff -r 671021ba6f79 -r f26d56905af0 src/share/vm/classfile/verifier.cpp +--- openjdk/hotspot/src/share/vm/classfile/verifier.cpp Thu May 08 17:19:49 2014 -0400 ++++ openjdk/hotspot/src/share/vm/classfile/verifier.cpp Sat Oct 04 21:04:20 2014 +0100 +@@ -1736,7 +1736,7 @@ + VerificationType throwable = + VerificationType::reference_type(vmSymbols::java_lang_Throwable()); + bool is_subclass = throwable.is_assignable_from( +- catch_type, this, CHECK_VERIFY(this)); ++ catch_type, this, false, CHECK_VERIFY(this)); + if (!is_subclass) { + // 4286534: should throw VerifyError according to recent spec change + verify_error(ErrorContext::bad_type(handler_pc, +@@ -2191,7 +2191,7 @@ + stack_object_type = current_type(); + } + is_assignable = target_class_type.is_assignable_from( +- stack_object_type, this, CHECK_VERIFY(this)); ++ stack_object_type, this, false, CHECK_VERIFY(this)); + if (!is_assignable) { + verify_error(ErrorContext::bad_type(bci, + current_frame->stack_top_ctx(), +@@ -2218,7 +2218,7 @@ + // It's protected access, check if stack object is assignable to + // current class. + is_assignable = current_type().is_assignable_from( +- stack_object_type, this, CHECK_VERIFY(this)); ++ stack_object_type, this, true, CHECK_VERIFY(this)); + if (!is_assignable) { + verify_error(ErrorContext::bad_type(bci, + current_frame->stack_top_ctx(), +@@ -2315,7 +2315,7 @@ + instanceKlassHandle mh(THREAD, m->method_holder()); + if (m->is_protected() && !mh->is_same_class_package(_klass())) { + bool assignable = current_type().is_assignable_from( +- objectref_type, this, CHECK_VERIFY(this)); ++ objectref_type, this, true, CHECK_VERIFY(this)); + if (!assignable) { + verify_error(ErrorContext::bad_type(bci, + TypeOrigin::cp(new_class_index, objectref_type), +@@ -2489,11 +2489,11 @@ + bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref; + if (!current_class()->is_anonymous()) { + subtype = ref_class_type.is_assignable_from( +- current_type(), this, CHECK_VERIFY(this)); ++ current_type(), this, false, CHECK_VERIFY(this)); + } else { + VerificationType host_klass_type = + VerificationType::reference_type(current_class()->host_klass()->name()); +- subtype = ref_class_type.is_assignable_from(host_klass_type, this, CHECK_VERIFY(this)); ++ subtype = ref_class_type.is_assignable_from(host_klass_type, this, false, CHECK_VERIFY(this)); + + // If invokespecial of IMR, need to recheck for same or + // direct interface relative to the host class +@@ -2537,7 +2537,7 @@ + VerificationType top = current_frame->pop_stack(CHECK_VERIFY(this)); + VerificationType hosttype = + VerificationType::reference_type(current_class()->host_klass()->name()); +- bool subtype = hosttype.is_assignable_from(top, this, CHECK_VERIFY(this)); ++ bool subtype = hosttype.is_assignable_from(top, this, false, CHECK_VERIFY(this)); + if (!subtype) { + verify_error( ErrorContext::bad_type(current_frame->offset(), + current_frame->stack_top_ctx(), +@@ -2562,7 +2562,7 @@ + // It's protected access, check if stack object is + // assignable to current class. + bool is_assignable = current_type().is_assignable_from( +- stack_object_type, this, CHECK_VERIFY(this)); ++ stack_object_type, this, true, CHECK_VERIFY(this)); + if (!is_assignable) { + if (ref_class_type.name() == vmSymbols::java_lang_Object() + && stack_object_type.is_array() +@@ -2745,7 +2745,7 @@ + "Method expects a return value"); + return; + } +- bool match = return_type.is_assignable_from(type, this, CHECK_VERIFY(this)); ++ bool match = return_type.is_assignable_from(type, this, false, CHECK_VERIFY(this)); + if (!match) { + verify_error(ErrorContext::bad_type(bci, + current_frame->stack_top_ctx(), TypeOrigin::signature(return_type)), +diff -r 671021ba6f79 -r f26d56905af0 src/share/vm/runtime/reflection.cpp +--- openjdk/hotspot/src/share/vm/runtime/reflection.cpp Thu May 08 17:19:49 2014 -0400 ++++ openjdk/hotspot/src/share/vm/runtime/reflection.cpp Sat Oct 04 21:04:20 2014 +0100 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2014, 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 +@@ -484,7 +484,7 @@ + ik = InstanceKlass::cast(hc); + + // There's no way to make a host class loop short of patching memory. +- // Therefore there cannot be a loop here unles there's another bug. ++ // Therefore there cannot be a loop here unless there's another bug. + // Still, let's check for it. + assert(--inf_loop_check > 0, "no host_klass loop"); + } +@@ -553,7 +553,8 @@ + if (access.is_protected()) { + if (!protected_restriction) { + // See if current_class (or outermost host class) is a subclass of field_class +- if (host_class->is_subclass_of(field_class)) { ++ // An interface may not access protected members of j.l.Object ++ if (!host_class->is_interface() && host_class->is_subclass_of(field_class)) { + if (access.is_static() || // static fields are ok, see 6622385 + current_class == resolved_class || + field_class == resolved_class ||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8036805-correct_linker_method_lookup.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,221 @@ +# HG changeset patch +# User lfoltan +# Date 1397593040 14400 +# Tue Apr 15 16:17:20 2014 -0400 +# Node ID 088ea5eccf62f21f75b311f49102c1d27bc577f9 +# Parent f26d56905af0d3d8584d7ebc1e77c0515742286c +8036805: Correct linker method lookup. +Summary: Correct handling of array of primitive type qualifiers during field and method resolution. +Reviewed-by: acorn, hseigel, ahgross + +diff -r f26d56905af0 -r 088ea5eccf62 src/share/vm/interpreter/linkResolver.cpp +--- openjdk/hotspot/src/share/vm/interpreter/linkResolver.cpp Sat Oct 04 21:04:20 2014 +0100 ++++ openjdk/hotspot/src/share/vm/interpreter/linkResolver.cpp Tue Apr 15 16:17:20 2014 -0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2014, 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 +@@ -245,6 +245,12 @@ + void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, bool checkpolymorphism, bool in_imethod_resolve, TRAPS) { + Method* result_oop = klass->uncached_lookup_method(name, signature); + ++ if (klass->oop_is_array()) { ++ // Only consider klass and super klass for arrays ++ result = methodHandle(THREAD, result_oop); ++ return; ++ } ++ + // JDK 8, JVMS 5.4.3.4: Interface method resolution should + // ignore static and non-public methods of java.lang.Object, + // like clone, finalize, registerNatives. +@@ -283,6 +289,11 @@ + result = methodHandle(THREAD, super_klass->uncached_lookup_method(name, signature)); + } + ++ if (klass->oop_is_array()) { ++ // Only consider klass and super klass for arrays ++ return; ++ } ++ + if (result.is_null()) { + Array<Method*>* default_methods = InstanceKlass::cast(klass())->default_methods(); + if (default_methods != NULL) { +@@ -539,7 +550,7 @@ + // 2. lookup method in resolved klass and its super klasses + lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, true, false, CHECK); + +- if (resolved_method.is_null()) { // not found in the class hierarchy ++ if (resolved_method.is_null() && !resolved_klass->oop_is_array()) { // not found in the class hierarchy + // 3. lookup method in all the interfaces implemented by the resolved klass + lookup_method_in_interfaces(resolved_method, resolved_klass, method_name, method_signature, CHECK); + +@@ -552,16 +563,16 @@ + CLEAR_PENDING_EXCEPTION; + } + } ++ } + +- if (resolved_method.is_null()) { +- // 4. method lookup failed +- ResourceMark rm(THREAD); +- THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(), +- Method::name_and_sig_as_C_string(resolved_klass(), +- method_name, +- method_signature), +- nested_exception); +- } ++ if (resolved_method.is_null()) { ++ // 4. method lookup failed ++ ResourceMark rm(THREAD); ++ THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(), ++ Method::name_and_sig_as_C_string(resolved_klass(), ++ method_name, ++ method_signature), ++ nested_exception); + } + + // 5. check if method is concrete +@@ -636,17 +647,18 @@ + // JDK8: also look for static methods + lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, false, true, CHECK); + +- if (resolved_method.is_null()) { ++ if (resolved_method.is_null() && !resolved_klass->oop_is_array()) { + // lookup method in all the super-interfaces + lookup_method_in_interfaces(resolved_method, resolved_klass, method_name, method_signature, CHECK); +- if (resolved_method.is_null()) { +- // no method found +- ResourceMark rm(THREAD); +- THROW_MSG(vmSymbols::java_lang_NoSuchMethodError(), +- Method::name_and_sig_as_C_string(resolved_klass(), +- method_name, +- method_signature)); +- } ++ } ++ ++ if (resolved_method.is_null()) { ++ // no method found ++ ResourceMark rm(THREAD); ++ THROW_MSG(vmSymbols::java_lang_NoSuchMethodError(), ++ Method::name_and_sig_as_C_string(resolved_klass(), ++ method_name, ++ method_signature)); + } + + if (nostatics && resolved_method->is_static()) { +@@ -779,7 +791,7 @@ + } + + // Resolve instance field +- KlassHandle sel_klass(THREAD, InstanceKlass::cast(resolved_klass())->find_field(field, sig, &fd)); ++ KlassHandle sel_klass(THREAD, resolved_klass->find_field(field, sig, &fd)); + // check if field exists; i.e., if a klass containing the field def has been selected + if (sel_klass.is_null()) { + ResourceMark rm(THREAD); +diff -r f26d56905af0 -r 088ea5eccf62 src/share/vm/oops/arrayKlass.cpp +--- openjdk/hotspot/src/share/vm/oops/arrayKlass.cpp Sat Oct 04 21:04:20 2014 +0100 ++++ openjdk/hotspot/src/share/vm/oops/arrayKlass.cpp Tue Apr 15 16:17:20 2014 -0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2014, 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 +@@ -64,6 +64,13 @@ + return NULL; + } + ++// find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined ++Klass* ArrayKlass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { ++ // There are no fields in an array klass but look to the super class (Object) ++ assert(super(), "super klass must be present"); ++ return super()->find_field(name, sig, fd); ++} ++ + Method* ArrayKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const { + // There are no methods in an array klass but the super class (Object) has some + assert(super(), "super klass must be present"); +diff -r f26d56905af0 -r 088ea5eccf62 src/share/vm/oops/arrayKlass.hpp +--- openjdk/hotspot/src/share/vm/oops/arrayKlass.hpp Sat Oct 04 21:04:20 2014 +0100 ++++ openjdk/hotspot/src/share/vm/oops/arrayKlass.hpp Tue Apr 15 16:17:20 2014 -0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2014, 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 +@@ -28,6 +28,7 @@ + #include "memory/universe.hpp" + #include "oops/klass.hpp" + ++class fieldDescriptor; + class klassVtable; + + // ArrayKlass is the abstract baseclass for all array classes +@@ -85,6 +86,9 @@ + virtual oop multi_allocate(int rank, jint* sizes, TRAPS); + objArrayOop allocate_arrayArray(int n, int length, TRAPS); + ++ // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined ++ Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const; ++ + // Lookup operations + Method* uncached_lookup_method(Symbol* name, Symbol* signature) const; + +diff -r f26d56905af0 -r 088ea5eccf62 src/share/vm/oops/klass.cpp +--- openjdk/hotspot/src/share/vm/oops/klass.cpp Sat Oct 04 21:04:20 2014 +0100 ++++ openjdk/hotspot/src/share/vm/oops/klass.cpp Tue Apr 15 16:17:20 2014 -0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2014, 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 +@@ -128,6 +128,15 @@ + return is_subclass_of(k); + } + ++Klass* Klass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { ++#ifdef ASSERT ++ tty->print_cr("Error: find_field called on a klass oop." ++ " Likely error: reflection method does not correctly" ++ " wrap return value in a mirror object."); ++#endif ++ ShouldNotReachHere(); ++ return NULL; ++} + + Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature) const { + #ifdef ASSERT +diff -r f26d56905af0 -r 088ea5eccf62 src/share/vm/oops/klass.hpp +--- openjdk/hotspot/src/share/vm/oops/klass.hpp Sat Oct 04 21:04:20 2014 +0100 ++++ openjdk/hotspot/src/share/vm/oops/klass.hpp Tue Apr 15 16:17:20 2014 -0400 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 1997, 2014, 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 +@@ -91,6 +91,7 @@ + class klassVtable; + class ParCompactionManager; + class KlassSizeStats; ++class fieldDescriptor; + + class Klass : public Metadata { + friend class VMStructs; +@@ -421,6 +422,7 @@ + virtual void initialize(TRAPS); + // lookup operation for MethodLookupCache + friend class MethodLookupCache; ++ virtual Klass* find_field(Symbol* name, Symbol* signature, fieldDescriptor* fd) const; + virtual Method* uncached_lookup_method(Symbol* name, Symbol* signature) const; + public: + Method* lookup_method(Symbol* name, Symbol* signature) const {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8038898-safer_safepoints.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,21 @@ +# HG changeset patch +# User twisti +# Date 1398112591 36000 +# Mon Apr 21 10:36:31 2014 -1000 +# Node ID 77e62c1876767e336b1b47c62e45b9db39808a72 +# Parent 088ea5eccf62f21f75b311f49102c1d27bc577f9 +8038898: Safer safepoints +Reviewed-by: kvn, ahgross + +diff -r 088ea5eccf62 -r 77e62c187676 src/share/vm/runtime/arguments.cpp +--- openjdk/hotspot/src/share/vm/runtime/arguments.cpp Tue Apr 15 16:17:20 2014 -0400 ++++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp Mon Apr 21 10:36:31 2014 -1000 +@@ -2342,6 +2342,8 @@ + status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction"); + status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity"); + ++ status &= verify_interval(SafepointPollOffset, 0, os::vm_page_size() - BytesPerWord, "SafepointPollOffset"); ++ + return status; + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8038903-more_native_monitor_monitoring.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,30 @@ +# HG changeset patch +# User zgu +# Date 1402928626 14400 +# Mon Jun 16 10:23:46 2014 -0400 +# Node ID e6b2c9c464d11d2b54d61c693d447f3cb8670663 +# Parent 77e62c1876767e336b1b47c62e45b9db39808a72 +8038903: More native monitor monitoring +Summary: Moved ntive monitor monitoring flags to experimental +Reviewed-by: acorn, hseigel, mschoene + +diff -r 77e62c187676 -r e6b2c9c464d1 src/share/vm/runtime/globals.hpp +--- openjdk/hotspot/src/share/vm/runtime/globals.hpp Mon Apr 21 10:36:31 2014 -1000 ++++ openjdk/hotspot/src/share/vm/runtime/globals.hpp Mon Jun 16 10:23:46 2014 -0400 +@@ -1147,11 +1147,11 @@ + "Prevent spurious or premature wakeups from object.wait " \ + "(Solaris only)") \ + \ +- product(intx, NativeMonitorTimeout, -1, "(Unstable)") \ +- \ +- product(intx, NativeMonitorFlags, 0, "(Unstable)") \ +- \ +- product(intx, NativeMonitorSpinLimit, 20, "(Unstable)") \ ++ experimental(intx, NativeMonitorTimeout, -1, "(Unstable)") \ ++ \ ++ experimental(intx, NativeMonitorFlags, 0, "(Unstable)") \ ++ \ ++ experimental(intx, NativeMonitorSpinLimit, 20, "(Unstable)") \ + \ + develop(bool, UsePthreads, false, \ + "Use pthread-based instead of libthread-based synchronization " \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8041717-issue_with_class_file_parser.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,33 @@ +# HG changeset patch +# User hseigel +# Date 1401471163 14400 +# Fri May 30 13:32:43 2014 -0400 +# Node ID 9664162a7109691191835f5d625daba3ce5f78a5 +# Parent e6b2c9c464d11d2b54d61c693d447f3cb8670663 +8041717: Issue with class file parser +Summary: Add better checking for bad values. +Reviewed-by: coleenp, lfoltan, mschoene + +diff -r e6b2c9c464d1 -r 9664162a7109 src/share/vm/classfile/classFileParser.cpp +--- openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Jun 16 10:23:46 2014 -0400 ++++ openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp Fri May 30 13:32:43 2014 -0400 +@@ -2826,6 +2826,11 @@ + "bootstrap_method_index %u has bad constant type in class file %s", + bootstrap_method_index, + CHECK); ++ ++ guarantee_property((operand_fill_index + 1 + argument_count) < operands->length(), ++ "Invalid BootstrapMethods num_bootstrap_methods or num_bootstrap_arguments value in class file %s", ++ CHECK); ++ + operands->at_put(operand_fill_index++, bootstrap_method_index); + operands->at_put(operand_fill_index++, argument_count); + +@@ -2843,7 +2848,6 @@ + } + + assert(operand_fill_index == operands->length(), "exact fill"); +- assert(ConstantPool::operand_array_length(operands) == attribute_array_length, "correct decode"); + + u1* current_end = cfs->current(); + guarantee_property(current_end == current_start + attribute_byte_length,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8042603-safepointpolloffset.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,22 @@ +# HG changeset patch +# User twisti +# Date 1400640658 25200 +# Tue May 20 19:50:58 2014 -0700 +# Node ID cb9aea9e6eb75c7f1ca7b2dd477b48d481261fa7 +# Parent 9664162a7109691191835f5d625daba3ce5f78a5 +8042603: 'SafepointPollOffset' was not declared in static member function 'static bool Arguments::check_vm_args_consistency()' +Reviewed-by: kvn + +diff -r 9664162a7109 -r cb9aea9e6eb7 src/share/vm/runtime/arguments.cpp +--- openjdk/hotspot/src/share/vm/runtime/arguments.cpp Fri May 30 13:32:43 2014 -0400 ++++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp Tue May 20 19:50:58 2014 -0700 +@@ -2342,7 +2342,9 @@ + status &= verify_interval(NmethodSweepFraction, 1, ReservedCodeCacheSize/K, "NmethodSweepFraction"); + status &= verify_interval(NmethodSweepActivity, 0, 2000, "NmethodSweepActivity"); + ++#ifdef COMPILER1 + status &= verify_interval(SafepointPollOffset, 0, os::vm_page_size() - BytesPerWord, "SafepointPollOffset"); ++#endif + + return status; + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8044269-analysis_of_archive_files.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,250 @@ +# HG changeset patch +# User jiangli +# Date 1407879976 14400 +# Tue Aug 12 17:46:16 2014 -0400 +# Node ID f3c772c55002ccb7313952d067261951322be263 +# Parent cb9aea9e6eb75c7f1ca7b2dd477b48d481261fa7 +8044269: Analysis of archive files. +Summary: Add checksum verification. +Reviewed-by: iklam, dholmes, mschoene + +diff -r cb9aea9e6eb7 -r f3c772c55002 src/share/vm/classfile/classLoader.cpp +--- openjdk/hotspot/src/share/vm/classfile/classLoader.cpp Tue May 20 19:50:58 2014 -0700 ++++ openjdk/hotspot/src/share/vm/classfile/classLoader.cpp Tue Aug 12 17:46:16 2014 -0400 +@@ -81,6 +81,7 @@ + typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf); + typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf); + typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n); ++typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len); + + static ZipOpen_t ZipOpen = NULL; + static ZipClose_t ZipClose = NULL; +@@ -89,6 +90,7 @@ + static ReadMappedEntry_t ReadMappedEntry = NULL; + static GetNextEntry_t GetNextEntry = NULL; + static canonicalize_fn_t CanonicalizeEntry = NULL; ++static Crc32_t Crc32 = NULL; + + // Globals + +@@ -629,9 +631,11 @@ + ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry")); + ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry")); + GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry")); ++ Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32")); + + // ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL +- if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL || GetNextEntry == NULL) { ++ if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL || ++ GetNextEntry == NULL || Crc32 == NULL) { + vm_exit_during_initialization("Corrupted ZIP library", path); + } + +@@ -641,6 +645,11 @@ + // This lookup only works on 1.3. Do not check for non-null here + } + ++int ClassLoader::crc32(int crc, const char* buf, int len) { ++ assert(Crc32 != NULL, "ZIP_CRC32 is not found"); ++ return (*Crc32)(crc, (const jbyte*)buf, len); ++} ++ + // PackageInfo data exists in order to support the java.lang.Package + // class. A Package object provides information about a java package + // (version, vendor, etc.) which originates in the manifest of the jar +diff -r cb9aea9e6eb7 -r f3c772c55002 src/share/vm/classfile/classLoader.hpp +--- openjdk/hotspot/src/share/vm/classfile/classLoader.hpp Tue May 20 19:50:58 2014 -0700 ++++ openjdk/hotspot/src/share/vm/classfile/classLoader.hpp Tue Aug 12 17:46:16 2014 -0400 +@@ -215,6 +215,7 @@ + // to avoid confusing the zip library + static bool get_canonical_path(char* orig, char* out, int len); + public: ++ static int crc32(int crc, const char* buf, int len); + // Used by the kernel jvm. + static void update_class_path_entry_list(char *path, + bool check_for_duplicates); +diff -r cb9aea9e6eb7 -r f3c772c55002 src/share/vm/memory/filemap.cpp +--- openjdk/hotspot/src/share/vm/memory/filemap.cpp Tue May 20 19:50:58 2014 -0700 ++++ openjdk/hotspot/src/share/vm/memory/filemap.cpp Tue Aug 12 17:46:16 2014 -0400 +@@ -176,7 +176,14 @@ + fail_continue("The shared archive file has the wrong version."); + return false; + } +- _file_offset = (long)n; ++ size_t len = lseek(fd, 0, SEEK_END); ++ struct FileMapInfo::FileMapHeader::space_info* si = ++ &_header._space[MetaspaceShared::mc]; ++ if (si->_file_offset >= len || len - si->_file_offset < si->_used) { ++ fail_continue("The shared archive file has been truncated."); ++ return false; ++ } ++ _file_offset = n; + return true; + } + +@@ -267,6 +274,7 @@ + si->_capacity = capacity; + si->_read_only = read_only; + si->_allow_exec = allow_exec; ++ si->_crc = ClassLoader::crc32(0, base, (jint)size); + write_bytes_aligned(base, (int)size); + } + +@@ -291,14 +299,15 @@ + // Align file position to an allocation unit boundary. + + void FileMapInfo::align_file_position() { +- long new_file_offset = align_size_up(_file_offset, os::vm_allocation_granularity()); ++ size_t new_file_offset = align_size_up(_file_offset, ++ os::vm_allocation_granularity()); + if (new_file_offset != _file_offset) { + _file_offset = new_file_offset; + if (_file_open) { + // Seek one byte back from the target and write a byte to insure + // that the written file is the correct length. + _file_offset -= 1; +- if (lseek(_fd, _file_offset, SEEK_SET) < 0) { ++ if (lseek(_fd, (long)_file_offset, SEEK_SET) < 0) { + fail_stop("Unable to seek.", NULL); + } + char zero = 0; +@@ -405,6 +414,19 @@ + return base; + } + ++bool FileMapInfo::verify_region_checksum(int i) { ++ if (!VerifySharedSpaces) { ++ return true; ++ } ++ const char* buf = _header._space[i]._base; ++ size_t sz = _header._space[i]._used; ++ int crc = ClassLoader::crc32(0, buf, (jint)sz); ++ if (crc != _header._space[i]._crc) { ++ fail_continue("Checksum verification failed."); ++ return false; ++ } ++ return true; ++} + + // Unmap a memory region in the address space. + +@@ -456,8 +478,20 @@ + return true; + } + ++int FileMapInfo::compute_header_crc() { ++ char* header = (char*)&_header; ++ // start computing from the field after _crc ++ char* buf = (char*)&_header._crc + sizeof(int); ++ size_t sz = sizeof(FileMapInfo::FileMapHeader) - (buf - header); ++ int crc = ClassLoader::crc32(0, buf, (jint)sz); ++ return crc; ++} + + bool FileMapInfo::validate() { ++ if (VerifySharedSpaces && compute_header_crc() != _header._crc) { ++ fail_continue("Header checksum verification failed."); ++ return false; ++ } + if (_header._version != current_version()) { + fail_continue("The shared archive file is the wrong version."); + return false; +diff -r cb9aea9e6eb7 -r f3c772c55002 src/share/vm/memory/filemap.hpp +--- openjdk/hotspot/src/share/vm/memory/filemap.hpp Tue May 20 19:50:58 2014 -0700 ++++ openjdk/hotspot/src/share/vm/memory/filemap.hpp Tue Aug 12 17:46:16 2014 -0400 +@@ -54,7 +54,7 @@ + + bool _file_open; + int _fd; +- long _file_offset; ++ size_t _file_offset; + + // FileMapHeader describes the shared space data in the file to be + // mapped. This structure gets written to a file. It is not a class, so +@@ -62,12 +62,14 @@ + + struct FileMapHeader { + int _magic; // identify file type. ++ int _crc; // header crc checksum. + int _version; // (from enum, above.) + size_t _alignment; // how shared archive should be aligned + int _obj_alignment; // value of ObjectAlignmentInBytes + + struct space_info { +- int _file_offset; // sizeof(this) rounded to vm page size ++ int _crc; // crc checksum of the current space ++ size_t _file_offset; // sizeof(this) rounded to vm page size + char* _base; // copy-on-write base address + size_t _capacity; // for validity checking + size_t _used; // for setting space top on read +@@ -104,6 +106,8 @@ + } + + static int current_version() { return _current_version; } ++ int compute_header_crc(); ++ void set_header_crc(int crc) { _header._crc = crc; } + void populate_header(size_t alignment); + bool validate(); + void invalidate(); +@@ -136,6 +140,7 @@ + void write_bytes_aligned(const void* buffer, int count); + char* map_region(int i); + void unmap_region(int i); ++ bool verify_region_checksum(int i); + void close(); + bool is_open() { return _file_open; } + ReservedSpace reserve_shared_memory(); +diff -r cb9aea9e6eb7 -r f3c772c55002 src/share/vm/memory/metaspaceShared.cpp +--- openjdk/hotspot/src/share/vm/memory/metaspaceShared.cpp Tue May 20 19:50:58 2014 -0700 ++++ openjdk/hotspot/src/share/vm/memory/metaspaceShared.cpp Tue Aug 12 17:46:16 2014 -0400 +@@ -581,6 +581,7 @@ + + // Pass 2 - write data. + mapinfo->open_for_write(); ++ mapinfo->set_header_crc(mapinfo->compute_header_crc()); + mapinfo->write_header(); + mapinfo->write_space(MetaspaceShared::ro, _loader_data->ro_metaspace(), true); + mapinfo->write_space(MetaspaceShared::rw, _loader_data->rw_metaspace(), false); +@@ -861,9 +862,13 @@ + + // Map each shared region + if ((_ro_base = mapinfo->map_region(ro)) != NULL && ++ mapinfo->verify_region_checksum(ro) && + (_rw_base = mapinfo->map_region(rw)) != NULL && ++ mapinfo->verify_region_checksum(rw) && + (_md_base = mapinfo->map_region(md)) != NULL && ++ mapinfo->verify_region_checksum(md) && + (_mc_base = mapinfo->map_region(mc)) != NULL && ++ mapinfo->verify_region_checksum(mc) && + (image_alignment == (size_t)max_alignment())) { + // Success (no need to do anything) + return true; +diff -r cb9aea9e6eb7 -r f3c772c55002 src/share/vm/runtime/arguments.cpp +--- openjdk/hotspot/src/share/vm/runtime/arguments.cpp Tue May 20 19:50:58 2014 -0700 ++++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp Tue Aug 12 17:46:16 2014 -0400 +@@ -3536,6 +3536,11 @@ + return JNI_ENOMEM; + } + ++ // Set up VerifySharedSpaces ++ if (FLAG_IS_DEFAULT(VerifySharedSpaces) && SharedArchiveFile != NULL) { ++ VerifySharedSpaces = true; ++ } ++ + // Delay warning until here so that we've had a chance to process + // the -XX:-PrintWarnings flag + if (needs_hotspotrc_warning) { +diff -r cb9aea9e6eb7 -r f3c772c55002 src/share/vm/runtime/globals.hpp +--- openjdk/hotspot/src/share/vm/runtime/globals.hpp Tue May 20 19:50:58 2014 -0700 ++++ openjdk/hotspot/src/share/vm/runtime/globals.hpp Tue Aug 12 17:46:16 2014 -0400 +@@ -3721,6 +3721,10 @@ + product(bool, UseSharedSpaces, true, \ + "Use shared spaces for metadata") \ + \ ++ product(bool, VerifySharedSpaces, false, \ ++ "Verify shared spaces (false for default archive, true for " \ ++ "archive specified by -XX:SharedArchiveFile)") \ ++ \ + product(bool, RequireSharedSpaces, false, \ + "Require shared spaces for metadata") \ + \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8046213-testemptybootstrapmethodsattr_failure.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,24 @@ +# HG changeset patch +# User asaha +# Date 1402377672 25200 +# Mon Jun 09 22:21:12 2014 -0700 +# Node ID 6358e85321420be7d53b7cb4ac45ff9ea0390c6f +# Parent f3c772c55002ccb7313952d067261951322be263 +8046213: Test test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java Fails +Reviewed-by: lfoltan + +diff -r f3c772c55002 -r 6358e8532142 src/share/vm/classfile/classFileParser.cpp +--- openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp Tue Aug 12 17:46:16 2014 -0400 ++++ openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Jun 09 22:21:12 2014 -0700 +@@ -2780,11 +2780,6 @@ + ClassFileStream* cfs = stream(); + u1* current_start = cfs->current(); + +- guarantee_property(attribute_byte_length > sizeof(u2), +- "Invalid BootstrapMethods attribute length %u in class file %s", +- attribute_byte_length, +- CHECK); +- + cfs->guarantee_more(attribute_byte_length, CHECK); + + int attribute_array_length = cfs->get_u2_fast();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20141014-8050485-super_causes_verifyerror.patch Tue Oct 14 22:11:50 2014 +0100 @@ -0,0 +1,259 @@ +# HG changeset patch +# User hseigel +# Date 1407889765 14400 +# Tue Aug 12 20:29:25 2014 -0400 +# Node ID fa7db0bbeac1cb2751167ff9134c48aceced1cda +# Parent 6358e85321420be7d53b7cb4ac45ff9ea0390c6f +8050485: super() in a try block in a ctor causes VerifyError +Summary: Parse catch clause paths to ensure they end in throws +Reviewed-by: dlong, acorn, kamg, ctornqvi, lfoltan + +diff -r 6358e8532142 -r fa7db0bbeac1 src/share/vm/classfile/verifier.cpp +--- openjdk/hotspot/src/share/vm/classfile/verifier.cpp Mon Jun 09 22:21:12 2014 -0700 ++++ openjdk/hotspot/src/share/vm/classfile/verifier.cpp Tue Aug 12 20:29:25 2014 -0400 +@@ -2233,6 +2233,181 @@ + } + } + ++// Look at the method's handlers. If the bci is in the handler's try block ++// then check if the handler_pc is already on the stack. If not, push it. ++void ClassVerifier::push_handlers(ExceptionTable* exhandlers, ++ GrowableArray<u4>* handler_stack, ++ u4 bci) { ++ int exlength = exhandlers->length(); ++ for(int x = 0; x < exlength; x++) { ++ if (bci >= exhandlers->start_pc(x) && bci < exhandlers->end_pc(x)) { ++ handler_stack->append_if_missing(exhandlers->handler_pc(x)); ++ } ++ } ++} ++ ++// Return TRUE if all code paths starting with start_bc_offset end in ++// bytecode athrow or loop. ++bool ClassVerifier::ends_in_athrow(u4 start_bc_offset) { ++ ResourceMark rm; ++ // Create bytecode stream. ++ RawBytecodeStream bcs(method()); ++ u4 code_length = method()->code_size(); ++ bcs.set_start(start_bc_offset); ++ u4 target; ++ // Create stack for storing bytecode start offsets for if* and *switch. ++ GrowableArray<u4>* bci_stack = new GrowableArray<u4>(30); ++ // Create stack for handlers for try blocks containing this handler. ++ GrowableArray<u4>* handler_stack = new GrowableArray<u4>(30); ++ // Create list of visited branch opcodes (goto* and if*). ++ GrowableArray<u4>* visited_branches = new GrowableArray<u4>(30); ++ ExceptionTable exhandlers(_method()); ++ ++ while (true) { ++ if (bcs.is_last_bytecode()) { ++ // if no more starting offsets to parse or if at the end of the ++ // method then return false. ++ if ((bci_stack->is_empty()) || ((u4)bcs.end_bci() == code_length)) ++ return false; ++ // Pop a bytecode starting offset and scan from there. ++ bcs.set_start(bci_stack->pop()); ++ } ++ Bytecodes::Code opcode = bcs.raw_next(); ++ u4 bci = bcs.bci(); ++ ++ // If the bytecode is in a TRY block, push its handlers so they ++ // will get parsed. ++ push_handlers(&exhandlers, handler_stack, bci); ++ ++ switch (opcode) { ++ case Bytecodes::_if_icmpeq: ++ case Bytecodes::_if_icmpne: ++ case Bytecodes::_if_icmplt: ++ case Bytecodes::_if_icmpge: ++ case Bytecodes::_if_icmpgt: ++ case Bytecodes::_if_icmple: ++ case Bytecodes::_ifeq: ++ case Bytecodes::_ifne: ++ case Bytecodes::_iflt: ++ case Bytecodes::_ifge: ++ case Bytecodes::_ifgt: ++ case Bytecodes::_ifle: ++ case Bytecodes::_if_acmpeq: ++ case Bytecodes::_if_acmpne: ++ case Bytecodes::_ifnull: ++ case Bytecodes::_ifnonnull: ++ target = bcs.dest(); ++ if (visited_branches->contains(bci)) { ++ if (bci_stack->is_empty()) return true; ++ // Pop a bytecode starting offset and scan from there. ++ bcs.set_start(bci_stack->pop()); ++ } else { ++ if (target > bci) { // forward branch ++ if (target >= code_length) return false; ++ // Push the branch target onto the stack. ++ bci_stack->push(target); ++ // then, scan bytecodes starting with next. ++ bcs.set_start(bcs.next_bci()); ++ } else { // backward branch ++ // Push bytecode offset following backward branch onto the stack. ++ bci_stack->push(bcs.next_bci()); ++ // Check bytecodes starting with branch target. ++ bcs.set_start(target); ++ } ++ // Record target so we don't branch here again. ++ visited_branches->append(bci); ++ } ++ break; ++ ++ case Bytecodes::_goto: ++ case Bytecodes::_goto_w: ++ target = (opcode == Bytecodes::_goto ? bcs.dest() : bcs.dest_w()); ++ if (visited_branches->contains(bci)) { ++ if (bci_stack->is_empty()) return true; ++ // Been here before, pop new starting offset from stack. ++ bcs.set_start(bci_stack->pop()); ++ } else { ++ if (target >= code_length) return false; ++ // Continue scanning from the target onward. ++ bcs.set_start(target); ++ // Record target so we don't branch here again. ++ visited_branches->append(bci); ++ } ++ break; ++ ++ // Check that all switch alternatives end in 'athrow' bytecodes. Since it ++ // is difficult to determine where each switch alternative ends, parse ++ // each switch alternative until either hit a 'return', 'athrow', or reach ++ // the end of the method's bytecodes. This is gross but should be okay ++ // because: ++ // 1. tableswitch and lookupswitch byte codes in handlers for ctor explicit ++ // constructor invocations should be rare. ++ // 2. if each switch alternative ends in an athrow then the parsing should be ++ // short. If there is no athrow then it is bogus code, anyway. ++ case Bytecodes::_lookupswitch: ++ case Bytecodes::_tableswitch: ++ { ++ address aligned_bcp = (address) round_to((intptr_t)(bcs.bcp() + 1), jintSize); ++ u4 default_offset = Bytes::get_Java_u4(aligned_bcp) + bci; ++ int keys, delta; ++ if (opcode == Bytecodes::_tableswitch) { ++ jint low = (jint)Bytes::get_Java_u4(aligned_bcp + jintSize); ++ jint high = (jint)Bytes::get_Java_u4(aligned_bcp + 2*jintSize); ++ // This is invalid, but let the regular bytecode verifier ++ // report this because the user will get a better error message. ++ if (low > high) return true; ++ keys = high - low + 1; ++ delta = 1; ++ } else { ++ keys = (int)Bytes::get_Java_u4(aligned_bcp + jintSize); ++ delta = 2; ++ } ++ // Invalid, let the regular bytecode verifier deal with it. ++ if (keys < 0) return true; ++ ++ // Push the offset of the next bytecode onto the stack. ++ bci_stack->push(bcs.next_bci()); ++ ++ // Push the switch alternatives onto the stack. ++ for (int i = 0; i < keys; i++) { ++ u4 target = bci + (jint)Bytes::get_Java_u4(aligned_bcp+(3+i*delta)*jintSize); ++ if (target > code_length) return false; ++ bci_stack->push(target); ++ } ++ ++ // Start bytecode parsing for the switch at the default alternative. ++ if (default_offset > code_length) return false; ++ bcs.set_start(default_offset); ++ break; ++ } ++ ++ case Bytecodes::_return: ++ return false; ++ ++ case Bytecodes::_athrow: ++ { ++ if (bci_stack->is_empty()) { ++ if (handler_stack->is_empty()) { ++ return true; ++ } else { ++ // Parse the catch handlers for try blocks containing athrow. ++ bcs.set_start(handler_stack->pop()); ++ } ++ } else { ++ // Pop a bytecode offset and starting scanning from there. ++ bcs.set_start(bci_stack->pop()); ++ } ++ } ++ break; ++ ++ default: ++ ; ++ } // end switch ++ } // end while loop ++ ++ return false; ++} ++ + void ClassVerifier::verify_invoke_init( + RawBytecodeStream* bcs, u2 ref_class_index, VerificationType ref_class_type, + StackMapFrame* current_frame, u4 code_length, bool *this_uninit, +@@ -2259,18 +2434,26 @@ + return; + } + +- // Make sure that this call is not done from within a TRY block because +- // that can result in returning an incomplete object. Simply checking +- // (bci >= start_pc) also ensures that this call is not done after a TRY +- // block. That is also illegal because this call must be the first Java +- // statement in the constructor. ++ // Check if this call is done from inside of a TRY block. If so, make ++ // sure that all catch clause paths end in a throw. Otherwise, this ++ // can result in returning an incomplete object. + ExceptionTable exhandlers(_method()); + int exlength = exhandlers.length(); + for(int i = 0; i < exlength; i++) { +- if (bci >= exhandlers.start_pc(i)) { +- verify_error(ErrorContext::bad_code(bci), +- "Bad <init> method call from after the start of a try block"); +- return; ++ u2 start_pc = exhandlers.start_pc(i); ++ u2 end_pc = exhandlers.end_pc(i); ++ ++ if (bci >= start_pc && bci < end_pc) { ++ if (!ends_in_athrow(exhandlers.handler_pc(i))) { ++ verify_error(ErrorContext::bad_code(bci), ++ "Bad <init> method call from after the start of a try block"); ++ return; ++ } else if (VerboseVerification) { ++ ResourceMark rm; ++ tty->print_cr( ++ "Survived call to ends_in_athrow(): %s", ++ current_class()->name()->as_C_string()); ++ } + } + } + +diff -r 6358e8532142 -r fa7db0bbeac1 src/share/vm/classfile/verifier.hpp +--- openjdk/hotspot/src/share/vm/classfile/verifier.hpp Mon Jun 09 22:21:12 2014 -0700 ++++ openjdk/hotspot/src/share/vm/classfile/verifier.hpp Tue Aug 12 20:29:25 2014 -0400 +@@ -30,6 +30,7 @@ + #include "oops/klass.hpp" + #include "oops/method.hpp" + #include "runtime/handles.hpp" ++#include "utilities/growableArray.hpp" + #include "utilities/exceptions.hpp" + + // The verifier class +@@ -306,6 +307,16 @@ + StackMapFrame* current_frame, u4 code_length, bool* this_uninit, + constantPoolHandle cp, TRAPS); + ++ // Used by ends_in_athrow() to push all handlers that contain bci onto ++ // the handler_stack, if the handler is not already on the stack. ++ void push_handlers(ExceptionTable* exhandlers, ++ GrowableArray<u4>* handler_stack, ++ u4 bci); ++ ++ // Returns true if all paths starting with start_bc_offset end in athrow ++ // bytecode or loop. ++ bool ends_in_athrow(u4 start_bc_offset); ++ + void verify_invoke_instructions( + RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame, + bool* this_uninit, VerificationType return_type,