diff options
| -rw-r--r-- | meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch | 174 | ||||
| -rw-r--r-- | meta/recipes-core/util-linux/util-linux_2.26.1.bb (renamed from meta/recipes-core/util-linux/util-linux_2.25.2.bb) | 15 |
2 files changed, 7 insertions, 182 deletions
diff --git a/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch b/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch deleted file mode 100644 index 5eaa08df63..0000000000 --- a/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch +++ /dev/null | |||
| @@ -1,174 +0,0 @@ | |||
| 1 | Upstream-Status: Backport | ||
| 2 | |||
| 3 | This patch is for CVE-2014-9114. | ||
| 4 | This patch should be removed once util-linux is upgraded to 2.26. | ||
| 5 | |||
| 6 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
| 7 | |||
| 8 | From 89e90ae7b2826110ea28c1c0eb8e7c56c3907bdc Mon Sep 17 00:00:00 2001 | ||
| 9 | From: Karel Zak <kzak@redhat.com> | ||
| 10 | Date: Thu, 27 Nov 2014 13:39:35 +0100 | ||
| 11 | Subject: [PATCH] libblkid: care about unsafe chars in cache | ||
| 12 | |||
| 13 | The high-level libblkid API uses /run/blkid/blkid.tab cache to | ||
| 14 | store probing results. The cache format is | ||
| 15 | |||
| 16 | <device NAME="value" ...>devname</device> | ||
| 17 | |||
| 18 | and unfortunately the cache code does not escape quotation marks: | ||
| 19 | |||
| 20 | # mkfs.ext4 -L 'AAA"BBB' | ||
| 21 | |||
| 22 | # cat /run/blkid/blkid.tab | ||
| 23 | ... | ||
| 24 | <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device> | ||
| 25 | |||
| 26 | such string is later incorrectly parsed and blkid(8) returns | ||
| 27 | nonsenses. And for use-cases like | ||
| 28 | |||
| 29 | # eval $(blkid -o export /dev/sdb1) | ||
| 30 | |||
| 31 | it's also insecure. | ||
| 32 | |||
| 33 | Note that mount, udevd and blkid -p are based on low-level libblkid | ||
| 34 | API, it bypass the cache and directly read data from the devices. | ||
| 35 | |||
| 36 | The current udevd upstream does not depend on blkid(8) output at all, | ||
| 37 | it's directly linked with the library and all unsafe chars are encoded by | ||
| 38 | \x<hex> notation. | ||
| 39 | |||
| 40 | # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1 | ||
| 41 | # udevadm info --export-db | grep LABEL | ||
| 42 | ... | ||
| 43 | E: ID_FS_LABEL=X__/tmp/foo___ | ||
| 44 | E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22 | ||
| 45 | |||
| 46 | Signed-off-by: Karel Zak <kzak@redhat.com> | ||
| 47 | --- | ||
| 48 | libblkid/src/read.c | 21 ++++++++++++++++++--- | ||
| 49 | libblkid/src/save.c | 22 +++++++++++++++++++++- | ||
| 50 | misc-utils/blkid.8 | 5 ++++- | ||
| 51 | misc-utils/blkid.c | 4 ++-- | ||
| 52 | 4 files changed, 45 insertions(+), 7 deletions(-) | ||
| 53 | |||
| 54 | diff --git a/libblkid/src/read.c b/libblkid/src/read.c | ||
| 55 | index 0e91c9c..81ab0df 100644 | ||
| 56 | --- a/libblkid/src/read.c | ||
| 57 | +++ b/libblkid/src/read.c | ||
| 58 | @@ -252,15 +252,30 @@ static int parse_token(char **name, char **value, char **cp) | ||
| 59 | *value = skip_over_blank(*value + 1); | ||
| 60 | |||
| 61 | if (**value == '"') { | ||
| 62 | - end = strchr(*value + 1, '"'); | ||
| 63 | - if (!end) { | ||
| 64 | + char *p = end = *value + 1; | ||
| 65 | + | ||
| 66 | + /* convert 'foo\"bar' to 'foo"bar' */ | ||
| 67 | + while (*p) { | ||
| 68 | + if (*p == '\\') { | ||
| 69 | + p++; | ||
| 70 | + *end = *p; | ||
| 71 | + } else { | ||
| 72 | + *end = *p; | ||
| 73 | + if (*p == '"') | ||
| 74 | + break; | ||
| 75 | + } | ||
| 76 | + p++; | ||
| 77 | + end++; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + if (*end != '"') { | ||
| 81 | DBG(READ, ul_debug("unbalanced quotes at: %s", *value)); | ||
| 82 | *cp = *value; | ||
| 83 | return -BLKID_ERR_CACHE; | ||
| 84 | } | ||
| 85 | (*value)++; | ||
| 86 | *end = '\0'; | ||
| 87 | - end++; | ||
| 88 | + end = ++p; | ||
| 89 | } else { | ||
| 90 | end = skip_over_word(*value); | ||
| 91 | if (*end) { | ||
| 92 | diff --git a/libblkid/src/save.c b/libblkid/src/save.c | ||
| 93 | index 8216f09..5e8bbee 100644 | ||
| 94 | --- a/libblkid/src/save.c | ||
| 95 | +++ b/libblkid/src/save.c | ||
| 96 | @@ -26,6 +26,21 @@ | ||
| 97 | |||
| 98 | #include "blkidP.h" | ||
| 99 | |||
| 100 | + | ||
| 101 | +static void save_quoted(const char *data, FILE *file) | ||
| 102 | +{ | ||
| 103 | + const char *p; | ||
| 104 | + | ||
| 105 | + fputc('"', file); | ||
| 106 | + for (p = data; p && *p; p++) { | ||
| 107 | + if ((unsigned char) *p == 0x22 || /* " */ | ||
| 108 | + (unsigned char) *p == 0x5c) /* \ */ | ||
| 109 | + fputc('\\', file); | ||
| 110 | + | ||
| 111 | + fputc(*p, file); | ||
| 112 | + } | ||
| 113 | + fputc('"', file); | ||
| 114 | +} | ||
| 115 | static int save_dev(blkid_dev dev, FILE *file) | ||
| 116 | { | ||
| 117 | struct list_head *p; | ||
| 118 | @@ -43,9 +58,14 @@ static int save_dev(blkid_dev dev, FILE *file) | ||
| 119 | |||
| 120 | if (dev->bid_pri) | ||
| 121 | fprintf(file, " PRI=\"%d\"", dev->bid_pri); | ||
| 122 | + | ||
| 123 | list_for_each(p, &dev->bid_tags) { | ||
| 124 | blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags); | ||
| 125 | - fprintf(file, " %s=\"%s\"", tag->bit_name,tag->bit_val); | ||
| 126 | + | ||
| 127 | + fputc(' ', file); /* space between tags */ | ||
| 128 | + fputs(tag->bit_name, file); /* tag NAME */ | ||
| 129 | + fputc('=', file); /* separator between NAME and VALUE */ | ||
| 130 | + save_quoted(tag->bit_val, file); /* tag "VALUE" */ | ||
| 131 | } | ||
| 132 | fprintf(file, ">%s</device>\n", dev->bid_name); | ||
| 133 | |||
| 134 | diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8 | ||
| 135 | index 156a14b..c95b833 100644 | ||
| 136 | --- a/misc-utils/blkid.8 | ||
| 137 | +++ b/misc-utils/blkid.8 | ||
| 138 | @@ -200,7 +200,10 @@ partitions. This output format is \fBDEPRECATED\fR. | ||
| 139 | .TP | ||
| 140 | .B export | ||
| 141 | print key=value pairs for easy import into the environment; this output format | ||
| 142 | -is automatically enabled when I/O Limits (\fB-i\fR option) are requested | ||
| 143 | +is automatically enabled when I/O Limits (\fB-i\fR option) are requested. | ||
| 144 | + | ||
| 145 | +The non-printing characters are encoded by ^ and M- notation and all | ||
| 146 | +potentially unsafe characters are escaped. | ||
| 147 | .RE | ||
| 148 | .TP | ||
| 149 | .BI \-O " offset" | ||
| 150 | diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c | ||
| 151 | index a6ca660..1bd8646 100644 | ||
| 152 | --- a/misc-utils/blkid.c | ||
| 153 | +++ b/misc-utils/blkid.c | ||
| 154 | @@ -306,7 +306,7 @@ static void print_value(int output, int num, const char *devname, | ||
| 155 | printf("DEVNAME=%s\n", devname); | ||
| 156 | fputs(name, stdout); | ||
| 157 | fputs("=", stdout); | ||
| 158 | - safe_print(value, valsz, NULL); | ||
| 159 | + safe_print(value, valsz, " \\\"'$`<>"); | ||
| 160 | fputs("\n", stdout); | ||
| 161 | |||
| 162 | } else { | ||
| 163 | @@ -315,7 +315,7 @@ static void print_value(int output, int num, const char *devname, | ||
| 164 | fputs(" ", stdout); | ||
| 165 | fputs(name, stdout); | ||
| 166 | fputs("=\"", stdout); | ||
| 167 | - safe_print(value, valsz, "\""); | ||
| 168 | + safe_print(value, valsz, "\"\\"); | ||
| 169 | fputs("\"", stdout); | ||
| 170 | } | ||
| 171 | } | ||
| 172 | -- | ||
| 173 | 1.9.1 | ||
| 174 | |||
diff --git a/meta/recipes-core/util-linux/util-linux_2.25.2.bb b/meta/recipes-core/util-linux/util-linux_2.26.1.bb index 0ff1e7cc64..58bc90dbbc 100644 --- a/meta/recipes-core/util-linux/util-linux_2.25.2.bb +++ b/meta/recipes-core/util-linux/util-linux_2.26.1.bb | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | MAJOR_VERSION = "2.25" | 1 | MAJOR_VERSION = "2.26" |
| 2 | require util-linux.inc | 2 | require util-linux.inc |
| 3 | PR = "r1" | ||
| 4 | 3 | ||
| 5 | # To support older hosts, we need to patch and/or revert | 4 | # To support older hosts, we need to patch and/or revert |
| 6 | # some upstream changes. Only do this for native packages. | 5 | # some upstream changes. Only do this for native packages. |
| @@ -14,18 +13,18 @@ SRC_URI += "file://util-linux-ng-replace-siginterrupt.patch \ | |||
| 14 | file://uclibc-__progname-conflict.patch \ | 13 | file://uclibc-__progname-conflict.patch \ |
| 15 | file://configure-sbindir.patch \ | 14 | file://configure-sbindir.patch \ |
| 16 | file://fix-parallel-build.patch \ | 15 | file://fix-parallel-build.patch \ |
| 17 | file://CVE-2014-9114.patch \ | ||
| 18 | ${OLDHOST} \ | 16 | ${OLDHOST} \ |
| 19 | " | 17 | " |
| 20 | 18 | SRC_URI[md5sum] = "2308850946766677f3fabe0685e85de8" | |
| 21 | SRC_URI[md5sum] = "cab3d7be354000f629bc601238b629b3" | 19 | SRC_URI[sha256sum] = "22dc1c957262e2cbdfb4d524a63d5cd4f219d3ac9b5eab570fc771076799bb6e" |
| 22 | SRC_URI[sha256sum] = "e0457f715b73f4a349e1acb08cb410bf0edc9a74a3f75c357070f31f70e33cd6" | ||
| 23 | 20 | ||
| 24 | CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms" | 21 | CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms" |
| 25 | 22 | ||
| 26 | EXTRA_OECONF_class-native = "${SHARED_EXTRA_OECONF} \ | 23 | EXTRA_OECONF_class-native = "${SHARED_EXTRA_OECONF} \ |
| 27 | --disable-fallocate --disable-use-tty-group \ | 24 | --disable-fallocate \ |
| 25 | --disable-use-tty-group \ | ||
| 28 | " | 26 | " |
| 29 | EXTRA_OECONF_class-nativesdk = "${SHARED_EXTRA_OECONF} \ | 27 | EXTRA_OECONF_class-nativesdk = "${SHARED_EXTRA_OECONF} \ |
| 30 | --disable-fallocate --disable-use-tty-group \ | 28 | --disable-fallocate \ |
| 29 | --disable-use-tty-group \ | ||
| 31 | " | 30 | " |
