void-packages/srcpkgs/openjdk8/patches/011_pr3607.patch
q66 6783ab9f47 openjdk: update to 8u232b09, rename to openjdk8, native bootstrap
This updates OpenJDK 8 to a newer version and brings a bunch of
changes.

Newly, it is bootstrapped with openjdk7-bootstrap, so it does not
need to download binaries. It can also cross-compile and is patched
for musl and other platforms.

We're newly using the aarch64 port repo in order to get aarch64
JIT. For non-aarch64 platforms, the codebase is the same.

The symlink for /usr/lib/jvm/openjdk is also now gone and we're
using a unified java-VERSION-VENDOR naming.

Also general template cleanup.

[ci skip]
2019-11-24 16:33:30 -05:00

52 lines
1.7 KiB
Diff

# HG changeset patch
# User andrew
# Date 1533744073 -3600
# Wed Aug 08 17:01:13 2018 +0100
# Node ID 0458118b5f190097099f2ea7b025cb2d5aeb0429
# Parent 66087a86ded39c2595dc61223fa03671ff051e33
PR3607: CVE-2018-3639 hw: cpu: speculative store bypass mitigation
diff -Nru openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp openjdk/hotspot/src/os/linux/vm/os_linux.cpp
--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp 2019-01-31 04:18:03.357394677 +0000
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp 2019-01-31 04:19:59.099570272 +0000
@@ -103,6 +103,8 @@
# include <inttypes.h>
# include <sys/ioctl.h>
+#include <sys/prctl.h>
+
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
#ifndef _GNU_SOURCE
@@ -5001,6 +5003,31 @@
}
}
+/* Per task speculation control */
+#ifndef PR_GET_SPECULATION_CTRL
+#define PR_GET_SPECULATION_CTRL 52
+#endif
+#ifndef PR_SET_SPECULATION_CTRL
+#define PR_SET_SPECULATION_CTRL 53
+#endif
+/* Speculation control variants */
+# undef PR_SPEC_STORE_BYPASS
+# define PR_SPEC_STORE_BYPASS 0
+/* Return and control values for PR_SET/GET_SPECULATION_CTRL */
+# undef PR_SPEC_NOT_AFFECTED
+# undef PR_SPEC_PRCTL
+# undef PR_SPEC_ENABLE
+# undef PR_SPEC_DISABLE
+# define PR_SPEC_NOT_AFFECTED 0
+# define PR_SPEC_PRCTL (1UL << 0)
+# define PR_SPEC_ENABLE (1UL << 1)
+# define PR_SPEC_DISABLE (1UL << 2)
+
+static void set_speculation() __attribute__((constructor));
+static void set_speculation() {
+ prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0);
+}
+
// this is called _before_ most of the global arguments have been parsed
void os::init(void) {
char dummy; /* used to get a guess on initial stack address */