From c20f6002f111ffb37ab785eb8814679466a2e2c9 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 07 2019 10:15:10 +0000 Subject: import blktrace-1.2.0-9.el8 --- diff --git a/.blktrace.metadata b/.blktrace.metadata new file mode 100644 index 0000000..67daffe --- /dev/null +++ b/.blktrace.metadata @@ -0,0 +1 @@ +da76ff5b2387443de5a1ee9ca32e165881959868 SOURCES/blktrace-1.2.0.tar.bz2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..da27b56 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/blktrace-1.2.0.tar.bz2 diff --git a/SOURCES/blktrace-fix-btt-overflow.patch b/SOURCES/blktrace-fix-btt-overflow.patch new file mode 100644 index 0000000..cabe5fb --- /dev/null +++ b/SOURCES/blktrace-fix-btt-overflow.patch @@ -0,0 +1,144 @@ +From d61ff409cb4dda31386373d706ea0cfb1aaac5b7 Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Wed, 2 May 2018 10:24:17 -0600 +Subject: btt: make device/devno use PATH_MAX to avoid overflow + +Herbo Zhang reports: + +I found a bug in blktrace/btt/devmap.c. The code is just as follows: + +https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git/tree/btt/devmap.c?id=8349ad2f2d19422a6241f94ea84d696b21de4757 + + struct devmap { + +struct list_head head; +char device[32], devno[32]; // #1 +}; + +LIST_HEAD(all_devmaps); + +static int dev_map_add(char *line) +{ +struct devmap *dmp; + +if (strstr(line, "Device") != NULL) +return 1; + +dmp = malloc(sizeof(struct devmap)); +if (sscanf(line, "%s %s", dmp->device, dmp->devno) != 2) { //#2 +free(dmp); +return 1; +} + +list_add_tail(&dmp->head, &all_devmaps); +return 0; +} + +int dev_map_read(char *fname) +{ +char line[256]; // #3 +FILE *fp = my_fopen(fname, "r"); + +if (!fp) { +perror(fname); +return 1; +} + +while (fscanf(fp, "%255[a-zA-Z0-9 :.,/_-]\n", line) == 1) { +if (dev_map_add(line)) +break; +} + +fclose(fp); +return 0; +} + + The line length is 256, but the dmp->device, dmp->devno max length +is only 32. We can put strings longer than 32 into dmp->device and +dmp->devno , and then they will be overflowed. + + we can trigger this bug just as follows: + + $ python -c "print 'A'*256" > ./test + $ btt -M ./test + + *** Error in btt': free(): invalid next size (fast): 0x000055ad7349b250 *** + ======= Backtrace: ========= + /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f7f158ce7e5] + /lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7f7f158d6e0a] + /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f7f158da98c] + btt(+0x32e0)[0x55ad7306f2e0] + btt(+0x2c5f)[0x55ad7306ec5f] + btt(+0x251f)[0x55ad7306e51f] + /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f7f15877830] + btt(+0x26b9)[0x55ad7306e6b9] + ======= Memory map: ======== + 55ad7306c000-55ad7307f000 r-xp 00000000 08:14 3698139 + /usr/bin/btt + 55ad7327e000-55ad7327f000 r--p 00012000 08:14 3698139 + /usr/bin/btt + 55ad7327f000-55ad73280000 rw-p 00013000 08:14 3698139 + /usr/bin/btt + 55ad73280000-55ad73285000 rw-p 00000000 00:00 0 + 55ad7349a000-55ad734bb000 rw-p 00000000 00:00 0 + [heap] + 7f7f10000000-7f7f10021000 rw-p 00000000 00:00 0 + 7f7f10021000-7f7f14000000 ---p 00000000 00:00 0 + 7f7f15640000-7f7f15656000 r-xp 00000000 08:14 14942237 + /lib/x86_64-linux-gnu/libgcc_s.so.1 + 7f7f15656000-7f7f15855000 ---p 00016000 08:14 14942237 + /lib/x86_64-linux-gnu/libgcc_s.so.1 + 7f7f15855000-7f7f15856000 r--p 00015000 08:14 14942237 + /lib/x86_64-linux-gnu/libgcc_s.so.1 + 7f7f15856000-7f7f15857000 rw-p 00016000 08:14 14942237 + /lib/x86_64-linux-gnu/libgcc_s.so.1 + 7f7f15857000-7f7f15a16000 r-xp 00000000 08:14 14948477 + /lib/x86_64-linux-gnu/libc-2.23.so + 7f7f15a16000-7f7f15c16000 ---p 001bf000 08:14 14948477 + /lib/x86_64-linux-gnu/libc-2.23.so + 7f7f15c16000-7f7f15c1a000 r--p 001bf000 08:14 14948477 + /lib/x86_64-linux-gnu/libc-2.23.so + 7f7f15c1a000-7f7f15c1c000 rw-p 001c3000 08:14 14948477 + /lib/x86_64-linux-gnu/libc-2.23.so + 7f7f15c1c000-7f7f15c20000 rw-p 00000000 00:00 0 + 7f7f15c20000-7f7f15c46000 r-xp 00000000 08:14 14948478 + /lib/x86_64-linux-gnu/ld-2.23.so + 7f7f15e16000-7f7f15e19000 rw-p 00000000 00:00 0 + 7f7f15e42000-7f7f15e45000 rw-p 00000000 00:00 0 + 7f7f15e45000-7f7f15e46000 r--p 00025000 08:14 14948478 + /lib/x86_64-linux-gnu/ld-2.23.so + 7f7f15e46000-7f7f15e47000 rw-p 00026000 08:14 14948478 + /lib/x86_64-linux-gnu/ld-2.23.so + 7f7f15e47000-7f7f15e48000 rw-p 00000000 00:00 0 + 7ffdebe5c000-7ffdebe7d000 rw-p 00000000 00:00 0 + [stack] + 7ffdebebc000-7ffdebebe000 r--p 00000000 00:00 0 + [vvar] + 7ffdebebe000-7ffdebec0000 r-xp 00000000 00:00 0 + [vdso] + ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 + [vsyscall] + [1] 6272 abort btt -M test + +Signed-off-by: Jens Axboe +--- + btt/devmap.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/btt/devmap.c b/btt/devmap.c +index 0553a9e..5fc1cb2 100644 +--- a/btt/devmap.c ++++ b/btt/devmap.c +@@ -23,7 +23,7 @@ + + struct devmap { + struct list_head head; +- char device[32], devno[32]; ++ char device[PATH_MAX], devno[PATH_MAX]; + }; + + LIST_HEAD(all_devmaps); +-- +cgit v1.1 + + diff --git a/SOURCES/blktrace-python3.patch b/SOURCES/blktrace-python3.patch new file mode 100644 index 0000000..7b46239 --- /dev/null +++ b/SOURCES/blktrace-python3.patch @@ -0,0 +1,190 @@ +make btt scripts python3-ready + +Many distributions are moving to python3 by default. Here's +an attempt to make the python scripts in blktrace python3-ready. + +Most of this was done with automated tools. I hand fixed some +space-vs tab issues, and cast an array index to integer. It +passes rudimentary testing when run under python2.7 as well +as python3. + +This doesn't do anything with the shebangs, it leaves them both +invoking whatever "env python" coughs up on the system. + +Signed-off-by: Eric Sandeen +--- + +I am not a python guru at all. Happy to have review by anyone more +pythonic than I am. Hopefully this helps at least move things +toward python3-readiness. Thanks! + +Index: blktrace-1.2.0/btt/bno_plot.py +=================================================================== +--- blktrace-1.2.0.orig/btt/bno_plot.py ++++ blktrace-1.2.0/btt/bno_plot.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#!/usr/bin/python3 + # + # btt blkno plotting interface + # +@@ -38,6 +38,8 @@ automatically push the keys under the gr + To exit the plotter, enter 'quit' or ^D at the 'gnuplot> ' prompt. + """ + ++from __future__ import absolute_import ++from __future__ import print_function + import getopt, glob, os, sys, tempfile + + verbose = 0 +@@ -60,14 +62,14 @@ def parse_args(in_args): + + try: + (opts, args) = getopt.getopt(in_args, s_opts, l_opts) +- except getopt.error, msg: +- print >>sys.stderr, msg +- print >>sys.stderr, __doc__ ++ except getopt.error as msg: ++ print(msg, file=sys.stderr) ++ print(__doc__, file=sys.stderr) + sys.exit(1) + + for (o, a) in opts: + if o in ('-h', '--help'): +- print __doc__ ++ print(__doc__) + sys.exit(0) + elif o in ('-v', '--verbose'): + verbose += 1 +@@ -84,10 +86,10 @@ if __name__ == '__main__': + (bnos, keys_below) = parse_args(sys.argv[1:]) + + if verbose: +- print 'Using files:', +- for bno in bnos: print bno, +- if keys_below: print '\nKeys are to be placed below graph' +- else: print '' ++ print('Using files:', end=' ') ++ for bno in bnos: print(bno, end=' ') ++ if keys_below: print('\nKeys are to be placed below graph') ++ else: print('') + + tmpdir = tempfile.mktemp() + os.mkdir(tmpdir) +@@ -99,7 +101,7 @@ if __name__ == '__main__': + fo = open(t, 'w') + for line in open(f, 'r'): + fld = line.split(None) +- print >>fo, fld[0], fld[1], int(fld[2])-int(fld[1]) ++ print(fld[0], fld[1], int(fld[2])-int(fld[1]), file=fo) + fo.close() + + t = t[t.rfind('/')+1:] +@@ -107,16 +109,16 @@ if __name__ == '__main__': + else: plot_cmd = "%s,'%s'" % (plot_cmd, t) + + fo = open('%s/plot.cmds' % tmpdir, 'w') +- print >>fo, cmds +- if len(bnos) > 10 or keys_below: print >>fo, 'set key below' +- print >>fo, plot_cmd ++ print(cmds, file=fo) ++ if len(bnos) > 10 or keys_below: print('set key below', file=fo) ++ print(plot_cmd, file=fo) + fo.close() + + pid = os.fork() + if pid == 0: + cmd = 'gnuplot %s/plot.cmds -' % tmpdir + +- if verbose: print 'Executing %s' % cmd ++ if verbose: print('Executing %s' % cmd) + + os.chdir(tmpdir) + os.system(cmd) +Index: blktrace-1.2.0/btt/btt_plot.py +=================================================================== +--- blktrace-1.2.0.orig/btt/btt_plot.py ++++ blktrace-1.2.0/btt/btt_plot.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#!/usr/bin/python3 + # + # btt_plot.py: Generate matplotlib plots for BTT generate data files + # +@@ -55,6 +55,10 @@ Arguments: + but the -o (--output) and -T (--title) options will be ignored. + """ + ++from __future__ import absolute_import ++from __future__ import print_function ++import six ++from six.moves import range + __author__ = 'Alan D. Brunelle ' + + #------------------------------------------------------------------------------ +@@ -82,7 +86,7 @@ get_base = lambda file: file[file.find( + def fatal(msg): + """Generate fatal error message and exit""" + +- print >>sys.stderr, 'FATAL: %s' % msg ++ print('FATAL: %s' % msg, file=sys.stderr) + sys.exit(1) + + #------------------------------------------------------------------------------ +@@ -163,7 +167,7 @@ def get_data(files): + if not os.path.exists(file): + fatal('%s not found' % file) + elif verbose: +- print 'Processing %s' % file ++ print('Processing %s' % file) + + xs = [] + ys = [] +@@ -214,8 +218,8 @@ def parse_args(args): + + try: + (opts, args) = getopt.getopt(args[1:], s_opts, l_opts) +- except getopt.error, msg: +- print >>sys.stderr, msg ++ except getopt.error as msg: ++ print(msg, file=sys.stderr) + fatal(__doc__) + + for (o, a) in opts: +@@ -293,15 +297,15 @@ def generate_output(type, db): + def color(idx, style): + """Returns a color/symbol type based upon the index passed.""" + +- colors = [ 'b', 'g', 'r', 'c', 'm', 'y', 'k' ] ++ colors = [ 'b', 'g', 'r', 'c', 'm', 'y', 'k' ] + l_styles = [ '-', ':', '--', '-.' ] + m_styles = [ 'o', '+', '.', ',', 's', 'v', 'x', '<', '>' ] + + color = colors[idx % len(colors)] + if style == 'line': +- style = l_styles[(idx / len(l_styles)) % len(l_styles)] ++ style = l_styles[int((idx / len(l_styles)) % len(l_styles))] + elif style == 'marker': +- style = m_styles[(idx / len(m_styles)) % len(m_styles)] ++ style = m_styles[int((idx / len(m_styles)) % len(m_styles))] + + return '%s%s' % (color, style) + +@@ -314,7 +318,7 @@ def generate_output(type, db): + ofile = '%s.png' % type + + if verbose: +- print 'Generating plot into %s' % ofile ++ print('Generating plot into %s' % ofile) + + fig = plt.figure(figsize=plot_size) + ax = fig.add_subplot(111) +@@ -329,7 +333,7 @@ def generate_output(type, db): + legends = None + + keys = [] +- for file in db.iterkeys(): ++ for file in six.iterkeys(db): + if not file in ['min_x', 'max_x', 'min_y', 'max_y']: + keys.append(file) + diff --git a/SPECS/blktrace.spec b/SPECS/blktrace.spec new file mode 100644 index 0000000..c3167a9 --- /dev/null +++ b/SPECS/blktrace.spec @@ -0,0 +1,213 @@ +Summary: Utilities for performing block layer IO tracing in the Linux kernel +Name: blktrace +Version: 1.2.0 +Release: 9%{?dist} +License: GPLv2+ +Group: Development/System +Source: http://brick.kernel.dk/snaps/blktrace-%{version}.tar.bz2 +Url: http://brick.kernel.dk/snaps + +BuildRequires: python3-devel +BuildRequires: gcc, libaio-devel, librsvg2-devel + +Patch0: blktrace-fix-btt-overflow.patch +Patch1: blktrace-python3.patch + +%description +blktrace is a block layer IO tracing mechanism which provides detailed +information about request queue operations to user space. This package +includes both blktrace, a utility which gathers event traces from the kernel; +and blkparse, a utility which formats trace data collected by blktrace. + +You should install the blktrace package if you need to gather detailed +information about IO patterns. + + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 + +sed -i '1s=^#!/usr/bin/python3=#!%{__python3}=' \ + btt/{btt_plot.py,bno_plot.py} + +%build +make CFLAGS="%{optflags} %{build_ldflags}" all + +%install +rm -rf %{buildroot} +make dest=%{buildroot} prefix=%{buildroot}/%{_prefix} mandir=%{buildroot}/%{_mandir} install + +%files +%doc README COPYING +%{_bindir}/blkparse +%{_bindir}/blkrawverify +%{_bindir}/bno_plot.py +%{_bindir}/btt +%{_bindir}/verify_blkparse +%{_bindir}/blkiomon +%{_bindir}/blktrace +%{_bindir}/btrace +%{_bindir}/btrecord +%{_bindir}/btreplay +%{_mandir}/man1/blkparse.* +%{_mandir}/man1/blkrawverify.* +%{_mandir}/man1/bno_plot.* +%{_mandir}/man1/btt.* +%{_mandir}/man1/verify_blkparse.* +%{_mandir}/man8/blkiomon.* +%{_mandir}/man8/blktrace.* +%{_mandir}/man8/btrace.* +%{_mandir}/man8/btrecord.* +%{_mandir}/man8/btreplay.* + +%package -n iowatcher +Summary: Utility for visualizing block layer IO patterns and performance +Requires: blktrace sysstat theora-tools + +%description -n iowatcher +iowatcher generates graphs from blktrace runs to help visualize IO patterns and +performance as SVG images or movies. It can plot multiple blktrace runs +together, making it easy to compare the differences between different benchmark +runs. + +You should install the iowatcher package if you need to visualize detailed +information about IO patterns. + +%files -n iowatcher +%doc README iowatcher/COPYING +%{_bindir}/iowatcher +%{_mandir}/man1/iowatcher.* + +%changelog +* Wed Jun 20 2018 Tomas Orsava - 1.2.0-9 +- Switch hardcoded python3 shebangs into the %%{__python3} macro +- Add missing BuildRequires on python3-devel so that %%{__python3} macro is + defined + +* Thu May 24 2018 Eric Sandeen - 1.2.0-8 +- Fix CVE-2018-10689 buffer overflow (#1575121) + +* Wed May 16 2018 Eric Sandeen - 1.2.0-7 +- Make scripts python3-ready + +* Mon May 07 2018 Eric Sandeen - 1.2.0-6 +- Fix for CVE-2018-10689 (#1575120) + +* Mon Feb 26 2018 Eric Sandeen - 1.2.0-5 +- BuildRequires: gcc + +* Sun Feb 25 2018 Florian Weimer - 1.2.0-4 +- Use LDFLAGS from redhat-rpm-config + +* Wed Feb 07 2018 Fedora Release Engineering - 1.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Dec 15 2017 Iryna Shcherbina - 1.2.0-2 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Mon Nov 06 2017 Eric Sandeen - 1.2.0-1 +- New upstream version + +* Wed Aug 02 2017 Fedora Release Engineering - 1.1.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1.1.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 1.1.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Feb 03 2016 Fedora Release Engineering - 1.1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 1.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Fri Sep 26 2014 Andrew Price - 1.1.0-1 +- New upstream version +- Add iowatcher subpackage +- Remove obsolete 'clean' and 'defattr' sections + +* Fri Aug 15 2014 Fedora Release Engineering - 1.0.5-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 1.0.5-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sat Aug 03 2013 Fedora Release Engineering - 1.0.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Mar 21 2013 Eric Sandeen - 1.0.5-4 +- Remove tex->pdf doc build, fix build & lighten up buildreqs + +* Wed Feb 13 2013 Fedora Release Engineering - 1.0.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Jul 18 2012 Fedora Release Engineering - 1.0.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Mar 23 2012 Eric Sandeen - 1.0.5-1 +- New upstream version + +* Tue Jan 31 2012 Eric Sandeen - 1.0.4-1 +- New upstream version + +* Thu Jan 12 2012 Fedora Release Engineering - 1.0.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri Aug 12 2011 Eric Sandeen - 1.0.3-1 +- New upstream version + +* Wed Mar 16 2011 Eric Sandeen - 1.0.2-1 +- New upstream version + +* Mon Feb 07 2011 Fedora Release Engineering - 1.0.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Feb 13 2010 Eric Sandeen - 1.0.1-4 +- Fix linking with libpthread (#564775) + +* Fri Jul 24 2009 Fedora Release Engineering - 1.0.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon May 11 2009 Eric Sandeen - 1.0.1-2 +- Upstream respun the release tarball to re-include top-level dir +- drop exclude of bno_plot.py[co], not getting built now? + +* Mon May 11 2009 Eric Sandeen - 1.0.1-1 +- New upstream version + +* Mon Feb 23 2009 Fedora Release Engineering - 1.0.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Feb 17 2009 Eric Sandeen - 1.0.0-2 +- Build PDF documentation after all + +* Sun Nov 02 2008 Eric Sandeen - 1.0.0-1 +- New upstream version (now with actual versioning!) + +* Fri Feb 08 2008 Eric Sandeen - 0.0-0.9.20080103162505git +- gcc-4.3 rebuild + +* Sat Jan 26 2008 Eric Sandeen - 0.0-0.8.20080103162505git +- New upstream version + +* Wed Oct 24 2007 Eric Sandeen - 0.0-0.6.20071010202719git +- Add libaio-devel to BuildRequires + +* Wed Oct 24 2007 Eric Sandeen - 0.0-0.5.20071010202719git +- New upstream version + +* Wed Aug 15 2007 Eric Sandeen - 0.0-0.4.20070730162628git +- Fix up btt/Makefile to accept rpm's CFLAGS + +* Tue Aug 14 2007 Eric Sandeen - 0.0-0.3.20070730162628git +- Just drop the pdf build, bloats the buildroot for such a simple tool + +* Wed Aug 01 2007 Eric Sandeen - 0.0-0.2.20070730162628git +- Add ghostscript to BuildRequires, use attr macro for man pages + +* Wed Aug 01 2007 Eric Sandeen - 0.0-0.1.20070730162628git +- New package, initial build.