Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/8] New QA tests for unsafe references to exec_prefix
@ 2011-12-16 22:36 Scott Garman
  2011-12-16 22:36 ` [PATCH 1/8] ncurses: move libraries to base_libdir Scott Garman
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

Hello,

This is a P2 feature for Yocto 1.2. It adds two new QA tests to check
files in base_bindir, base_sbindir, and base_libdir for references to
files under exec_prefix (e.g, dynamic linking for binaries and
references to exec_prefix in scripts).

The reason for these tests is that exec_prefix (typically /usr) can
be kept on a separate partition that may be mounted late in the boot
process, or may not be mounted at all during system recovery
operations.

It was my original goal to make the dynamic linking test a QA error
upon failure, but it turned out the amount of recipe work needed was
much larger than I expected. So for the time being they have been
changed to generate QA warmings.

The libraries I've moved to base_libdir in this pull request should
take care of all binaries in /bin and /sbin for packages we include
in core-image-minimal and -sato. 

I would like to ask recipe maintainers to look for these QA warnings
and fix them ASAP, as I believe we'll be changing this to a QA error
before the release of 1.2. 

Scott

The following changes since commit 3e05acab1c119a3b2a4703ea8729cc768935d36e:

  license.bbclass: remove bashism (2011-12-16 16:50:39 +0000)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib sgarman/per-recipe-sanitychk-final
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/per-recipe-sanitychk-final

Scott Garman (8):
  ncurses: move libraries to base_libdir
  libcap: move library to base_libdir
  util-linux: move libraries to base_libdir
  e2fsprogs: move libraries to base_libdir
  libusb1: move libraries to base_libdir
  libusb-compat: move libraries to base_libdir
  prelink: update to latest git version
  insane.bbclass: add QA tests for unsafe references to exec_prefix

 meta/classes/insane.bbclass                        |  111 +++++++++++++++++++-
 .../conf/distro/include/distro_tracking_fields.inc |    8 +-
 meta/recipes-core/ncurses/ncurses.inc              |   26 +++--
 meta/recipes-core/util-linux/util-linux.inc        |   20 ++--
 meta/recipes-core/util-linux/util-linux_2.19.1.bb  |    2 +-
 .../e2fsprogs/e2fsprogs_1.41.14.bb                 |   29 +++--
 meta/recipes-devtools/prelink/prelink_git.bb       |    2 +-
 meta/recipes-support/libcap/libcap.inc             |   15 +++-
 meta/recipes-support/libcap/libcap_2.22.bb         |    2 +-
 meta/recipes-support/libusb/libusb-compat_0.1.3.bb |   12 ++-
 meta/recipes-support/libusb/libusb1_1.0.8.bb       |   16 +++-
 11 files changed, 200 insertions(+), 43 deletions(-)

-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/8] ncurses: move libraries to base_libdir
  2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
@ 2011-12-16 22:36 ` Scott Garman
  2011-12-16 22:36 ` [PATCH 2/8] libcap: move library " Scott Garman
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

Various utilities (including bash and the util-linux programs) located
in base_bindir (/bin) or base_sbindir (/sbin) dynamically link against
many of the ncurses libraries. So move these libraries from libdir
(/usr/lib) to base_libdir (/lib).

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 meta/recipes-core/ncurses/ncurses.inc |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/meta/recipes-core/ncurses/ncurses.inc b/meta/recipes-core/ncurses/ncurses.inc
index 98f45a4..c33dabe 100644
--- a/meta/recipes-core/ncurses/ncurses.inc
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -26,6 +26,8 @@ ENABLE_WIDEC = "true"
 # builds.
 BUILD_CPPFLAGS += "-D_GNU_SOURCE"
 
+BUILD_LDFLAGS += "-Wl,-rpath,${base_libdir}"
+
 # Helper function for do_configure to allow multiple configurations
 # $1 the directory to run configure in
 # $@ the arguments to pass to configure
@@ -41,6 +43,7 @@ ncurses_configure() {
 	        --enable-hard-tabs \
 	        --enable-xmc-glitch \
 	        --enable-colorfgbg \
+	        --libdir=${base_libdir} \
 	        --with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap' \
 	        --with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo' \
 	        --with-shared \
@@ -120,7 +123,6 @@ do_install() {
         ! ${ENABLE_WIDEC} || \
             oe_runmake -C widec ${_install_opts}
 
-
         cd narrowc
 
         # include some basic terminfo files
@@ -155,28 +157,29 @@ do_install() {
         # else when '-Wl,--no-copy-dt-needed-entries' has been set in
         # linker flags.
         for i in libncurses libncursesw; do
-		f=${D}${libdir}/$i.so
+                f=${D}${base_libdir}/$i.so
                 test -h $f || continue
                 rm -f $f
                 echo '/* GNU ld script */'  >$f
                 echo "INPUT($i.so.5 AS_NEEDED(-ltinfo))" >>$f
         done
-	# Make sure that libcurses is linked so that it gets -ltinfo
-	# also, this should be addressed upstream really.
-	ln -sf libncurses.so ${D}${libdir}/libcurses.so
+
+        # Make sure that libcurses is linked so that it gets -ltinfo
+        # also, this should be addressed upstream really.
+        ln -sf libncurses.so ${D}${base_libdir}/libcurses.so
 
         # create libtermcap.so linker script for backward compatibility
-        f=${D}${libdir}/libtermcap.so
+        f=${D}${base_libdir}/libtermcap.so
         echo '/* GNU ld script */' >$f
         echo 'INPUT(AS_NEEDED(-ltinfo))' >>$f
 
-	oe_multilib_header curses.h
+        oe_multilib_header curses.h
 }
 
 python populate_packages_prepend () {
-        libdir = bb.data.expand("${libdir}", d)
+        base_libdir = bb.data.expand("${base_libdir}", d)
         pnbase = bb.data.expand("${PN}-lib%s", d)
-        do_split_packages(d, libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
+        do_split_packages(d, base_libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
 }
 
 
@@ -210,6 +213,10 @@ FILES_${PN} = "\
   ${datadir}/tabset \
 "
 
+FILES_${PN}-dev += "\
+ ${base_libdir}/*.so \
+"
+
 # This keeps only tput/tset in ncurses
 # clear/reset are in already busybox
 FILES_${PN}-tools = "\
@@ -223,6 +230,7 @@ FILES_${PN}-tools = "\
   ${bindir}/tack \
   ${bindir}/tabs \
 "
+
 # 'reset' is a symlink to 'tset' which is in the 'ncurses' package
 RDEPENDS_${PN}-tools = "${PN}"
 
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/8] libcap: move library to base_libdir
  2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
  2011-12-16 22:36 ` [PATCH 1/8] ncurses: move libraries to base_libdir Scott Garman
@ 2011-12-16 22:36 ` Scott Garman
  2011-12-16 22:36 ` [PATCH 3/8] util-linux: move libraries " Scott Garman
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

ls from coreutils links to libcap, so move the libcap library
from libdir (/usr/lib) to base_libdir (/lib).

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 meta/recipes-support/libcap/libcap.inc     |   15 +++++++++++++--
 meta/recipes-support/libcap/libcap_2.22.bb |    2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-support/libcap/libcap.inc b/meta/recipes-support/libcap/libcap.inc
index 184b58a..9418abf 100644
--- a/meta/recipes-support/libcap/libcap.inc
+++ b/meta/recipes-support/libcap/libcap.inc
@@ -21,6 +21,8 @@ do_configure() {
 	sed -e 's,BUILD_CFLAGS ?=,BUILD_CFLAGS := $(BUILD_CFLAGS),' -i Make.Rules
 }
 
+BUILD_LDFLAGS_virtclass_native += "-Wl,rpath=${base_libdir}"
+
 EXTRA_OEMAKE = " \
   LIBATTR=yes \
   PAM_CAP=${@base_contains('DISTRO_FEATURES', 'pam', 'yes', 'no', d)} \
@@ -42,8 +44,17 @@ do_install() {
 	oe_runmake install DESTDIR="${D}" prefix="${prefix}"
 }
 
+do_install_append() {
+	# Move the library to base_libdir
+	install -d ${D}${base_libdir}
+	mv ${D}${libdir}/* ${D}${base_libdir}
+	rmdir ${D}${libdir}
+}
+
+FILES_${PN}-dev += "${base_libdir}/*.so"
+
 # pam files
-FILES_${PN} += "${libdir}/security/*.so"
-FILES_${PN}-dbg += "${libdir}/security/.debug/*.so"
+FILES_${PN} += "${base_libdir}/security/*.so"
+FILES_${PN}-dbg += "${base_libdir}/security/.debug/*.so"
 
 BBCLASSEXTEND = "native"
diff --git a/meta/recipes-support/libcap/libcap_2.22.bb b/meta/recipes-support/libcap/libcap_2.22.bb
index dd63d9e..be1df54 100644
--- a/meta/recipes-support/libcap/libcap_2.22.bb
+++ b/meta/recipes-support/libcap/libcap_2.22.bb
@@ -1,6 +1,6 @@
 require libcap.inc
 
-PR = "r2"
+PR = "r3"
 
 SRC_URI[md5sum] = "ce64058bdb3f086ddbfca8ce6c919845"
 SRC_URI[sha256sum] = "73ebbd4877b5f69dd28b72098e510c5b318bc480f8201c4061ac98b78c04050f"
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/8] util-linux: move libraries to base_libdir
  2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
  2011-12-16 22:36 ` [PATCH 1/8] ncurses: move libraries to base_libdir Scott Garman
  2011-12-16 22:36 ` [PATCH 2/8] libcap: move library " Scott Garman
@ 2011-12-16 22:36 ` Scott Garman
  2011-12-16 22:36 ` [PATCH 4/8] e2fsprogs: " Scott Garman
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

Various util-linux programs in base_sbindir (/sbin) linked to libraries
located under exec_prefix (/usr). Since this is not safe, move these
libraries from libdir (/usr/lib) to base_libdir (/lib).

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 meta/recipes-core/util-linux/util-linux.inc       |   20 +++++++++++---------
 meta/recipes-core/util-linux/util-linux_2.19.1.bb |    2 +-
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index acc4a39..0ed6775 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -17,7 +17,6 @@ inherit autotools gettext pkgconfig
 DEPENDS = "zlib ncurses"
 DEPENDS_virtclass-native = " lzo-native"
 
-
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux-ng/v${MAJOR_VERSION}/util-linux-${PV}.tar.bz2 \
            file://MCONFIG \
            file://swapargs.h \
@@ -30,11 +29,14 @@ PACKAGES =+ "util-linux-agetty util-linux-fdisk util-linux-cfdisk util-linux-sfd
              util-linux-mount util-linux-readprofile util-linux-libblkid \
              util-linux-libblkid-dev util-linux-libuuid util-linux-libuuid-dev \
              util-linux-uuidgen util-linux-lscpu util-linux-fsck util-linux-blkid \
-	     util-linux-chkdupexe util-linux-mkfs util-linux-mcookie"
+             util-linux-chkdupexe util-linux-mkfs util-linux-mcookie"
 
-EXTRA_OECONF = "--disable-use-tty-group --disable-makeinstall-chown --enable-elvtune --enable-init --enable-kill --enable-last \
- --enable-mesg --enable-partx --enable-raw --enable-rdev --enable-reset \
-  --disable-login-utils --enable-write --enable-arch --enable-mount --with-fsprobe=builtin --enable-libuuid --enable-libblkid --enable-fsck"
+EXTRA_OECONF = "--libdir=${base_libdir} --disable-use-tty-group \
+                --disable-makeinstall-chown --enable-elvtune --enable-init \
+                --enable-kill --enable-last --enable-mesg --enable-partx \
+                --enable-raw --enable-rdev --enable-reset --disable-login-utils \
+                --enable-write --enable-arch --enable-mount --with-fsprobe=builtin \
+                --enable-libuuid --enable-libblkid --enable-fsck"
 
 FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
 
@@ -50,10 +52,10 @@ FILES_util-linux-umount = "${base_bindir}/umount.${PN}"
 FILES_util-linux-readprofile = "${base_sbindir}/readprofile.${PN}"
 FILES_util-linux-uuidgen = "${bindir}/uuidgen"
 
-FILES_util-linux-libblkid = "${libdir}/libblkid.so.*"
-FILES_util-linux-libblkid-dev = "${libdir}/libblkid.so ${libdir}/libblkid.a ${libdir}/libblkid.la ${includedir}/blkid"
-FILES_util-linux-libuuid = "${libdir}/libuuid.so.*"
-FILES_util-linux-libuuid-dev = "${libdir}/libuuid.so ${libdir}/libuuid.a ${libdir}/libuuid.la ${includedir}/uuid"
+FILES_util-linux-libblkid = "${base_libdir}/libblkid.so.*"
+FILES_util-linux-libblkid-dev = "${base_libdir}/libblkid.so ${base_libdir}/libblkid.a ${base_libdir}/libblkid.la ${includedir}/blkid"
+FILES_util-linux-libuuid = "${base_libdir}/libuuid.so.*"
+FILES_util-linux-libuuid-dev = "${base_libdir}/libuuid.so ${base_libdir}/libuuid.a ${base_libdir}/libuuid.la ${includedir}/uuid"
 FILES_util-linux-lscpu = "${bindir}/lscpu"
 
 FILES_util-linux-fsck = "${base_sbindir}/fsck*"
diff --git a/meta/recipes-core/util-linux/util-linux_2.19.1.bb b/meta/recipes-core/util-linux/util-linux_2.19.1.bb
index 82040ef..f012907 100644
--- a/meta/recipes-core/util-linux/util-linux_2.19.1.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.19.1.bb
@@ -1,5 +1,5 @@
 MAJOR_VERSION = "2.19"
-PR = "r12"
+PR = "r13"
 require util-linux.inc
 
 # note that `lscpu' is under GPLv3+
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/8] e2fsprogs: move libraries to base_libdir
  2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
                   ` (2 preceding siblings ...)
  2011-12-16 22:36 ` [PATCH 3/8] util-linux: move libraries " Scott Garman
@ 2011-12-16 22:36 ` Scott Garman
  2011-12-16 22:36 ` [PATCH 5/8] libusb1: " Scott Garman
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

The e2fsprogs utilities are installed into base_sbindir (/sbin)
and should not link to libraries under exec_prefix (/usr). So move
these libraries from libdir (/usr/lib) to base_libdir (/lib).

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 .../e2fsprogs/e2fsprogs_1.41.14.bb                 |   29 ++++++++++++-------
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.41.14.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.41.14.bb
index c6c1f0d..0bd0c67 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.41.14.bb
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.41.14.bb
@@ -1,6 +1,6 @@
 require e2fsprogs.inc
 
-PR = "r3"
+PR = "r4"
 
 SRC_URI += "file://quotefix.patch \
             file://acinclude.m4"
@@ -11,9 +11,9 @@ SRC_URI[sha256sum] = "3f8ac1fedd7c4bec480afcbe4acabdd4ac59ec0446a0fd50c8975cd0aa
 
 PARALLEL_MAKE = ""
 
-EXTRA_OECONF += " --sbindir=${base_sbindir} --enable-elf-shlibs --disable-libuuid"
-EXTRA_OECONF_darwin = "--sbindir=${base_sbindir} --enable-bsd-shlibs"
-EXTRA_OECONF_darwin8 = "--sbindir=${base_sbindir} --enable-bsd-shlibs"
+EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-elf-shlibs --disable-libuuid"
+EXTRA_OECONF_darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
+EXTRA_OECONF_darwin8 = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
 
 do_configure_prepend () {
 	cp ${WORKDIR}/acinclude.m4 ${S}/
@@ -28,9 +28,16 @@ do_install () {
 	oe_runmake 'DESTDIR=${D}' install
 	oe_runmake 'DESTDIR=${D}' install-libs
 	# We use blkid from util-linux now so remove from here
-	rm -f ${D}${libdir}/libblkid*
+	rm -f ${D}${base_libdir}/libblkid*
 	rm -rf ${D}${includedir}/blkid
-	rm -f ${D}${libdir}/pkgconfig/blkid.pc
+	rm -f ${D}${base_libdir}/pkgconfig/blkid.pc
+}
+
+do_install_append () {
+	# e2initrd_helper and the pkgconfig files belong in libdir
+	install -d ${D}${libdir}
+	mv ${D}${base_libdir}/e2initrd_helper ${D}${libdir}
+	mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
 }
 
 # blkid used to be part of e2fsprogs but is useful outside, add it
@@ -47,10 +54,10 @@ FILES_e2fsprogs-e2fsck = "${base_sbindir}/e2fsck ${base_sbindir}/fsck.ext*"
 FILES_e2fsprogs-mke2fs = "${base_sbindir}/mke2fs ${base_sbindir}/mkfs.ext* ${sysconfdir}/mke2fs.conf"
 FILES_e2fsprogs-tune2fs = "${base_sbindir}/tune2fs ${base_sbindir}/e2label ${base_sbindir}/findfs"
 FILES_e2fsprogs-badblocks = "${base_sbindir}/badblocks"
-FILES_libcomerr = "${libdir}/libcom_err.so.*"
-FILES_libss = "${libdir}/libss.so.*"
-FILES_libe2p = "${libdir}/libe2p.so.*"
-FILES_libext2fs = "${libdir}/e2initrd_helper ${libdir}/libext2fs.so.*"
-FILES_${PN}-dev += "${datadir}/*/*.awk ${datadir}/*/*.sed"
+FILES_libcomerr = "${base_libdir}/libcom_err.so.*"
+FILES_libss = "${base_libdir}/libss.so.*"
+FILES_libe2p = "${base_libdir}/libe2p.so.*"
+FILES_libext2fs = "${libdir}/e2initrd_helper ${base_libdir}/libext2fs.so.*"
+FILES_${PN}-dev += "${datadir}/*/*.awk ${datadir}/*/*.sed ${base_libdir}/*.so"
 
 BBCLASSEXTEND = "native"
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/8] libusb1: move libraries to base_libdir
  2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
                   ` (3 preceding siblings ...)
  2011-12-16 22:36 ` [PATCH 4/8] e2fsprogs: " Scott Garman
@ 2011-12-16 22:36 ` Scott Garman
  2011-12-16 22:36 ` [PATCH 6/8] libusb-compat: " Scott Garman
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

udev links to libusb1, and so these libraries need to be in
base_libdir (/lib) instead of libdir (/usr/lib).

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 meta/recipes-support/libusb/libusb1_1.0.8.bb |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-support/libusb/libusb1_1.0.8.bb b/meta/recipes-support/libusb/libusb1_1.0.8.bb
index 302a8be..5a921e0 100644
--- a/meta/recipes-support/libusb/libusb1_1.0.8.bb
+++ b/meta/recipes-support/libusb/libusb1_1.0.8.bb
@@ -1,4 +1,4 @@
-DESCRIPTION = "userspace library to access USB (version 1.0)"
+DESCRIPTION = "Userspace library to access USB (version 1.0)"
 HOMEPAGE = "http://libusb.sf.net"
 BUGTRACKER = "http://www.libusb.org/report"
 SECTION = "libs"
@@ -6,7 +6,7 @@ SECTION = "libs"
 LICENSE = "LGPLv2.1+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"
 
-PR = "r0"
+PR = "r1"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/libusb/libusb-${PV}.tar.bz2"
 
@@ -15,3 +15,15 @@ SRC_URI[sha256sum] = "21d0d3a5710f7f4211c595102c6b9eccb42435a17a4f5bd2c3f4166ab1
 S = "${WORKDIR}/libusb-${PV}"
 
 inherit autotools pkgconfig
+
+EXTRA_OECONF = "--libdir=${base_libdir}"
+
+do_install_append() {
+	install -d ${D}${libdir}
+	mv ${D}${base_libdir}/*.la ${D}${libdir}
+	mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
+}
+
+FILES_${PN} += "${base_libdir}/*.so.*"
+
+FILES_${PN}-dev += "${base_libdir}/*.so"
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/8] libusb-compat: move libraries to base_libdir
  2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
                   ` (4 preceding siblings ...)
  2011-12-16 22:36 ` [PATCH 5/8] libusb1: " Scott Garman
@ 2011-12-16 22:36 ` Scott Garman
  2011-12-16 22:36 ` [PATCH 7/8] prelink: update to latest git version Scott Garman
  2011-12-16 22:36 ` [PATCH 8/8] insane.bbclass: add QA tests for unsafe references to exec_prefix Scott Garman
  7 siblings, 0 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

udev links to libusb-compat, and so this library needs to be in
base_libdir (/lib) instead of libdir (/usr/lib).

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 meta/recipes-support/libusb/libusb-compat_0.1.3.bb |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/meta/recipes-support/libusb/libusb-compat_0.1.3.bb b/meta/recipes-support/libusb/libusb-compat_0.1.3.bb
index ef8552b..e070463 100644
--- a/meta/recipes-support/libusb/libusb-compat_0.1.3.bb
+++ b/meta/recipes-support/libusb/libusb-compat_0.1.3.bb
@@ -15,7 +15,7 @@ DEPENDS = "libusb1"
 PROVIDES = "libusb"
 
 PE = "1"
-PR = "r0"
+PR = "r1"
 
 SRC_URI = "${SOURCEFORGE_MIRROR}/libusb/libusb-compat-${PV}.tar.bz2 \
            file://0.1.0-beta1-gcc3.4-fix.patch"
@@ -24,3 +24,13 @@ SRC_URI[md5sum] = "570ac2ea085b80d1f74ddc7c6a93c0eb"
 SRC_URI[sha256sum] = "a590a03b6188030ee1ca1a0af55685fcde005ca807b963970f839be776031d94"
 
 inherit autotools pkgconfig binconfig
+
+EXTRA_OECONF = "--libdir=${base_libdir}"
+
+do_install_append() {
+	install -d ${D}${libdir}
+	mv ${D}${base_libdir}/*.la ${D}${libdir}
+	mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
+}
+
+FILES_${PN}-dev += "${base_libdir}/*.so"
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/8] prelink: update to latest git version
  2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
                   ` (5 preceding siblings ...)
  2011-12-16 22:36 ` [PATCH 6/8] libusb-compat: " Scott Garman
@ 2011-12-16 22:36 ` Scott Garman
  2011-12-16 22:36 ` [PATCH 8/8] insane.bbclass: add QA tests for unsafe references to exec_prefix Scott Garman
  7 siblings, 0 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

New version includes:

2011-12-08 Mark Hatle <mark.hatle@windriver.com>
    * rtld/rtld.c: Fix an issue where missing objects would trigger
      an assert in dl-version.c
    * rtld/rtld.h: Add _dl_new_object prototype
    * rtld/rtld.c: Add support for $ORIGIN, $PLATFORM and $LIB.
      Note: $PLATFORM = ""

These fixes are needed to prevent prelink-rtld from crashing when
running the new unsafe-references-in-binaries QA test.

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 .../conf/distro/include/distro_tracking_fields.inc |    8 ++++----
 meta/recipes-devtools/prelink/prelink_git.bb       |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta/conf/distro/include/distro_tracking_fields.inc b/meta/conf/distro/include/distro_tracking_fields.inc
index f2b7d4b..fe7cb44 100644
--- a/meta/conf/distro/include/distro_tracking_fields.inc
+++ b/meta/conf/distro/include/distro_tracking_fields.inc
@@ -3067,10 +3067,10 @@ RECIPE_LAST_UPDATE_pn-perl = "Oct 22, 2011"
 RECIPE_MANUAL_CHECK_DATE_pn-perl = "Nov 16, 2011"
 RECIPE_MAINTAINER_pn-perl = "Nitin A Kamble <nitin.a.kamble@intel.com>"
 
-RECIPE_STATUS_pn-prelink="red" 
-RECIPE_LATEST_VERSION_pn-prelink="1.0+git0+0x909470ee441237563d6236c505cb2d02ddc48704"
-RECIPE_LAST_UPDATE_pn-prelink = "Jul 23, 2010"
-RECIPE_MANUAL_CHECK_DATE_pn-prelink = "Dec 01, 2011"
+RECIPE_STATUS_pn-prelink="green" 
+RECIPE_LATEST_VERSION_pn-prelink="1.0+git0+0xbb1b660c5e3859b6c5a2ac8d739713e9989a4dd7"
+RECIPE_LAST_UPDATE_pn-prelink = "Dec 15, 2011"
+RECIPE_MANUAL_CHECK_DATE_pn-prelink = "Dec 15, 2011"
 RECIPE_MAINTAINER_pn-prelink = "Mark Hatle <mark.hatle@windriver.com>"
 
 RECIPE_STATUS_pn-python-dbus="green" 
diff --git a/meta/recipes-devtools/prelink/prelink_git.bb b/meta/recipes-devtools/prelink/prelink_git.bb
index af6de8e..31c22ef 100644
--- a/meta/recipes-devtools/prelink/prelink_git.bb
+++ b/meta/recipes-devtools/prelink/prelink_git.bb
@@ -8,7 +8,7 @@ and executables, so that far fewer relocations need to be resolved at \
 runtime and thus programs come up faster."
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b"
-SRCREV = "3e3f9b0876aa5ac83a783a95b8bab52cb38ed785"
+SRCREV = "bb1b660c5e3859b6c5a2ac8d739713e9989a4dd7"
 PV = "1.0+git${SRCPV}"
 PR = "r7"
 
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 8/8] insane.bbclass: add QA tests for unsafe references to exec_prefix
  2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
                   ` (6 preceding siblings ...)
  2011-12-16 22:36 ` [PATCH 7/8] prelink: update to latest git version Scott Garman
@ 2011-12-16 22:36 ` Scott Garman
  7 siblings, 0 replies; 9+ messages in thread
From: Scott Garman @ 2011-12-16 22:36 UTC (permalink / raw)
  To: openembedded-core

Files under exec_prefix (commonly /usr) may not be available during
system recovery. exec_prefix may also be kept on a separate partition
that is mounted late in the boot process.

This QA test throws an warning if a binary in base_[bindir|sbindir|libdir]
is dynamically linked to a file under exec_prefix. The intention is to
turn this into an error in the near future.

It also checks executable non-binaries (e.g, shell scripts) in the above
base directories with a simple grep test to look for references to
exec_prefix. This test only produces a warning, since false positives
are likely.

This fixes [YOCTO #1008]

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 meta/classes/insane.bbclass |  111 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 109 insertions(+), 2 deletions(-)

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 5726e69..b8d4507 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -11,6 +11,10 @@
 #  -Check if packages contains .debug directories or .so files
 #   where they should be in -dev or -dbg
 #  -Check if config.log contains traces to broken autoconf tests
+#  -Ensure that binaries in base_[bindir|sbindir|libdir] do not link
+#   into exec_prefix
+#  -Check that scripts in base_[bindir|sbindir|libdir] do not reference
+#   files under exec_prefix
 
 
 #
@@ -19,9 +23,14 @@
 # The package.bbclass can help us here.
 #
 inherit package
-PACKAGE_DEPENDS += "pax-utils-native desktop-file-utils-native"
+PACKAGE_DEPENDS += "pax-utils-native desktop-file-utils-native ${QADEPENDS}"
 PACKAGEFUNCS += " do_package_qa "
 
+# unsafe-references-in-binaries requires prelink-rtld from
+# prelink-native, but we don't want this DEPENDS for -native builds
+QADEPENDS = "prelink-native"
+QADEPENDS_virtclass-native = ""
+QADEPENDS_virtclass-nativesdk = ""
 
 #
 # dictionary for elf headers
@@ -100,7 +109,7 @@ def package_qa_get_machine_dict():
 
 
 # Currently not being used by default "desktop"
-WARN_QA ?= "ldflags useless-rpaths rpaths"
+WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts"
 ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms"
 
 def package_qa_clean_path(path,d):
@@ -201,6 +210,104 @@ def package_qa_check_perm(path,name,d, elf, messages):
     """
     return
 
+QAPATHTEST[unsafe-references-in-binaries] = "package_qa_check_unsafe_references_in_binaries"
+def package_qa_check_unsafe_references_in_binaries(path, name, d, elf, messages):
+	"""
+	Ensure binaries in base_[bindir|sbindir|libdir] do not link to files under exec_prefix
+	"""
+	if unsafe_references_skippable(path, name, d):
+		return
+
+	if elf:
+		import subprocess as sub
+		pn = d.getVar('PN', True)
+
+		exec_prefix = d.getVar('exec_prefix', True)
+		sysroot_path = d.getVar('STAGING_DIR_TARGET', True)
+		sysroot_path_usr = sysroot_path + exec_prefix
+
+		try:
+			ldd_output = sub.check_output(["prelink-rtld", "--root", sysroot_path, path])
+		except sub.CalledProcessError as e:
+			if e.returncode != 127:
+				error_msg = pn + ": prelink-rtld aborted when processing %s" % path
+				package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
+				return False
+			else:
+				# Sometimes this is done deliberately (e.g, e2fsprogs), so only warn
+				bb.warn("%s has missing library dependencies" % path)
+				return
+		if sysroot_path_usr in ldd_output:
+			error_msg = pn + ": %s links to something under exec_prefix" % path
+			package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
+			error_msg = "ldd reports: %s" % ldd_output
+			package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
+			return False
+
+QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts"
+def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages):
+	"""
+	Warn if scripts in base_[bindir|sbindir|libdir] reference files under exec_prefix
+	"""
+	if unsafe_references_skippable(path, name, d):
+		return
+
+	if not elf:
+		import stat
+		pn = d.getVar('PN', True)
+
+		# Ensure we're checking an executable script
+		statinfo = os.stat(path)
+		if bool(statinfo.st_mode & stat.S_IXUSR):
+			# grep shell scripts for possible references to /exec_prefix/
+			exec_prefix = d.getVar('exec_prefix', True)
+			statement = "grep -e '%s/' %s > /dev/null" % (exec_prefix, path)
+			if os.system(statement) == 0:
+				error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path)
+				package_qa_handle_error("unsafe-references-in-scripts", error_msg, d)
+				error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix"
+				package_qa_handle_error("unsafe-references-in-scripts", error_msg, d)
+
+def unsafe_references_skippable(path, name, d):
+	if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d):
+		return True
+
+	if "-dbg" in name or "-dev" in name:
+		return True
+
+	# Other package names to skip:
+	if name.startswith("kernel-module-"):
+		return True
+
+	# Skip symlinks
+	if os.path.islink(path):
+		return True
+
+	# Skip unusual rootfs layouts which make these tests irrelevant
+	exec_prefix = d.getVar('exec_prefix', True)
+	if exec_prefix == "":
+		return True
+
+	pkgdest = d.getVar('PKGDEST', True)
+	pkgdest = pkgdest + "/" + name
+	pkgdest = os.path.abspath(pkgdest)
+	base_bindir = pkgdest + d.getVar('base_bindir', True)
+	base_sbindir = pkgdest + d.getVar('base_sbindir', True)
+	base_libdir = pkgdest + d.getVar('base_libdir', True)
+	bindir = pkgdest + d.getVar('bindir', True)
+	sbindir = pkgdest + d.getVar('sbindir', True)
+	libdir = pkgdest + d.getVar('libdir', True)
+
+	if base_bindir == bindir and base_sbindir == sbindir and base_libdir == libdir:
+		return True
+
+	# Skip files not in base_[bindir|sbindir|libdir]
+	path = os.path.abspath(path)
+	if not (base_bindir in path or base_sbindir in path or base_libdir in path):
+		return True
+
+	return False
+
 QAPATHTEST[arch] = "package_qa_check_arch"
 def package_qa_check_arch(path,name,d, elf, messages):
     """
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-16 22:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 22:36 [PATCH 0/8] New QA tests for unsafe references to exec_prefix Scott Garman
2011-12-16 22:36 ` [PATCH 1/8] ncurses: move libraries to base_libdir Scott Garman
2011-12-16 22:36 ` [PATCH 2/8] libcap: move library " Scott Garman
2011-12-16 22:36 ` [PATCH 3/8] util-linux: move libraries " Scott Garman
2011-12-16 22:36 ` [PATCH 4/8] e2fsprogs: " Scott Garman
2011-12-16 22:36 ` [PATCH 5/8] libusb1: " Scott Garman
2011-12-16 22:36 ` [PATCH 6/8] libusb-compat: " Scott Garman
2011-12-16 22:36 ` [PATCH 7/8] prelink: update to latest git version Scott Garman
2011-12-16 22:36 ` [PATCH 8/8] insane.bbclass: add QA tests for unsafe references to exec_prefix Scott Garman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox