diff options
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r-- | meta/recipes-extended/mdadm/files/CVE-2023-28736.patch | 77 | ||||
-rw-r--r-- | meta/recipes-extended/mdadm/mdadm_4.1.bb | 1 |
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 @@ | |||
1 | From ced5fa8b170ad448f4076e24a10c731b5cfb36ce Mon Sep 17 00:00:00 2001 | ||
2 | From: Blazej Kucman <blazej.kucman@intel.com> | ||
3 | Date: Fri, 3 Dec 2021 15:31:15 +0100 | ||
4 | Subject: mdadm: block creation with long names | ||
5 | |||
6 | This fixes buffer overflows in create_mddev(). It prohibits | ||
7 | creation with not supported names for DDF and native. For IMSM, | ||
8 | mdadm will do silent cut to 16 later. | ||
9 | |||
10 | Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | ||
11 | Signed-off-by: Blazej Kucman <blazej.kucman@intel.com> | ||
12 | Signed-off-by: Jes Sorensen <jsorensen@fb.com> | ||
13 | --- | ||
14 | |||
15 | Upstream-Status: Backport from [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/patch/?id=ced5fa8b170ad448f4076e24a10c731b5cfb36ce] | ||
16 | CVE: CVE-2023-28736 | ||
17 | Signed-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 | |||
24 | diff --git a/mdadm.8.in b/mdadm.8.in | ||
25 | index 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%. | ||
40 | diff --git a/mdadm.c b/mdadm.c | ||
41 | index 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); | ||
62 | diff --git a/mdadm.h b/mdadm.h | ||
63 | index 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 | -- | ||
76 | cgit | ||
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 | ||
29 | SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598" | 30 | SRC_URI[md5sum] = "51bf3651bd73a06c413a2f964f299598" |