Compare commits

..

No commits in common. "91d74b1819d933908413b33e5347115518ac7e24" and "a76cd894f69987aca2d7352611e48ccc500667bf" have entirely different histories.

10 changed files with 1 additions and 490 deletions

View File

@ -1,51 +0,0 @@
From ddb558e87f96aac76c7d38701e61e89583d651a5 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 3 Feb 2025 11:29:44 +0100
Subject: [PATCH] dmesg: fix --notime use
The --notime command line option disables parsing of timestamps from
kmsg. This is a bug because the timestamps can be used for operations
other than just output. For example, they can be used for filters like
--since (dmesg --since '1 day ago' --notime).
Addresses: https://github.com/util-linux/util-linux/issues/3392
Signed-off-by: Karel Zak <kzak@redhat.com>
Reference:https://github.com/util-linux/util-linux/commit/ddb558e87f96aac76c7d38701e61e89583d651a5
Conflict:context adapt
---
sys-utils/dmesg.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 5c58010..3c883a8 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -752,11 +752,7 @@ static int get_next_syslog_record(struct dmesg_control *ctl,
if (*begin == '[' && (*(begin + 1) == ' ' ||
isdigit(*(begin + 1)))) {
- if (!is_timefmt(ctl, NONE))
- begin = parse_syslog_timestamp(begin + 1, &rec->tv);
- else
- begin = skip_item(begin, end, "]");
-
+ begin = parse_syslog_timestamp(begin + 1, &rec->tv);
if (begin < end && *begin == ' ')
begin++;
}
@@ -1205,10 +1201,7 @@ static int parse_kmsg_record(struct dmesg_control *ctl,
goto mesg;
/* C) timestamp */
- if (is_timefmt(ctl, NONE))
- p = skip_item(p, end, ",;");
- else
- p = parse_kmsg_timestamp(p, &rec->tv);
+ p = parse_kmsg_timestamp(p, &rec->tv);
if (LAST_KMSG_FIELD(p))
goto mesg;
--
2.33.0

View File

@ -1,59 +0,0 @@
From dfe1c4bc742ed3f53c06bb232ebc1f5fadd0881e Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 13 Jan 2025 11:26:06 +0100
Subject: [PATCH] libblkid: fix potential memory leaks
Addresses: https://github.com/util-linux/util-linux/pull/3356
Signed-off-by: Karel Zak <kzak@redhat.com>
Reference:https://github.com/util-linux/util-linux/commit/dfe1c4bc742ed3f53c06bb232ebc1f5fadd0881e
Conflict:NA
---
libblkid/src/save.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libblkid/src/save.c b/libblkid/src/save.c
index 1a617c07..295924e1 100644
--- a/libblkid/src/save.c
+++ b/libblkid/src/save.c
@@ -109,7 +109,8 @@ int blkid_flush_cache(blkid_cache cache)
&& errno != EEXIST) {
DBG(SAVE, ul_debug("can't create %s directory for cache file",
BLKID_RUNTIME_DIR));
- return 0;
+ ret = 0;
+ goto done;
}
}
@@ -117,7 +118,8 @@ int blkid_flush_cache(blkid_cache cache)
if (((ret = stat(filename, &st)) < 0 && errno != ENOENT) ||
(ret == 0 && access(filename, W_OK) < 0)) {
DBG(SAVE, ul_debug("can't write to cache file %s", filename));
- return 0;
+ ret = 0;
+ goto done;
}
/*
@@ -154,7 +156,7 @@ int blkid_flush_cache(blkid_cache cache)
if (!file) {
ret = errno;
- goto errout;
+ goto done;
}
list_for_each(p, &cache->bic_devs) {
@@ -201,7 +203,7 @@ int blkid_flush_cache(blkid_cache cache)
}
}
-errout:
+done:
free(tmp);
if (filename != cache->bic_filename)
free(filename);
--
2.33.0

View File

@ -1,26 +0,0 @@
From f2d35154e52052e315a193900157dc9a0e2f3fb9 Mon Sep 17 00:00:00 2001
From: Yunhui Cui <cuiyunhui@bytedance.com>
Date: Mon, 19 Feb 2024 17:34:17 +0800
Subject: [PATCH] lscpu: add RISC-V CPUTYPE support
Only after adding cpu type can print the remaining cpu information,
such as cacheinfo.
Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
Signed-off-by: yuanchicheng <chicheng.oerv@isrc.iscas.ac.cn>
---
sys-utils/lscpu-cputype.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys-utils/lscpu-cputype.c b/sys-utils/lscpu-cputype.c
index bcdf06e8db0..4ca3d353299 100644
--- a/sys-utils/lscpu-cputype.c
+++ b/sys-utils/lscpu-cputype.c
@@ -212,6 +212,7 @@
DEF_PAT_CPUTYPE( "family", PAT_FAMILY, family),
DEF_PAT_CPUTYPE( "features", PAT_FEATURES, flags), /* s390 */
DEF_PAT_CPUTYPE( "flags", PAT_FLAGS, flags), /* x86 */
+ DEF_PAT_CPUTYPE( "hart isa", PAT_ISA, isa), /* riscv */
DEF_PAT_CPUTYPE( "max thread id", PAT_MAX_THREAD_ID, mtid), /* s390 */
DEF_PAT_CPUTYPE( "model", PAT_MODEL, model),
DEF_PAT_CPUTYPE( "model name", PAT_MODEL_NAME, modelname),

View File

@ -1,37 +0,0 @@
From f5bd825b9c187000d621f65af08b23a945a6cad8 Mon Sep 17 00:00:00 2001
From: AntonMoryakov <ant.v.moryakov@gmail.com>
Date: Thu, 16 Jan 2025 19:24:20 +0300
Subject: [PATCH] setpriv.c: fix memory leak in parse_groups function
The static analyzer flagged a memory leak in the parse_groups function.
The memory allocated for 'buf' (via xstrdup) was not freed at the end
of the function, leading to a memory leak.
Changes:
- Added free(buf) at the end of the function to release allocated memory.
Triggers found by static analyzer Svace.
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Reference:https://github.com/util-linux/util-linux/commit/f5bd825b9c187000d621f65af08b23a945a6cad8
Conflict:NA
---
sys-utils/setpriv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 87299a10..90784554 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -448,7 +448,7 @@ static void parse_groups(struct privctx *opts, const char *str)
while ((c = strsep(&groups, ",")))
opts->groups[i++] = get_group(c, _("Invalid supplementary group id"));
- free(groups);
+ free(buf);
}
static void parse_pdeathsig(struct privctx *opts, const char *str)
--
2.33.0

View File

@ -1,52 +0,0 @@
From aa11f9a2e163a57455255b03a03bf841cbf5be72 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 16 Jan 2025 13:14:43 +0100
Subject: [PATCH] sulogin: fix POSIX locale use
In some cases, sulogin can set LC_CTYPE="POSIX" while retaining the
original LC_MESSAGES. In this scenario, the gettext() function may not
work as intended and sulogin returns "???" (for example for
ja_JP.UTF-8). GNU gettext FAQ:
This symptom occurs when the LC_CTYPE facet of the locale is not set;
then gettext() doesn't know which character set to use, and converts
all messages to ASCII, as far as possible.
Addresses: https://issues.redhat.com/browse/RHEL-56983
Addresses: https://github.com/util-linux/util-linux/issues/2185
Signed-off-by: Karel Zak <kzak@redhat.com>
Reference:https://github.com/util-linux/util-linux/commit/aa11f9a2e163a57455255b03a03bf841cbf5be72
Conflict:NA
---
login-utils/sulogin.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index d2241396..77fc5b20 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -313,6 +313,7 @@ static void tcinit(struct console *con)
}
setlocale(LC_CTYPE, "POSIX");
+ setlocale(LC_MESSAGES, "POSIX");
goto setattr;
}
#if defined(IUTF8) && defined(KDGKBMODE)
@@ -327,10 +328,12 @@ static void tcinit(struct console *con)
case K_XLATE:
default:
setlocale(LC_CTYPE, "POSIX");
+ setlocale(LC_MESSAGES, "POSIX");
break;
}
#else
setlocale(LC_CTYPE, "POSIX");
+ setlocale(LC_MESSAGES, "POSIX");
#endif
reset_virtual_console(tio, flags);
setattr:
--
2.33.0

View File

@ -1,41 +0,0 @@
From 0fabec8c7fda554b79327d8713352e7a07539895 Mon Sep 17 00:00:00 2001
From: AntonMoryakov <ant.v.moryakov@gmail.com>
Date: Tue, 14 Jan 2025 18:06:49 +0300
Subject: [PATCH] sys-utils: fix add NULL check for mnt_fs_get_target return
value
The static analyzer flagged a potential issue: the return value of
mnt_fs_get_target(fs) could be NULL, but it was dereferenced without
a check. This could lead to undefined behavior.
Added a NULL check before using the tgt pointer. If tgt is NULL,
the current iteration is skipped.
ChanChanges:
- Added if (!tgt) check before using tgt.
Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
Reference:https://github.com/util-linux/util-linux/commit/0fabec8c7fda554b79327d8713352e7a07539895
Conflict:NA
---
sys-utils/lsns.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
index 500bc013..93bbd758 100644
--- a/sys-utils/lsns.c
+++ b/sys-utils/lsns.c
@@ -1132,6 +1132,9 @@ static int nsfs_xasputs(char **str,
const char *tgt = mnt_fs_get_target(fs);
+ if(!tgt)
+ continue;
+
if (!*str)
xasprintf(str, "%s", tgt);
--
2.33.0

View File

@ -1,27 +0,0 @@
From 7e06d474b17b9b74aa8e4b8a42ab394c1f80b1fd Mon Sep 17 00:00:00 2001
From: xiovwx <xiovwx@gmail.com>
Date: Thu, 23 Jan 2025 11:06:27 +0000
Subject: [PATCH] whereis: avoid accessing uninitialized memory
Reference:https://github.com/util-linux/util-linux/commit/7e06d474b17b9b74aa8e4b8a42ab394c1f80b1fd
Conflict:NA
---
misc-utils/whereis.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index a35c1dff..b575e57a 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -471,7 +471,7 @@ static void findin(const char *dir, const char *pattern, int *count,
static void lookup(const char *pattern, struct wh_dirlist *ls, int want)
{
- char patbuf[PATH_MAX];
+ char patbuf[PATH_MAX] = { 0 };
int count = 0;
char *wait = NULL, *p;
--
2.33.0

View File

@ -1,108 +0,0 @@
From 2c6ce1240f118a2d00ad93060da409c3995b7f67 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 1 Apr 2025 15:54:07 +0200
Subject: [PATCH] mkfs.bfs: fix memory leaks and weak code
- use size_t to store strlen() result
- init superblock with the default volume and fsname
- don't use strdup(), it's unnecessary as getopt_long() does not
modify arguments
- don't use memcpy() as we need to check string sizes
- restrict verbose output 6 bytes
Addresses: https://github.com/util-linux/util-linux/pull/3488
Signed-off-by: Karel Zak <kzak@redhat.com>
---
disk-utils/mkfs.bfs.c | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/disk-utils/mkfs.bfs.c b/disk-utils/mkfs.bfs.c
index 895a1f27b..d18589ab2 100644
--- a/disk-utils/mkfs.bfs.c
+++ b/disk-utils/mkfs.bfs.c
@@ -103,7 +103,7 @@ static void __attribute__((__noreturn__)) usage(void)
int main(int argc, char **argv)
{
- char *device, *volume, *fsname;
+ char *device, *volume = NULL, *fsname = NULL;
char *lockmode = 0;
long inodes;
unsigned long long total_blocks, ino_bytes, ino_blocks, data_blocks;
@@ -111,12 +111,16 @@ int main(int argc, char **argv)
int verbose = 0;
int fd;
uint32_t first_block;
- struct bfssb sb;
struct bfsi ri;
struct bfsde de;
struct stat statbuf;
time_t now;
- int c, i, len;
+ int c, i;
+ size_t len;
+ struct bfssb sb = {
+ .s_fsname = "\x20\x20\x20\x20\x20\x20",
+ .s_volume = "\x20\x20\x20\x20\x20\x20"
+ };
enum {
VERSION_OPTION = CHAR_MAX + 1,
@@ -145,7 +149,6 @@ int main(int argc, char **argv)
if (argc == 2 && !strcmp(argv[1], "-V"))
print_version(EXIT_SUCCESS);
- volume = fsname = " "; /* is there a default? */
inodes = 0;
while ((c = getopt_long(argc, argv, "N:V:F:vhcl", longopts, NULL)) != -1) {
@@ -155,17 +158,21 @@ int main(int argc, char **argv)
break;
case 'V':
+ if (volume)
+ errx(EXIT_FAILURE, _("more than one volume"));
len = strlen(optarg);
- if (len <= 0 || len > 6)
+ if (!len || len > sizeof(sb.s_volume))
errx(EXIT_FAILURE, _("volume name too long"));
- volume = xstrdup(optarg);
+ volume = optarg;
break;
case 'F':
+ if (fsname)
+ errx(EXIT_FAILURE, _("more than one fsname"));
len = strlen(optarg);
- if (len <= 0 || len > 6)
+ if (!len || len > sizeof(sb.s_fsname))
errx(EXIT_FAILURE, _("fsname name too long"));
- fsname = xstrdup(optarg);
+ fsname = optarg;
break;
case 'v':
@@ -260,13 +267,16 @@ int main(int argc, char **argv)
sb.s_start = cpu_to_le32(ino_bytes + sizeof(struct bfssb));
sb.s_end = cpu_to_le32(total_blocks * BFS_BLOCKSIZE - 1);
sb.s_from = sb.s_to = sb.s_backup_from = sb.s_backup_to = -1;
- memcpy(sb.s_fsname, fsname, 6);
- memcpy(sb.s_volume, volume, 6);
+
+ if (fsname)
+ str2memcpy(sb.s_fsname, fsname, sizeof(sb.s_fsname));
+ if (volume)
+ str2memcpy(sb.s_volume, volume, sizeof(sb.s_volume));
if (verbose) {
fprintf(stderr, _("Device: %s\n"), device);
- fprintf(stderr, _("Volume: <%-6s>\n"), volume);
- fprintf(stderr, _("FSname: <%-6s>\n"), fsname);
+ fprintf(stderr, _("Volume: <%.6s>\n"), sb.s_volume);
+ fprintf(stderr, _("FSname: <%.6s>\n"), sb.s_fsname);
fprintf(stderr, _("BlockSize: %d\n"), BFS_BLOCKSIZE);
if (ino_blocks == 1)
fprintf(stderr, _("Inodes: %ld (in 1 block)\n"),
--
2.20.1

View File

@ -1,39 +0,0 @@
From 0be7252a9227bf5f37d04d12c959cd317c0a0a18 Mon Sep 17 00:00:00 2001
From: "He, Xinzhe" <xzhe@linx-info.com>
Date: Wed, 12 Mar 2025 20:33:10 +0800
Subject: [PATCH] mount-fix-use-option-owner-mount-failed
Signed-off-by: He, Xinzhe <xzhe@linx-info.com>
---
libmount/src/context_mount.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index 50e4a62..4eaeb31 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -202,10 +202,6 @@ static int evaluate_permissions(struct libmnt_context *cxt)
*
* The old deprecated way is to use mnt_optstr_get_flags().
*/
- if (user_flags & (MNT_MS_OWNER | MNT_MS_GROUP))
- rc = mnt_optlist_remove_flags(ol,
- MNT_MS_OWNER | MNT_MS_GROUP, cxt->map_userspace);
-
if (!rc && (user_flags & MNT_MS_OWNER))
rc = mnt_optlist_insert_flags(ol,
MS_OWNERSECURE, cxt->map_linux,
@@ -226,6 +222,10 @@ static int evaluate_permissions(struct libmnt_context *cxt)
rc = mnt_optlist_insert_flags(ol, MS_SECURE, cxt->map_linux,
MNT_MS_USERS, cxt->map_userspace);
+ if (user_flags & (MNT_MS_OWNER | MNT_MS_GROUP))
+ rc = mnt_optlist_remove_flags(ol,
+ MNT_MS_OWNER | MNT_MS_GROUP, cxt->map_userspace);
+
DBG(CXT, ul_debugobj(cxt, "perms: superuser [rc=%d]", rc));
if (rc)
return rc;
--
2.43.0

View File

@ -3,7 +3,7 @@
Name: util-linux
Version: 2.39.1
Release: 21
Release: 16
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
@ -93,20 +93,11 @@ Patch6071: backport-lsmem-make-lsmem-to-check-for-the-nodes-more-robust.pat
Patch6072: backport-cfdisk-fix-possible-integer-overflow-coverity-scan.patch
Patch6073: backport-more-make-sure-we-have-data-on-stderr.patch
Patch6074: backport-libblkid-apfs-validate-checksums.patch
Patch6075: backport-lscpu-add-riscv-cputype-support.patch
Patch6076: backport-libblkid-fix-potential-memory-leaks.patch
Patch6077: backport-sys-utils-fix-add-NULL-check-for-mnt_fs_get_target-r.patch
Patch6078: backport-sulogin-fix-POSIX-locale-use.patch
Patch6079: backport-setpriv.c-fix-memory-leak-in-parse_groups-function.patch
Patch6080: backport-whereis-avoid-accessing-uninitialized-memory.patch
Patch6081: backport-dmesg-fix-notime-use.patch
Patch9000: SKIPPED-no-root-permissions-test.patch
Patch9001: util-linux-Add-sw64-architecture.patch
Patch9002: sfdisk-fix-crash-casued-by-out-of-bounds-access.patch
Patch9003: add-new-gmo-file.patch
Patch9004: mount-fix-use-option-owner-mount-failed.patch
Patch9005: mkfs.bfs-fix-memory-leaks-and-weak-code.patch
BuildRequires: audit-libs-devel >= 1.0.6 gettext-devel libselinux-devel ncurses-devel pam-devel zlib-devel popt-devel
BuildRequires: libutempter-devel systemd-devel systemd libuser-devel libcap-ng-devel python3-devel gcc autoconf automake
@ -483,46 +474,6 @@ fi
%endif
%changelog
* Fri Apr 18 2025 hugel <gengqihu2@h-partners.com> - 2.39.1-21
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:revert community patch
[del] backport-libblkid-fix-spurious-ext-superblock-checksum-mismat.patch
* Thu Mar 27 2025 zhangting <dev03303@linx-info.com> - 2.39.1-20
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fix an issue that mkfs.bfs fix memory leak
mkfs.bfs-fix-memory-leaks-and-weak-code.patch
* Tue Mar 25 2025 zhangyao <zhangyao108@huawei.com> - 2.39.1-19
- Type: bugfix
- CVE: NA
- SUG: NA
- DESC: backport community patches
[add] backport-libblkid-fix-spurious-ext-superblock-checksum-mismat.patch
backport-libblkid-fix-potential-memory-leaks.patch
backport-sys-utils-fix-add-NULL-check-for-mnt_fs_get_target-r.patch
backport-sulogin-fix-POSIX-locale-use.patch
backport-setpriv.c-fix-memory-leak-in-parse_groups-function.patch
backport-whereis-avoid-accessing-uninitialized-memory.patch
backport-dmesg-fix-notime-use.patch
* Wed Mar 12 2025 He, Xinzhe <dev03107@linx-info.com> - 2.39.1-18
- Type: bugfix
- CVE: NA
- SUG: NA
- DESC: fix use option "owner" mount failed
* Fri Feb 28 2025 yuanchicheng <chicheng.oerv@isrc.iscas.ac.cn> - 2.39.1-17
- Type: bugfix
- CVE: NA
- SUG: NA
- DESC: backport community patches
backport-lscpu-add-riscv-cputype-support.patch
* Mon Dec 16 2024 yanglongkang <yanglongkang@h-partners.com> - 2.39.1-16
- Type: bugfix
- CVE: NA