New upstream version 1.3.0

This commit is contained in:
Eric Sandeen 2021-06-14 12:07:17 -05:00
parent 805a64ac9f
commit 58f9a6a8e5
8 changed files with 1850 additions and 458 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ blktrace-1.0.1.tar.bz2
/blktrace-1.0.5.tar.bz2
/blktrace-1.1.0.tar.bz2
/blktrace-1.2.0.tar.bz2
/blktrace-1.3.0.tar.bz2
/blktrace-1.3.0.tar.bz2.asc

View File

@ -1,70 +0,0 @@
From 519fd9a5d08d85f3d9cb4192d624fe8351e40232 Mon Sep 17 00:00:00 2001
From: "Robin H. Johnson" <robbat2@gentoo.org>
Date: Tue, 23 Jan 2018 17:57:55 -0500
Subject: [PATCH] fix parallel build failures
When building in parallel, the btreplay/btrecord and btreplay/btreplay
targets cause make to kick off two jobs for `make -C btreplay` and they
sometimes end up clobbering each other. We could fix this by making one
a dependency of the other, but it's a bit cleaner to refactor things to
be based on subdirs. This way changes in subdirs also get noticed:
$ touch btreplay/*.[ch]
$ make
<btreplay is now correctly updated>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
Makefile | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
index 68de591..5917814 100644
--- a/Makefile
+++ b/Makefile
@@ -4,23 +4,19 @@ ALL_CFLAGS = $(CFLAGS) -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PROGS = blkparse blktrace verify_blkparse blkrawverify blkiomon
LIBS = -lpthread
SCRIPTS = btrace
+SUBDIRS = btreplay btt iowatcher
-ALL = $(PROGS) $(SCRIPTS) btt/btt btreplay/btrecord btreplay/btreplay \
+ALL = $(PROGS) $(SCRIPTS)
+INSTALL_ALL = $(ALL) btt/btt btreplay/btrecord btreplay/btreplay \
btt/bno_plot.py iowatcher/iowatcher
-all: $(ALL)
+all: $(ALL) $(SUBDIRS)
-btt/btt:
- $(MAKE) -C btt
-
-iowatcher/iowatcher:
- $(MAKE) -C iowatcher
-
-btreplay/btrecord:
- $(MAKE) -C btreplay
-
-btreplay/btreplay:
- $(MAKE) -C btreplay
+# We always descend into subdirs because they contain their own dependency
+# information which we don't track in this top level Makefile.
+$(SUBDIRS):
+ $(MAKE) -C $@
+.PHONY: $(SUBDIRS)
%.o: %.c
$(CC) -o $*.o -c $(ALL_CFLAGS) $<
@@ -85,7 +81,7 @@ install: all
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8
- $(INSTALL) -m 755 $(ALL) $(DESTDIR)$(bindir)
+ $(INSTALL) -m 755 $(INSTALL_ALL) $(DESTDIR)$(bindir)
$(INSTALL) -m 644 doc/*.1 $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 644 doc/*.8 $(DESTDIR)$(mandir)/man8
--
2.25.3

View File

@ -1,38 +0,0 @@
From f4f8ef7cdea138cfaa2f3ca0ee31fa23d3bcf1cc Mon Sep 17 00:00:00 2001
From: Gwendal Grignou <gwendal@chromium.org>
Date: Thu, 16 Jan 2020 12:33:26 -0800
Subject: [PATCH] fix parallel build of btt and blkiomon
rbtree.c is used by both binaries. It is possible that when make -C btt
is invoked rbtree.o does not exist yet, but is already schedule by the
compilation of blkiomon. That could result in recompiling rbtree.o again
for btt/btt.
In that case, at install time, make will recompile blkiomon which can
fail in gentoo, because CC variable is not overriden by ebuild script at
install time. (see https://bugs.gentoo.org/705594)
Add a dependency on SUBDIRS to wait for all binary in . to be compiled.
It will guarante rbtree.o exists.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 5917814..eb3c6a1 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ all: $(ALL) $(SUBDIRS)
# We always descend into subdirs because they contain their own dependency
# information which we don't track in this top level Makefile.
-$(SUBDIRS):
+$(SUBDIRS): $(PROGS)
$(MAKE) -C $@
.PHONY: $(SUBDIRS)
--
2.25.3

1830
F7D358FB2971E0A6.asc Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,144 +0,0 @@
From d61ff409cb4dda31386373d706ea0cfb1aaac5b7 Mon Sep 17 00:00:00 2001
From: Jens Axboe <axboe@kernel.dk>
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 <axboe@kernel.dk>
---
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

View File

@ -1,192 +0,0 @@
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 <sandeen@redhat.com>
---
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 <alan.brunelle@hp.com>'
#------------------------------------------------------------------------------
@@ -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)

View File

@ -1,9 +1,12 @@
Summary: Utilities for performing block layer IO tracing in the Linux kernel
Name: blktrace
Version: 1.2.0
Release: 17%{?dist}
Version: 1.3.0
Release: 1%{?dist}
License: GPLv2+
Source: http://brick.kernel.dk/snaps/blktrace-%{version}.tar.bz2
Source0: http://brick.kernel.dk/snaps/blktrace-%{version}.tar.bz2
Source1: https://brick.kernel.dk/snaps/blktrace-%{version}.tar.bz2.asc
Source2: https://git.kernel.org/pub/scm/docs/kernel/pgpkeys.git/tree/keys/F7D358FB2971E0A6.asc
Url: http://brick.kernel.dk/snaps
Requires: librsvg2-tools
@ -12,11 +15,6 @@ BuildRequires: python3-devel
BuildRequires: gcc, libaio-devel, librsvg2-devel
BuildRequires: make
Patch0: blktrace-fix-btt-overflow.patch
Patch1: blktrace-python3.patch
Patch2: 0001-fix-parallel-build-failures.patch
Patch3: 0001-fix-parallel-build-of-btt-and-blkiomon.patch
%description
blktrace is a block layer IO tracing mechanism which provides detailed
information about request queue operations to user space. This package
@ -27,11 +25,12 @@ You should install the blktrace package if you need to gather detailed
information about IO patterns.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%autosetup -p1
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
pathfix.py -i %{__python3} -pn \
btt/bno_plot.py \
btt/btt_plot.py
sed -i '1s=^#!/usr/bin/python3=#!%{__python3}=' \
btt/{btt_plot.py,bno_plot.py}
@ -85,6 +84,10 @@ information about IO patterns.
%{_mandir}/man1/iowatcher.*
%changelog
* Mon Jun 14 2021 Eric Sandeen <sandeen@redhat.com> - 1.3.0-1
- New upstream version 1.3.0
- Add signature validation to specfile
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

View File

@ -1 +1,2 @@
SHA512 (blktrace-1.2.0.tar.bz2) = ce82c8010ca5c2868746d8eb7c6a107fc7382c05df949eeff79e612f5b1a98301a5aa5ab39de0766ea1c074f95e378ba985401cbeba9a296e3182da7d7a23b86
SHA512 (blktrace-1.3.0.tar.bz2) = 4cc3d8e0d77e934bd70f447e1bb462400d3c9982460802f093d260e3cb69a66c6f61a63a05af55b84c35c5bdf18027e571d55cebea8c89d0be6d00c7ca9b9174
SHA512 (blktrace-1.3.0.tar.bz2.asc) = bfe890f5984b7373eb6e38ee4163b2a44861218920e5db0c8e358879e13c42952cef9edeb99d24ce69ff99114152271255a72e4eed38b67df44e4410364df135