[<prev] [next>] [day] [month] [year] [list]
Message-Id: <78b201bfbeabdb8c55fcd51d76e0475c437175ed.1643033113.git.bristot@kernel.org>
Date: Mon, 24 Jan 2022 15:24:09 +0100
From: Daniel Bristot de Oliveira <bristot@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Daniel Bristot de Oliveira <bristot@...nel.org>,
linux-kernel@...r.kernel.org, linux-trace-devel@...r.kernel.org
Subject: [PATCH 6/8] rtla/timerlat_hist: Fix segmentation fault when failing to enable -t
rtla timerlat hist is causing a segmentation fault when running with
the --trace option on a kernel that does not support multiple
instances. For example:
[root@f34 rtla]# rtla timerlat hist -t
failed to enable the tracer timerlat
Could not enable osnoiser tracer for tracing
Failed to enable the trace instance
Segmentation fault (core dumped)
This error happens because the exit code of the tools is trying
to destroy the trace instance that failed to be created.
Rearrange the order in which trace instances are destroyed to avoid
this problem.
Fixes: (1eeb6328e8b3 "rtla/timerlat: Add timerlat hist mode")
Cc: Daniel Bristot de Oliveira <bristot@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org
Cc: linux-trace-devel@...r.kernel.org
Signed-off-by: Daniel Bristot de Oliveira <bristot@...nel.org>
---
tools/tracing/rtla/src/timerlat_hist.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index 235f9620ef3d..74ccb6351ad2 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -792,7 +792,7 @@ int timerlat_hist_main(int argc, char *argv[])
trace);
if (retval < 0) {
err_msg("Error iterating on events\n");
- goto out_hist;
+ goto out_trace;
}
if (!tracefs_trace_is_on(trace->inst))
@@ -811,11 +811,12 @@ int timerlat_hist_main(int argc, char *argv[])
}
}
+out_trace:
+ if (params->trace_output)
+ osnoise_destroy_tool(record);
out_hist:
timerlat_free_histogram(tool->data);
osnoise_destroy_tool(tool);
- if (params->trace_output)
- osnoise_destroy_tool(record);
free(params);
out_exit:
exit(return_value);
--
2.34.1
Powered by blists - more mailing lists