From 7ea14a056e2ed2ae3b30ac0342e4775817950c6b Mon Sep 17 00:00:00 2001 From: liuh Date: Tue, 21 Oct 2025 20:21:04 +0800 Subject: [PATCH] hardlink: fix memory corruption in read buffers --- ...ix-memory-corruption-in-read-buffers.patch | 50 +++++++++++++++++++ util-linux.spec | 9 +++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 backport-hardlink-fix-memory-corruption-in-read-buffers.patch diff --git a/backport-hardlink-fix-memory-corruption-in-read-buffers.patch b/backport-hardlink-fix-memory-corruption-in-read-buffers.patch new file mode 100644 index 0000000..398d71d --- /dev/null +++ b/backport-hardlink-fix-memory-corruption-in-read-buffers.patch @@ -0,0 +1,50 @@ +From f036bc1d34385da7bcfb2d7815aa62eedef702c2 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 21 Oct 2025 20:18:12 +0800 +Subject: [PATCH] hardlink: fix memory corruption in read buffers + +--- + lib/fileeq.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/lib/fileeq.c b/lib/fileeq.c +index 2d5038c..c8669d0 100644 +--- a/lib/fileeq.c ++++ b/lib/fileeq.c +@@ -183,6 +183,13 @@ int ul_fileeq_init(struct ul_fileeq *eq, const char *method) + return 0; + } + ++static void reset_fileeq_bufs(struct ul_fileeq *eq) ++{ ++ free(eq->buf_a); ++ free(eq->buf_b); ++ eq->buf_last = eq->buf_a = eq->buf_b = NULL; ++} ++ + void ul_fileeq_deinit(struct ul_fileeq *eq) + { + if (!eq) +@@ -192,8 +199,7 @@ void ul_fileeq_deinit(struct ul_fileeq *eq) + #ifdef USE_FILEEQ_CRYPTOAPI + deinit_crypto_api(eq); + #endif +- free(eq->buf_a); +- free(eq->buf_b); ++ reset_fileeq_bufs(eq); + } + + void ul_fileeq_data_close_file(struct ul_fileeq_data *data) +@@ -281,6 +287,9 @@ size_t ul_fileeq_set_size(struct ul_fileeq *eq, uint64_t filesiz, + + DBG(EQ, ul_debugobj(eq, "set sizes: filesiz=%ju, maxblocks=%" PRIu64 ", readsiz=%zu", + eq->filesiz, eq->blocksmax, eq->readsiz)); ++ ++ reset_fileeq_bufs(eq); ++ + return eq->blocksmax; + } + +-- +2.43.0 + diff --git a/util-linux.spec b/util-linux.spec index be2f475..c13ef73 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -3,7 +3,7 @@ Name: util-linux Version: 2.40.4 -Release: 12 +Release: 13 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 @@ -51,6 +51,7 @@ Patch6029: backport-Update-bufflen.patch Patch6030: backport-libmount-verity-fix-deinitialization.patch Patch6031: backport-more-temporarily-ignore-stdin-when-waiting-for-stderr.patch Patch6032: backport-logger-fix-buffer-overflow-when-read-stdin.patch +Patch6033: backport-hardlink-fix-memory-corruption-in-read-buffers.patch Patch9000: SKIPPED-no-root-permissions-test.patch Patch9001: util-linux-Add-sw64-architecture.patch @@ -418,6 +419,12 @@ fi %endif %changelog +* Tue Oct 21 2025 liuh - 2.40.4-13 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:backport-hardlink-fix-memory-corruption-in-read-buffers.patch + * Tue Oct 21 2025 yanglongkang - 2.40.4-12 - Type:bugfix - CVE:NA -- Gitee