Blame SOURCES/rh1750419-redhat_alt_java.patch

b6c39c
diff --git openjdk.orig/jdk/make/CompileLaunchers.gmk openjdk/jdk/make/CompileLaunchers.gmk
b6c39c
--- openjdk.orig/jdk/make/CompileLaunchers.gmk
b6c39c
+++ openjdk/jdk/make/CompileLaunchers.gmk
b6c39c
@@ -255,6 +255,32 @@
b6c39c
   endif
b6c39c
 endif
b6c39c
 
b6c39c
+$(eval $(call SetupLauncher,alt-java, \
b6c39c
+    -DEXPAND_CLASSPATH_WILDCARDS -DREDHAT_ALT_JAVA,,,user32.lib comctl32.lib, \
b6c39c
+    $(JDK_OUTPUTDIR)/objs/jli_static.lib, $(JAVA_RC_FLAGS), \
b6c39c
+    $(JDK_TOPDIR)/src/windows/resource/java.rc, $(JDK_OUTPUTDIR)/objs/java_objs,true))
b6c39c
+
b6c39c
+$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/alt-java$(EXE_SUFFIX): $(BUILD_LAUNCHER_alt-java)
b6c39c
+	$(MKDIR) -p $(@D)
b6c39c
+	$(RM) $@
b6c39c
+	$(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/alt-java$(EXE_SUFFIX) $@
b6c39c
+
b6c39c
+$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/alt-java$(DEBUGINFO_EXT): $(BUILD_LAUNCHER_alt-java)
b6c39c
+	$(MKDIR) -p $(@D)
b6c39c
+	$(RM) $@
b6c39c
+	$(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/alt-java$(DEBUGINFO_EXT) $@
b6c39c
+
b6c39c
+ifeq ($(OPENJDK_TARGET_OS), linux)
b6c39c
+  BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/alt-java$(EXE_SUFFIX)
b6c39c
+  ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
b6c39c
+    ifneq ($(POST_STRIP_CMD), )
b6c39c
+      ifneq ($(STRIP_POLICY), no_strip)
b6c39c
+        BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/alt-java$(DEBUGINFO_EXT)
b6c39c
+      endif
b6c39c
+    endif
b6c39c
+  endif
b6c39c
+endif
b6c39c
+
b6c39c
 ifeq ($(OPENJDK_TARGET_OS), windows)
b6c39c
   $(eval $(call SetupLauncher,javaw, \
b6c39c
       -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
b6c39c
diff --git openjdk.orig/jdk/src/share/bin/alt_main.h openjdk/jdk/src/share/bin/alt_main.h
b6c39c
new file mode 100644
b6c39c
--- /dev/null
b6c39c
+++ openjdk/jdk/src/share/bin/alt_main.h
b6c39c
@@ -0,0 +1,73 @@
b6c39c
+/*
b6c39c
+ * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
b6c39c
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b6c39c
+ *
b6c39c
+ * This code is free software; you can redistribute it and/or modify it
b6c39c
+ * under the terms of the GNU General Public License version 2 only, as
b6c39c
+ * published by the Free Software Foundation.  Oracle designates this
b6c39c
+ * particular file as subject to the "Classpath" exception as provided
b6c39c
+ * by Oracle in the LICENSE file that accompanied this code.
b6c39c
+ *
b6c39c
+ * This code is distributed in the hope that it will be useful, but WITHOUT
b6c39c
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b6c39c
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b6c39c
+ * version 2 for more details (a copy is included in the LICENSE file that
b6c39c
+ * accompanied this code).
b6c39c
+ *
b6c39c
+ * You should have received a copy of the GNU General Public License version
b6c39c
+ * 2 along with this work; if not, write to the Free Software Foundation,
b6c39c
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b6c39c
+ *
b6c39c
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b6c39c
+ * or visit www.oracle.com if you need additional information or have any
b6c39c
+ * questions.
b6c39c
+ */
b6c39c
+
b6c39c
+#ifdef REDHAT_ALT_JAVA
b6c39c
+
b6c39c
+#include <sys/prctl.h>
b6c39c
+
b6c39c
+
b6c39c
+/* Per task speculation control */
b6c39c
+#ifndef PR_GET_SPECULATION_CTRL
b6c39c
+# define PR_GET_SPECULATION_CTRL    52
b6c39c
+#endif
b6c39c
+#ifndef PR_SET_SPECULATION_CTRL
b6c39c
+# define PR_SET_SPECULATION_CTRL    53
b6c39c
+#endif
b6c39c
+/* Speculation control variants */
b6c39c
+#ifndef PR_SPEC_STORE_BYPASS
b6c39c
+# define PR_SPEC_STORE_BYPASS          0
b6c39c
+#endif
b6c39c
+/* Return and control values for PR_SET/GET_SPECULATION_CTRL */
b6c39c
+
b6c39c
+#ifndef PR_SPEC_NOT_AFFECTED
b6c39c
+# define PR_SPEC_NOT_AFFECTED          0
b6c39c
+#endif
b6c39c
+#ifndef PR_SPEC_PRCTL
b6c39c
+# define PR_SPEC_PRCTL                 (1UL << 0)
b6c39c
+#endif
b6c39c
+#ifndef PR_SPEC_ENABLE
b6c39c
+# define PR_SPEC_ENABLE                (1UL << 1)
b6c39c
+#endif
b6c39c
+#ifndef PR_SPEC_DISABLE
b6c39c
+# define PR_SPEC_DISABLE               (1UL << 2)
b6c39c
+#endif
b6c39c
+#ifndef PR_SPEC_FORCE_DISABLE
b6c39c
+# define PR_SPEC_FORCE_DISABLE         (1UL << 3)
b6c39c
+#endif
b6c39c
+#ifndef PR_SPEC_DISABLE_NOEXEC
b6c39c
+# define PR_SPEC_DISABLE_NOEXEC        (1UL << 4)
b6c39c
+#endif
b6c39c
+
b6c39c
+static void set_speculation() __attribute__((constructor));
b6c39c
+static void set_speculation() {
b6c39c
+  if ( prctl(PR_SET_SPECULATION_CTRL,
b6c39c
+             PR_SPEC_STORE_BYPASS,
b6c39c
+             PR_SPEC_DISABLE_NOEXEC, 0, 0) == 0 ) {
b6c39c
+    return;
b6c39c
+  }
b6c39c
+  prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS, PR_SPEC_DISABLE, 0, 0);
b6c39c
+}
b6c39c
+
b6c39c
+#endif // REDHAT_ALT_JAVA
b6c39c
diff --git openjdk.orig/jdk/src/share/bin/main.c openjdk/jdk/src/share/bin/main.c
b6c39c
--- openjdk.orig/jdk/src/share/bin/main.c
b6c39c
+++ openjdk/jdk/src/share/bin/main.c
b6c39c
@@ -32,6 +32,10 @@
b6c39c
 
b6c39c
 #include "defines.h"
b6c39c
 
b6c39c
+#if defined(linux) && defined(__x86_64)
b6c39c
+#include "alt_main.h"
b6c39c
+#endif
b6c39c
+
b6c39c
 #ifdef _MSC_VER
b6c39c
 #if _MSC_VER > 1400 && _MSC_VER < 1600
b6c39c