[gnome-continuous-yocto/gnomeostree-3.22-krogoth] Revert "Update the util-linux recipe from Rocko"



commit b6902c0ce1293a7afcc706ff8ea06f9389ccdca8
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Feb 13 15:05:28 2018 +0000

    Revert "Update the util-linux recipe from Rocko"
    
    This reverts commit a3a8b7f2fcec35db5986f53f94012f3e63e8a43a.

 meta/recipes-core/util-linux/util-linux.inc        |  126 ++++++++------------
 .../util-linux/util-linux/CVE-2016-5011.patch      |   59 +++++++++
 .../util-linux/util-linux/CVE-2016-5011_p2.patch   |   91 ++++++++++++++
 .../util-linux/avoid_unsupported_grep_opts.patch   |   57 +++++++++
 .../util-linux/avoid_unsupported_sleep_param.patch |   20 +++
 .../util-linux/display_testname_for_subtest.patch  |   27 ++---
 .../util-linux/util-linux/no_getrandom.patch       |   21 ----
 .../recipes-core/util-linux/util-linux/ptest.patch |   16 +--
 .../util-linux/util-linux/util-linux-native.patch  |   57 +++++++++
 .../util-linux-ng-2.16-mount_lock_path.patch       |   27 ++++
 .../util-linux/uuid-test-error-api.patch           |   92 ++++++++++++++
 .../{util-linux_2.30.bb => util-linux_2.27.1.bb}   |   19 ++-
 12 files changed, 479 insertions(+), 133 deletions(-)
---
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index f0ffd25..a1614c2 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -1,5 +1,4 @@
 SUMMARY = "A suite of basic system administration utilities"
-HOMEPAGE = "http://userweb.kernel.org/~kzak/util-linux/";
 DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \
 commonly found on most Linux systems.  Some of the more important utilities include \
 disk partitioning, kernel message management, filesystem creation, and system login."
@@ -18,8 +17,7 @@ LIC_FILES_CHKSUM = "file://README.licensing;md5=1715f5ee3e01203ca1e1e0b9ee65918c
                     file://libmount/COPYING;md5=fb93f01d4361069c5616327705373b16 \
                     file://libblkid/COPYING;md5=fb93f01d4361069c5616327705373b16"
 
-#gtk-doc is not enabled as it requires xmlto which requires util-linux
-inherit autotools gettext pkgconfig systemd update-alternatives python3-dir bash-completion ptest
+inherit autotools gettext pkgconfig systemd update-alternatives python-dir ptest bash-completion
 DEPENDS = "zlib ncurses"
 DEPENDS_append_class-native = " lzo-native"
 DEPENDS_append_class-nativesdk = " lzo-native"
@@ -30,14 +28,13 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
 PACKAGES =+ "util-linux-agetty util-linux-fdisk util-linux-cfdisk util-linux-sfdisk \
              util-linux-swaponoff util-linux-losetup util-linux-umount \
              util-linux-mount util-linux-readprofile util-linux-uuidd \
-             util-linux-uuidgen util-linux-lscpu util-linux-fsck.cramfs util-linux-fsck \
-             util-linux-blkid util-linux-mkfs util-linux-mcookie util-linux-reset \
-             util-linux-lsblk util-linux-mkfs.cramfs util-linux-fstrim \
+             util-linux-uuidgen util-linux-lscpu util-linux-fsck util-linux-blkid \
+             util-linux-mkfs util-linux-mcookie util-linux-reset \
+             util-linux-mkfs.cramfs util-linux-fsck.cramfs util-linux-fstrim \
              util-linux-partx util-linux-hwclock util-linux-mountpoint \
-             util-linux-findfs util-linux-getopt util-linux-sulogin util-linux-prlimit \
-             util-linux-ionice util-linux-switch-root"
+             util-linux-findfs util-linux-getopt util-linux-sulogin"
 PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', 'util-linux-pylibmount', '', d)}"
-PACKAGES =+ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'util-linux-runuser util-linux-su', '', d)}"
+PACKAGES =+ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'util-linux-runuser', '', d)}"
 
 PACKAGES_DYNAMIC = "^util-linux-lib.*"
 
@@ -47,14 +44,13 @@ SHARED_EXTRA_OECONF = "--disable-use-tty-group \
                        --enable-raw --enable-reset --disable-login \
                        --disable-vipw --disable-newgrp --disable-chfn-chsh \
                        --enable-write --enable-mount \
-                       --enable-libuuid --enable-libblkid --enable-fsck \
-                       --disable-minix --disable-bfs --without-udev \
+                       --enable-libuuid --enable-libblkid --enable-fsck --without-udev \
                        usrsbin_execdir='${sbindir}' \
 "
 
 EXTRA_OECONF = "${SHARED_EXTRA_OECONF} --libdir=${base_libdir}"
 
-PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
+PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
 PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
 
 # Respect the systemd feature for uuidd
@@ -64,14 +60,14 @@ PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_u
 PACKAGECONFIG[libcap-ng] = "--enable-setpriv,--disable-setpriv,libcap-ng,"
 
 # Build python bindings for libmount
-PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python 
--disable-pylibmount,python3"
+PACKAGECONFIG[pylibmount] = "--with-python --enable-pylibmount,--without-python --disable-pylibmount,python"
 
 # Readline support
 PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
 
 FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
 
-FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
+FILES_${PN}-dev += "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.la"
 
 FILES_util-linux-agetty = "${base_sbindir}/agetty"
 FILES_util-linux-fdisk = "${base_sbindir}/fdisk.${BPN}"
@@ -86,21 +82,15 @@ FILES_util-linux-umount = "${base_bindir}/umount.${BPN}"
 FILES_util-linux-readprofile = "${sbindir}/readprofile.${BPN}"
 FILES_util-linux-uuidgen = "${bindir}/uuidgen"
 FILES_util-linux-uuidd = "${sbindir}/uuidd"
-FILES_util-linux-reset = "${base_bindir}/reset*"
+FILES_util-linux-reset = "${base_bindir}/reset"
 FILES_util-linux-partx = "${sbindir}/partx"
 FILES_util-linux-hwclock = "${base_sbindir}/hwclock.${BPN}"
 FILES_util-linux-findfs = "${sbindir}/findfs"
 FILES_util-linux-getopt = "${base_bindir}/getopt.${BPN}"
 FILES_util-linux-runuser = "${sbindir}/runuser"
-FILES_util-linux-prlimit = "${bindir}/prlimit"
-FILES_util-linux-ionice = "${bindir}/ionice"
-FILES_util-linux-su = "${bindir}/su.util-linux ${sysconfdir}/pam.d/su-l"
-CONFFILES_util-linux-su = "${sysconfdir}/pam.d/su-l"
-
-FILES_util-linux-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
-                               ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
-                               ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
-FILES_util-linux-lsblk = "${bindir}/lsblk"
+
+FILES_util-linux-pylibmount = "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.so \
+                               ${libdir}/${PYTHON_DIR}/dist-packages/libmount/__init__.*"
 FILES_util-linux-lscpu = "${bindir}/lscpu"
 
 FILES_util-linux-fsck = "${base_sbindir}/fsck*"
@@ -112,8 +102,6 @@ FILES_util-linux-mkfs.cramfs = "${sbindir}/mkfs.cramfs"
 FILES_util-linux-sulogin = "${base_sbindir}/sulogin*"
 FILES_util-linux-mountpoint = "${base_bindir}/mountpoint.${BPN}"
 
-FILES_util-linux-switch-root = "${base_sbindir}/switch_root.${BPN}"
-
 # Util-linux' blkid replaces the e2fsprogs one
 FILES_util-linux-blkid = "${base_sbindir}/blkid*"
 RCONFLICTS_util-linux-blkid = "e2fsprogs-blkid"
@@ -123,12 +111,11 @@ RREPLACES_util-linux-blkid = "e2fsprogs-blkid"
 RDEPENDS_util-linux-reset += "ncurses"
 
 RDEPENDS_util-linux-runuser += "libpam"
-RDEPENDS_util-linux-su += "libpam"
 
-RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup util-linux-sulogin 
util-linux-lsblk"
-RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'util-linux-runuser util-linux-su', '', 
d)}"
+RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup util-linux-sulogin"
+RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'util-linux-runuser', '', d)}"
 
-RRECOMMENDS_${PN} = "util-linux-fdisk util-linux-cfdisk util-linux-sfdisk util-linux-mount 
util-linux-readprofile util-linux-mkfs util-linux-mountpoint util-linux-prlimit util-linux-ionice 
util-linux-switch-root"
+RRECOMMENDS_${PN} = "util-linux-fdisk util-linux-cfdisk util-linux-sfdisk util-linux-mount 
util-linux-readprofile util-linux-mkfs util-linux-mountpoint"
 
 RRECOMMENDS_${PN}_class-native = ""
 RRECOMMENDS_${PN}_class-nativesdk = ""
@@ -159,7 +146,7 @@ do_install () {
        mkdir -p ${D}${base_bindir}
 
         sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
-        sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk fsck blkid 
blockdev fstrim sulogin switch_root nologin"
+        sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk fsck blkid 
blockdev fstrim sulogin switch_root"
         binprogs_a="dmesg getopt kill more umount mount login reset su mountpoint"
 
         if [ "${base_sbindir}" != "${sbindir}" ]; then
@@ -185,17 +172,11 @@ do_install () {
 
        rm -f ${D}${bindir}/chkdupexe
 
-       if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
+       if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
                install -d ${D}${sysconfdir}/pam.d
                install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
                install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
        fi
-       if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
-               # Required for "su -" aka "su --login" because
-               # otherwise it uses "other", which has "auth pam_deny.so"
-               # and thus prevents the operation.
-               ln -s su ${D}${sysconfdir}/pam.d/su-l
-       fi
 }
 
 # reset and nologin causes a conflict with ncurses-native and shadow-native
@@ -207,8 +188,8 @@ do_install_append_class-native () {
 ALTERNATIVE_PRIORITY = "80"
 
 ALTERNATIVE_${PN}  = "dmesg kill more mkswap blockdev pivot_root switch_root"
-ALTERNATIVE_${PN} += "hexdump last lastb logger mesg renice wall"
-ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject nologin"
+ALTERNATIVE_${PN} += "mkfs.minix hexdump last lastb logger mesg renice wall"
+ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject"
 
 ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
 ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
@@ -217,10 +198,10 @@ ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
 ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
 ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
 ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
+ALTERNATIVE_LINK_NAME[mkfs.minix] = "${base_sbindir}/mkfs.minix"
 ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
-ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
 
-ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 reset.1 
kill.1 libblkid.3 blkid.8 findfs.8 fsck.8 uuid.3 eject.1 logger.1"
+ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 reset.1 
kill.1 libblkid.3 blkid.8 findfs.8 fsck.8 uuid.3"
 
 ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
 ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
@@ -237,8 +218,6 @@ ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
 ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
 ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
 ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
-ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
-ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
 
 ALTERNATIVE_util-linux-hwclock = "hwclock"
 ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
@@ -266,7 +245,8 @@ ALTERNATIVE_util-linux-swaponoff = "swapoff swapon"
 ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
 ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
 
-ALTERNATIVE_util-linux-fsck = "fsck"
+ALTERNATIVE_util-linux-fsck = "fsck.minix fsck"
+ALTERNATIVE_LINK_NAME[fsck.minix] = "${base_sbindir}/fsck.minix"
 ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
 
 ALTERNATIVE_util-linux-blkid = "blkid"
@@ -288,12 +268,10 @@ ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
 BBCLASSEXTEND = "native nativesdk"
 
 python do_package_prepend () {
-    if '--enable-su' in d.getVar('EXTRA_OECONF').split():
-        d.appendVar(d.expand('ALTERNATIVE_${PN}'), ' su')
-        d.appendVar(d.expand('ALTERNATIVE_${PN}-doc'), ' su.1')
-
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', "su", d.expand('${base_bindir}/su'))
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', "su.1", d.expand('${mandir}/man1/su.1'))
+    if '--enable-su' in d.getVar('EXTRA_OECONF', True).split():
+        alt_name = "su"
+        d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('base_bindir', True), alt_name))
+        d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name)
 }
 
 python populate_packages_prepend() {
@@ -303,8 +281,7 @@ python populate_packages_prepend() {
                       extra_depends='', prepend=True, allow_links=True)
 }
 
-RDEPENDS_${PN}-bash-completion += "util-linux-lsblk"
-RDEPENDS_${PN}-ptest = "bash grep coreutils which util-linux-blkid util-linux-fsck btrfs-tools"
+RDEPENDS_${PN}-ptest = "bash"
 
 do_compile_ptest() {
     oe_runmake buildtest-TESTS
@@ -312,30 +289,23 @@ do_compile_ptest() {
 
 do_install_ptest() {
     mkdir -p ${D}${PTEST_PATH}/tests/ts
-    find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
-    find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
-    find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
-
-    cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/
+    find . -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
+    cp ${S}/tests/functions.sh ${D}${PTEST_PATH}/tests/
+    cp ${S}/tests/commands.sh ${D}${PTEST_PATH}/tests/
+    cp ${S}/tests/run.sh ${D}${PTEST_PATH}/tests/
     cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
-    cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
-    cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH}
-
-    # The original paths of executables to be tested point to a local folder containing
-    # the executables. We want to test the installed executables, not the local copies.
-    # So strip the paths, the executables will be located via "which"
-    sed  -i \
-         -e '/^TS_CMD/ s|$top_builddir/||g' \
-         -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \
-         ${D}${PTEST_PATH}/tests/commands.sh
-
-    # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]'
-    sed -i -e \
-        '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \
-         ${D}${PTEST_PATH}/tests/functions.sh
-
-    # "kill -L" behaves differently than "/bin/kill -L" so we need an additional fix
-    sed -i -e \
-         '/^TS_CMD_KILL/ s|kill|/bin/kill|g' \
-         ${D}${PTEST_PATH}/tests/commands.sh
+
+    list="bitops build-sys cal col colrm column dmesg fsck hexdump hwclock ipcs isosize login look md5 misc 
more namei paths schedutils script swapon tailf"
+    # The following tests are not installed  yet:
+    # blkid scsi_debug module dependent
+    # cramfs gcc dependent
+    # eject gcc dependent
+    # fdisk scsi_debug module and gcc dependent
+    # lscpu gcc dependant
+    # libmount uuidgen dependent
+    # mount gcc dependant
+    # partx blkid dependant
+    for d in $list; do
+        cp -pR ${S}/tests/ts/$d ${D}${PTEST_PATH}/tests/ts/
+    done
 }
diff --git a/meta/recipes-core/util-linux/util-linux/CVE-2016-5011.patch 
b/meta/recipes-core/util-linux/util-linux/CVE-2016-5011.patch
new file mode 100644
index 0000000..9571280
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/CVE-2016-5011.patch
@@ -0,0 +1,59 @@
+From 7164a1c34d18831ac61c6744ad14ce916d389b3f Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak redhat com>
+Date: Thu, 7 Jul 2016 14:22:41 +0200
+Subject: [PATCH] libblkid: ignore extended partition at zero offset
+
+If the extended partition starts at zero LBA then MBR is interpreted
+as EBR and all is recursively parsed... result is out-of-memory.
+
+ MBR --extended-partition--> EBR --> MBR --> ENB --> MBR ...
+
+Note that such PT is not possible to create by standard partitioning
+tools.
+
+Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1349536
+Signed-off-by: Karel Zak <kzak redhat com>
+
+Upstream-status: Backport
+CVE: CVE-2016-5011 patch 1
+Signed-off-by: Armin Kuster <akuster mvista com>
+
+---
+ libblkid/src/partitions/dos.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/libblkid/src/partitions/dos.c b/libblkid/src/partitions/dos.c
+index 9bba32f..e79f124 100644
+--- a/libblkid/src/partitions/dos.c
++++ b/libblkid/src/partitions/dos.c
+@@ -47,6 +47,12 @@ static int parse_dos_extended(blkid_probe pr, blkid_parttable tab,
+       int ct_nodata = 0;      /* count ext.partitions without data partitions */
+       int i;
+ 
++      DBG(LOWPROBE, ul_debug("parse EBR [start=%d, size=%d]", ex_start/ssf, ex_size/ssf));
++      if (ex_start == 0) {
++              DBG(LOWPROBE, ul_debug("Bad offset in primary extended partition -- ignore"));
++              return 0;
++      }
++
+       while (1) {
+               struct dos_partition *p, *p0;
+               uint32_t start, size;
+@@ -116,8 +122,12 @@ static int parse_dos_extended(blkid_probe pr, blkid_parttable tab,
+                       start = dos_partition_get_start(p) * ssf;
+                       size = dos_partition_get_size(p) * ssf;
+ 
+-                      if (size && is_extended(p))
+-                              break;
++                      if (size && is_extended(p)) {
++                              if (start == 0)
++                                      DBG(LOWPROBE, ul_debug("#%d: EBR link offset is zero -- ignore", i + 
1));
++                              else
++                                      break;
++                      }
+               }
+               if (i == 4)
+                       goto leave;
+-- 
+2.7.4
+
diff --git a/meta/recipes-core/util-linux/util-linux/CVE-2016-5011_p2.patch 
b/meta/recipes-core/util-linux/util-linux/CVE-2016-5011_p2.patch
new file mode 100644
index 0000000..9c6960f
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/CVE-2016-5011_p2.patch
@@ -0,0 +1,91 @@
+From 50d1594c2e6142a3b51d2143c74027480df082e0 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak redhat com>
+Date: Tue, 12 Jul 2016 13:34:54 +0200
+Subject: [PATCH] libblkid: avoid non-empty recursion in EBR
+
+This is extension to the patch 7164a1c34d18831ac61c6744ad14ce916d389b3f.
+
+We also need to detect non-empty recursion in the EBR chain. It's
+possible to create standard valid logical partitions and in the last one
+points back to the EBR chain. In this case all offsets will be non-empty.
+
+Unfortunately, it's valid to create logical partitions that are not in
+the "disk order" (sorted by start offset). So link somewhere back is
+valid, but this link cannot points to already existing partition
+(otherwise we will see recursion).
+
+This patch forces libblkid to ignore duplicate logical partitions, the
+duplicate chain segment is interpreted as non-data segment, after 100
+iterations with non-data segments it will break the loop -- no memory
+is allocated in this case by the loop.
+
+Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1349536
+References: http://seclists.org/oss-sec/2016/q3/40
+Signed-off-by: Karel Zak <kzak redhat com>
+
+Upstream-status: Backport
+CVE: CVE-2016-5011 patch 2
+Signed-off-by: Armin Kuster <akuster mvista com>
+
+---
+ libblkid/src/partitions/dos.c        |  7 +++++++
+ libblkid/src/partitions/partitions.c | 14 ++++++++++++++
+ libblkid/src/partitions/partitions.h |  2 ++
+ 3 files changed, 23 insertions(+)
+
+Index: util-linux-2.26.2/libblkid/src/partitions/dos.c
+===================================================================
+--- util-linux-2.26.2.orig/libblkid/src/partitions/dos.c
++++ util-linux-2.26.2/libblkid/src/partitions/dos.c
+@@ -105,6 +105,13 @@ static int parse_dos_extended(blkid_prob
+                                       continue;
+                       }
+ 
++                      /* Avoid recursive non-empty links, see ct_nodata counter */
++                      if (blkid_partlist_get_partition_by_start(ls, abs_start)) {
++                              DBG(LOWPROBE, ul_debug("#%d: EBR duplicate data partition [abs start=%u] -- 
ignore",
++                                                      i + 1, abs_start));
++                              continue;
++                      }
++
+                       par = blkid_partlist_add_partition(ls, tab, abs_start, size);
+                       if (!par)
+                               return -ENOMEM;
+Index: util-linux-2.26.2/libblkid/src/partitions/partitions.c
+===================================================================
+--- util-linux-2.26.2.orig/libblkid/src/partitions/partitions.c
++++ util-linux-2.26.2/libblkid/src/partitions/partitions.c
+@@ -940,6 +940,20 @@ blkid_partition blkid_partlist_get_parti
+       return &ls->parts[n];
+ }
+ 
++blkid_partition blkid_partlist_get_partition_by_start(blkid_partlist ls, uint64_t start)
++{
++      int i, nparts;
++      blkid_partition par;
++
++      nparts = blkid_partlist_numof_partitions(ls);
++      for (i = 0; i < nparts; i++) {
++              par = blkid_partlist_get_partition(ls, i);
++              if ((uint64_t) blkid_partition_get_start(par) == start)
++                      return par;
++      }
++      return NULL;
++}
++
+ /**
+  * blkid_partlist_get_partition_by_partno
+  * @ls: partitions list
+Index: util-linux-2.26.2/libblkid/src/partitions/partitions.h
+===================================================================
+--- util-linux-2.26.2.orig/libblkid/src/partitions/partitions.h
++++ util-linux-2.26.2/libblkid/src/partitions/partitions.h
+@@ -21,6 +21,8 @@ extern int blkid_partlist_increment_part
+ 
+ extern blkid_partition blkid_partlist_get_parent(blkid_partlist ls);
+ 
++extern blkid_partition blkid_partlist_get_partition_by_start(blkid_partlist ls, uint64_t start);
++
+ extern int blkid_partitions_do_subprobe(blkid_probe pr,
+                       blkid_partition parent, const struct blkid_idinfo *id);
+ 
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_unsupported_grep_opts.patch 
b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_grep_opts.patch
new file mode 100644
index 0000000..a0d5efa
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_grep_opts.patch
@@ -0,0 +1,57 @@
+Avoid unsupported grep options
+
+Signed-off-by: Tudor Florea <tudor florea enea com>
+Upstream-Status: Pending
+
+diff -ruN a/ts/ipcs/headers b/ts/ipcs/headers
+--- a/tests/ts/ipcs/headers    2013-09-04 11:03:36.118613250 +0200
++++ b/teste/ts/ipcs/headers    2013-09-04 11:03:27.906958437 +0200
+@@ -22,35 +22,35 @@
+ ts_init "$*"
+ 
+ ts_log "test: shm headers"
+-$TS_CMD_IPCS -m -t | grep --after-context=1 "^---"  >> $TS_OUTPUT
+-$TS_CMD_IPCS -m -p | grep --after-context=1 "^---"  >> $TS_OUTPUT
+-$TS_CMD_IPCS -m -c | grep --after-context=1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -m -t | grep -A 1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -m -p | grep -A 1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -m -c | grep -A 1 "^---"  >> $TS_OUTPUT
+ $TS_CMD_IPCS -m -l | grep "^---"  >> $TS_OUTPUT
+ $TS_CMD_IPCS -m -u | grep "^---"  >> $TS_OUTPUT
+ echo >> $TS_OUTPUT
+ 
+ ts_log "test: mesg headers"
+-$TS_CMD_IPCS -q -t | grep --after-context=1 "^---"  >> $TS_OUTPUT
+-$TS_CMD_IPCS -q -p | grep --after-context=1 "^---"  >> $TS_OUTPUT
+-$TS_CMD_IPCS -q -c | grep --after-context=1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -q -t | grep -A 1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -q -p | grep -A 1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -q -c | grep -A 1 "^---"  >> $TS_OUTPUT
+ $TS_CMD_IPCS -q -l | grep  "^---"  >> $TS_OUTPUT
+ $TS_CMD_IPCS -q -u | grep  "^---"  >> $TS_OUTPUT
+ echo >> $TS_OUTPUT
+ 
+ ts_log "test: sem headers"
+-$TS_CMD_IPCS -s -t | grep --after-context=1 "^---"  >> $TS_OUTPUT
+-$TS_CMD_IPCS -s -p | grep --after-context=1 "^---"  >> $TS_OUTPUT
+-$TS_CMD_IPCS -s -c | grep --after-context=1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -s -t | grep -A 1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -s -p | grep -A 1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -s -c | grep -A 1 "^---"  >> $TS_OUTPUT
+ $TS_CMD_IPCS -s -l | grep  "^---"  >> $TS_OUTPUT
+ $TS_CMD_IPCS -s -u | grep  "^---"  >> $TS_OUTPUT
+ echo >> $TS_OUTPUT
+ 
+ ts_log "test: all headers"
+-$TS_CMD_IPCS -a | grep --after-context=1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -a | grep -A 1 "^---"  >> $TS_OUTPUT
+ 
+-$TS_CMD_IPCS -a -t | grep --after-context=1 "^---"  >> $TS_OUTPUT
+-$TS_CMD_IPCS -a -p | grep --after-context=1 "^---"  >> $TS_OUTPUT
+-$TS_CMD_IPCS -a -c | grep --after-context=1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -a -t | grep -A 1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -a -p | grep -A 1 "^---"  >> $TS_OUTPUT
++$TS_CMD_IPCS -a -c | grep -A 1 "^---"  >> $TS_OUTPUT
+ $TS_CMD_IPCS -a -l | grep "^---"  >> $TS_OUTPUT
+ $TS_CMD_IPCS -a -u | grep "^---"  >> $TS_OUTPUT
+ 
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_unsupported_sleep_param.patch 
b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_sleep_param.patch
new file mode 100644
index 0000000..7a63a4e
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_sleep_param.patch
@@ -0,0 +1,20 @@
+Avoid unsupported sleep parameter
+
+Signed-off-by: Tudor Florea <tudor florea enea com>
+Upstream-Status: Pending
+
+diff -ruN a/simple b/simple
+--- a/tests/ts/tailf/simple    2015-11-12 11:34:49.971817130 +0200
++++ b/tests/ts/tailf/simple    2013-11-12 11:34:37.876325128 +0200
+@@ -27,9 +27,9 @@
+ 
+ $TS_CMD_TAILF $INPUT > $TS_OUTPUT 2>&1 &
+ 
+-sleep 0.5
++sleep 1
+ echo {0..9} >> $INPUT
+-sleep 0.5
++sleep 1
+ 
+ rm -f $INPUT
+ 
diff --git a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch 
b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
index 417ca1d..0eb8810 100644
--- a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
+++ b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
@@ -3,23 +3,16 @@ Display testname for subtest
 Signed-off-by: Tudor Florea <tudor florea enea com>
 Upstream-Status: Pending
 
----
- tests/functions.sh | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/functions.sh b/tests/functions.sh
-index 5246605..b24dc15 100644
---- a/tests/functions.sh
-+++ b/tests/functions.sh
-@@ -320,7 +320,7 @@ function ts_init_subtest {
- 
-       if [ "$TS_PARSABLE" != "yes" ]; then
-               [ $TS_NSUBTESTS -eq 1 ] && echo
--              printf "%16s: %-27s ..." "" "$TS_SUBNAME"
-+              printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_SUBNAME"
+diff -ruN a/functions.sh b/functions.sh
+--- a/tests/functions.sh       2015-11-12 21:32:02.434542124 +0100
++++ b/tests/functions.sh       2015-11-12 21:40:37.095317280 +0100
+@@ -297,7 +297,7 @@
+       if [ "$TS_PARALLEL" == "yes" ]; then
+               TS_TITLE=$(printf "%13s: %-30s ...\n%16s: %-27s ..." "$TS_COMPONENT" "$TS_DESC" "" 
"$TS_SUBNAME")
+       else
+-              TS_TITLE=$(printf "%16s: %-27s ..." "" "$TS_SUBNAME")
++               TS_TITLE=$(printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_SUBNAME")
+               echo -n "$TS_TITLE"
        fi
  }
- 
--- 
-2.8.3
 
diff --git a/meta/recipes-core/util-linux/util-linux/ptest.patch 
b/meta/recipes-core/util-linux/util-linux/ptest.patch
index 0537f7d..837f189 100644
--- a/meta/recipes-core/util-linux/util-linux/ptest.patch
+++ b/meta/recipes-core/util-linux/util-linux/ptest.patch
@@ -2,22 +2,16 @@ Define TESTS variable
 
 Signed-off-by: Tudor Florea <tudor florea enea com>
 Upstream-Status: Pending
----
- Makefile.am | 1 +
- 1 file changed, 1 insertion(+)
 
-diff --git a/Makefile.am b/Makefile.am
-index bbaccb1..7d5a6bb 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -48,6 +48,7 @@ systemdsystemunit_DATA =
+diff -ruN a/Makefile.am b/Makefile.am
+--- a/Makefile.am      2015-11-12 20:29:46.778396936 +0100
++++ b/Makefile.am      2015-11-12 20:32:24.342450279 +0100
+@@ -48,7 +48,7 @@
  dist_bashcompletion_DATA =
  check_PROGRAMS =
  dist_check_SCRIPTS =
+-TESTS =
 +TESTS = $(check_PROGRAMS)
  
  PATHFILES =
- 
--- 
-2.8.3
 
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-native.patch 
b/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
new file mode 100644
index 0000000..1f496de
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
@@ -0,0 +1,57 @@
+Support older hosts with latest util-linux-native
+
+mkostemp is not defined on older machines.  So we detect this and
+provide a define that uses mkstemp instead.
+
+O_CLOEXEC is not defined on older machines.  It is however defined
+in the 'c.h' header.  Fix up the users to include 'c.h'.
+
+fdisks/fdisksunlabel.c was modified to use qsort_r, however
+this is not defined on older hosts.  Revert:
+  commit c69bbca9c1f6645097bd20fe3a21f5a99a2a0698
+  fdisk: (sun): use ask API, remove global variable
+
+Upstream-Status: Inappropriate [other]
+Patches revert upstream changes in order to support older
+machines.
+
+Signed-off-by: Mark Hatle <mark hatle windriver com>
+Signed-off-by: Chen Qi <Qi Chen windriver com>
+---
+ configure.ac | 1 +
+ include/c.h  | 7 +++++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index eb3680b..93e015f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -318,6 +318,7 @@ AC_CHECK_FUNCS([ \
+       llseek \
+       lseek64 \
+       mempcpy \
++      mkostemp \
+       nanosleep \
+       open_memstream \
+       personality \
+diff --git a/include/c.h b/include/c.h
+index e423e8b..cf33b94 100644
+--- a/include/c.h
++++ b/include/c.h
+@@ -233,6 +233,13 @@ static inline int dirfd(DIR *d)
+ #endif
+ 
+ /*
++ * mkostemp replacement
++ */
++#ifndef HAVE_MKOSTEMP
++#define mkostemp(template, flags) mkstemp(template)
++#endif
++
++/*
+  * MAXHOSTNAMELEN replacement
+  */
+ static inline size_t get_hostname_max(void)
+-- 
+1.9.1
+
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-ng-2.16-mount_lock_path.patch 
b/meta/recipes-core/util-linux/util-linux/util-linux-ng-2.16-mount_lock_path.patch
new file mode 100644
index 0000000..5773d7e
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-ng-2.16-mount_lock_path.patch
@@ -0,0 +1,27 @@
+Upstream-Status: Inappropriate [embedded specific]
+
+The FHS indicates that /etc must be capable of being mounted R/O.
+
+The FHS also indicates that lock files belong in /var/lock, and /var must
+be R/W as soon as possible during boot.
+
+This patch moves the mtab lock file from the potentially R/O /etc, to the
+R/W /var/lock area.  This lock file is used when mounting disks and making
+other mount adjustments.  The _PATH_MOUNTED_TMP is not adjusted, as failing
+to write to this file does not cause any functional limitations.
+
+(Note, if /etc is R/O, then /etc/mtab should be a symlink to /proc/mounts)
+
+Signed-off-by: Mark Hatle <mark hatle windriver com>
+
+--- util-linux-ng-2.16/include/pathnames.h.orig
++++ util-linux-ng-2.16/include/pathnames.h
+@@ -90,7 +90,7 @@
+ # endif
+ #endif
+ 
+-#define _PATH_MOUNTED_LOCK    _PATH_MOUNTED "~"
++#define _PATH_MOUNTED_LOCK    "/var/lock/mtab~"
+ #define _PATH_MOUNTED_TMP     _PATH_MOUNTED ".tmp"
+ 
+ #ifndef _PATH_DEV
diff --git a/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch 
b/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
new file mode 100644
index 0000000..1b0ff79
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/uuid-test-error-api.patch
@@ -0,0 +1,92 @@
+This patch adds error() API implementation for non-glibc system C libs
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj khem gmail com>
+
+Index: util-linux-2.27.1/tests/helpers/test_uuidd.c
+===================================================================
+--- util-linux-2.27.1.orig/tests/helpers/test_uuidd.c
++++ util-linux-2.27.1/tests/helpers/test_uuidd.c
+@@ -23,7 +23,6 @@
+  *
+  *    make uuidd uuidgen localstatedir=/var
+  */
+-#include <error.h>
+ #include <libgen.h>
+ #include <pthread.h>
+ #include <stdio.h>
+@@ -39,6 +38,17 @@
+ #include "xalloc.h"
+ #include "strutils.h"
+ 
++#ifdef __GLIBC__
++#include <error.h>
++#else
++extern void (*error_print_progname)(void);
++extern unsigned int error_message_count;
++extern int error_one_per_line;
++
++void error(int, int, const char *, ...);
++void error_at_line(int, int, const char *, unsigned int, const char *, ...);
++#endif
++
+ #define LOG(level,args) if (loglev >= level) { fprintf args; }
+ 
+ size_t nprocesses = 4;
+@@ -257,6 +267,56 @@ static void object_dump(size_t idx, obje
+       fprintf(stderr, "}\n");
+ }
+ 
++#ifndef __GLIBC__
++extern char *__progname;
++
++void (*error_print_progname)(void) = 0;
++unsigned int error_message_count = 0;
++int error_one_per_line = 0;
++
++static void eprint(int status, int e, const char *file, unsigned int line, const char *fmt, va_list ap)
++{
++      if (file && error_one_per_line) {
++              static const char *oldfile;
++              static unsigned int oldline;
++              if (line == oldline && strcmp(file, oldfile) == 0)
++                      return;
++              oldfile = file;
++              oldline = line;
++      }
++      if (error_print_progname)
++              error_print_progname();
++      else
++              fprintf(stderr, "%s: ", __progname);
++      if (file)
++              fprintf(stderr, "%s:%u: ", file, line);
++      vfprintf(stderr, fmt, ap);
++      if (e)
++              fprintf(stderr, ": %s", strerror(e));
++      putc('\n', stderr);
++      fflush(stderr);
++      error_message_count++;
++      if (status)
++              exit(status);
++}
++
++void error(int status, int e, const char *fmt, ...)
++{
++      va_list ap;
++      va_start(ap,fmt);
++      eprint(status, e, 0, 0, fmt, ap);
++      va_end(ap);
++}
++
++void error_at_line(int status, int e, const char *file, unsigned int line, const char *fmt, ...)
++{
++      va_list ap;
++      va_start(ap,fmt);
++      eprint(status, e, file, line, fmt, ap);
++      va_end(ap);
++}
++#endif /* __GLIBC__ */
++
+ int main(int argc, char *argv[])
+ {
+       size_t i, nfailed = 0, nignored = 0;
diff --git a/meta/recipes-core/util-linux/util-linux_2.30.bb 
b/meta/recipes-core/util-linux/util-linux_2.27.1.bb
similarity index 54%
rename from meta/recipes-core/util-linux/util-linux_2.30.bb
rename to meta/recipes-core/util-linux/util-linux_2.27.1.bb
index 39449d9..5ad73c7 100644
--- a/meta/recipes-core/util-linux/util-linux_2.30.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.27.1.bb
@@ -1,23 +1,30 @@
-MAJOR_VERSION = "2.30"
+MAJOR_VERSION = "2.27"
 require util-linux.inc
 
 # To support older hosts, we need to patch and/or revert
 # some upstream changes.  Only do this for native packages.
 OLDHOST = ""
-OLDHOST_class-native = "file://util-linux-native-qsort.patch"
+OLDHOST_class-native = "file://util-linux-native.patch \
+                        file://util-linux-native-qsort.patch \
+                       "
 
-SRC_URI += "file://configure-sbindir.patch \
+SRC_URI += "file://util-linux-ng-2.16-mount_lock_path.patch \
+            file://configure-sbindir.patch \
             file://runuser.pamd \
             file://runuser-l.pamd \
             ${OLDHOST} \
             file://ptest.patch \
             file://run-ptest \
+            file://avoid_unsupported_sleep_param.patch \
+            file://avoid_unsupported_grep_opts.patch \
             file://display_testname_for_subtest.patch \
             file://avoid_parallel_tests.patch \
+            file://uuid-test-error-api.patch \
+            file://CVE-2016-5011.patch \
+            file://CVE-2016-5011_p2.patch \
 "
-SRC_URI_append_class-native = " file://no_getrandom.patch"
-SRC_URI[md5sum] = "eaa3429150268027908a1b8ae6ee9a62"
-SRC_URI[sha256sum] = "c208a4ff6906cb7f57940aa5bc3a6eed146e50a7cc0a092f52ef2ab65057a08d"
+SRC_URI[md5sum] = "3cd2698d1363a2c64091c2dadc974647"
+SRC_URI[sha256sum] = "0a818fcdede99aec43ffe6ca5b5388bff80d162f2f7bd4541dca94fecb87a290"
 
 CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]