|
|
c3e128 |
diff -r 1356affa5e44 make/launcher/Launcher-java.base.gmk
|
|
|
c3e128 |
--- openjdk/make/launcher/Launcher-java.base.gmk Wed Nov 25 08:27:15 2020 +0100
|
|
|
c3e128 |
+++ openjdk/make/launcher/Launcher-java.base.gmk Tue Dec 01 12:29:30 2020 +0100
|
|
|
c3e128 |
@@ -41,6 +41,16 @@
|
|
|
c3e128 |
OPTIMIZATION := HIGH, \
|
|
|
c3e128 |
))
|
|
|
c3e128 |
|
|
|
c3e128 |
+#Wno-error=cpp is present to allow commented warning in ifdef part of main.c
|
|
|
c3e128 |
+$(eval $(call SetupBuildLauncher, alt-java, \
|
|
|
c3e128 |
+ CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES -DREDHAT_ALT_JAVA -Wno-error=cpp, \
|
|
|
c3e128 |
+ LDFLAGS_solaris := -R$(OPENWIN_HOME)/lib$(OPENJDK_TARGET_CPU_ISADIR), \
|
|
|
c3e128 |
+ LIBS_windows := user32.lib comctl32.lib, \
|
|
|
c3e128 |
+ EXTRA_RC_FLAGS := $(JAVA_RC_FLAGS), \
|
|
|
c3e128 |
+ VERSION_INFO_RESOURCE := $(JAVA_VERSION_INFO_RESOURCE), \
|
|
|
c3e128 |
+ OPTIMIZATION := HIGH, \
|
|
|
c3e128 |
+))
|
|
|
c3e128 |
+
|
|
|
c3e128 |
ifeq ($(OPENJDK_TARGET_OS), windows)
|
|
|
c3e128 |
$(eval $(call SetupBuildLauncher, javaw, \
|
|
|
c3e128 |
CFLAGS := -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS -DENABLE_ARG_FILES, \
|
|
|
c3e128 |
|
|
|
c3e128 |
diff -r 25e94aa812b2 src/share/bin/alt_main.h
|
|
|
c3e128 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
|
c3e128 |
+++ openjdk/src/java.base/share/native/launcher/alt_main.h Tue Jun 02 17:15:28 2020 +0100
|
|
|
c3e128 |
@@ -0,0 +1,73 @@
|
|
|
c3e128 |
+/*
|
|
|
c3e128 |
+ * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
|
|
|
c3e128 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
c3e128 |
+ *
|
|
|
c3e128 |
+ * This code is free software; you can redistribute it and/or modify it
|
|
|
c3e128 |
+ * under the terms of the GNU General Public License version 2 only, as
|
|
|
c3e128 |
+ * published by the Free Software Foundation. Oracle designates this
|
|
|
c3e128 |
+ * particular file as subject to the "Classpath" exception as provided
|
|
|
c3e128 |
+ * by Oracle in the LICENSE file that accompanied this code.
|
|
|
c3e128 |
+ *
|
|
|
c3e128 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
c3e128 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
c3e128 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
c3e128 |
+ * version 2 for more details (a copy is included in the LICENSE file that
|
|
|
c3e128 |
+ * accompanied this code).
|
|
|
c3e128 |
+ *
|
|
|
c3e128 |
+ * You should have received a copy of the GNU General Public License version
|
|
|
c3e128 |
+ * 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
c3e128 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
c3e128 |
+ *
|
|
|
c3e128 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
c3e128 |
+ * or visit www.oracle.com if you need additional information or have any
|
|
|
c3e128 |
+ * questions.
|
|
|
c3e128 |
+ */
|
|
|
c3e128 |
+
|
|
|
c3e128 |
+#ifdef REDHAT_ALT_JAVA
|
|
|
c3e128 |
+
|
|
|
c3e128 |
+#include <sys/prctl.h>
|
|
|
c3e128 |
+
|
|
|
c3e128 |
+
|
|
|
c3e128 |
+/* Per task speculation control */
|
|
|
c3e128 |
+#ifndef PR_GET_SPECULATION_CTRL
|
|
|
c3e128 |
+# define PR_GET_SPECULATION_CTRL 52
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+#ifndef PR_SET_SPECULATION_CTRL
|
|
|
c3e128 |
+# define PR_SET_SPECULATION_CTRL 53
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+/* Speculation control variants */
|
|
|
c3e128 |
+#ifndef PR_SPEC_STORE_BYPASS
|
|
|
c3e128 |
+# define PR_SPEC_STORE_BYPASS 0
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+/* Return and control values for PR_SET/GET_SPECULATION_CTRL */
|
|
|
c3e128 |
+
|
|
|
c3e128 |
+#ifndef PR_SPEC_NOT_AFFECTED
|
|
|
c3e128 |
+# define PR_SPEC_NOT_AFFECTED 0
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+#ifndef PR_SPEC_PRCTL
|
|
|
c3e128 |
+# define PR_SPEC_PRCTL (1UL << 0)
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+#ifndef PR_SPEC_ENABLE
|
|
|
c3e128 |
+# define PR_SPEC_ENABLE (1UL << 1)
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+#ifndef PR_SPEC_DISABLE
|
|
|
c3e128 |
+# define PR_SPEC_DISABLE (1UL << 2)
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+#ifndef PR_SPEC_FORCE_DISABLE
|
|
|
c3e128 |
+# define PR_SPEC_FORCE_DISABLE (1UL << 3)
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+#ifndef PR_SPEC_DISABLE_NOEXEC
|
|
|
c3e128 |
+# define PR_SPEC_DISABLE_NOEXEC (1UL << 4)
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+
|
|
|
c3e128 |
+static void set_speculation() __attribute__((constructor));
|
|
|
c3e128 |
+static void set_speculation() {
|
|
|
c3e128 |
+ if ( prctl(PR_SET_SPECULATION_CTRL,
|
|
|
c3e128 |
+ PR_SPEC_STORE_BYPASS,
|
|
|
c3e128 |
+ PR_SPEC_DISABLE_NOEXEC, 0, 0) == 0 ) {
|
|
|
c3e128 |
+ return;
|
|
|
c3e128 |
+ }
|
|
|
c3e128 |
+ prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0);
|
|
|
c3e128 |
+}
|
|
|
c3e128 |
+
|
|
|
c3e128 |
+#endif // REDHAT_ALT_JAVA
|
|
|
c3e128 |
diff -r 25e94aa812b2 src/share/bin/main.c
|
|
|
c3e128 |
--- openjdk/src/java.base/share/native/launcher/main.c Wed Feb 05 12:20:36 2020 -0300
|
|
|
c3e128 |
+++ openjdk/src/java.base/share/native/launcher/main.c Tue Jun 02 17:15:28 2020 +0100
|
|
|
c3e128 |
@@ -34,6 +34,14 @@
|
|
|
c3e128 |
#include "jli_util.h"
|
|
|
c3e128 |
#include "jni.h"
|
|
|
c3e128 |
|
|
|
c3e128 |
+#ifdef REDHAT_ALT_JAVA
|
|
|
c3e128 |
+#if defined(__linux__) && defined(__x86_64__)
|
|
|
c3e128 |
+#include "alt_main.h"
|
|
|
c3e128 |
+#else
|
|
|
c3e128 |
+#warning alt-java requested but SSB mitigation not available on this platform.
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+#endif
|
|
|
c3e128 |
+
|
|
|
c3e128 |
#ifdef _MSC_VER
|
|
|
c3e128 |
#if _MSC_VER > 1400 && _MSC_VER < 1600
|
|
|
c3e128 |
|