summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended
diff options
context:
space:
mode:
authorAshish Sharma <asharma@mvista.com>2023-09-27 20:08:09 +0530
committerSteve Sakoman <steve@sakoman.com>2023-10-04 05:17:50 -1000
commit15854dc716330aa102abda830da63d3e39cd64f6 (patch)
treed2bfe073048c05ec29ad87bc1434de6878547872 /meta/recipes-extended
parentf980ef9fec58217b4b743c0ee103d5957894676a (diff)
downloadpoky-15854dc716330aa102abda830da63d3e39cd64f6.tar.gz
mdadm: Backport fix for CVE-2023-28736
(From OE-Core rev: fb37fa3661095b8ebe68c2ffa36aabf35da30b91) Signed-off-by: Ashish Sharma <asharma@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r--meta/recipes-extended/mdadm/files/CVE-2023-28736.patch77
-rw-r--r--meta/recipes-extended/mdadm/mdadm_4.1.bb1
2 files changed, 78 insertions, 0 deletions
diff --git a/meta/recipes-extended/mdadm/files/CVE-2023-28736.patch b/meta/recipes-extended/mdadm/files/CVE-2023-28736.patch
new file mode 100644
index 0000000000..8e0a06cbc7
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/CVE-2023-28736.patch
@@ -0,0 +1,77 @@
1From ced5fa8b170ad448f4076e24a10c731b5cfb36ce Mon Sep 17 00:00:00 2001
2From: Blazej Kucman <blazej.kucman@intel.com>
3Date: Fri, 3 Dec 2021 15:31:15 +0100
4Subject: mdadm: block creation with long names
5
6This fixes buffer overflows in create_mddev(). It prohibits
7creation with not supported names for DDF and native. For IMSM,
8mdadm will do silent cut to 16 later.
9
10Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
11Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
12Signed-off-by: Jes Sorensen <jsorensen@fb.com>
13---
14
15Upstream-Status: Backport from [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/patch/?id=ced5fa8b170ad448f4076e24a10c731b5cfb36ce]
16CVE: CVE-2023-28736
17Signed-off-by: Ashish Sharma <asharma@mvista.com>
18
19 mdadm.8.in | 5 +++++
20 mdadm.c | 9 ++++++++-
21 mdadm.h | 5 +++++
22 3 files changed, 18 insertions(+), 1 deletion(-)
23
24diff --git a/mdadm.8.in b/mdadm.8.in
25index 28d773c2..68e100cb 100644
26--- a/mdadm.8.in
27+++ b/mdadm.8.in
28@@ -2186,6 +2186,11 @@ is run, but will be created by
29 .I udev
30 once the array becomes active.
31
32+The max length md-device name is limited to 32 characters.
33+Different metadata types have more strict limitation
34+(like IMSM where only 16 characters are allowed).
35+For that reason, long name could be truncated or rejected, it depends on metadata policy.
36+
37 As devices are added, they are checked to see if they contain RAID
38 superblocks or filesystems. They are also checked to see if the variance in
39 device size exceeds 1%.
40diff --git a/mdadm.c b/mdadm.c
41index 91e67467..26299b2e 100644
42--- a/mdadm.c
43+++ b/mdadm.c
44@@ -1359,9 +1359,16 @@ int main(int argc, char *argv[])
45 mdfd = open_mddev(devlist->devname, 1);
46 if (mdfd < 0)
47 exit(1);
48- } else
49+ } else {
50+ char *bname = basename(devlist->devname);
51+
52+ if (strlen(bname) > MD_NAME_MAX) {
53+ pr_err("Name %s is too long.\n", devlist->devname);
54+ exit(1);
55+ }
56 /* non-existent device is OK */
57 mdfd = open_mddev(devlist->devname, 0);
58+ }
59 if (mdfd == -2) {
60 pr_err("device %s exists but is not an md array.\n", devlist->devname);
61 exit(1);
62diff --git a/mdadm.h b/mdadm.h
63index 54567396..c7268a71 100644
64--- a/mdadm.h
65+++ b/mdadm.h
66@@ -1880,3 +1880,8 @@ enum r0layout {
67 #define INVALID_SECTORS 1
68 /* And another special number needed for --data_offset=variable */
69 #define VARIABLE_OFFSET 3
70+
71+/**
72+ * This is true for native and DDF, IMSM allows 16.
73+ */
74+#define MD_NAME_MAX 32
75--
76cgit
77
diff --git a/meta/recipes-extended/mdadm/mdadm_4.1.bb b/meta/recipes-extended/mdadm/mdadm_4.1.bb
index bb77759cf9..5238a41df2 100644
--- a/meta/recipes-extended/mdadm/mdadm_4.1.bb
+++ b/meta/recipes-extended/mdadm/mdadm_4.1.bb
@@ -24,6 +24,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
24 file://0001-mdadm-add-option-y-for-use-syslog-to-recive-event-re.patch \ 24 file://0001-mdadm-add-option-y-for-use-syslog-to-recive-event-re.patch \
25 file://include_sysmacros.patch \ 25 file://include_sysmacros.patch \
26 file://0001-mdadm-skip-test-11spare-migration.patch \ 26 file://0001-mdadm-skip-test-11spare-migration.patch \
27 file://CVE-2023-28736.patch \
27 " 28 "
28 29
29SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598" 30SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598"