Skip to contentSkip to conversation

util-linux: fix two CVEs

PATCH In review Joe Slater 2 participants 2 messages May 11, 2022 – May 12, 2022

lore
Share & tools
lore

Joe Slater

author
#0 lore raw

PATCH 1/1 util-linux: fix two CVEs

Advance to 2.38 to fix CVE-2021-3995 and CVE-2021-3996 by pulling that recipe from master. The first version on master to fix these was 2.37.4.

---
 ...d_2.36.2.bb => util-linux-libuuid_2.38.bb} |   2 +-
 meta/recipes-core/util-linux/util-linux.inc   |  18 ++-
 ...-tags-add-use-system-commands-option.patch |  35 -----
 ...RA_LTLIBRARIES-instead-of-noinst_LTL.patch |  49 -------
 .../util-linux/CVE-2021-37600.patch           |  38 -----
 .../util-linux/avoid_parallel_tests.patch     |  27 ++--
 .../util-linux/util-linux/ptest.patch         |  15 +-
 .../util-linux/util-linux/run-ptest           |  24 +---
 ...til-linux_2.36.2.bb => util-linux_2.38.bb} | 130 ++++++++----------
 9 files changed, 98 insertions(+), 240 deletions(-)
 rename meta/recipes-core/util-linux/{util-linux-libuuid_2.36.2.bb => util-linux-libuuid_2.38.bb} (95%)
 delete mode 100644 meta/recipes-core/util-linux/util-linux/0001-tabfiles-tags-add-use-system-commands-option.patch
 delete mode 100644 meta/recipes-core/util-linux/util-linux/Automake-use-EXTRA_LTLIBRARIES-instead-of-noinst_LTL.patch
 delete mode 100644 meta/recipes-core/util-linux/util-linux/CVE-2021-37600.patch
 rename meta/recipes-core/util-linux/{util-linux_2.36.2.bb => util-linux_2.38.bb} (77%)
meta/recipes-core/util-linux/util-linux-libuuid_2.38.bb renamed from meta/recipes-core/util-linux/util-linux-libuuid_2.36.2.bb +1 -1
similarity index 95%
rename from meta/recipes-core/util-linux/util-linux-libuuid_2.36.2.bb
rename to meta/recipes-core/util-linux/util-linux-libuuid_2.38.bb
index 9612c491cd..5d759aed94 100644
@@ -9,7 +9,7 @@ S = "${WORKDIR}/util-linux-${PV}"
 EXTRA_OECONF += "--disable-all-programs --enable-libuuid"
 LICENSE = "BSD-3-Clause"
 
-do_install_append() {
+do_install:append() {
 	rm -rf ${D}${datadir} ${D}${bindir} ${D}${base_bindir} ${D}${sbindir} ${D}${base_sbindir} ${D}${exec_prefix}/sbin
 }
 
meta/recipes-core/util-linux/util-linux.inc +8 -10
index 00b8777b8b..c9bddfb7a6 100644
@@ -6,11 +6,11 @@ disk partitioning, kernel message management, filesystem creation, and system lo
 
 SECTION = "base"
 
-LICENSE = "GPLv2+ & LGPLv2.1+ & BSD-3-Clause & BSD-4-Clause"
-LICENSE_${PN}-libblkid = "LGPLv2.1+"
-LICENSE_${PN}-libfdisk = "LGPLv2.1+"
-LICENSE_${PN}-libmount = "LGPLv2.1+"
-LICENSE_${PN}-libsmartcols = "LGPLv2.1+"
+LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & BSD-3-Clause & BSD-4-Clause"
+LICENSE:${PN}-libblkid = "LGPL-2.1-or-later"
+LICENSE:${PN}-libfdisk = "LGPL-2.1-or-later"
+LICENSE:${PN}-libmount = "LGPL-2.1-or-later"
+LICENSE:${PN}-libsmartcols = "LGPL-2.1-or-later"
 
 LIC_FILES_CHKSUM = "file://README.licensing;md5=0fd5c050c6187d2bf0a4492b7f4e33da \
                     file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
@@ -25,7 +25,7 @@ LIC_FILES_CHKSUM = "file://README.licensing;md5=0fd5c050c6187d2bf0a4492b7f4e33da
                     file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
 "
 
-FILESEXTRAPATHS_prepend := "${THISDIR}/util-linux:"
+FILESEXTRAPATHS:prepend := "${THISDIR}/util-linux:"
 MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
            file://configure-sbindir.patch \
@@ -35,8 +35,6 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
            file://run-ptest \
            file://display_testname_for_subtest.patch \
            file://avoid_parallel_tests.patch \
-           file://Automake-use-EXTRA_LTLIBRARIES-instead-of-noinst_LTL.patch \
-           file://CVE-2021-37600.patch \
-           file://0001-tabfiles-tags-add-use-system-commands-option.patch \
            "
-SRC_URI[sha256sum] = "f7516ba9d8689343594356f0e5e1a5f0da34adfbc89023437735872bb5024c5f"
+
+SRC_URI[sha256sum] = "6d111cbe4d55b336db2f1fbeffbc65b89908704c01136371d32aa9bec373eb64"
meta/recipes-core/util-linux/util-linux/0001-tabfiles-tags-add-use-system-commands-option.patch deleted +0 -35
deleted file mode 100644
index 9f5a3c2d02..0000000000
@@ -1,35 +0,0 @@
-From be3ecff8b1bc1de4d29ca6381ee9ab42e6c15947 Mon Sep 17 00:00:00 2001
-From: Mingli Yu <[email protected]>
-Date: Fri, 12 Nov 2021 15:33:53 +0800
-Subject: [PATCH] tabfiles-tags: add use-system-commands option
-
-Pass --use-system-commands option to make blkid command available
-Fixes:
- # ./ts/libmount/tabfiles-tags
- [snip]
- ./ts/libmount/../../functions.sh: line 652: /usr/lib64/util-linux/ptest/blkid: No such file or directory
- FAILED (libmount/tabfiles-tags)'
-
-Upstream-Status: Inappropriate [configuration specific]
-
-Signed-off-by: Mingli Yu <[email protected]>
----
- tests/ts/libmount/tabfiles-tags | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/ts/libmount/tabfiles-tags b/tests/ts/libmount/tabfiles-tags
-index 69b06a9..17176ef 100755
---- a/tests/ts/libmount/tabfiles-tags
-+++ b/tests/ts/libmount/tabfiles-tags
-@@ -4,7 +4,7 @@ TS_TOPDIR="${0%/*}/../.."
- TS_DESC="tags"
- 
- . $TS_TOPDIR/functions.sh
--ts_init "$*"
-+ts_init "$* --use-system-commands"
- 
- ts_skip_nonroot
- 
--- 
-2.17.1
-
meta/recipes-core/util-linux/util-linux/Automake-use-EXTRA_LTLIBRARIES-instead-of-noinst_LTL.patch deleted +0 -49

49 lines not on this page · raw message

meta/recipes-core/util-linux/util-linux/CVE-2021-37600.patch deleted +0 -38
deleted file mode 100644
index 11934eee8d..0000000000
@@ -1,38 +0,0 @@
-From 1c9143d0c1f979c3daf10e1c37b5b1e916c22a1c Mon Sep 17 00:00:00 2001
-From: Karel Zak <[email protected]>
-Date: Tue, 27 Jul 2021 11:58:31 +0200
-Subject: [PATCH] sys-utils/ipcutils: be careful when call calloc() for uint64
- nmembs
-
-Fix: https://github.com/karelzak/util-linux/issues/1395
-Signed-off-by: Karel Zak <[email protected]>
-
-CVE: CVE-2021-37600
-
-after version 2.37.1
-https://github.com/karelzak/util-linux.git 1c9143d0c1d...
-unmodified
-
-Upstream-Status: Backport
-
-Signed-off-by: Joe Slater <[email protected]>
----
- sys-utils/ipcutils.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c
-index e784c4d..18868cf 100644
---- a/sys-utils/ipcutils.c
-+++ b/sys-utils/ipcutils.c
-@@ -218,7 +218,7 @@ static void get_sem_elements(struct sem_data *p)
- {
- 	size_t i;
- 
--	if (!p || !p->sem_nsems || p->sem_perm.id < 0)
-+	if (!p || !p->sem_nsems || p->sem_nsems > SIZE_MAX || p->sem_perm.id < 0)
- 		return;
- 
- 	p->elements = xcalloc(p->sem_nsems, sizeof(struct sem_elem));
--- 
-2.7.4
-
meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch +18 -9
index 748b6ef096..f1cbdb3beb 100644
@@ -1,20 +1,29 @@
+From ee3c7812e1efa6719af68b994804f0e6caceabd8 Mon Sep 17 00:00:00 2001
+From: Tudor Florea <[email protected]>
+Date: Mon, 14 Jun 2021 14:00:31 +0200
+Subject: [PATCH] util-linux: Add ptest
+
 Ptest needs buildtest-TESTS and runtest-TESTS targets.
 serial-tests is required to generate those targets.
-Revert run.sh script accordingly to serialize running tests 
+Revert run.sh script accordingly to serialize running tests
 
 Signed-off-by: Tudor Florea  <[email protected]>
-Upstream-Status: Inappropriate 
+Upstream-Status: Inappropriate
+
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
 
-Index: util-linux-2.32/configure.ac
-===================================================================
---- util-linux-2.32.orig/configure.ac
-+++ util-linux-2.32/configure.ac
+diff --git a/configure.ac b/configure.ac
+index 5664f9f..075ef27 100644
+--- a/configure.ac
++++ b/configure.ac
 @@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4])
  dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
- dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
+ dnl the compiler (like LT_INIT) to avoid autoconf errors.
  AC_USE_SYSTEM_EXTENSIONS
--AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
-+AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
+-AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
++AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
  
  m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
  			    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
meta/recipes-core/util-linux/util-linux/ptest.patch +8 -7
index 0537f7d856..ba2bd3f6ac 100644
@@ -1,23 +1,24 @@
-Define TESTS variable
+From af073c13ef184ca75811df688e0a0a25827b36c3 Mon Sep 17 00:00:00 2001
+From: Tudor Florea <[email protected]>
+Date: Thu, 3 Dec 2015 04:08:00 +0100
+Subject: [PATCH] Define TESTS variable
 
 Signed-off-by: Tudor Florea <[email protected]>
 Upstream-Status: Pending
+
 ---
  Makefile.am | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/Makefile.am b/Makefile.am
-index bbaccb1..7d5a6bb 100644
+index 886598d..1cf4346 100644
 --- a/Makefile.am
 +++ b/Makefile.am
-@@ -48,6 +48,7 @@ systemdsystemunit_DATA =
+@@ -57,6 +57,7 @@ systemdsystemunit_DATA =
  dist_bashcompletion_DATA =
  check_PROGRAMS =
  dist_check_SCRIPTS =
 +TESTS = $(check_PROGRAMS)
  
  PATHFILES =
- 
--- 
-2.8.3
-
+ ADOCFILES_COMMON =
meta/recipes-core/util-linux/util-linux/run-ptest +4 -20
index e135ee583b..097107cd09 100644
@@ -13,31 +13,15 @@ current_path=$(readlink -f $0)
 export bindir=$(dirname $current_path)
 export PATH=$bindir/bin:$PATH
 
-cd tests || exit 1                                                          
+# losetup tests will be skipped and/or fail otherwise
+modprobe loop
 
-comps=$(find ts/ -type f -perm -111 -regex ".*/[^\.~]*" |  sort)
-
-
-echo
-echo "-------------------- util-linux regression tests --------------------"
-echo
-echo "                    For development purpose only.                    "
-echo "                 Don't execute on production system!                 "
-echo
-
-res=0
-count=0
-for ts in $comps; 
-do 
-   $ts | sed -u '{        
+./tests/run.sh --use-system-commands --parsable --show-diff | sed -u '{
       s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/                              
       s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/                
       s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/               
-   }' 
-done
-
+   }'
 
 if [ "x$UDEV_PID" != "x" ]; then
     /etc/init.d/udev start
 fi
-
meta/recipes-core/util-linux/util-linux_2.38.bb renamed from meta/recipes-core/util-linux/util-linux_2.36.2.bb +59 -71

254 lines not on this page · raw message

Signature · 1 line
2.35.1
#1 lore raw
Quoted 16 lines · Joe Slater

Advance to 2.38 to fix CVE-2021-3995 and CVE-2021-3996 by pulling that recipe from master. The first version on master to fix these was 2.37.4.

---
  ...d_2.36.2.bb => util-linux-libuuid_2.38.bb} |   2 +-
  meta/recipes-core/util-linux/util-linux.inc   |  18 ++-
  ...-tags-add-use-system-commands-option.patch |  35 -----
  ...RA_LTLIBRARIES-instead-of-noinst_LTL.patch |  49 -------
  .../util-linux/CVE-2021-37600.patch           |  38 -----
  .../util-linux/avoid_parallel_tests.patch     |  27 ++--
  .../util-linux/util-linux/ptest.patch         |  15 +-
  .../util-linux/util-linux/run-ptest           |  24 +---
  ...til-linux_2.36.2.bb => util-linux_2.38.bb} | 130 ++++++++----------
  9 files changed, 98 insertions(+), 240 deletions(-)
Quoted 7 lines

rename meta/recipes-core/util-linux/{util-linux-libuuid_2.36.2.bb => util-linux-libuuid_2.38.bb} (95%) delete mode 100644 meta/recipes-core/util-linux/util-linux/0001-tabfiles-tags-add-use-system-commands-option.patch delete mode 100644 meta/recipes-core/util-linux/util-linux/Automake-use-EXTRA_LTLIBRARIES-instead-of-noinst_LTL.patch delete mode 100644 meta/recipes-core/util-linux/util-linux/CVE-2021-37600.patch
rename meta/recipes-core/util-linux/{util-linux_2.36.2.bb => util-linux_2.38.bb} (77%)

...

Joe,

Hardknott is EOL so we'll do this in WR Linux only.

https://wiki.yoctoproject.org/wiki/Releases

Signature · 2 lines
# Randy MacLeod
# Wind River Linux