summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/util-linux
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-04-06 17:36:39 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-10 18:10:26 +0100
commit472eaf13893ec35a634db54314167c303996f716 (patch)
treea7fd5277ccf6e6dc08e6573d24b04ad2a62b7c4c /meta/recipes-core/util-linux
parentb22114050e9c0f5ae7d2ac35280f0a1a3b86fae7 (diff)
downloadpoky-472eaf13893ec35a634db54314167c303996f716.tar.gz
util-linux: Upgrade to 2.26
Drop backports Change-Id: I94d442edaf37ab8e685670f0e14ed60031a995fa (From OE-Core rev: 302844ab3302050733df5e9c5e9cb92351cd315e) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/util-linux')
-rw-r--r--meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch174
-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 @@
1Upstream-Status: Backport
2
3This patch is for CVE-2014-9114.
4This patch should be removed once util-linux is upgraded to 2.26.
5
6Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
7
8From 89e90ae7b2826110ea28c1c0eb8e7c56c3907bdc Mon Sep 17 00:00:00 2001
9From: Karel Zak <kzak@redhat.com>
10Date: Thu, 27 Nov 2014 13:39:35 +0100
11Subject: [PATCH] libblkid: care about unsafe chars in cache
12
13The high-level libblkid API uses /run/blkid/blkid.tab cache to
14store probing results. The cache format is
15
16 <device NAME="value" ...>devname</device>
17
18and 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
26such string is later incorrectly parsed and blkid(8) returns
27nonsenses. And for use-cases like
28
29 # eval $(blkid -o export /dev/sdb1)
30
31it's also insecure.
32
33Note that mount, udevd and blkid -p are based on low-level libblkid
34API, it bypass the cache and directly read data from the devices.
35
36The current udevd upstream does not depend on blkid(8) output at all,
37it'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
46Signed-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
54diff --git a/libblkid/src/read.c b/libblkid/src/read.c
55index 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) {
92diff --git a/libblkid/src/save.c b/libblkid/src/save.c
93index 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
134diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8
135index 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"
150diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
151index 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--
1731.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 @@
1MAJOR_VERSION = "2.25" 1MAJOR_VERSION = "2.26"
2require util-linux.inc 2require util-linux.inc
3PR = "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 18SRC_URI[md5sum] = "2308850946766677f3fabe0685e85de8"
21SRC_URI[md5sum] = "cab3d7be354000f629bc601238b629b3" 19SRC_URI[sha256sum] = "22dc1c957262e2cbdfb4d524a63d5cd4f219d3ac9b5eab570fc771076799bb6e"
22SRC_URI[sha256sum] = "e0457f715b73f4a349e1acb08cb410bf0edc9a74a3f75c357070f31f70e33cd6"
23 20
24CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms" 21CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
25 22
26EXTRA_OECONF_class-native = "${SHARED_EXTRA_OECONF} \ 23EXTRA_OECONF_class-native = "${SHARED_EXTRA_OECONF} \
27 --disable-fallocate --disable-use-tty-group \ 24 --disable-fallocate \
25 --disable-use-tty-group \
28" 26"
29EXTRA_OECONF_class-nativesdk = "${SHARED_EXTRA_OECONF} \ 27EXTRA_OECONF_class-nativesdk = "${SHARED_EXTRA_OECONF} \
30 --disable-fallocate --disable-use-tty-group \ 28 --disable-fallocate \
29 --disable-use-tty-group \
31" 30"