changeset 2543:70bfc9d0aa81

Support kernels that require PaX marking on the JDK binaries. 2012-05-21 Andrew John Hughes <ahughes@redhat.com> * AUTHORS: Add Ralph Sennhauser. 2012-02-03 Ralph Sennhauser <sera@gentoo.org> * Makefile.am: (ICEDTEA_PATCHES): Add test_gamma patch if WITH_PAX is set. (ICEDTEA_BOOT_PATCHES): Only add test_gamma patch if WITH_PAX is not set. (icedtea): Run pax-mark-vm on the just-built image. (icedtea-debug): Likewise. (icedtea-boot): Likewise. * acinclude.m4: (IT_WITH_PAX): Check for a pax command being specified. * configure.ac: Call IT_WITH_PAX. * patches/test_gamma.patch: Patch to be applied for the main OpenJDK tree when --with-pax is specified. Stops the test_gamma app being run, which will fail as the JDK is not yet PaX marked. * pax-mark-vm.in: Script to PaX mark a JDK image.
author Andrew John Hughes <ahughes@redhat.com>
date Mon, 21 May 2012 18:43:33 +0100
parents 9db4ba854770
children a1aed32a081d
files AUTHORS ChangeLog Makefile.am acinclude.m4 configure.ac patches/test_gamma.patch pax-mark-vm.in
diffstat 7 files changed, 143 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Thu May 03 00:06:07 2012 +0100
+++ b/AUTHORS	Mon May 21 18:43:33 2012 +0100
@@ -30,6 +30,7 @@
 Bernhard Rosenkränzer <bero@arklinux.org>
 Marc Schoenefeld <mschoene@redhat.com>
 Keith Seitz <keiths@redhat.com>
+Ralph Sennhauser <sera@gentoo.org>
 Joshua Sumali <jsumali@redhat.com>
 Pavel Tisnovsky <ptisnovs@redhat.com>
 Christian Thalinger <twisti@complang.tuwien.ac.at>
--- a/ChangeLog	Thu May 03 00:06:07 2012 +0100
+++ b/ChangeLog	Mon May 21 18:43:33 2012 +0100
@@ -1,3 +1,28 @@
+2012-05-21  Andrew John Hughes  <ahughes@redhat.com>
+
+	* AUTHORS: Add Ralph Sennhauser.
+
+2012-02-03  Ralph Sennhauser <sera@gentoo.org>
+
+	* Makefile.am:
+	(ICEDTEA_PATCHES): Add test_gamma patch if
+	WITH_PAX is set.
+	(ICEDTEA_BOOT_PATCHES): Only add test_gamma patch
+	if WITH_PAX is not set.
+	(icedtea): Run pax-mark-vm on the just-built image.
+	(icedtea-debug): Likewise.
+	(icedtea-boot): Likewise.
+	* acinclude.m4:
+	(IT_WITH_PAX): Check for a pax command being specified.
+	* configure.ac:
+	Call IT_WITH_PAX.
+	* patches/test_gamma.patch:
+	Patch to be applied for the main OpenJDK tree when
+	--with-pax is specified.  Stops the test_gamma app being
+	run, which will fail as the JDK is not yet PaX marked.
+	* pax-mark-vm.in:
+	Script to PaX mark a JDK image.
+
 2012-05-02  Andrew John Hughes  <ahughes@redhat.com>
 
 	Bump to jdk7u4 b13.
--- a/Makefile.am	Thu May 03 00:06:07 2012 +0100
+++ b/Makefile.am	Mon May 21 18:43:33 2012 +0100
@@ -276,6 +276,10 @@
 ICEDTEA_PATCHES += patches/nss-not-enabled-config.patch
 endif
 
+if WITH_PAX
+ICEDTEA_PATCHES += patches/test_gamma.patch
+endif
+
 ICEDTEA_PATCHES += $(DISTRIBUTION_PATCHES)
 
 # Bootstrapping patches
@@ -297,7 +301,6 @@
 	patches/boot/jar.patch \
 	patches/boot/symbols.patch \
 	patches/boot/tobin.patch \
-	patches/boot/test_gamma.patch \
 	patches/boot/tools.jar.patch \
 	patches/boot/jopt.patch \
 	patches/boot/jaxp-dependency.patch \
@@ -317,6 +320,10 @@
 	patches/boot/ecj-autoboxing.patch \
 	patches/boot/xsltproc.patch
 
+if !WITH_PAX
+ICEDTEA_BOOT_PATCHES += patches/boot/test_gamma.patch
+endif
+
 if CP39408_JAVAH
 ICEDTEA_BOOT_PATCHES += patches/boot/pr39408.patch
 endif
@@ -1643,6 +1650,7 @@
 	  $(ICEDTEA_ENV) \
 	  -C openjdk/ \
 	  $(ICEDTEA_BUILD_TARGET)
+	$(abs_top_builddir)/pax-mark-vm $(BUILD_OUTPUT_DIR)/j2sdk-image
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/$(INSTALL_ARCH_DIR)
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2re-image/lib/$(INSTALL_ARCH_DIR)
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/ext
@@ -1708,6 +1716,7 @@
 	  $(ICEDTEA_ENV) \
 	  -C openjdk/ \
 	  $(ICEDTEA_DEBUG_BUILD_TARGET)
+	$(abs_top_builddir)/pax-mark-vm $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image
 	mkdir -p $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/$(INSTALL_ARCH_DIR)
 	mkdir -p $(DEBUG_BUILD_OUTPUT_DIR)/j2re-image/lib/$(INSTALL_ARCH_DIR)
 	mkdir -p $(DEBUG_BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/ext
@@ -1796,6 +1805,7 @@
 	  $(ICEDTEA_ENV_BOOT) \
 	  -C openjdk-boot \
 	  $(ICEDTEA_BUILD_TARGET)
+	$(abs_top_builddir)/pax-mark-vm $(BOOT_BUILD_OUTPUT_DIR)/j2sdk-image
 	@echo "Bootstrapped IcedTea is served:" \
 	  $(BOOT_BUILD_OUTPUT_DIR)
 	mkdir -p stamps
--- a/acinclude.m4	Thu May 03 00:06:07 2012 +0100
+++ b/acinclude.m4	Mon May 21 18:43:33 2012 +0100
@@ -2201,3 +2201,46 @@
   AM_CONDITIONAL([DOWNLOADING], test x"${enable_downloading}" = "xyes")
   AC_SUBST([enable_downloading])
 ])
+
+AC_DEFUN_ONCE([IT_WITH_PAX],
+[
+  AC_MSG_CHECKING([for pax utility to use])
+  AC_ARG_WITH([pax],
+              [AS_HELP_STRING(--with-pax=COMMAND,the command used for pax marking)],
+  [
+    PAX_COMMAND=${withval}
+  ],
+  [ 
+    PAX_COMMAND="not specified"
+  ])
+  case "x${PAX_COMMAND}" in
+    xchpax)
+      case "${host_cpu}" in
+        i?86)
+          PAX_COMMAND_ARGS="-msp"
+          ;;
+        *)
+          PAX_COMMAND_ARGS="-m"
+          ;;
+      esac
+      ;;
+    xpaxctl)
+      case "${host_cpu}" in
+        i?86)
+          PAX_COMMAND_ARGS="-msp"
+          ;;
+        *)
+          PAX_COMMAND_ARGS="-m"
+          ;;
+      esac
+      ;;
+    *)
+      PAX_COMMAND="not specified"
+      PAX_COMMAND_ARGS="not specified"
+      ;;
+  esac
+  AM_CONDITIONAL(WITH_PAX, test "x${PAX_COMMAND}" != "xnot specified")
+  AC_MSG_RESULT(${PAX_COMMAND})
+  AC_SUBST(PAX_COMMAND)
+  AC_SUBST(PAX_COMMAND_ARGS)
+])
--- a/configure.ac	Thu May 03 00:06:07 2012 +0100
+++ b/configure.ac	Mon May 21 18:43:33 2012 +0100
@@ -147,6 +147,9 @@
 IT_ENABLE_HG
 IT_WITH_TZDATA_DIR
 
+IT_WITH_PAX
+AC_CONFIG_FILES([pax-mark-vm], [chmod +x pax-mark-vm])
+
 AC_PATH_TOOL([HG],[hg])
 if test "x${enable_hg}" = "xyes"; then
   if test "x${HG}" = x; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/test_gamma.patch	Mon May 21 18:43:33 2012 +0100
@@ -0,0 +1,47 @@
+diff -Nru ../openjdk.orig/openjdk/hotspot/make/linux/Makefile openjdk/hotspot/make/linux/Makefile
+--- ../openjdk.orig/openjdk/hotspot/make/linux/Makefile	2009-10-30 17:37:07.000000000 +0000
++++ openjdk/hotspot/make/linux/Makefile	2009-10-30 17:45:40.000000000 +0000
+@@ -287,42 +287,36 @@
+ 
+ $(TARGETS_C2):  $(SUBDIRS_C2)
+ 	cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_TIERED):  $(SUBDIRS_TIERED)
+ 	cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_C1):  $(SUBDIRS_C1)
+ 	cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_CORE):  $(SUBDIRS_CORE)
+ 	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_ZERO):  $(SUBDIRS_ZERO)
+ 	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS)
+-	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && ./test_gamma
+ ifdef INSTALL
+ 	cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
+ $(TARGETS_SHARK):  $(SUBDIRS_SHARK)
+    cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS)
+-   cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && ./test_gamma
+ ifdef INSTALL
+    cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install
+ endif
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pax-mark-vm.in	Mon May 21 18:43:33 2012 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Taken from Gentoo's pax-utils.eclass
+list_paxables() {
+	file "$@" 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//'
+}
+
+if test "@PAX_COMMAND@" != "not specified"; then
+	for paxable in `list_paxables "${1}"/bin/* "${1}"/jre/bin/*`; do
+		echo "PaX mark @PAX_COMMAND_ARGS@ ${paxable}"
+		@PAX_COMMAND@ @PAX_COMMAND_ARGS@ "${paxable}"
+	done
+fi