!85 [sync] PR-84: update version to 2.37.2

Merge pull request !85 from openeuler-sync-bot/sync-pr84-openEuler-22.03-LTS-Next-to-master
This commit is contained in:
openeuler-ci-bot 2021-12-29 03:26:30 +00:00 committed by Gitee
commit df2cd8f359
11 changed files with 13 additions and 688 deletions

View File

@ -1,12 +0,0 @@
diff -up util-linux-2.36/login-utils/login.c.kzak util-linux-2.36/login-utils/login.c
--- util-linux-2.36/login-utils/login.c.kzak 2020-07-23 14:13:26.777030764 +0200
+++ util-linux-2.36/login-utils/login.c 2020-07-23 14:11:22.793686983 +0200
@@ -585,7 +585,7 @@ static void log_lastlog(struct login_con
sa.sa_handler = SIG_IGN;
sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
- fd = open(_PATH_LASTLOG, O_RDWR, 0);
+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
if (fd < 0)
goto done;
offset = cxt->pwd->pw_uid * sizeof(ll);

View File

@ -1,34 +0,0 @@
From 72466ac801928c205604b99fe01f830809bda930 Mon Sep 17 00:00:00 2001
From: Liquor <lirui130@huawei.com>
Date: Thu, 17 Dec 2020 15:04:56 +0800
Subject: [PATCH] Add check to resolve uname26-version test failed
The uname command is modified in packages uname-build-checks,
but the uname26-version test case needs to use the uname -r query
result.As a result,the test fails.
So we add a judgment to check whether uname-build-checks is installed.
---
tests/ts/misc/setarch | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/ts/misc/setarch b/tests/ts/misc/setarch
index 7c99cca..25d02c1 100755
--- a/tests/ts/misc/setarch
+++ b/tests/ts/misc/setarch
@@ -77,7 +77,12 @@ ts_finalize_subtest "$finmsg"
# conditional subtest
if [ "$uname26_seems_supported" = "yes" ]; then
ts_init_subtest uname26-version
- tmp=$($TS_CMD_SETARCH $ARCH --uname-2.6 uname -r)
+ rpm -qa | grep -q "uname-build-checks"
+ if [ $? -eq 0 ]; then
+ tmp=$($TS_CMD_SETARCH $ARCH --uname-2.6 uname.bin -r)
+ else
+ tmp=$($TS_CMD_SETARCH $ARCH --uname-2.6 uname -r)
+ fi
if echo "$tmp" | grep -q "^2\.6\."; then
echo "kernel version changed to 2.6" >> $TS_OUTPUT
else
--
2.27.0

View File

@ -1,26 +0,0 @@
From b629f0e02c2ac6283012131404380acc56beb5e8 Mon Sep 17 00:00:00 2001
From: yang_zhuang_zhuang <yangzhuangzhuang1@huaweo.com>
Date: Mon, 2 Nov 2020 17:17:13 +0800
Subject: Do not excute Utmp testcases.
The compilation environment and test cases are vulnerable.As a result,the Utmp testcase fail to be compiled.Therefore,the Utmp testcases are commented out.
---
tests/commands.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/commands.sh b/tests/commands.sh
index 5f34452..ad3edb2 100644
--- a/tests/commands.sh
+++ b/tests/commands.sh
@@ -100,7 +100,7 @@ TS_CMD_SWAPOFF=${TS_CMD_SWAPOFF:-"${ts_commandsdir}swapoff"}
TS_CMD_SWAPON=${TS_CMD_SWAPON:-"${ts_commandsdir}swapon"}
TS_CMD_UL=${TS_CMD_UL-"${ts_commandsdir}ul"}
TS_CMD_UMOUNT=${TS_CMD_UMOUNT:-"${ts_commandsdir}umount"}
-TS_CMD_UTMPDUMP=${TS_CMD_UTMPDUMP-"${ts_commandsdir}utmpdump"}
+#TS_CMD_UTMPDUMP=${TS_CMD_UTMPDUMP-"${ts_commandsdir}utmpdump"}
TS_CMD_UUIDD=${TS_CMD_UUIDD-"${ts_commandsdir}uuidd"}
TS_CMD_UUIDGEN=${TS_CMD_UUIDGEN-"${ts_commandsdir}uuidgen"}
TS_CMD_UUIDPARSE=${TS_CMD_UUIDPARSE-"${ts_commandsdir}uuidparse"}
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From 1c9143d0c1f979c3daf10e1c37b5b1e916c22a1c Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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 e784c4dcb9..18868cfd38 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));

View File

@ -1,75 +0,0 @@
From e9131920485962f33bd32b492cb93078ee7a3c34 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 30 Sep 2020 11:37:09 +0200
Subject: [PATCH] libblkid: improve debug for /proc/partitions
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libblkid/src/devname.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c
index c58b784..8f2d89a 100644
--- a/libblkid/src/devname.c
+++ b/libblkid/src/devname.c
@@ -351,7 +351,7 @@ static void lvm_probe_all(blkid_cache cache, int only_if_new)
lv_name);
dev = lvm_get_devno(lvm_device);
sprintf(lvm_device, "%s/%s", vg_name, lv_name);
- DBG(DEVNAME, ul_debug("LVM dev %s: devno 0x%04X",
+ DBG(DEVNAME, ul_debug("Probe LVM dev %s: devno 0x%04X",
lvm_device,
(unsigned int) dev));
probe_one(cache, lvm_device, dev, BLKID_PRI_LVM,
@@ -383,7 +383,7 @@ evms_probe_all(blkid_cache cache, int only_if_new)
&ma, &mi, &sz, device) != 4)
continue;
- DBG(DEVNAME, ul_debug("Checking partition %s (%d, %d)",
+ DBG(DEVNAME, ul_debug("Probe EVMS partition %s (%d, %d)",
device, ma, mi));
probe_one(cache, device, makedev(ma, mi), BLKID_PRI_EVMS,
@@ -433,7 +433,7 @@ ubi_probe_all(blkid_cache cache, int only_if_new)
if (!S_ISCHR(st.st_mode) || !minor(dev))
continue;
- DBG(DEVNAME, ul_debug("UBI vol %s/%s: devno 0x%04X",
+ DBG(DEVNAME, ul_debug("Probe UBI vol %s/%s: devno 0x%04X",
*dirname, name, (int) dev));
probe_one(cache, name, dev, BLKID_PRI_UBI, only_if_new, 0);
}
@@ -506,7 +506,7 @@ static int probe_all(blkid_cache cache, int only_if_new)
/* probably partition, so check */
if (!iswhole[which]) {
- DBG(DEVNAME, ul_debug(" partition dev %s, devno 0x%04X",
+ DBG(DEVNAME, ul_debug(" Probe partition dev %s, devno 0x%04X",
ptname, (unsigned int) devs[which]));
if (sz > 1)
@@ -545,7 +545,7 @@ static int probe_all(blkid_cache cache, int only_if_new)
* check last as well.
*/
if (lens[last] && strncmp(ptnames[last], ptname, lens[last]) != 0) {
- DBG(DEVNAME, ul_debug(" whole dev %s, devno 0x%04X",
+ DBG(DEVNAME, ul_debug(" Probe whole dev %s, devno 0x%04X",
ptnames[last], (unsigned int) devs[last]));
probe_one(cache, ptnames[last], devs[last], 0,
only_if_new, 0);
@@ -555,8 +555,11 @@ static int probe_all(blkid_cache cache, int only_if_new)
}
/* Handle the last device if it wasn't partitioned */
- if (lens[which])
+ if (lens[which]) {
+ DBG(DEVNAME, ul_debug(" Probe whole dev %s, devno 0x%04X",
+ ptname, (unsigned int) devs[which]));
probe_one(cache, ptname, devs[which], 0, only_if_new, 0);
+ }
fclose(proc);
blkid_flush_cache(cache);
--
1.8.3.1

View File

@ -1,414 +0,0 @@
From 8d3f9430c59416e4c1eddc899578158a7a1ed414 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 7 Oct 2020 13:49:45 +0200
Subject: [PATCH] libblkid: use /sys to read all block devices
The old implementation uses /proc/partitions where devices are
filtered by kernel (missing devices with ext_range=1 and removable
devices).
The problem with the old implementation is whole-disk heuristic based
on device name, order of devices, etc.
The new implementation use the same code to read also removable
devices.
Addresses: https://github.com/karelzak/util-linux/issues/1151
Signed-off-by: Karel Zak <kzak@redhat.com>
---
lib/sysfs.c | 36 +++++---
libblkid/src/blkidP.h | 2 +-
libblkid/src/devname.c | 235 +++++++++++++++++++++----------------------------
3 files changed, 128 insertions(+), 145 deletions(-)
diff --git a/lib/sysfs.c b/lib/sysfs.c
index 5b4de2c..0c360ce 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -874,7 +874,7 @@ int sysfs_devname_is_hidden(const char *prefix, const char *name)
dev_t __sysfs_devname_to_devno(const char *prefix, const char *name, const char *parent)
{
char buf[PATH_MAX];
- char *_name = NULL; /* name as encoded in sysfs */
+ char *_name = NULL, *_parent = NULL; /* name as encoded in sysfs */
dev_t dev = 0;
int len;
@@ -901,19 +901,20 @@ dev_t __sysfs_devname_to_devno(const char *prefix, const char *name, const char
goto done;
sysfs_devname_dev_to_sys(_name);
- if (parent && strncmp("dm-", name, 3) != 0) {
- /*
- * Create path to /sys/block/<parent>/<name>/dev
- */
- char *_parent = strdup(parent);
-
+ if (parent) {
+ _parent = strdup(parent);
if (!_parent)
goto done;
+ }
+
+ if (parent && strncmp("dm-", name, 3) != 0) {
+ /*
+ * Create path to /sys/block/<parent>/<name>/dev
+ */
sysfs_devname_dev_to_sys(_parent);
len = snprintf(buf, sizeof(buf),
"%s" _PATH_SYS_BLOCK "/%s/%s/dev",
prefix, _parent, _name);
- free(_parent);
if (len < 0 || (size_t) len >= sizeof(buf))
goto done;
@@ -934,10 +935,22 @@ dev_t __sysfs_devname_to_devno(const char *prefix, const char *name, const char
goto done;
dev = read_devno(buf);
+ /*
+ * Read from /sys/block/<parent>/<partition>/dev
+ */
+ if (!dev && parent && startswith(name, parent)) {
+ len = snprintf(buf, sizeof(buf),
+ "%s" _PATH_SYS_BLOCK "/%s/%s/dev",
+ prefix, _parent, _name);
+ if (len < 0 || (size_t) len >= sizeof(buf))
+ goto done;
+ dev = read_devno(buf);
+ }
+
+ /*
+ * Read from /sys/block/<sysname>/device/dev
+ */
if (!dev) {
- /*
- * Read from /sys/block/<sysname>/device/dev
- */
len = snprintf(buf, sizeof(buf),
"%s" _PATH_SYS_BLOCK "/%s/device/dev",
prefix, _name);
@@ -947,6 +960,7 @@ dev_t __sysfs_devname_to_devno(const char *prefix, const char *name, const char
}
done:
free(_name);
+ free(_parent);
return dev;
}
diff --git a/libblkid/src/blkidP.h b/libblkid/src/blkidP.h
index 802a1b3..fe3736f 100644
--- a/libblkid/src/blkidP.h
+++ b/libblkid/src/blkidP.h
@@ -301,7 +301,7 @@ struct blkid_struct_cache
#define BLKID_PROBE_NONE 1
#define BLKID_ERR_IO 5
-#define BLKID_ERR_PROC 9
+#define BLKID_ERR_SYSFS 9
#define BLKID_ERR_MEM 12
#define BLKID_ERR_CACHE 14
#define BLKID_ERR_DEV 19
diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c
index 8f2d89a..4b9df5a 100644
--- a/libblkid/src/devname.c
+++ b/libblkid/src/devname.c
@@ -39,6 +39,7 @@
#include "canonicalize.h" /* $(top_srcdir)/include */
#include "pathnames.h"
#include "sysfs.h"
+#include "fileutils.h"
/*
* Find a dev struct in the cache by device name, if available.
@@ -442,178 +443,146 @@ ubi_probe_all(blkid_cache cache, int only_if_new)
}
/*
- * Read the device data for all available block devices in the system.
+ * This function uses /sys to read all block devices in way compatible with
+ * /proc/partitions (like the original libblkid implementation)
*/
-static int probe_all(blkid_cache cache, int only_if_new)
+static int
+sysfs_probe_all(blkid_cache cache, int only_if_new, int only_removable)
{
- FILE *proc;
- char line[1024];
- char ptname0[128 + 1], ptname1[128 + 1], *ptname = NULL;
- char *ptnames[2];
- dev_t devs[2] = { 0, 0 };
- int iswhole[2] = { 0, 0 };
- int ma, mi;
- unsigned long long sz;
- int lens[2] = { 0, 0 };
- int which = 0, last = 0;
- struct list_head *p, *pnext;
+ DIR *sysfs;
+ struct dirent *dev;
- ptnames[0] = ptname0;
- ptnames[1] = ptname1;
+ sysfs = opendir(_PATH_SYS_BLOCK);
+ if (!sysfs)
+ return -BLKID_ERR_SYSFS;
- if (!cache)
- return -BLKID_ERR_PARAM;
+ /* scan /sys/block */
+ while ((dev = xreaddir(sysfs))) {
+ DIR *dir = NULL;
+ dev_t devno;
+ size_t nparts = 0;
+ unsigned int maxparts = 0, removable = 0;
+ struct dirent *part;
+ struct path_cxt *pc = NULL;
+ uint64_t size = 0;
- if (cache->bic_flags & BLKID_BIC_FL_PROBED &&
- time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL)
- return 0;
+ DBG(DEVNAME, ul_debug("checking %s", dev->d_name));
- blkid_read_cache(cache);
- evms_probe_all(cache, only_if_new);
-#ifdef VG_DIR
- lvm_probe_all(cache, only_if_new);
-#endif
- ubi_probe_all(cache, only_if_new);
+ devno = sysfs_devname_to_devno(dev->d_name);
+ if (!devno)
+ goto next;
+ pc = ul_new_sysfs_path(devno, NULL, NULL);
+ if (!pc)
+ goto next;
+
+ if (ul_path_read_u64(pc, &size, "size") != 0)
+ size = 0;
+ if (ul_path_read_u32(pc, &removable, "removable") != 0)
+ removable = 0;
+
+ /* ingnore empty devices */
+ if (!size)
+ goto next;
+
+ /* accept removeable if only removable requested */
+ if (only_removable) {
+ if (!removable)
+ goto next;
+
+ /* emulate /proc/partitions
+ * -- ignore empty devices and non-partitionable removable devices */
+ } else {
+ if (ul_path_read_u32(pc, &maxparts, "ext_range") != 0)
+ maxparts = 0;
+ if (!maxparts && removable)
+ goto next;
+ }
- proc = fopen(PROC_PARTITIONS, "r" UL_CLOEXECSTR);
- if (!proc)
- return -BLKID_ERR_PROC;
+ DBG(DEVNAME, ul_debug("read device name %s", dev->d_name));
- while (fgets(line, sizeof(line), proc)) {
- last = which;
- which ^= 1;
- ptname = ptnames[which];
+ dir = ul_path_opendir(pc, NULL);
+ if (!dir)
+ goto next;
- if (sscanf(line, " %d %d %llu %128[^\n ]",
- &ma, &mi, &sz, ptname) != 4)
- continue;
- devs[which] = makedev(ma, mi);
-
- DBG(DEVNAME, ul_debug("read device name %s", ptname));
-
- /* Skip whole disk devs unless they have no partitions.
- * If base name of device has changed, also
- * check previous dev to see if it didn't have a partn.
- * heuristic: partition name ends in a digit, & partition
- * names contain whole device name as substring.
- *
- * Skip extended partitions.
- * heuristic: size is 1
- */
+ /* read /sys/block/<name>/ do get partitions */
+ while ((part = xreaddir(dir))) {
+ dev_t partno;
- lens[which] = strlen(ptname);
- iswhole[which] = sysfs_devno_is_wholedisk(devs[which]);
+ if (!sysfs_blkdev_is_partition_dirent(dir, part, dev->d_name))
+ continue;
- /* probably partition, so check */
- if (!iswhole[which]) {
- DBG(DEVNAME, ul_debug(" Probe partition dev %s, devno 0x%04X",
- ptname, (unsigned int) devs[which]));
+ /* ignore extended partitions
+ * -- recount size to blocks like /proc/partitions */
+ if (ul_path_readf_u64(pc, &size, "%s/size", part->d_name) == 0
+ && (size >> 1) == 1)
+ continue;
+ partno = __sysfs_devname_to_devno(NULL, part->d_name, dev->d_name);
+ if (!partno)
+ continue;
- if (sz > 1)
- probe_one(cache, ptname, devs[which], 0,
- only_if_new, 0);
- lens[which] = 0; /* mark as checked */
+ DBG(DEVNAME, ul_debug(" Probe partition dev %s, devno 0x%04X",
+ part->d_name, (unsigned int) partno));
+ nparts++;
+ probe_one(cache, part->d_name, partno, 0, only_if_new, 0);
}
- /*
- * If last was a whole disk and we just found a partition
- * on it, remove the whole-disk dev from the cache if
- * it exists.
- */
- if (lens[last] && iswhole[last]
- && !strncmp(ptnames[last], ptname, lens[last])) {
+ if (!nparts) {
+ /* add non-partitioned whole disk to cache */
+ DBG(DEVNAME, ul_debug(" Probe whole dev %s, devno 0x%04X",
+ dev->d_name, (unsigned int) devno));
+ probe_one(cache, dev->d_name, devno, 0, only_if_new, 0);
+ } else {
+ /* remove partitioned whole-disk from cache */
+ struct list_head *p, *pnext;
list_for_each_safe(p, pnext, &cache->bic_devs) {
- blkid_dev tmp;
-
- /* find blkid dev for the whole-disk devno */
- tmp = list_entry(p, struct blkid_struct_dev,
- bid_devs);
- if (tmp->bid_devno == devs[last]) {
- DBG(DEVNAME, ul_debug(" freeing %s",
- tmp->bid_name));
+ blkid_dev tmp = list_entry(p, struct blkid_struct_dev,
+ bid_devs);
+ if (tmp->bid_devno == devno) {
+ DBG(DEVNAME, ul_debug(" freeing %s", tmp->bid_name));
blkid_free_dev(tmp);
cache->bic_flags |= BLKID_BIC_FL_CHANGED;
break;
}
}
- lens[last] = 0; /* mark as checked */
- }
- /*
- * If last was not checked because it looked like a whole-disk
- * dev, and the device's base name has changed,
- * check last as well.
- */
- if (lens[last] && strncmp(ptnames[last], ptname, lens[last]) != 0) {
- DBG(DEVNAME, ul_debug(" Probe whole dev %s, devno 0x%04X",
- ptnames[last], (unsigned int) devs[last]));
- probe_one(cache, ptnames[last], devs[last], 0,
- only_if_new, 0);
-
- lens[last] = 0; /* mark as checked */
}
+ next:
+ if (dir)
+ closedir(dir);
+ if (pc)
+ ul_unref_path(pc);
}
- /* Handle the last device if it wasn't partitioned */
- if (lens[which]) {
- DBG(DEVNAME, ul_debug(" Probe whole dev %s, devno 0x%04X",
- ptname, (unsigned int) devs[which]));
- probe_one(cache, ptname, devs[which], 0, only_if_new, 0);
- }
-
- fclose(proc);
- blkid_flush_cache(cache);
+ closedir(sysfs);
return 0;
}
-/* Don't use it by default -- it's pretty slow (because cdroms, floppy, ...)
+/*
+ * Read the device data for all available block devices in the system.
*/
-static int probe_all_removable(blkid_cache cache)
+static int probe_all(blkid_cache cache, int only_if_new)
{
- struct path_cxt *pc;
- DIR *dir;
- struct dirent *d;
-
if (!cache)
return -BLKID_ERR_PARAM;
- dir = opendir(_PATH_SYS_BLOCK);
- if (!dir)
- return -BLKID_ERR_PROC;
-
- pc = ul_new_path(NULL);
+ if (cache->bic_flags & BLKID_BIC_FL_PROBED &&
+ time(NULL) - cache->bic_time < BLKID_PROBE_INTERVAL)
+ return 0;
- while((d = readdir(dir))) {
- int removable = 0;
- dev_t devno;
+ blkid_read_cache(cache);
-#ifdef _DIRENT_HAVE_D_TYPE
- if (d->d_type != DT_UNKNOWN && d->d_type != DT_LNK)
- continue;
+ evms_probe_all(cache, only_if_new);
+#ifdef VG_DIR
+ lvm_probe_all(cache, only_if_new);
#endif
- if (d->d_name[0] == '.' &&
- ((d->d_name[1] == 0) ||
- ((d->d_name[1] == '.') && (d->d_name[2] == 0))))
- continue;
-
- devno = sysfs_devname_to_devno(d->d_name);
- if (!devno)
- continue;
-
- if (sysfs_blkdev_init_path(pc, devno, NULL) == 0
- && ul_path_read_s32(pc, &removable, "removable") != 0)
- removable = 0;
+ ubi_probe_all(cache, only_if_new);
- if (removable)
- probe_one(cache, d->d_name, devno, 0, 0, 1);
- }
+ sysfs_probe_all(cache, only_if_new, 0);
- ul_unref_path(pc);
- closedir(dir);
+ blkid_flush_cache(cache);
return 0;
}
-
/**
* blkid_probe_all:
* @cache: cache handler
@@ -677,7 +646,7 @@ int blkid_probe_all_removable(blkid_cache cache)
int ret;
DBG(PROBE, ul_debug("Begin blkid_probe_all_removable()"));
- ret = probe_all_removable(cache);
+ ret = sysfs_probe_all(cache, 0, 1);
DBG(PROBE, ul_debug("End blkid_probe_all_removable() [rc=%d]", ret));
return ret;
}
--
1.8.3.1

View File

@ -1,22 +0,0 @@
From 9f03ad60e58f7bdcac6a1046471a3374550ee384 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 13 Aug 2020 10:12:01 +0200
Subject: [PATCH] libfdisk: make fdisk_partname() more robust
---
libfdisk/src/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libfdisk/src/utils.c b/libfdisk/src/utils.c
index 6056e7f1f..38ad23393 100644
--- a/libfdisk/src/utils.c
+++ b/libfdisk/src/utils.c
@@ -142,7 +142,7 @@ char *fdisk_partname(const char *dev, size_t partno)
/* devfs kludge - note: fdisk partition names are not supposed
to equal kernel names, so there is no reason to do this */
- if (strcmp(dev + w - 4, "disc") == 0) {
+ if (endswith(dev, "disc")) {
w -= 4;
p = "part";
}

View File

@ -1,66 +0,0 @@
From 72f783d0ea5297e3fab22a93574aa63f421c5f69 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 17 Aug 2020 16:33:59 +0200
Subject: [PATCH] libmount: fix tab parser for badly terminated lines
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libmount/src/tab_parse.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index fa2d31b81..329987bcb 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -481,7 +481,7 @@ static int is_terminated_by_blank(const char *str)
if (p == str)
return 1; /* only '\n' */
p--;
- while (p >= str && (*p == ' ' || *p == '\t'))
+ while (p > str && (*p == ' ' || *p == '\t'))
p--;
return *p == '\n' ? 1 : 0;
}
@@ -553,22 +553,16 @@ static int mnt_table_parse_next(struct libmnt_parser *pa,
pa->line++;
s = strchr(pa->buf, '\n');
if (!s) {
+ DBG(TAB, ul_debugobj(tb, "%s:%zu: no final newline",
+ pa->filename, pa->line));
+
/* Missing final newline? Otherwise an extremely */
/* long line - assume file was corrupted */
- if (feof(pa->f)) {
- DBG(TAB, ul_debugobj(tb,
- "%s: no final newline", pa->filename));
- s = strchr(pa->buf, '\0');
- } else {
- DBG(TAB, ul_debugobj(tb,
- "%s:%zu: missing newline at line",
- pa->filename, pa->line));
- goto err;
- }
- }
+ if (feof(pa->f))
+ s = memchr(pa->buf, '\0', pa->bufsiz);
/* comments parser */
- if (tb->comms
+ } else if (tb->comms
&& (tb->fmt == MNT_FMT_GUESS || tb->fmt == MNT_FMT_FSTAB)
&& is_comment_line(pa->buf)) {
do {
@@ -584,9 +578,11 @@ static int mnt_table_parse_next(struct libmnt_parser *pa,
}
+ if (!s)
+ goto err;
*s = '\0';
- if (--s >= pa->buf && *s == '\r')
- *s = '\0';
+ if (s > pa->buf && *(s - 1) == '\r')
+ *(--s) = '\0';
s = (char *) skip_blank(pa->buf);
} while (*s == '\0' || *s == '#');

Binary file not shown.

BIN
util-linux-2.37.2.tar.xz Normal file

Binary file not shown.

View File

@ -2,8 +2,8 @@
%global upstream_major 2.36
Name: util-linux
Version: 2.36.1
Release: 5
Version: 2.37.2
Release: 1
Summary: A random collection of Linux utilities
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
@ -35,15 +35,6 @@ Provides: /bin/dmesg /bin/kill /bin/more /bin/mount /bin/umount /sbin/blki
Provides: /sbin/blockdev /sbin/findfs /sbin/fsck /sbin/nologin
Obsoletes: eject <= 2.1.5 rfkill <= 0.5 util-linux-ng < 2.19 hardlink <= 1:1.3-9
Patch0: 2.36-login-lastlog-create.patch
Patch1: Do-not-excute-Utmp-testcases.patch
Patch2: backport-libfdisk-make-fdisk_partname-more-robust.patch
Patch3: backport-libmount-fix-tab-parser-for-badly-terminated-lines.patch
Patch4: backport-libblkid-improve-debug-for-proc-partitions.patch
Patch5: backport-libblkid-use-sys-to-read-all-block-devices.patch
Patch6000: backport-CVE-2021-37600.patch
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
%description
The util-linux package contains a random collection of files that
@ -301,7 +292,7 @@ fi
%ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog
%ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/mtab
%{_unitdir}/fstrim.*
%{_bindir}/{cal,chrt,col,colcrt,colrm,column,chmem,dmesg,eject,fallocate,fincore,findmnt,choom}
%{_bindir}/{cal,chrt,col,colcrt,colrm,column,chmem,dmesg,eject,fallocate,fincore,findmnt,choom,uclampset}
%{_bindir}/{flock,getopt,hexdump,ionice,ipcmk,ipcrm,ipcs,isosize,kill,last,lastb,logger,hardlink}
%{_bindir}/{look,lsblk,lscpu,lsipc,lslocks,lslogins,lsmem,lsns,mcookie,mesg,more,mountpoint}
%{_bindir}/{namei,nsenter,prlimit,raw,rename,renice,rev,script,scriptreplay,setarch,setpriv}
@ -369,11 +360,13 @@ fi
%{_libdir}/{libfdisk.so,libsmartcols.so,libuuid.so,libblkid.so,libmount.so}
%{_libdir}/pkgconfig/{fdisk.pc,smartcols.pc,uuid.pc,blkid.pc,mount.pc}
%files help -f %{name}-help.files
%files help
%exclude %{_datadir}/doc/util-linux/getopt/*
%{_datadir}/bash-completion/completions/*
%{_docdir}/%{name}/getopt-example.*
%doc README NEWS Documentation/deprecated.txt
%doc %attr(0644,-,-) misc-utils/getopt-*.{bash,tcsh}
%{_mandir}/man1/{chfn.1*,chsh.1*,cal.1*,chrt.1*,col.1*,colcrt.1*,colrm.1*,column.1*,dmesg.1*,eject.1*}
%{_mandir}/man1/{chfn.1*,chsh.1*,cal.1*,chrt.1*,col.1*,colcrt.1*,colrm.1*,column.1*,dmesg.1*,eject.1*,uclampset.1*}
%{_mandir}/man1/{fallocate.1*,fincore.1*,flock.1*,getopt.1*,hexdump.1*,ionice.1*,ipcmk.1*,ipcrm.1*,ipcs.1*}
%{_mandir}/man1/{kill.1*,last.1*,lastb.1*,logger.1*,login.1*,look.1*,lscpu.1*,lsipc.1*,lslogins.1*,lsmem.1*}
%{_mandir}/man1/{mcookie.1*,mesg.1*,more.1*,mountpoint.1*,namei.1*,nsenter.1*,prlimit.1*,rename.1*,renice.1*}
@ -391,6 +384,12 @@ fi
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
%changelog
* Mon Dec 27 2021 tianwei <tianwei12@huawei.com> - 2.37.2-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update version to 2.37.2
* Tue Aug 10 2021 shixuantong<shixuantong@huawei.com> - 2.36.1-5
- Type:CVE
- ID:CVE-2021-37600