Sync community patches
(cherry picked from commit 0c076c6b8e45ffb530b27a96d1e1810a97c5e9ee)
This commit is contained in:
parent
68f1531685
commit
7256e99e59
@ -0,0 +1,26 @@
|
|||||||
|
From 6ff67988785af818b97a7175c8ca80f2ee2d039f Mon Sep 17 00:00:00 2001
|
||||||
|
From: csbo98 <boliu98@foxmail.com>
|
||||||
|
Date: Sun, 22 May 2022 14:47:13 +0800
|
||||||
|
Subject: [PATCH] Maybe there is a little mistake in do_taskset() function in
|
||||||
|
taskset.c. In the first call of sched_getaffinity(), if the call is failed we
|
||||||
|
should use err_affinity(ts->pid, 0) other than err_affinity(ts->pid, 1).
|
||||||
|
---
|
||||||
|
schedutils/taskset.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/schedutils/taskset.c b/schedutils/taskset.c
|
||||||
|
index 224cfbe23..0ab7d12e2 100644
|
||||||
|
--- a/schedutils/taskset.c
|
||||||
|
+++ b/schedutils/taskset.c
|
||||||
|
@@ -117,7 +117,7 @@ static void do_taskset(struct taskset *ts, size_t setsize, cpu_set_t *set)
|
||||||
|
/* read the current mask */
|
||||||
|
if (ts->pid) {
|
||||||
|
if (sched_getaffinity(ts->pid, ts->setsize, ts->set) < 0)
|
||||||
|
- err_affinity(ts->pid, 1);
|
||||||
|
+ err_affinity(ts->pid, 0);
|
||||||
|
print_affinity(ts, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
From ea459dcf95d0bb04c816b71d2b85fbcd8cfc5ee4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Thu, 17 Mar 2022 12:18:03 +0100
|
||||||
|
Subject: [PATCH] lib/path: make ul_path_read_buffer() more robust [coverity
|
||||||
|
scan]
|
||||||
|
|
||||||
|
Make sure we never call buf[rc - 1] for rc=0.
|
||||||
|
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
lib/path.c | 17 ++++++++++-------
|
||||||
|
1 file changed, 10 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/path.c b/lib/path.c
|
||||||
|
index 8a2b882fe4..20a3ea15d2 100644
|
||||||
|
--- a/lib/path.c
|
||||||
|
+++ b/lib/path.c
|
||||||
|
@@ -672,14 +672,17 @@ int ul_path_readf_string(struct path_cxt *pc, char **str, const char *path, ...)
|
||||||
|
int ul_path_read_buffer(struct path_cxt *pc, char *buf, size_t bufsz, const char *path)
|
||||||
|
{
|
||||||
|
int rc = ul_path_read(pc, buf, bufsz - 1, path);
|
||||||
|
- if (rc < 0)
|
||||||
|
- return rc;
|
||||||
|
|
||||||
|
- /* Remove tailing newline (usual in sysfs) */
|
||||||
|
- if (rc > 0 && *(buf + rc - 1) == '\n')
|
||||||
|
- buf[--rc] = '\0';
|
||||||
|
- else
|
||||||
|
- buf[rc - 1] = '\0';
|
||||||
|
+ if (rc == 0)
|
||||||
|
+ buf[0] = '\0';
|
||||||
|
+
|
||||||
|
+ else if (rc > 0) {
|
||||||
|
+ /* Remove tailing newline (usual in sysfs) */
|
||||||
|
+ if (*(buf + rc - 1) == '\n')
|
||||||
|
+ buf[--rc] = '\0';
|
||||||
|
+ else
|
||||||
|
+ buf[rc - 1] = '\0';
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
24
backport-libblkid-bsd-fix-buffer-pointer-use-fuzzing.patch
Normal file
24
backport-libblkid-bsd-fix-buffer-pointer-use-fuzzing.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 0a0630133055c3b3daa3072a3fd9944a1a149401 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Thu, 2 Jun 2022 16:02:54 +0200
|
||||||
|
Subject: [PATCH] libblkid: (bsd) fix buffer pointer use [fuzzing]
|
||||||
|
|
||||||
|
Reported-by: Thibault Guittet <tguittet@redhat.com>
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
libblkid/src/partitions/bsd.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/libblkid/src/partitions/bsd.c b/libblkid/src/partitions/bsd.c
|
||||||
|
index c74517334f..7a0b23195e 100644
|
||||||
|
--- a/libblkid/src/partitions/bsd.c
|
||||||
|
+++ b/libblkid/src/partitions/bsd.c
|
||||||
|
@@ -50,7 +50,7 @@ static int probe_bsd_pt(blkid_probe pr, const struct blkid_idmag *mag)
|
||||||
|
goto nothing;
|
||||||
|
}
|
||||||
|
|
||||||
|
- l = (struct bsd_disklabel *) data + BLKID_MAG_LASTOFFSET(mag);
|
||||||
|
+ l = (struct bsd_disklabel *) (data + BLKID_MAG_LASTOFFSET(mag));
|
||||||
|
|
||||||
|
ls = blkid_probe_get_partlist(pr);
|
||||||
|
if (!ls)
|
||||||
59
backport-libblkid-check-fsync-return-code.patch
Normal file
59
backport-libblkid-check-fsync-return-code.patch
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
From 133a0d70f637b4f4e4337811e452153b04f2bdcf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Tue, 19 Apr 2022 09:44:07 +0200
|
||||||
|
Subject: [PATCH] libblkid: check fsync() return code
|
||||||
|
|
||||||
|
Since 39f5af25982d8b0244000e92a9d0e0e6557d0e17 libblkid uses
|
||||||
|
O_NONBLOCK. Now it's more obvious that check fsync() (and close())
|
||||||
|
return value after write() is always a good idea ...
|
||||||
|
|
||||||
|
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2074486
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
libblkid/src/probe.c | 3 ++-
|
||||||
|
misc-utils/wipefs.c | 8 ++++++--
|
||||||
|
2 files changed, 8 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
|
||||||
|
index 80db524..3e8a7a0 100644
|
||||||
|
--- a/libblkid/src/probe.c
|
||||||
|
+++ b/libblkid/src/probe.c
|
||||||
|
@@ -1299,7 +1299,8 @@ int blkid_do_wipe(blkid_probe pr, int dryrun)
|
||||||
|
/* wipen on device */
|
||||||
|
if (write_all(fd, buf, len))
|
||||||
|
return -1;
|
||||||
|
- fsync(fd);
|
||||||
|
+ if (fsync(fd) != 0)
|
||||||
|
+ return -1;
|
||||||
|
pr->flags &= ~BLKID_FL_MODIF_BUFF; /* be paranoid */
|
||||||
|
|
||||||
|
return blkid_probe_step_back(pr);
|
||||||
|
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
|
||||||
|
index 78dc63e..f08a9ba 100644
|
||||||
|
--- a/misc-utils/wipefs.c
|
||||||
|
+++ b/misc-utils/wipefs.c
|
||||||
|
@@ -615,7 +615,9 @@ static int do_wipe(struct wipe_control *ctl)
|
||||||
|
if (need_force)
|
||||||
|
warnx(_("Use the --force option to force erase."));
|
||||||
|
|
||||||
|
- fsync(blkid_probe_get_fd(pr));
|
||||||
|
+ if (fsync(blkid_probe_get_fd(pr)) != 0)
|
||||||
|
+ err(EXIT_FAILURE, _("%s: cannot flush modified buffers"),
|
||||||
|
+ ctl->devname);
|
||||||
|
|
||||||
|
#ifdef BLKRRPART
|
||||||
|
if (reread && (mode & O_EXCL)) {
|
||||||
|
@@ -635,7 +637,9 @@ static int do_wipe(struct wipe_control *ctl)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- close(blkid_probe_get_fd(pr));
|
||||||
|
+ if (close(blkid_probe_get_fd(pr)) != 0)
|
||||||
|
+ err(EXIT_FAILURE, _("%s: close device failed"), ctl->devname);
|
||||||
|
+
|
||||||
|
blkid_free_probe(pr);
|
||||||
|
free(backup);
|
||||||
|
return 0;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
27
backport-libblkid-hfs-fix-label-use-fuzzing.patch
Normal file
27
backport-libblkid-hfs-fix-label-use-fuzzing.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From 74e48269ee9a15e230e25d0e3d2e50f5b0ba2b04 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Thu, 2 Jun 2022 16:02:54 +0200
|
||||||
|
Subject: [PATCH] libblkid: (hfs) fix label use [fuzzing]
|
||||||
|
|
||||||
|
Reported-by: Thibault Guittet <tguittet@redhat.com>
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
libblkid/src/superblocks/hfs.c | 5 ++++-
|
||||||
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/libblkid/src/superblocks/hfs.c b/libblkid/src/superblocks/hfs.c
|
||||||
|
index 9674b1481f..68cb30edbb 100644
|
||||||
|
--- a/libblkid/src/superblocks/hfs.c
|
||||||
|
+++ b/libblkid/src/superblocks/hfs.c
|
||||||
|
@@ -173,7 +173,10 @@ static int probe_hfs(blkid_probe pr, const struct blkid_idmag *mag)
|
||||||
|
|
||||||
|
hfs_set_uuid(pr, hfs->finder_info.id, sizeof(hfs->finder_info.id));
|
||||||
|
|
||||||
|
- blkid_probe_set_label(pr, hfs->label, hfs->label_len);
|
||||||
|
+ size = hfs->label_len;
|
||||||
|
+ if ((size_t) size > sizeof(hfs->label))
|
||||||
|
+ size = sizeof(hfs->label);
|
||||||
|
+ blkid_probe_set_label(pr, hfs->label, size);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
From 4e12fbca62be10b09503cecc7507757874043474 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Thu, 2 Jun 2022 16:02:54 +0200
|
||||||
|
Subject: [PATCH] libblkid: (mac) make sure block size is large enough
|
||||||
|
[fuzzing]
|
||||||
|
|
||||||
|
Reported-by: Thibault Guittet <tguittet@redhat.com>
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
libblkid/src/partitions/mac.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/libblkid/src/partitions/mac.c b/libblkid/src/partitions/mac.c
|
||||||
|
index 092d31d322..75a558b0a3 100644
|
||||||
|
--- a/libblkid/src/partitions/mac.c
|
||||||
|
+++ b/libblkid/src/partitions/mac.c
|
||||||
|
@@ -93,6 +93,8 @@ static int probe_mac_pt(blkid_probe pr,
|
||||||
|
}
|
||||||
|
|
||||||
|
block_size = be16_to_cpu(md->block_size);
|
||||||
|
+ if (block_size < sizeof(struct mac_partition))
|
||||||
|
+ goto nothing;
|
||||||
|
|
||||||
|
/* The partition map always begins at physical block 1,
|
||||||
|
* the second block on the disk.
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
From 106de261469e1001243d5b81ed895762fb34b2ba Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Thu, 2 Jun 2022 16:02:54 +0200
|
||||||
|
Subject: [PATCH] libblkid: (probe) fix size and offset overflows [fuzzing]
|
||||||
|
|
||||||
|
Reported-by: Thibault Guittet <tguittet@redhat.com>
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
libblkid/src/probe.c | 17 ++++++++++++++---
|
||||||
|
1 file changed, 14 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
|
||||||
|
index 06c25572be..fc638c9bbe 100644
|
||||||
|
--- a/libblkid/src/probe.c
|
||||||
|
+++ b/libblkid/src/probe.c
|
||||||
|
@@ -621,6 +621,11 @@ static int hide_buffer(blkid_probe pr, uint64_t off, uint64_t len)
|
||||||
|
struct list_head *p;
|
||||||
|
int ct = 0;
|
||||||
|
|
||||||
|
+ if (UINT64_MAX - len < off) {
|
||||||
|
+ DBG(BUFFER, ul_debug("\t hide-buffer overflow (ignore)"));
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
list_for_each(p, &pr->buffers) {
|
||||||
|
struct blkid_bufinfo *x =
|
||||||
|
list_entry(p, struct blkid_bufinfo, bufs);
|
||||||
|
@@ -656,14 +661,20 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr, uint64_t off, uint64_t len
|
||||||
|
DBG(BUFFER, ul_debug("\t>>>> off=%ju, real-off=%ju (probe <%ju..%ju>, len=%ju",
|
||||||
|
off, real_off, pr->off, pr->off + pr->size, len));
|
||||||
|
*/
|
||||||
|
-
|
||||||
|
if (pr->size == 0) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (len == 0 || (!S_ISCHR(pr->mode) && pr->off + pr->size < real_off + len)) {
|
||||||
|
- DBG(BUFFER, ul_debug("\t ignore: request out of probing area"));
|
||||||
|
+ if (UINT64_MAX - len < off || UINT64_MAX - len < real_off) {
|
||||||
|
+ DBG(BUFFER, ul_debug("\t read-buffer overflow (ignore)"));
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (len == 0
|
||||||
|
+ || (!S_ISCHR(pr->mode) && (pr->size < off || pr->size < len))
|
||||||
|
+ || (!S_ISCHR(pr->mode) && (pr->off + pr->size < real_off + len))) {
|
||||||
|
+ DBG(BUFFER, ul_debug("\t read-buffer out of probing area (ignore)"));
|
||||||
|
errno = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
ssFrom fbc09df31a1f89b02ae13b21c949728ad82f5713 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Thu, 17 Mar 2022 13:00:44 +0100
|
||||||
|
Subject: [PATCH] libmount: fix possible memory leak in
|
||||||
|
mnt_optstr_fix_secontext() [coverity scan]
|
||||||
|
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
libmount/src/optstr.c | 8 ++++++--
|
||||||
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
|
||||||
|
index 16800f5..97fd6da 100644
|
||||||
|
--- a/libmount/src/optstr.c
|
||||||
|
+++ b/libmount/src/optstr.c
|
||||||
|
@@ -908,12 +908,16 @@ int mnt_optstr_fix_secontext(char **optstr,
|
||||||
|
|
||||||
|
/* create a quoted string from the raw context */
|
||||||
|
sz = strlen((char *) raw);
|
||||||
|
- if (!sz)
|
||||||
|
+ if (!sz) {
|
||||||
|
+ freecon(raw);
|
||||||
|
return -EINVAL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
p = val = malloc(valsz + 3);
|
||||||
|
- if (!val)
|
||||||
|
+ if (!val) {
|
||||||
|
+ freecon(raw);
|
||||||
|
return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
*p++ = '"';
|
||||||
|
memcpy(p, raw, sz);
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
23
backport-losetup-fix-memory-leak-asan.patch
Normal file
23
backport-losetup-fix-memory-leak-asan.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
From 01dd2838b4f60888fc66ccb9aa0f44907d1851a4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Tue, 8 Mar 2022 13:06:45 +0100
|
||||||
|
Subject: [PATCH] losetup: fix memory leak [asan]
|
||||||
|
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
sys-utils/losetup.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
|
||||||
|
index 09c028b6b4..1d81b117ac 100644
|
||||||
|
--- a/sys-utils/losetup.c
|
||||||
|
+++ b/sys-utils/losetup.c
|
||||||
|
@@ -239,7 +239,7 @@ static int set_scols_data(struct loopdev_cxt *lc, struct libscols_line *ln)
|
||||||
|
p = loopcxt_get_device(lc);
|
||||||
|
break;
|
||||||
|
case COL_BACK_FILE:
|
||||||
|
- p = loopcxt_get_backing_file(lc);
|
||||||
|
+ np = loopcxt_get_backing_file(lc);
|
||||||
|
break;
|
||||||
|
case COL_OFFSET:
|
||||||
|
if (loopcxt_get_offset(lc, &x) == 0)
|
||||||
88
backport-lslogins-improve-prefixes-interpretation.patch
Normal file
88
backport-lslogins-improve-prefixes-interpretation.patch
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
From c51cba1e838ae7e36a843ec785543492bb8737cd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Tue, 7 Jun 2022 09:11:56 +0200
|
||||||
|
Subject: [PATCH] lslogins: improve prefixes interpretation
|
||||||
|
|
||||||
|
It seems that for example 'passwd --lock' uses two exclamation marks
|
||||||
|
in password field. It seems better to assume arbitrary number of '!'
|
||||||
|
and '*' prefixes.
|
||||||
|
|
||||||
|
The patch also makes description of the PWD-EMPTY output field more
|
||||||
|
explicit.
|
||||||
|
|
||||||
|
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2093166
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
login-utils/lslogins.c | 33 ++++++++++++++++++++++++++-------
|
||||||
|
1 file changed, 26 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
|
||||||
|
index 4a1c62fe9d..3646883e0e 100644
|
||||||
|
--- a/login-utils/lslogins.c
|
||||||
|
+++ b/login-utils/lslogins.c
|
||||||
|
@@ -226,7 +226,7 @@ static const struct lslogins_coldesc coldescs[] =
|
||||||
|
{
|
||||||
|
[COL_USER] = { "USER", N_("user name"), N_("Username"), 0.1, SCOLS_FL_NOEXTREMES },
|
||||||
|
[COL_UID] = { "UID", N_("user ID"), "UID", 1, SCOLS_FL_RIGHT},
|
||||||
|
- [COL_PWDEMPTY] = { "PWD-EMPTY", N_("password not required"), N_("Password not required"), 1, SCOLS_FL_RIGHT },
|
||||||
|
+ [COL_PWDEMPTY] = { "PWD-EMPTY", N_("password not defined"), N_("Password not required (empty)"), 1, SCOLS_FL_RIGHT },
|
||||||
|
[COL_PWDDENY] = { "PWD-DENY", N_("login by password disabled"), N_("Login by password disabled"), 1, SCOLS_FL_RIGHT },
|
||||||
|
[COL_PWDLOCK] = { "PWD-LOCK", N_("password defined, but locked"), N_("Password is locked"), 1, SCOLS_FL_RIGHT },
|
||||||
|
[COL_PWDMETHOD] = { "PWD-METHOD", N_("password encryption method"), N_("Password encryption method"), 0.1 },
|
||||||
|
@@ -823,23 +823,42 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c
|
||||||
|
break;
|
||||||
|
case COL_PWDEMPTY:
|
||||||
|
if (shadow) {
|
||||||
|
- if (!*shadow->sp_pwdp) /* '\0' */
|
||||||
|
+ const char *p = shadow->sp_pwdp;
|
||||||
|
+
|
||||||
|
+ while (p && (*p == '!' || *p == '*'))
|
||||||
|
+ p++;
|
||||||
|
+
|
||||||
|
+ if (!p || !*p)
|
||||||
|
user->pwd_empty = STATUS_TRUE;
|
||||||
|
} else
|
||||||
|
user->pwd_empty = STATUS_UNKNOWN;
|
||||||
|
break;
|
||||||
|
case COL_PWDDENY:
|
||||||
|
if (shadow) {
|
||||||
|
- if ((*shadow->sp_pwdp == '!' ||
|
||||||
|
- *shadow->sp_pwdp == '*') &&
|
||||||
|
- !valid_pwd(shadow->sp_pwdp + 1))
|
||||||
|
+ const char *p = shadow->sp_pwdp;
|
||||||
|
+
|
||||||
|
+ while (p && (*p == '!' || *p == '*'))
|
||||||
|
+ p++;
|
||||||
|
+
|
||||||
|
+ if (p && *p && p != shadow->sp_pwdp && !valid_pwd(p))
|
||||||
|
user->pwd_deny = STATUS_TRUE;
|
||||||
|
} else
|
||||||
|
user->pwd_deny = STATUS_UNKNOWN;
|
||||||
|
break;
|
||||||
|
case COL_PWDLOCK:
|
||||||
|
if (shadow) {
|
||||||
|
- if (*shadow->sp_pwdp == '!' && valid_pwd(shadow->sp_pwdp + 1))
|
||||||
|
+ const char *p = shadow->sp_pwdp;
|
||||||
|
+ int i = 0;
|
||||||
|
+
|
||||||
|
+ /* 'passwd --lock' uses two exclamation marks,
|
||||||
|
+ * shadow(5) describes the lock as "field which
|
||||||
|
+ * starts with an exclamation mark". Let's
|
||||||
|
+ * support more '!' ...
|
||||||
|
+ */
|
||||||
|
+ while (p && *p == '!')
|
||||||
|
+ p++, i++;
|
||||||
|
+
|
||||||
|
+ if (i != 0 && (!*p || valid_pwd(p)))
|
||||||
|
user->pwd_lock = STATUS_TRUE;
|
||||||
|
} else
|
||||||
|
user->pwd_lock = STATUS_UNKNOWN;
|
||||||
|
@@ -848,7 +867,7 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c
|
||||||
|
if (shadow) {
|
||||||
|
const char *p = shadow->sp_pwdp;
|
||||||
|
|
||||||
|
- if (*p == '!' || *p == '*')
|
||||||
|
+ while (p && (*p == '!' || *p == '*'))
|
||||||
|
p++;
|
||||||
|
user->pwd_method = get_pwd_method(p, NULL, NULL);
|
||||||
|
} else
|
||||||
100
backport-lsns-fix-the-memory-leak.patch
Normal file
100
backport-lsns-fix-the-memory-leak.patch
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
From 395f3baed6df1eb736c872ecaa3aa2f05c5dc111 Mon Sep 17 00:00:00 2001
|
||||||
|
From: lishengyu <lishengyu@uniontech.com>
|
||||||
|
Date: Thu, 23 Jun 2022 14:02:49 +0800
|
||||||
|
Subject: [PATCH] lsns: fix the memory leak.
|
||||||
|
|
||||||
|
==28129== 96 bytes in 3 blocks are possibly lost in loss record 1 of 4
|
||||||
|
==28129== at 0x4837B65: calloc (vg_replace_malloc.c:752)
|
||||||
|
==28129== by 0x405C83: xcalloc (xalloc.h:60)
|
||||||
|
==28129== by 0x405C83: netnsid_cache_add (lsns.c:389)
|
||||||
|
==28129== by 0x405C83: get_netnsid (lsns.c:486)
|
||||||
|
==28129== by 0x405C83: read_process (lsns.c:549)
|
||||||
|
==28129== by 0x403FB4: read_processes (lsns.c:586)
|
||||||
|
==28129== by 0x403FB4: main (lsns.c:1417)
|
||||||
|
==28129==
|
||||||
|
==28129== 119,664 (384 direct, 119,280 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4
|
||||||
|
==28129== at 0x4837B65: calloc (vg_replace_malloc.c:752)
|
||||||
|
==28129== by 0x4055F5: xcalloc (xalloc.h:60)
|
||||||
|
==28129== by 0x4055F5: read_process (lsns.c:516)
|
||||||
|
==28129== by 0x403FB4: read_processes (lsns.c:586)
|
||||||
|
==28129== by 0x403FB4: main (lsns.c:1417)
|
||||||
|
---
|
||||||
|
include/list.h | 19 +++++++++++++++++++
|
||||||
|
sys-utils/lsns.c | 25 +++++++++++++++++++++++++
|
||||||
|
2 files changed, 44 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/list.h b/include/list.h
|
||||||
|
index 96c84e5..b6bbbdd 100644
|
||||||
|
--- a/include/list.h
|
||||||
|
+++ b/include/list.h
|
||||||
|
@@ -208,6 +208,25 @@ _INLINE_ void list_splice(struct list_head *list, struct list_head *head)
|
||||||
|
for (pos = (head)->next, pnext = pos->next; pos != (head); \
|
||||||
|
pos = pnext, pnext = pos->next)
|
||||||
|
|
||||||
|
+/**
|
||||||
|
+ * list_free - remove all entries from list and call freefunc()
|
||||||
|
+ * for each entry
|
||||||
|
+ * @head: the head for your list
|
||||||
|
+ * @type: the type of the struct this is embedded in.
|
||||||
|
+ * @member: the name of the list_struct within the struct.
|
||||||
|
+ * @freefunc: the list entry deallocator
|
||||||
|
+ */
|
||||||
|
+#define list_free(head, type, member, freefunc) \
|
||||||
|
+ do { \
|
||||||
|
+ struct list_head *__p, *__pnext; \
|
||||||
|
+ \
|
||||||
|
+ list_for_each_safe (__p, __pnext, (head)) { \
|
||||||
|
+ type *__elt = list_entry(__p, type, member); \
|
||||||
|
+ list_del(__p); \
|
||||||
|
+ freefunc(__elt); \
|
||||||
|
+ } \
|
||||||
|
+ } while (0)
|
||||||
|
+
|
||||||
|
_INLINE_ size_t list_count_entries(struct list_head *head)
|
||||||
|
{
|
||||||
|
struct list_head *pos;
|
||||||
|
diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
|
||||||
|
index 8e25ff1..baa80bd 100644
|
||||||
|
--- a/sys-utils/lsns.c
|
||||||
|
+++ b/sys-utils/lsns.c
|
||||||
|
@@ -953,6 +953,28 @@ static int show_namespace_processes(struct lsns *ls, struct lsns_namespace *ns)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void free_lsns_process(struct lsns_process *lsns_p)
|
||||||
|
+{
|
||||||
|
+ free(lsns_p);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void free_netnsid_caches(struct netnsid_cache *cache)
|
||||||
|
+{
|
||||||
|
+ free(cache);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void free_lsns_namespace(struct lsns_namespace *lsns_n)
|
||||||
|
+{
|
||||||
|
+ free(lsns_n);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void free_all(struct lsns *ls)
|
||||||
|
+{
|
||||||
|
+ list_free(&ls->processes, struct lsns_process, processes, free_lsns_process);
|
||||||
|
+ list_free(&netnsids_cache, struct netnsid_cache, netnsids, free_netnsid_caches);
|
||||||
|
+ list_free(&ls->namespaces, struct lsns_namespace, namespaces, free_lsns_namespace);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void __attribute__((__noreturn__)) usage(void)
|
||||||
|
{
|
||||||
|
FILE *out = stdout;
|
||||||
|
@@ -1162,5 +1184,8 @@ int main(int argc, char *argv[])
|
||||||
|
if (netlink_fd >= 0)
|
||||||
|
close(netlink_fd);
|
||||||
|
free_idcache(uid_cache);
|
||||||
|
+
|
||||||
|
+ free_all(&ls);
|
||||||
|
+
|
||||||
|
return r == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
From 9ae0289e8142097f4d3cf91bd4d1f2a5621914c7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Thu, 17 Mar 2022 11:22:29 +0100
|
||||||
|
Subject: [PATCH] partx: remove memory leak to make scanners happy [coverity
|
||||||
|
scan]
|
||||||
|
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
disk-utils/partx.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/disk-utils/partx.c b/disk-utils/partx.c
|
||||||
|
index 07b3e28b9e..76872907fe 100644
|
||||||
|
--- a/disk-utils/partx.c
|
||||||
|
+++ b/disk-utils/partx.c
|
||||||
|
@@ -1013,6 +1013,7 @@ int main(int argc, char **argv)
|
||||||
|
errx(EXIT_FAILURE, _("%s: partitioned loop devices unsupported"),
|
||||||
|
wholedisk);
|
||||||
|
assoc_loopdev(wholedisk);
|
||||||
|
+ free(wholedisk);
|
||||||
|
wholedisk = xstrdup(lc.device);
|
||||||
|
} else if (!S_ISBLK(x.st_mode))
|
||||||
|
errx(EXIT_FAILURE, _("%s: not a block device"), wholedisk);
|
||||||
|
@@ -1061,6 +1062,8 @@ int main(int argc, char **argv)
|
||||||
|
blkid_free_probe(pr);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ free(wholedisk);
|
||||||
|
+
|
||||||
|
if (loopdev)
|
||||||
|
loopcxt_deinit(&lc);
|
||||||
|
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
From b383155ac6a94f14f5c661d2e4a62c1eef5b6e27 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Mon, 8 Nov 2021 14:01:55 +0100
|
||||||
|
Subject: [PATCH] sfdisk: fix typo in --move-data when check partition size
|
||||||
|
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
disk-utils/sfdisk.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
|
||||||
|
index b08c945..65256c8 100644
|
||||||
|
--- a/disk-utils/sfdisk.c
|
||||||
|
+++ b/disk-utils/sfdisk.c
|
||||||
|
@@ -418,7 +418,7 @@ static int move_partition_data(struct sfdisk *sf, size_t partno, struct fdisk_pa
|
||||||
|
warnx(_("failed to get start of the old partition; ignoring --move-data"));
|
||||||
|
else if (fdisk_partition_get_start(pa) == fdisk_partition_get_start(orig_pa))
|
||||||
|
warnx(_("start of the partition has not been moved; ignoring --move-data"));
|
||||||
|
- else if (fdisk_partition_get_size(orig_pa) < fdisk_partition_get_size(pa))
|
||||||
|
+ else if (fdisk_partition_get_size(orig_pa) > fdisk_partition_get_size(pa))
|
||||||
|
warnx(_("new partition is smaller than original; ignoring --move-data"));
|
||||||
|
else
|
||||||
|
ok = 1;
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Name: util-linux
|
Name: util-linux
|
||||||
Version: 2.37.2
|
Version: 2.37.2
|
||||||
Release: 10
|
Release: 11
|
||||||
Summary: A random collection of Linux utilities
|
Summary: A random collection of Linux utilities
|
||||||
License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain
|
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
|
URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
|
||||||
@ -38,6 +38,19 @@ Patch6016: backport-sfdisk-write-empty-label-also-when-only-ignored-part.pa
|
|||||||
Patch6017: backport-fstat-dir-itself.patch
|
Patch6017: backport-fstat-dir-itself.patch
|
||||||
Patch6018: backport-libblkid-src-topology-dm-close-redundant-write-file-.patch
|
Patch6018: backport-libblkid-src-topology-dm-close-redundant-write-file-.patch
|
||||||
Patch6019: backport-libblkid-topology-init-variables-for-DM.patch
|
Patch6019: backport-libblkid-topology-init-variables-for-DM.patch
|
||||||
|
Patch6020: backport-sfdisk-fix-typo-in-move-data-when-check-partition-size.patch
|
||||||
|
Patch6021: backport-losetup-fix-memory-leak-asan.patch
|
||||||
|
Patch6022: backport-partx-remove-memory-leak-to-make-scanners-happy-coverity-scan.patch
|
||||||
|
Patch6023: backport-lib-path-make-ul_path_read_buffer-more-robust-coverity-scan.patch
|
||||||
|
Patch6024: backport-libmount-fix-possible-memory-leak-in-mnt_optstr_fix_secontext-coverity-scan.patch
|
||||||
|
Patch6025: backport-libblkid-probe-fix-size-and-offset-overflows-fuzzing.patch
|
||||||
|
Patch6026: backport-lslogins-improve-prefixes-interpretation.patch
|
||||||
|
Patch6027: backport-lsns-fix-the-memory-leak.patch
|
||||||
|
Patch6028: backport-libblkid-check-fsync-return-code.patch
|
||||||
|
Patch6029: backport-libblkid-mac-make-sure-block-size-is-large-enough-fuzzing.patch
|
||||||
|
Patch6030: backport-libblkid-bsd-fix-buffer-pointer-use-fuzzing.patch
|
||||||
|
Patch6031: backport-libblkid-hfs-fix-label-use-fuzzing.patch
|
||||||
|
Patch6032: backport-Maybe-there-is-a-little-mistake-in-do_taskset-functi.patch
|
||||||
|
|
||||||
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
|
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
|
||||||
Patch9001: SKIPPED-no-root-permissions-test.patch
|
Patch9001: SKIPPED-no-root-permissions-test.patch
|
||||||
@ -409,6 +422,12 @@ fi
|
|||||||
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
|
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 8 2022 zhangyao<zhangyao108@hhuawei.com> - 2.37.2-11
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Sync community patches
|
||||||
|
|
||||||
* Wed Nov 2 2022 January <1398871225@qq.com> - 2.37.2-10
|
* Wed Nov 2 2022 January <1398871225@qq.com> - 2.37.2-10
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user