2020-11-27 17:41:13 +00:00
|
|
|
diff -r 25e94aa812b2 make/CompileLaunchers.gmk
|
|
|
|
--- openjdk/jdk/make/CompileLaunchers.gmk Wed Feb 05 12:20:36 2020 -0300
|
|
|
|
+++ openjdk/jdk/make/CompileLaunchers.gmk Tue Jun 02 17:15:28 2020 +0100
|
2020-12-17 14:49:22 +00:00
|
|
|
@@ -234,6 +234,21 @@
|
2020-11-27 17:41:13 +00:00
|
|
|
|
|
|
|
BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
|
|
|
|
|
2020-12-17 14:49:22 +00:00
|
|
|
+#Wno-error=cpp is present to allow commented warning in ifdef part of main.c
|
2020-11-27 17:41:13 +00:00
|
|
|
+$(eval $(call SetupLauncher,alt-java, \
|
2020-12-17 14:49:22 +00:00
|
|
|
+ -DEXPAND_CLASSPATH_WILDCARDS -DREDHAT_ALT_JAVA -Wno-error=cpp,,,user32.lib comctl32.lib, \
|
2020-11-27 17:41:13 +00:00
|
|
|
+ $(JDK_OUTPUTDIR)/objs/jli_static.lib, $(JAVA_RC_FLAGS), \
|
|
|
|
+ $(JDK_TOPDIR)/src/windows/resource/java.rc, $(JDK_OUTPUTDIR)/objs/java_objs,true))
|
|
|
|
+
|
|
|
|
+$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/alt-java$(EXE_SUFFIX): $(BUILD_LAUNCHER_alt-java)
|
|
|
|
+ $(MKDIR) -p $(@D)
|
|
|
|
+ $(RM) $@
|
|
|
|
+ $(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/alt-java$(EXE_SUFFIX) $@
|
|
|
|
+
|
|
|
|
+ifeq ($(OPENJDK_TARGET_OS), linux)
|
|
|
|
+ BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/alt-java$(EXE_SUFFIX)
|
|
|
|
+endif
|
|
|
|
+
|
|
|
|
ifeq ($(OPENJDK_TARGET_OS), windows)
|
|
|
|
$(eval $(call SetupLauncher,javaw, \
|
|
|
|
-DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
|
|
|
|
diff -r 25e94aa812b2 src/share/bin/alt_main.h
|
|
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ openjdk/jdk/src/share/bin/alt_main.h Tue Jun 02 17:15:28 2020 +0100
|
|
|
|
@@ -0,0 +1,73 @@
|
|
|
|
+/*
|
|
|
|
+ * Copyright (c) 2019, Red Hat, Inc. 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
|
|
|
|
+ * under the terms of the GNU General Public License version 2 only, as
|
|
|
|
+ * published by the Free Software Foundation. Oracle designates this
|
|
|
|
+ * particular file as subject to the "Classpath" exception as provided
|
|
|
|
+ * by Oracle in the LICENSE file that accompanied this code.
|
|
|
|
+ *
|
|
|
|
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
+ * version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
+ * accompanied this code).
|
|
|
|
+ *
|
|
|
|
+ * You should have received a copy of the GNU General Public License version
|
|
|
|
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
+ *
|
|
|
|
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
+ * or visit www.oracle.com if you need additional information or have any
|
|
|
|
+ * questions.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#ifdef REDHAT_ALT_JAVA
|
|
|
|
+
|
|
|
|
+#include <sys/prctl.h>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* 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 */
|
|
|
|
+#ifndef PR_SPEC_STORE_BYPASS
|
|
|
|
+# define PR_SPEC_STORE_BYPASS 0
|
|
|
|
+#endif
|
|
|
|
+/* Return and control values for PR_SET/GET_SPECULATION_CTRL */
|
|
|
|
+
|
|
|
|
+#ifndef PR_SPEC_NOT_AFFECTED
|
|
|
|
+# define PR_SPEC_NOT_AFFECTED 0
|
|
|
|
+#endif
|
|
|
|
+#ifndef PR_SPEC_PRCTL
|
|
|
|
+# define PR_SPEC_PRCTL (1UL << 0)
|
|
|
|
+#endif
|
|
|
|
+#ifndef PR_SPEC_ENABLE
|
|
|
|
+# define PR_SPEC_ENABLE (1UL << 1)
|
|
|
|
+#endif
|
|
|
|
+#ifndef PR_SPEC_DISABLE
|
|
|
|
+# define PR_SPEC_DISABLE (1UL << 2)
|
|
|
|
+#endif
|
|
|
|
+#ifndef PR_SPEC_FORCE_DISABLE
|
|
|
|
+# define PR_SPEC_FORCE_DISABLE (1UL << 3)
|
|
|
|
+#endif
|
|
|
|
+#ifndef PR_SPEC_DISABLE_NOEXEC
|
|
|
|
+# define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+static void set_speculation() __attribute__((constructor));
|
|
|
|
+static void set_speculation() {
|
|
|
|
+ if ( prctl(PR_SET_SPECULATION_CTRL,
|
|
|
|
+ PR_SPEC_STORE_BYPASS,
|
|
|
|
+ PR_SPEC_DISABLE_NOEXEC, 0, 0) == 0 ) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#endif // REDHAT_ALT_JAVA
|
|
|
|
diff -r 25e94aa812b2 src/share/bin/main.c
|
|
|
|
--- openjdk/jdk/src/share/bin/main.c Wed Feb 05 12:20:36 2020 -0300
|
|
|
|
+++ openjdk/jdk/src/share/bin/main.c Tue Jun 02 17:15:28 2020 +0100
|
2020-12-17 14:49:22 +00:00
|
|
|
@@ -32,6 +32,14 @@
|
2020-11-27 17:41:13 +00:00
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
|
2020-12-17 14:49:22 +00:00
|
|
|
+#ifdef REDHAT_ALT_JAVA
|
2020-12-17 12:34:57 +00:00
|
|
|
+#if defined(__linux__) && defined(__x86_64__)
|
2020-11-27 17:41:13 +00:00
|
|
|
+#include "alt_main.h"
|
2020-12-17 14:49:22 +00:00
|
|
|
+#else
|
|
|
|
+#warning alt-java requested but SSB mitigation not available on this platform.
|
|
|
|
+#endif
|
2020-11-27 17:41:13 +00:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#if _MSC_VER > 1400 && _MSC_VER < 1600
|
|
|
|
|