18744156 /usr/gnu/bin/chroot is killed when executed with an invalid command argument (adjust approach)
authorRich Burridge <rich.burridge@oracle.com>
Fri, 16 May 2014 10:43:57 -0700
changeset 1900 e587944ed7de
parent 1899 a814d85099bf
child 1901 d467d253c5b1
18744156 /usr/gnu/bin/chroot is killed when executed with an invalid command argument (adjust approach)
components/coreutils/Makefile
components/coreutils/patches/chroot-libthread.patch
--- a/components/coreutils/Makefile	Fri May 16 02:09:16 2014 -0700
+++ b/components/coreutils/Makefile	Fri May 16 10:43:57 2014 -0700
@@ -47,7 +47,7 @@
 COMPONENT_PREP_ACTION = (cd $(@D) ; autoreconf -f && automake)
 
 # Always show the build and link lines for easier debugging.
-GMAKE =                /usr/gnu/bin/make V=1
+COMPONENT_BUILD_ARGS +=		V=1
 
 # Enable ASLR for this component
 ASLR_MODE = $(ASLR_ENABLE)
--- a/components/coreutils/patches/chroot-libthread.patch	Fri May 16 02:09:16 2014 -0700
+++ b/components/coreutils/patches/chroot-libthread.patch	Fri May 16 10:43:57 2014 -0700
@@ -2,13 +2,19 @@
 bug CR #18752073.
 
 --- coreutils-8.16/src/Makefile.am.orig	2014-05-15 10:13:19.739717905 -0700
-+++ coreutils-8.16/src/Makefile.am	2014-05-15 10:13:51.751658970 -0700
[email protected]@ -178,6 +178,9 @@
++++ coreutils-8.16/src/Makefile.am	2014-05-16 10:39:39.250671691 -0700
[email protected]@ -178,6 +178,15 @@
  # Tell the linker to omit references to unused shared libraries.
  AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS)
  
 +# for chroot to work correctly for root (CR #18744156)
-+chroot_LDFLAGS =  -mt=no -D_REENTRANT -z now
++# add '-z now' to disable lazy loading since we need to bring in
++# dependencies before we chroot(2) to an environment that may not
++# be able to satisfy them.
++chroot_LDFLAGS =  -z now
++# add '-mt=no' so that we don't end up with an unnecessary dependency on
++# libthread.so.
++chroot_LDFLAGS +=  -mt=no
 +
  # Sometimes, the expansion of $(LIBINTL) includes -lc which may
  # include modules defining variables like 'optind', so libcoreutils.a