changeset 54284:a2897fb258f1

8221175: Fix bad function case for controlled JVM crash on PPC64 big-endian Reviewed-by: chrisphi, stuefe, goetz
author gromero
date Wed, 20 Mar 2019 16:43:49 -0400
parents e61065c08924
children 33f0b34c9dd7
files src/hotspot/share/utilities/vmError.cpp
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/utilities/vmError.cpp	Wed Mar 20 16:59:35 2019 -0400
+++ b/src/hotspot/share/utilities/vmError.cpp	Wed Mar 20 16:43:49 2019 -0400
@@ -1725,7 +1725,16 @@
   const char* const eol = os::line_separator();
   const char* const msg = "this message should be truncated during formatting";
   char * const dataPtr = NULL;  // bad data pointer
-  const void (*funcPtr)(void) = (const void(*)()) 0xF;  // bad function pointer
+  const void (*funcPtr)(void);  // bad function pointer
+
+#if defined(PPC64) && !defined(ABI_ELFv2)
+  struct FunctionDescriptor functionDescriptor;
+
+  functionDescriptor.set_entry((address) 0xF);
+  funcPtr = (const void(*)()) &functionDescriptor;
+#else
+  funcPtr = (const void(*)()) 0xF;
+#endif
 
   // Keep this in sync with test/hotspot/jtreg/runtime/ErrorHandling/ErrorHandler.java
   // which tests cases 1 thru 13.