lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150331141326.GH9438@kernel.org>
Date:	Tue, 31 Mar 2015 11:13:26 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	David Ahern <dsahern@...il.com>,
	Stephane Eranian <eranian@...gle.com>,
	Jiri Olsa <jolsa@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [BUG] perf script segfault

Em Tue, Mar 31, 2015 at 11:02:16AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Mar 31, 2015 at 03:58:01PM +0200, Jiri Olsa escreveu:
> > On Tue, Mar 31, 2015 at 09:59:20AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Mon, Mar 30, 2015 at 08:45:33PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Em Mon, Mar 30, 2015 at 04:51:34PM -0600, David Ahern escreveu:
> > > > > tool was moved to ordered_events and is not initialized for pipe mode. I
> > > > > don't have time to look into it more than that before PTO on Wednesday.
> > > So the following is better, can you give it a try, please?

> > > Subject: [PATCH 1/1] perf session: Always initialize ordered_events
> > > Even when it is not used to actually reorder events, some of its fields
> > > are used, like session->ordered_events->tool, to shorten function

> > hum, when did this happen? I somehow missed those changes.. :-\

> > I think we should have ordered_events struct free of perf_tool,
> > machines and perf_evlist structs
 
> If possible, yes, lemme see, yeah, thanks for the patch, testing it,
> good that we can remove that from ordered_events!

Ok, if I just apply your patch I stumble again on the bug I alluded to
in my patch changeset, i.e.:


Program terminated with signal 11, Segmentation fault.
#0  0x00000000004d11c0 in list_del (entry=0x0) at /home/acme/git/linux/tools/perf/util/include/../../../../include/linux/list.h:107
107		__list_del(entry->prev, entry->next);
Missing separate debuginfos, use: debuginfo-install audit-libs-2.4.1-5.el7.x86_64 bzip2-libs-1.0.6-12.el7.x86_64 elfutils-libelf-0.160-1.el7.x86_64 elfutils-libs-0.160-1.el7.x86_64 glibc-2.17-78.el7.x86_64 libgcc-4.8.3-9.el7.x86_64 nss-softokn-freebl-3.16.2.3-9.el7.x86_64 numactl-libs-2.0.9-4.el7.x86_64 perl-libs-5.16.3-285.el7.x86_64 python-libs-2.7.5-16.el7.x86_64 slang-2.2.4-11.el7.x86_64 xz-libs-5.1.2-9alpha.el7.x86_64 zlib-1.2.7-13.el7.x86_64
(gdb) bt
#0  0x00000000004d11c0 in list_del (entry=0x0) at /home/acme/git/linux/tools/perf/util/include/../../../../include/linux/list.h:107
#1  0x00000000004d20c4 in ordered_events__free (oe=0x1fe7e50) at util/ordered-events.c:315
#2  0x00000000004cf936 in __perf_session__process_pipe_events (session=0x1fe7c60) at util/session.c:1256
#3  0x00000000004cff53 in perf_session__process_events (session=0x1fe7c60) at util/session.c:1420
#4  0x0000000000440649 in __cmd_script (script=0x7fff7d2371c0) at builtin-script.c:803
#5  0x0000000000443b64 in cmd_script (argc=0, argv=0x7fff7d237f10, prefix=0x0) at builtin-script.c:1840
#6  0x0000000000488388 in run_builtin (p=0x871150 <commands+336>, argc=3, argv=0x7fff7d237f10) at perf.c:370
#7  0x00000000004885e7 in handle_internal_command (argc=3, argv=0x7fff7d237f10) at perf.c:429
#8  0x0000000000488733 in run_argv (argcp=0x7fff7d237d6c, argv=0x7fff7d237d60) at perf.c:473
#9  0x0000000000488a94 in main (argc=3, argv=0x7fff7d237f10) at perf.c:588
(gdb)

I.e. it tries to use uninitialized ordered_events stuff on the way out of
processing pipe events.

Which is related to the fact that builtin-script.c has:

                .tool = {
<SNIP>
                        .ordered_events  = true,
                        .ordering_requires_timestamps = true,
                },

Indicating it wants the ordered_events to be used, but then, when we get to
perf_session__new() we end up failing this test:

        if (tool && tool->ordering_requires_timestamps &&
            tool->ordered_events && !perf_evlist__sample_id_all(session->evlist)) {
                dump_printf("WARNING: No sample_id_all support, falling back to unordered processing\n");
                tool->ordered_events = false;
        } else {
                ordered_events__init(&session->ordered_events, &session->machines,
                                     session->evlist, ordered_events__deliver_event);
        }

And setting tool->ordered_events to false;

What fails is perf_evlist__sample_id_all(session->evlist), I went as far as
looking at the perf_evlist__sample_id_all call that will find a first evsel,
with all its fields zeroed, i.e. at some point it finds out it is a pipe (perf
script < perf.data) and seems to not read the perf_event_attr attributes, etc,
but I need to dig deeper here to figure out this and why is it that in that
case we end with two 'perf script' processes when I think it should be just one, etc.

So, to keep the assumptions in place I'll keep my patch, the one that David
tested, and redo yours on top, looking as well at ways to use what is in
perf_session, should provide a patch soon.

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ