summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwangmy <wangmy@fujitsu.com>2021-06-17 08:10:58 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-06-17 22:20:44 +0100
commit630b366ee69703b6aa38195d823995f6d295bd9f (patch)
tree0648324516fec31e1a325d740433c9c429443c56
parentcff03371aeb997fc06b6b4b57bc379be14e8f358 (diff)
downloadpoky-630b366ee69703b6aa38195d823995f6d295bd9f.tar.gz
blktrace: upgrade 1.2.0 -> 1.3.0
CVE-2018-10689.patch ldflags.patch make-btt-scripts-python3-ready.patch removed since they're included in 1.3.0 (From OE-Core rev: d8684646d66d83a6cf922ef57349450ad5a3591d) Signed-off-by: Wang Mingyu <wangmy@fujitsu.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-kernel/blktrace/blktrace/CVE-2018-10689.patch150
-rw-r--r--meta/recipes-kernel/blktrace/blktrace/ldflags.patch114
-rw-r--r--meta/recipes-kernel/blktrace/blktrace/make-btt-scripts-python3-ready.patch197
-rw-r--r--meta/recipes-kernel/blktrace/blktrace_git.bb10
4 files changed, 3 insertions, 468 deletions
diff --git a/meta/recipes-kernel/blktrace/blktrace/CVE-2018-10689.patch b/meta/recipes-kernel/blktrace/blktrace/CVE-2018-10689.patch
deleted file mode 100644
index 7b58568d59..0000000000
--- a/meta/recipes-kernel/blktrace/blktrace/CVE-2018-10689.patch
+++ /dev/null
@@ -1,150 +0,0 @@
1From d61ff409cb4dda31386373d706ea0cfb1aaac5b7 Mon Sep 17 00:00:00 2001
2From: Jens Axboe <axboe@kernel.dk>
3Date: Wed, 2 May 2018 10:24:17 -0600
4Subject: [PATCH] btt: make device/devno use PATH_MAX to avoid overflow
5
6Herbo Zhang reports:
7
8I found a bug in blktrace/btt/devmap.c. The code is just as follows:
9
10https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git/tree/btt/devmap.c?id=8349ad2f2d19422a6241f94ea84d696b21de4757
11
12 struct devmap {
13
14struct list_head head;
15char device[32], devno[32]; // #1
16};
17
18LIST_HEAD(all_devmaps);
19
20static int dev_map_add(char *line)
21{
22struct devmap *dmp;
23
24if (strstr(line, "Device") != NULL)
25return 1;
26
27dmp = malloc(sizeof(struct devmap));
28if (sscanf(line, "%s %s", dmp->device, dmp->devno) != 2) { //#2
29free(dmp);
30return 1;
31}
32
33list_add_tail(&dmp->head, &all_devmaps);
34return 0;
35}
36
37int dev_map_read(char *fname)
38{
39char line[256]; // #3
40FILE *fp = my_fopen(fname, "r");
41
42if (!fp) {
43perror(fname);
44return 1;
45}
46
47while (fscanf(fp, "%255[a-zA-Z0-9 :.,/_-]\n", line) == 1) {
48if (dev_map_add(line))
49break;
50}
51
52fclose(fp);
53return 0;
54}
55
56 The line length is 256, but the dmp->device, dmp->devno max length
57is only 32. We can put strings longer than 32 into dmp->device and
58dmp->devno , and then they will be overflowed.
59
60 we can trigger this bug just as follows:
61
62 $ python -c "print 'A'*256" > ./test
63 $ btt -M ./test
64
65 *** Error in btt': free(): invalid next size (fast): 0x000055ad7349b250 ***
66 ======= Backtrace: =========
67 /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f7f158ce7e5]
68 /lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f7f158d6e0a]
69 /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f7f158da98c]
70 btt(+0x32e0)[0x55ad7306f2e0]
71 btt(+0x2c5f)[0x55ad7306ec5f]
72 btt(+0x251f)[0x55ad7306e51f]
73 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f7f15877830]
74 btt(+0x26b9)[0x55ad7306e6b9]
75 ======= Memory map: ========
76 55ad7306c000-55ad7307f000 r-xp 00000000 08:14 3698139
77 /usr/bin/btt
78 55ad7327e000-55ad7327f000 r--p 00012000 08:14 3698139
79 /usr/bin/btt
80 55ad7327f000-55ad73280000 rw-p 00013000 08:14 3698139
81 /usr/bin/btt
82 55ad73280000-55ad73285000 rw-p 00000000 00:00 0
83 55ad7349a000-55ad734bb000 rw-p 00000000 00:00 0
84 [heap]
85 7f7f10000000-7f7f10021000 rw-p 00000000 00:00 0
86 7f7f10021000-7f7f14000000 ---p 00000000 00:00 0
87 7f7f15640000-7f7f15656000 r-xp 00000000 08:14 14942237
88 /lib/x86_64-linux-gnu/libgcc_s.so.1
89 7f7f15656000-7f7f15855000 ---p 00016000 08:14 14942237
90 /lib/x86_64-linux-gnu/libgcc_s.so.1
91 7f7f15855000-7f7f15856000 r--p 00015000 08:14 14942237
92 /lib/x86_64-linux-gnu/libgcc_s.so.1
93 7f7f15856000-7f7f15857000 rw-p 00016000 08:14 14942237
94 /lib/x86_64-linux-gnu/libgcc_s.so.1
95 7f7f15857000-7f7f15a16000 r-xp 00000000 08:14 14948477
96 /lib/x86_64-linux-gnu/libc-2.23.so
97 7f7f15a16000-7f7f15c16000 ---p 001bf000 08:14 14948477
98 /lib/x86_64-linux-gnu/libc-2.23.so
99 7f7f15c16000-7f7f15c1a000 r--p 001bf000 08:14 14948477
100 /lib/x86_64-linux-gnu/libc-2.23.so
101 7f7f15c1a000-7f7f15c1c000 rw-p 001c3000 08:14 14948477
102 /lib/x86_64-linux-gnu/libc-2.23.so
103 7f7f15c1c000-7f7f15c20000 rw-p 00000000 00:00 0
104 7f7f15c20000-7f7f15c46000 r-xp 00000000 08:14 14948478
105 /lib/x86_64-linux-gnu/ld-2.23.so
106 7f7f15e16000-7f7f15e19000 rw-p 00000000 00:00 0
107 7f7f15e42000-7f7f15e45000 rw-p 00000000 00:00 0
108 7f7f15e45000-7f7f15e46000 r--p 00025000 08:14 14948478
109 /lib/x86_64-linux-gnu/ld-2.23.so
110 7f7f15e46000-7f7f15e47000 rw-p 00026000 08:14 14948478
111 /lib/x86_64-linux-gnu/ld-2.23.so
112 7f7f15e47000-7f7f15e48000 rw-p 00000000 00:00 0
113 7ffdebe5c000-7ffdebe7d000 rw-p 00000000 00:00 0
114 [stack]
115 7ffdebebc000-7ffdebebe000 r--p 00000000 00:00 0
116 [vvar]
117 7ffdebebe000-7ffdebec0000 r-xp 00000000 00:00 0
118 [vdso]
119 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
120 [vsyscall]
121 [1] 6272 abort btt -M test
122
123Signed-off-by: Jens Axboe <axboe@kernel.dk>
124
125Upstream-Status: Backport
126[https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git/commit/?id=d61ff409cb4dda31386373d706ea0cfb1aaac5b7]
127
128CVE: CVE-2018-10689
129
130Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
131---
132 btt/devmap.c | 2 +-
133 1 file changed, 1 insertion(+), 1 deletion(-)
134
135diff --git a/btt/devmap.c b/btt/devmap.c
136index 0553a9e..5fc1cb2 100644
137--- a/btt/devmap.c
138+++ b/btt/devmap.c
139@@ -23,7 +23,7 @@
140
141 struct devmap {
142 struct list_head head;
143- char device[32], devno[32];
144+ char device[PATH_MAX], devno[PATH_MAX];
145 };
146
147 LIST_HEAD(all_devmaps);
148--
1492.7.4
150
diff --git a/meta/recipes-kernel/blktrace/blktrace/ldflags.patch b/meta/recipes-kernel/blktrace/blktrace/ldflags.patch
deleted file mode 100644
index ab905cf0da..0000000000
--- a/meta/recipes-kernel/blktrace/blktrace/ldflags.patch
+++ /dev/null
@@ -1,114 +0,0 @@
1blktrace: obey LDFLAGS
2
3Upstream-Status: Pending
4
5Signed-off-by: Christopher Larson <chris_larson@mentor.com>
6
7the patch was imported from meta-mentor layer on yoctoproject git server
8http://git.yoctoproject.org/cgit/cgit.cgi/meta-mentor as of commit id
9aed463414e2e2bf8ca44ba54ee5973e7ed599e57
10
11Signed-off-by: Fahad Usman <fahad_usman@mentor.com>
12
13Index: git/Makefile
14===================================================================
15--- git.orig/Makefile
16+++ git/Makefile
17@@ -1,5 +1,6 @@
18 CC = gcc
19 CFLAGS = -Wall -O2 -g -W
20+LDFLAGS =
21 ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
22 PROGS = blkparse blktrace verify_blkparse blkrawverify blkiomon
23 LIBS = -lpthread
24@@ -26,19 +27,19 @@ btreplay/btreplay:
25 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
26
27 blkparse: blkparse.o blkparse_fmt.o rbtree.o act_mask.o
28- $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
29+ $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LDFLAGS)
30
31 blktrace: blktrace.o act_mask.o
32- $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
33+ $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) $(LDFLAGS)
34
35 verify_blkparse: verify_blkparse.o
36- $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
37+ $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LDFLAGS)
38
39 blkrawverify: blkrawverify.o
40- $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^)
41+ $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LDFLAGS)
42
43 blkiomon: blkiomon.o rbtree.o
44- $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) -lrt
45+ $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) -lrt $(LDFLAGS)
46
47 $(PROGS): | depend
48
49Index: git/btreplay/Makefile
50===================================================================
51--- git.orig/btreplay/Makefile
52+++ git/btreplay/Makefile
53@@ -7,6 +7,7 @@
54
55 CC = gcc
56 CFLAGS = -Wall -W -O2 -g
57+LDFLAGS =
58 INCS = -I. -I.. -I../btt
59 OCFLAGS = -UCOUNT_IOS -UDEBUG -DNDEBUG
60 XCFLAGS = -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
61@@ -32,10 +33,10 @@ clean: docsclean
62 $(CC) $(CFLAGS) -c -o $*.o $<
63
64 btrecord: btrecord.o
65- $(CC) $(CFLAGS) -o $@ $(filter %.o,$^)
66+ $(CC) $(CFLAGS) -o $@ $(filter %.o,$^) $(LDFLAGS)
67
68 btreplay: btreplay.o
69- $(CC) $(CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
70+ $(CC) $(CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) $(LDFLAGS)
71
72 depend:
73 @$(CC) -MM $(CFLAGS) *.c 1> .depend
74Index: git/btt/Makefile
75===================================================================
76--- git.orig/btt/Makefile
77+++ git/btt/Makefile
78@@ -7,6 +7,7 @@
79
80 CC = gcc
81 CFLAGS = -Wall -W -O2 -g
82+LDFLAGS =
83 INCS = -I. -I..
84 XCFLAGS = -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
85 override CFLAGS += $(INCS) $(XCFLAGS)
86@@ -38,7 +39,7 @@ clean: docsclean
87 $(CC) $(CFLAGS) -c -o $*.o $<
88
89 btt: $(OBJS)
90- $(CC) $(CFLAGS) -o $@ $(filter %.o,$^) $(LIBS)
91+ $(CC) $(CFLAGS) -o $@ $(filter %.o,$^) $(LIBS) $(LDFLAGS)
92
93 ifneq ($(wildcard .depend),)
94 include .depend
95Index: git/iowatcher/Makefile
96===================================================================
97--- git.orig/iowatcher/Makefile
98+++ git/iowatcher/Makefile
99@@ -1,5 +1,6 @@
100 CC = gcc
101 CFLAGS = -Wall -O2 -g -W -Wunused-result
102+LDFLAGS =
103 ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
104
105 PROGS = iowatcher
106@@ -19,7 +20,7 @@ all: $(ALL)
107 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
108
109 iowatcher: blkparse.o plot.o main.o tracers.o mpstat.o fio.o
110- $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) -lm -lrt
111+ $(CC) $(ALL_CFLAGS) -o $@ $(filter %.o,$^) -lm $(LDFLAGS) -lrt
112
113 depend:
114 @$(CC) -MM $(ALL_CFLAGS) *.c 1> .depend
diff --git a/meta/recipes-kernel/blktrace/blktrace/make-btt-scripts-python3-ready.patch b/meta/recipes-kernel/blktrace/blktrace/make-btt-scripts-python3-ready.patch
deleted file mode 100644
index 3b0c1c692c..0000000000
--- a/meta/recipes-kernel/blktrace/blktrace/make-btt-scripts-python3-ready.patch
+++ /dev/null
@@ -1,197 +0,0 @@
1From 70d5ca2d5f3d6b97c11c641b7e0c5836983219a0 Mon Sep 17 00:00:00 2001
2From: Eric Sandeen <sandeen@redhat.com>
3Date: Wed, 28 Mar 2018 15:26:36 -0500
4Subject: [oe-core][PATCH 1/1] make btt scripts python3-ready
5
6Many distributions are moving to python3 by default. Here's
7an attempt to make the python scripts in blktrace python3-ready.
8
9Most of this was done with automated tools. I hand fixed some
10space-vs tab issues, and cast an array index to integer. It
11passes rudimentary testing when run under python2.7 as well
12as python3.
13
14This doesn't do anything with the shebangs, it leaves them both
15invoking whatever "env python" coughs up on the system.
16
17Signed-off-by: Eric Sandeen <sandeen@redhat.com>
18Signed-off-by: Jens Axboe <axboe@kernel.dk>
19
20Unchanged except to modify shebangs to use python3 since
21oe-core does not support python2 anymore.
22
23Upstream-Status: Backport [git://git.kernel.dk/blktrace.git commit 70d5ca2d5...]
24
25Signed-off-by: Joe Slater <joe.slater@windriver.com>
26
27---
28 btt/bno_plot.py | 28 +++++++++++++++-------------
29 btt/btt_plot.py | 22 +++++++++++++---------
30 2 files changed, 28 insertions(+), 22 deletions(-)
31
32--- git.orig/btt/bno_plot.py
33+++ git/btt/bno_plot.py
34@@ -1,4 +1,4 @@
35-#! /usr/bin/env python
36+#! /usr/bin/env python3
37 #
38 # btt blkno plotting interface
39 #
40@@ -38,6 +38,8 @@ automatically push the keys under the gr
41 To exit the plotter, enter 'quit' or ^D at the 'gnuplot> ' prompt.
42 """
43
44+from __future__ import absolute_import
45+from __future__ import print_function
46 import getopt, glob, os, sys, tempfile
47
48 verbose = 0
49@@ -60,14 +62,14 @@ def parse_args(in_args):
50
51 try:
52 (opts, args) = getopt.getopt(in_args, s_opts, l_opts)
53- except getopt.error, msg:
54- print >>sys.stderr, msg
55- print >>sys.stderr, __doc__
56+ except getopt.error as msg:
57+ print(msg, file=sys.stderr)
58+ print(__doc__, file=sys.stderr)
59 sys.exit(1)
60
61 for (o, a) in opts:
62 if o in ('-h', '--help'):
63- print __doc__
64+ print(__doc__)
65 sys.exit(0)
66 elif o in ('-v', '--verbose'):
67 verbose += 1
68@@ -84,10 +86,10 @@ if __name__ == '__main__':
69 (bnos, keys_below) = parse_args(sys.argv[1:])
70
71 if verbose:
72- print 'Using files:',
73- for bno in bnos: print bno,
74- if keys_below: print '\nKeys are to be placed below graph'
75- else: print ''
76+ print('Using files:', end=' ')
77+ for bno in bnos: print(bno, end=' ')
78+ if keys_below: print('\nKeys are to be placed below graph')
79+ else: print('')
80
81 tmpdir = tempfile.mktemp()
82 os.mkdir(tmpdir)
83@@ -99,7 +101,7 @@ if __name__ == '__main__':
84 fo = open(t, 'w')
85 for line in open(f, 'r'):
86 fld = line.split(None)
87- print >>fo, fld[0], fld[1], int(fld[2])-int(fld[1])
88+ print(fld[0], fld[1], int(fld[2])-int(fld[1]), file=fo)
89 fo.close()
90
91 t = t[t.rfind('/')+1:]
92@@ -107,16 +109,16 @@ if __name__ == '__main__':
93 else: plot_cmd = "%s,'%s'" % (plot_cmd, t)
94
95 fo = open('%s/plot.cmds' % tmpdir, 'w')
96- print >>fo, cmds
97- if len(bnos) > 10 or keys_below: print >>fo, 'set key below'
98- print >>fo, plot_cmd
99+ print(cmds, file=fo)
100+ if len(bnos) > 10 or keys_below: print('set key below', file=fo)
101+ print(plot_cmd, file=fo)
102 fo.close()
103
104 pid = os.fork()
105 if pid == 0:
106 cmd = 'gnuplot %s/plot.cmds -' % tmpdir
107
108- if verbose: print 'Executing %s' % cmd
109+ if verbose: print('Executing %s' % cmd)
110
111 os.chdir(tmpdir)
112 os.system(cmd)
113--- git.orig/btt/btt_plot.py
114+++ git/btt/btt_plot.py
115@@ -1,4 +1,4 @@
116-#! /usr/bin/env python
117+#! /usr/bin/env python3
118 #
119 # btt_plot.py: Generate matplotlib plots for BTT generate data files
120 #
121@@ -55,6 +55,10 @@ Arguments:
122 but the -o (--output) and -T (--title) options will be ignored.
123 """
124
125+from __future__ import absolute_import
126+from __future__ import print_function
127+import six
128+from six.moves import range
129 __author__ = 'Alan D. Brunelle <alan.brunelle@hp.com>'
130
131 #------------------------------------------------------------------------------
132@@ -82,7 +86,7 @@ get_base = lambda file: file[file.find(
133 def fatal(msg):
134 """Generate fatal error message and exit"""
135
136- print >>sys.stderr, 'FATAL: %s' % msg
137+ print('FATAL: %s' % msg, file=sys.stderr)
138 sys.exit(1)
139
140 #------------------------------------------------------------------------------
141@@ -163,7 +167,7 @@ def get_data(files):
142 if not os.path.exists(file):
143 fatal('%s not found' % file)
144 elif verbose:
145- print 'Processing %s' % file
146+ print('Processing %s' % file)
147
148 xs = []
149 ys = []
150@@ -214,8 +218,8 @@ def parse_args(args):
151
152 try:
153 (opts, args) = getopt.getopt(args[1:], s_opts, l_opts)
154- except getopt.error, msg:
155- print >>sys.stderr, msg
156+ except getopt.error as msg:
157+ print(msg, file=sys.stderr)
158 fatal(__doc__)
159
160 for (o, a) in opts:
161@@ -293,15 +297,15 @@ def generate_output(type, db):
162 def color(idx, style):
163 """Returns a color/symbol type based upon the index passed."""
164
165- colors = [ 'b', 'g', 'r', 'c', 'm', 'y', 'k' ]
166+ colors = [ 'b', 'g', 'r', 'c', 'm', 'y', 'k' ]
167 l_styles = [ '-', ':', '--', '-.' ]
168 m_styles = [ 'o', '+', '.', ',', 's', 'v', 'x', '<', '>' ]
169
170 color = colors[idx % len(colors)]
171 if style == 'line':
172- style = l_styles[(idx / len(l_styles)) % len(l_styles)]
173+ style = l_styles[int((idx / len(l_styles)) % len(l_styles))]
174 elif style == 'marker':
175- style = m_styles[(idx / len(m_styles)) % len(m_styles)]
176+ style = m_styles[int((idx / len(m_styles)) % len(m_styles))]
177
178 return '%s%s' % (color, style)
179
180@@ -314,7 +318,7 @@ def generate_output(type, db):
181 ofile = '%s.png' % type
182
183 if verbose:
184- print 'Generating plot into %s' % ofile
185+ print('Generating plot into %s' % ofile)
186
187 fig = plt.figure(figsize=plot_size)
188 ax = fig.add_subplot(111)
189@@ -329,7 +333,7 @@ def generate_output(type, db):
190 legends = None
191
192 keys = []
193- for file in db.iterkeys():
194+ for file in six.iterkeys(db):
195 if not file in ['min_x', 'max_x', 'min_y', 'max_y']:
196 keys.append(file)
197
diff --git a/meta/recipes-kernel/blktrace/blktrace_git.bb b/meta/recipes-kernel/blktrace/blktrace_git.bb
index 7ccc022b93..d00b1bd0be 100644
--- a/meta/recipes-kernel/blktrace/blktrace_git.bb
+++ b/meta/recipes-kernel/blktrace/blktrace_git.bb
@@ -10,15 +10,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
10 10
11DEPENDS = "libaio" 11DEPENDS = "libaio"
12 12
13SRCREV = "cca113f2fe0759b91fd6a0e10fdcda2c28f18a7e" 13SRCREV = "366d30b9cdb20345c5d064af850d686da79b89eb"
14 14
15PV = "1.2.0+git${SRCPV}" 15PV = "1.3.0+git${SRCPV}"
16 16
17SRC_URI = "git://git.kernel.dk/blktrace.git \ 17SRC_URI = "git://git.kernel.dk/blktrace.git"
18 file://ldflags.patch \
19 file://CVE-2018-10689.patch \
20 file://make-btt-scripts-python3-ready.patch \
21"
22 18
23S = "${WORKDIR}/git" 19S = "${WORKDIR}/git"
24 20