sync community patches

This commit is contained in:
fly_fzc 2024-06-06 11:52:08 +08:00
parent ef941698ab
commit b1adfad793
3 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 68459714838c8c0c2d34b6d658638f5d59298bc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Sun, 1 Oct 2023 13:57:12 +0200
Subject: [PATCH] include/c.h: add helpers for unaligned structure access
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
include/c.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/c.h b/include/c.h
index 752f568c5..224a8e54f 100644
--- a/include/c.h
+++ b/include/c.h
@@ -213,6 +213,14 @@
(type *)( (char *)__mptr - offsetof(type,member) );})
#endif
+#define read_unaligned_member(p, m) __extension__ ({ \
+ size_t offset = offsetof(__typeof__(* p), m); \
+ __typeof__(p->m) v; \
+ memcpy(&v, ((unsigned char *)p) + offset, sizeof(v)); \
+ v; })
+
+#define member_ptr(p, m) (((unsigned char *)p) + offsetof(__typeof__(*p), m))
+
#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
# ifdef HAVE___PROGNAME
extern char *__progname;
--
2.33.0

View File

@ -0,0 +1,50 @@
From 1ab5d84d66f144ef0a9d1ac9502a59a842466504 Mon Sep 17 00:00:00 2001
From: biubiuzy <294772273@qq.com>
Date: Wed, 17 Jan 2024 11:23:47 +0800
Subject: [PATCH] libblkid: (drbd) reduce false-positive
---
libblkid/src/superblocks/drbd.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/libblkid/src/superblocks/drbd.c b/libblkid/src/superblocks/drbd.c
index 1723229..410e21d 100644
--- a/libblkid/src/superblocks/drbd.c
+++ b/libblkid/src/superblocks/drbd.c
@@ -18,6 +18,13 @@
#include "superblocks.h"
+/*
+ * drbd/drbd_int.h
+ */
+#define BM_BLOCK_SHIFT 12 /* 4k per bit */
+#define BM_BLOCK_SIZE (1<<BM_BLOCK_SHIFT)
+
+
/*
* drbd/linux/drbd.h
*/
@@ -153,6 +160,9 @@ static int probe_drbd_84(blkid_probe pr)
be32_to_cpu(md->magic) != DRBD_MD_MAGIC_84_UNCLEAN)
return 1;
+ if (be32_to_cpu(read_unaligned_member(md, bm_bytes_per_bit)) != BM_BLOCK_SIZE)
+ return 1;
+
/*
* DRBD does not have "real" uuids; the following resembles DRBD's
* notion of uuids (64 bit, see struct above)
@@ -197,6 +197,9 @@ static int probe_drbd_90(blkid_probe pr)
if (be32_to_cpu(md->magic) != DRBD_MD_MAGIC_09)
return 1;
+ if (be32_to_cpu(read_unaligned_member(md, bm_bytes_per_bit)) != BM_BLOCK_SIZE)
+ return 1;
+
/*
* DRBD does not have "real" uuids; the following resembles DRBD's
* notion of uuids (64 bit, see struct above)
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: util-linux
Version: 2.35.2
Release: 16
Release: 17
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
@ -88,6 +88,8 @@ Patch6008: backport-wall-convert-homebrew-buffering-to-open_memstream.patch
Patch6009: backport-wall-use-fputs_careful.patch
Patch6010: backport-CVE-2024-28085.patch
Patch6011: backport-tests-fix-misc-setarch-run-in-a-docker-environment.patch
Patch6012: backport-include-c.h-add-helpers-for-unaligned-structure-acce.patch
Patch6013: backport-libblkid-drbd-reduce-false-positive.patch
Patch9000: Add-check-to-resolve-uname26-version-test-failed.patch
Patch9001: modify-rescuemode-chinese-error.patch
@ -439,6 +441,14 @@ fi
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
%changelog
* Thu Jun 06 2024 fuanan <fuanan3@h-partners.com> - 2.35.2-17
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:sync community patches
backport-include-c.h-add-helpers-for-unaligned-structure-acce.patch
backport-libblkid-drbd-reduce-false-positive.patch
* Fri Mar 29 2024 zhangyao<zhangyao108@huawei.com> - 2.35.2-16
- Type:CVE
- CVE:CVE-2024-28085