Mercurial > hg > release > icedtea7-2.5
changeset 2737:960cf7b88b42
Update AArch64 port and add July 2014 security patches.
Common frame handling for C1/C2 which correctly handle all frame sizes
Fix register misuse in verify_method_data_pointer
Fix register usage in generate_verify_oop().
Restrict default ReservedCodeCacheSize to 128M
Use explicit barrier instructions in C1.
2014-07-16 Andrew John Hughes <gnu.andrew@member.fsf.org>
* patches/hotspot/aarch64/20140415-8029858-enhance_array_copies.patch,
* patches/hotspot/aarch64/20140415-8034926-attribute_classes_properly.patch:
Removed, as applied upstream.
* Makefile.am:
(ICEDTEA_PATCHES): Updated.
* NEWS: Likewise.
* hotspot.map: Bump aarch64 port to latest tip.
* 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:
July 2014 security patches for AArch64 HotSpot.
author | Andrew John Hughes <gnu_andrew@member.fsf.org> |
---|---|
date | Wed, 16 Jul 2014 08:02:42 +0100 |
parents | 4e0d6d141661 |
children | 93624ef7b10e |
files | ChangeLog Makefile.am NEWS hotspot.map patches/hotspot/aarch64/20140415-8029858-enhance_array_copies.patch patches/hotspot/aarch64/20140415-8034926-attribute_classes_properly.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-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 |
diffstat | 14 files changed, 681 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jul 16 00:52:19 2014 +0100 +++ b/ChangeLog Wed Jul 16 08:02:42 2014 +0100 @@ -1,3 +1,22 @@ +2014-07-16 Andrew John Hughes <gnu.andrew@member.fsf.org> + + * patches/hotspot/aarch64/20140415-8029858-enhance_array_copies.patch, + * patches/hotspot/aarch64/20140415-8034926-attribute_classes_properly.patch: + Removed, as applied upstream. + * Makefile.am: + (ICEDTEA_PATCHES): Updated. + * NEWS: Likewise. + * hotspot.map: Bump aarch64 port to latest tip. + * 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: + July 2014 security patches for AArch64 HotSpot. + 2014-07-15 Andrew John Hughes <gnu.andrew@member.fsf.org> * Makefile.am:
--- a/Makefile.am Wed Jul 16 00:52:19 2014 +0100 +++ b/Makefile.am Wed Jul 16 08:02:42 2014 +0100 @@ -279,8 +279,14 @@ if WITH_ALT_HSBUILD ICEDTEA_PATCHES += patches/hotspot/aarch64/werror.patch \ - patches/hotspot/aarch64/20140415-8029858-enhance_array_copies.patch \ - patches/hotspot/aarch64/20140415-8034926-attribute_classes_properly.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 if ENABLE_SYSTEMTAP ICEDTEA_PATCHES += \ patches/hotspot/aarch64/systemtap_gc.patch
--- a/NEWS Wed Jul 16 00:52:19 2014 +0100 +++ b/NEWS Wed Jul 16 08:02:42 2014 +0100 @@ -77,6 +77,12 @@ - PR1853: Revert PR729 from minor release - PR1864: PCSC + OpenJDK 1.7 crash on Fedora 20 - PR1868: Avoid x86 workaround when running Zero rather than a JIT +* AArch64 port + - Common frame handling for C1/C2 which correctly handle all frame sizes + - Fix register misuse in verify_method_data_pointer + - Fix register usage in generate_verify_oop(). + - Restrict default ReservedCodeCacheSize to 128M + - Use explicit barrier instructions in C1. New in release 2.5.0 (2014-06-13):
--- a/hotspot.map Wed Jul 16 00:52:19 2014 +0100 +++ b/hotspot.map Wed Jul 16 08:02:42 2014 +0100 @@ -1,3 +1,3 @@ # version type(drop/hg) url changeset sha256sum -default drop http://icedtea.classpath.org/download/drops/icedtea7/2.5 02066294d005 78d57f7c207d8f56bba2ee6aec232a836fd51830d352cfa4804d8077d9a7b32b -aarch64 drop http://icedtea.classpath.org/download/drops/aarch64/2.5 d17532dbc6a7 3ad1f3116d30fb937719c6c462e070d689170dcf99173f785a9b13db074e1938 +default drop http://icedtea.classpath.org/download/drops/icedtea7/2.5.1 02066294d005 78d57f7c207d8f56bba2ee6aec232a836fd51830d352cfa4804d8077d9a7b32b +aarch64 drop http://icedtea.classpath.org/download/drops/aarch64/2.5.1 a03843f2ff15 e88ca1ef9eeafa9bac7f0e5277a927129288547f241f0ed1e53969c6888177f2
--- a/patches/hotspot/aarch64/20140415-8029858-enhance_array_copies.patch Wed Jul 16 00:52:19 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -# HG changeset patch -# User dsimms -# Date 1389348912 -3600 -# Fri Jan 10 11:15:12 2014 +0100 -# Node ID b478fbd631095afe8c37e3582c467d3ef64c7ba5 -# Parent 212a8089da498a233d4279e4b50235c271090f71 -8029858: Enhance array copies -Summary: Just read the source element once -Reviewed-by: coleenp, ahgross - -diff --git a/src/share/vm/oops/objArrayKlass.cpp b/src/share/vm/oops/objArrayKlass.cpp ---- openjdk/hotspot/src/share/vm/oops/objArrayKlass.cpp -+++ openjdk/hotspot/src/share/vm/oops/objArrayKlass.cpp -@@ -269,7 +269,7 @@ - if (element_is_null || - (new_val->klass())->is_subtype_of(bound)) { - bs->write_ref_field_pre(p, new_val); -- *p = *from; -+ *p = element; - } else { - // We must do a barrier to cover the partial copy. - const size_t pd = pointer_delta(p, dst, (size_t)heapOopSize);
--- a/patches/hotspot/aarch64/20140415-8034926-attribute_classes_properly.patch Wed Jul 16 00:52:19 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -# HG changeset patch -# User hseigel -# Date 1392921059 18000 -# Thu Feb 20 13:30:59 2014 -0500 -# Node ID 9b289963cb9a14636fbe8faaa2dd6d3678464a7b -# Parent c96a3381e55ebacff49901b98c2ee87e17cb0632 -8034926: Attribute classes properly -Summary: Add check to prevent underflow -Reviewed-by: coleenp, ahgross - -diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp ---- openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp -+++ openjdk/hotspot/src/share/vm/classfile/classFileParser.cpp -@@ -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 -@@ -2777,6 +2777,11 @@ - "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); -+ - // The attribute contains a counted array of counted tuples of shorts, - // represending bootstrap specifiers: - // length*{bootstrap_method_index, argument_count*{argument_index}}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20140715-8030763-validate_global_memory_allocation.patch Wed Jul 16 08:02:42 2014 +0100 @@ -0,0 +1,233 @@ +# 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 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20140715-8032536-jvm_resolves_wrong_method.patch Wed Jul 16 08:02:42 2014 +0100 @@ -0,0 +1,77 @@ +# 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;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20140715-8035119-fix_exceptions_to_bytecode_verification.patch Wed Jul 16 08:02:42 2014 +0100 @@ -0,0 +1,119 @@ +# 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(
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20140715-8036800-attribute_oom_to_right_code.patch Wed Jul 16 08:02:42 2014 +0100 @@ -0,0 +1,40 @@ +# 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}}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20140715-8037076-check_constant_pool_constants.patch Wed Jul 16 08:02:42 2014 +0100 @@ -0,0 +1,37 @@ +# 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); + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20140715-8037157-verify_init_call.patch Wed Jul 16 08:02:42 2014 +0100 @@ -0,0 +1,25 @@ +# 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(
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20140715-8037167-better_method_signature_resolution.patch Wed Jul 16 08:02:42 2014 +0100 @@ -0,0 +1,67 @@ +# 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,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/hotspot/aarch64/20140715-8043454-8037157_test_case_fix.patch Wed Jul 16 08:02:42 2014 +0100 @@ -0,0 +1,48 @@ +# 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; ++ } + } + } + }