Created attachment 285463 [details] The trace.dat file, used when reproducing the problem. Looks like it is not spefic to this particular file. While playing with the new KernelShark 2.0 alpha, I noticed a segmentation fault while loading / browsing the attached trace.dat file. According to the stack trace, the problem is in libtracecmd.so, linked dynamically to KernelShark. The problem is observed with the library, compiled from the trace-cmd HEAD branch. #0 0x00007ffff69bc2f6 in update_page_info (handle=0x7fffc0002720, cpu=3) at trace-input.c:1080 #1 0x00007ffff69bc89f in peek_event (handle=0x7fffc0002720, offset=0, cpu=3) at trace-input.c:1184 #2 0x00007ffff69bc91f in read_event (handle=0x7fffc0002720, offset=0, cpu=3) at trace-input.c:1202 #3 0x00007ffff69bcb8c in tracecmd_read_at (handle=0x7fffc0002720, offset=0, pcpu=0x0) at trace-input.c:1288 #4 0x00007ffff7ed79b6 in tepdata_get_pid (entry=0x7fffffffac00, stream=0x7fffc0007150) at /home/work/share/dancho/kernel-shark-2.alpha/src/libkshark-tepdata.c:561 #5 0x00007ffff7ed79b6 in tepdata_get_pid (stream=0x7fffc0007150, entry=0x7fffffffac00) at /home/work/share/dancho/kernel-shark-2.alpha/src/libkshark-tepdata.c:543 #6 0x00007ffff7ed791d in tepdata_get_task (stream=0x7fffc0007150, entry=<optimized out>) at /home/work/share/dancho/kernel-shark-2.alpha/src/libkshark-tepdata.c:578 #7 0x00007ffff7f86478 in kshark_get_task (entry=0x7fffffffac00) at /home/work/share/dancho/kernel-shark-2.alpha/src/libkshark.h:327 #8 0x00007ffff7f86478 in KsTraceGraph::_resetPointer(unsigned long, int, int, int) (this=0x7fffffffc0f0, ts=<optimized out>, sd=<optimized out>, cpu=0, pid=13495) at /home/work/share/dancho/kernel-shark-2.alpha/src/KsTraceGraph.cpp:269 #9 0x00007ffff6c85ec0 in QMetaObject::activate(QObject*, int, int, void**) () at /lib64/libQt5Core.so.5 #10 0x00007ffff7f4e69d in KsGLWidget::notFound(unsigned long, int, int, int) (this=this@entry=0x7fffffffc420, _t1=<optimized out>, _t1@entry=77924220595092, _t2=<optimized out>, _t3=<optimized out>, _t4=<optimized out>) at /home/work/share/dancho/kernel-shark-2.alpha/build/src/moc_KsGLWidget.cpp:236 #11 0x00007ffff7f6e6ef in KsGLWidget::mouseMoveEvent(QMouseEvent*) (this=0x7fffffffc420, event=<optimized out>) at /home/work/share/dancho/kernel-shark-2.alpha/src/libkshark-model.h:175 #12 0x00007ffff77bc16e in QWidget::event(QEvent*) () at /lib64/libQt5Widgets.so.5 #13 0x00007ffff7779af6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 #14 0x00007ffff77830d3 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 #15 0x00007ffff6c5bae8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5 #16 0x00007ffff77821b7 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /lib64/libQt5Widgets.so.5 #17 0x00007ffff77d7ead in () at /lib64/libQt5Widgets.so.5 #18 0x00007ffff77dad3c in () at /lib64/libQt5Widgets.so.5 #19 0x00007ffff7779af6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 #20 0x00007ffff7782e80 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5 #21 0x00007ffff6c5bae8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5 #22 0x00007ffff71ea783 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /lib64/libQt5Gui.so.5 #23 0x00007ffff71ebfab in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /lib64/libQt5Gui.so.5 #24 0x00007ffff71c84fb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Gui.so.5 #25 0x00007fffe6809bee in () at /lib64/libQt5XcbQpa.so.5 #26 0x00007ffff568aecd in g_main_context_dispatch () at /lib64/libglib-2.0.so.0 #27 0x00007ffff568b260 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0 #28 0x00007ffff568b303 in g_main_context_iteration () at /lib64/libglib-2.0.so.0 #29 0x00007ffff6cb0bd5 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5 #30 0x00007ffff6c5a9eb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5 #31 0x00007ffff6c62726 in QCoreApplication::exec() () at /lib64/libQt5Core.so.5 #32 0x0000000000402458 in main(int, char**) (argc=<optimized out>, argv=0x7fffffffd4d8) at /home/work/share/dancho/kernel-shark-2.alpha/src/kernelshark.cpp:107
Proposed a fix, commit ID 5a85e07fc40aceac106871401604d99f9a5e0b77 https://patchwork.kernel.org/patch/11185291/
Fixed by 219aeb06f9d8 ("trace-cmd: Fix segmentation fault in tracecmd_read_at() in specific use case")