Blame SOURCES/rh1566890-CVE_2018_3639-speculative_store_bypass.patch

03c558
diff --git openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp openjdk/hotspot/src/os/linux/vm/os_linux.cpp
03c558
--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp
03c558
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
03c558
@@ -103,6 +103,8 @@
03c558
 # include <inttypes.h>
03c558
 # include <sys/ioctl.h>
03c558
 
03c558
+#include <sys/prctl.h>
03c558
+
03c558
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
03c558
 
03c558
 #ifndef _GNU_SOURCE
03c558
@@ -4997,6 +4999,31 @@
03c558
   }
03c558
 }
03c558
 
03c558
+/* Per task speculation control */
03c558
+#ifndef PR_GET_SPECULATION_CTRL
03c558
+#define PR_GET_SPECULATION_CTRL    52
03c558
+#endif
03c558
+#ifndef PR_SET_SPECULATION_CTRL
03c558
+#define PR_SET_SPECULATION_CTRL    53
03c558
+#endif
03c558
+/* Speculation control variants */
03c558
+# undef PR_SPEC_STORE_BYPASS
03c558
+# define PR_SPEC_STORE_BYPASS          0
03c558
+/* Return and control values for PR_SET/GET_SPECULATION_CTRL */
03c558
+# undef PR_SPEC_NOT_AFFECTED
03c558
+# undef PR_SPEC_PRCTL
03c558
+# undef PR_SPEC_ENABLE
03c558
+# undef PR_SPEC_DISABLE
03c558
+# define PR_SPEC_NOT_AFFECTED          0
03c558
+# define PR_SPEC_PRCTL                 (1UL << 0)
03c558
+# define PR_SPEC_ENABLE                (1UL << 1)
03c558
+# define PR_SPEC_DISABLE               (1UL << 2)
03c558
+
03c558
+static void set_speculation() __attribute__((constructor));
03c558
+static void set_speculation() {
03c558
+  prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0);
03c558
+}
03c558
+
03c558
 // this is called _before_ most of the global arguments have been parsed
03c558
 void os::init(void) {
03c558
   char dummy;   /* used to get a guess on initial stack address */