|
|
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 |
@@ -5001,26 +5001,43 @@
|
|
|
03c558 |
|
|
|
03c558 |
/* Per task speculation control */
|
|
|
03c558 |
#ifndef PR_GET_SPECULATION_CTRL
|
|
|
03c558 |
-#define PR_GET_SPECULATION_CTRL 52
|
|
|
03c558 |
+# define PR_GET_SPECULATION_CTRL 52
|
|
|
03c558 |
#endif
|
|
|
03c558 |
#ifndef PR_SET_SPECULATION_CTRL
|
|
|
03c558 |
-#define PR_SET_SPECULATION_CTRL 53
|
|
|
03c558 |
+# define PR_SET_SPECULATION_CTRL 53
|
|
|
03c558 |
#endif
|
|
|
03c558 |
/* Speculation control variants */
|
|
|
03c558 |
-# undef PR_SPEC_STORE_BYPASS
|
|
|
03c558 |
+#ifndef PR_SPEC_STORE_BYPASS
|
|
|
03c558 |
# define PR_SPEC_STORE_BYPASS 0
|
|
|
03c558 |
+#endif
|
|
|
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 |
+
|
|
|
03c558 |
+#ifndef PR_SPEC_NOT_AFFECTED
|
|
|
03c558 |
# define PR_SPEC_NOT_AFFECTED 0
|
|
|
03c558 |
+#endif
|
|
|
03c558 |
+#ifndef PR_SPEC_PRCTL
|
|
|
03c558 |
# define PR_SPEC_PRCTL (1UL << 0)
|
|
|
03c558 |
+#endif
|
|
|
03c558 |
+#ifndef PR_SPEC_ENABLE
|
|
|
03c558 |
# define PR_SPEC_ENABLE (1UL << 1)
|
|
|
03c558 |
+#endif
|
|
|
03c558 |
+#ifndef PR_SPEC_DISABLE
|
|
|
03c558 |
# define PR_SPEC_DISABLE (1UL << 2)
|
|
|
03c558 |
+#endif
|
|
|
03c558 |
+#ifndef PR_SPEC_FORCE_DISABLE
|
|
|
03c558 |
+# define PR_SPEC_FORCE_DISABLE (1UL << 3)
|
|
|
03c558 |
+#endif
|
|
|
03c558 |
+#ifndef PR_SPEC_DISABLE_NOEXEC
|
|
|
03c558 |
+# define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
|
|
|
03c558 |
+#endif
|
|
|
03c558 |
|
|
|
03c558 |
static void set_speculation() __attribute__((constructor));
|
|
|
03c558 |
static void set_speculation() {
|
|
|
03c558 |
+ if ( prctl(PR_SET_SPECULATION_CTRL,
|
|
|
03c558 |
+ PR_SPEC_STORE_BYPASS,
|
|
|
03c558 |
+ PR_SPEC_DISABLE_NOEXEC, 0, 0) == 0 ) {
|
|
|
03c558 |
+ return;
|
|
|
03c558 |
+ }
|
|
|
03c558 |
prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0);
|
|
|
03c558 |
}
|
|
|
03c558 |
|