view patches/hotspot/aarch64/20140715-8030763-validate_global_memory_allocation.patch @ 2739:bbcd7fc7d5c3

Bump aarch64 port to latest tip and add security patches. AArch64 C2 instruct for smull Add a constructor as a conversion from Register - RegSet. Use it. Add RegSet::operator+=. Add support for a few simple intrinsics Add support for builtin crc32 instructions Add support for CRC32 intrinsic Add support for Neon implementation of CRC32 All address constants are 48 bits in size. C1: Fix offset overflow when profiling. Common frame handling for C1/C2 which correctly handle all frame sizes Correct costs for operations with shifts. Correct OptoAssembly for prologs and epilogs. Delete useless instruction. Don't use any form of _call_VM_leaf when we're calling a stub. Fast string comparison Fast String.equals() Fix a tonne of bogus comments. Fix biased locking and enable as default Fix instruction size from 8 to 4 Fix opto assembly for shifts. Fix register misuse in verify_method_data_pointer Fix register usage in generate_verify_oop(). Implement various locked memory operations. Improve C1 performance improvements in ic_cache checks Improve code generation for pop(), as suggested by Edward Nevill. Improvements to safepoint polling Make code entry alignment 64 for C2 Minor optimisation for divide by 2 New cost model for instruction selection. Offsets in lookupswitch instructions should be signed. Optimise addressing of card table byte map base Optimise C2 entry point verification Optimise long divide by 2 Performance improvement and ease of use changes pulled from upstream Preserve callee save FP registers around call to java code Remove obsolete C1 patching code. Remove special-case handling of division arguments. AArch64 doesn't need it. Remove unnecessary memory barriers around CAS operations Restore sp from sender sp, r13 in crc32 code Restrict default ReservedCodeCacheSize to 128M Rewrite CAS operations to be more conservative Save intermediate state before removing C1 patching code. Tidy up register usage in push/pop instructions. Tidy up stack frame handling. Use 2- and 3-instruction immediate form of movoop and mov_metadata in C2-generated code. Use an explicit set of registers rather than a bitmap for psh and pop operations. Use explicit barrier instructions in C1. Use gcc __clear_cache instead of doing it ourselves 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, 23 Jul 2014 03:20:14 +0100
parents
children
line wrap: on
line source

# 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 {