Bug 204139 - Segmentation fault when toggling "graph follows"
Summary: Segmentation fault when toggling "graph follows"
Status: RESOLVED CODE_FIX
Alias: None
Product: Tools
Classification: Unclassified
Component: Trace-cmd/Kernelshark (show other bugs)
Hardware: Intel Linux
: P1 normal
Assignee: Default virtual assignee for Trace-cmd and kernelshark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-11 14:15 UTC by Valentin Schneider
Modified: 2019-07-19 20:32 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.15.0-50
Subsystem:
Regression: No
Bisected commit-id:


Attachments
compressed trace.dat (1.20 MB, application/x-compressed-tar)
2019-07-11 14:15 UTC, Valentin Schneider
Details
patch fixing the segmentation fault (1.91 KB, application/mbox)
2019-07-12 10:27 UTC, Yordan Karadzhov
Details

Description Valentin Schneider 2019-07-11 14:15:09 UTC
Created attachment 283625 [details]
compressed trace.dat

The included trace is troublesome - it crashes my kernelshark (v0.2) with a buffer overflow when trying to open it:

  *** buffer overflow detected ***: kernelshark terminated


I built and tried out a less ancient version:
  0b9fa76975db ("trace-cmd: Version 2.8.1")

It manages to open the trace without a hitch, but I get a segmentation fault when toggling "Graph follows". The minimalist reproducer I've found (for that trace) is:

Open trace with kernelshark
Type "numa" in the search textbox
Click the "Next" button
Toggle the "Graph follows" checkbox (click twice)
<Segfault happens here>


It also happens with the current master:
  2e15c98bd394 ("kernel-shark: Less scary error message from Capture dialog")


this is what I get with GDB:

(gdb) c
Continuing.
[New Thread 0x7fffe9eb2700 (LWP 19879)]
[New Thread 0x7fffe8e7e700 (LWP 19880)]
Loading  "trace.dat"
[New Thread 0x7fffe35b9700 (LWP 19884)]
[Thread 0x7fffe35b9700 (LWP 19884) exited]

Thread 1 "kernelshark" received signal SIGSEGV, Segmentation fault.
KsTraceViewer::_graphFollowsChanged (this=0x7fffffffc9a8, state=<optimised out>)
    at /data/work/trace-cmd/kernel-shark/src/KsTraceViewer.cpp:308
308					emit select(*_it); // Send a signal to the Graph widget.
(gdb) list
303	
304			if (!_matchList.empty()) {
305				showRow(*_it, true);
306	
307				if (_graphFollows)
308					emit select(*_it); // Send a signal to the Graph widget.
309			}
310		} else {
311			/*
312			 * If the search is done, pressing "Enter" is equivalent
(gdb)
Comment 1 Steven Rostedt 2019-07-11 14:24:20 UTC
Well, I went South to pick up some of this sunshine I've heard about, and it
lasted a few weeks here in the North. Well, it ran out, and we don't have
anymore. I'm off to the South again to pick some more of it up, if there's
any left. I should be back on July 16th, to return your email (eventually).

-- Steve
Comment 2 Yordan Karadzhov 2019-07-12 10:27:49 UTC
Created attachment 283645 [details]
patch fixing the segmentation fault
Comment 3 Yordan Karadzhov 2019-07-12 10:30:56 UTC
Hi Valentin,

Thank you very much for reporting this problem!

Please try the attached patch and tell us if this fixes the problem that you see.

cheers,
Yordan
Comment 4 Valentin Schneider 2019-07-12 12:33:55 UTC
Hi Yordan,

Thanks for the quick turnaround! I can't reproduce the issue with your patch applied, feel free to add a

Tested-by: Valentin Schneider <valentin.schneider@arm.com>

if it's of any help.

Cheers,
Valentin
Comment 5 Yordan Karadzhov 2019-07-15 06:30:15 UTC
Great, I will keep the issue open until the fix gets merged upstream.

Thanks!
Yordad
Comment 6 Steven Rostedt 2019-07-19 20:32:26 UTC
Fixed by commit 8b4bd284b975 ("kernel-shark: The graph widget must follow the active marker")

Note You need to log in before you can comment on or make changes to this bug.