linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] rtla: v5.18-rc2 Fixes
@ 2022-04-15 13:36 Daniel Bristot de Oliveira
  2022-04-15 13:36 ` [PATCH 1/3] rtla: Avoid record NULL pointer dereference Daniel Bristot de Oliveira
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-04-15 13:36 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-devel, lkml, Daniel Bristot de Oliveira

Steven,

Here are some fixes for rtla.

I do not include "rtla/Makefile: Properly handle dependencies"
because I will make two changes to it:
        -  I need to check rst2man only in the make install phase
        -  I will remove procps-devel dependency on another patch

I will send a v2 of the "Properly handle dependencies" and the removal
of procps-devel dependencies next week. But these ones are already ready.

John Kacur (2):
  rtla: Don't overwrite existing directory mode
  rtla: Minor grammar fix for rtla README

Wan Jiabing (1):
  rtla: Avoid record NULL pointer dereference

 tools/tracing/rtla/Makefile            |  3 ++-
 tools/tracing/rtla/README.txt          | 12 +++++-------
 tools/tracing/rtla/src/osnoise_hist.c  |  5 +++--
 tools/tracing/rtla/src/osnoise_top.c   |  9 +++++----
 tools/tracing/rtla/src/timerlat_hist.c | 11 ++++++-----
 tools/tracing/rtla/src/timerlat_top.c  | 11 ++++++-----
 6 files changed, 27 insertions(+), 24 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] rtla: Avoid record NULL pointer dereference
  2022-04-15 13:36 [PATCH 0/3] rtla: v5.18-rc2 Fixes Daniel Bristot de Oliveira
@ 2022-04-15 13:36 ` Daniel Bristot de Oliveira
  2022-04-15 13:36 ` [PATCH 2/3] rtla: Don't overwrite existing directory mode Daniel Bristot de Oliveira
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-04-15 13:36 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-trace-devel, lkml, Daniel Bristot de Oliveira, Wan Jiabing,
	kael_w

From: Wan Jiabing <wanjiabing@vivo.com>

Fix the following null/deref_null.cocci errors:
./tools/tracing/rtla/src/osnoise_hist.c:870:31-36: ERROR: record is NULL but dereferenced.
./tools/tracing/rtla/src/osnoise_top.c:650:31-36: ERROR: record is NULL but dereferenced.
./tools/tracing/rtla/src/timerlat_hist.c:905:31-36: ERROR: record is NULL but dereferenced.
./tools/tracing/rtla/src/timerlat_top.c:700:31-36: ERROR: record is NULL but dereferenced.

"record" is NULL before calling osnoise_init_trace_tool.
Add a tag "out_free" to avoid dereferring a NULL pointer.

Link: https://lore.kernel.org/r/20220408151406.34823-1-wanjiabing@vivo.com/

Cc: kael_w@yeah.net
Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Fixes: 51d64c3a1819 ("rtla: Add -e/--event support")
Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 tools/tracing/rtla/src/osnoise_hist.c  |  5 +++--
 tools/tracing/rtla/src/osnoise_top.c   |  9 +++++----
 tools/tracing/rtla/src/timerlat_hist.c | 11 ++++++-----
 tools/tracing/rtla/src/timerlat_top.c  | 11 ++++++-----
 4 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
index b4380d45cacd..5d7ea479ac89 100644
--- a/tools/tracing/rtla/src/osnoise_hist.c
+++ b/tools/tracing/rtla/src/osnoise_hist.c
@@ -809,7 +809,7 @@ int osnoise_hist_main(int argc, char *argv[])
 		retval = set_comm_sched_attr("osnoise/", &params->sched_param);
 		if (retval) {
 			err_msg("Failed to set sched parameters\n");
-			goto out_hist;
+			goto out_free;
 		}
 	}
 
@@ -819,7 +819,7 @@ int osnoise_hist_main(int argc, char *argv[])
 		record = osnoise_init_trace_tool("osnoise");
 		if (!record) {
 			err_msg("Failed to enable the trace instance\n");
-			goto out_hist;
+			goto out_free;
 		}
 
 		if (params->events) {
@@ -869,6 +869,7 @@ int osnoise_hist_main(int argc, char *argv[])
 out_hist:
 	trace_events_destroy(&record->trace, params->events);
 	params->events = NULL;
+out_free:
 	osnoise_free_histogram(tool->data);
 out_destroy:
 	osnoise_destroy_tool(record);
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index 72c2fd6ce005..76479bfb2922 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -572,7 +572,7 @@ int osnoise_top_main(int argc, char **argv)
 	retval = osnoise_top_apply_config(tool, params);
 	if (retval) {
 		err_msg("Could not apply config\n");
-		goto out_top;
+		goto out_free;
 	}
 
 	trace = &tool->trace;
@@ -580,14 +580,14 @@ int osnoise_top_main(int argc, char **argv)
 	retval = enable_osnoise(trace);
 	if (retval) {
 		err_msg("Failed to enable osnoise tracer\n");
-		goto out_top;
+		goto out_free;
 	}
 
 	if (params->set_sched) {
 		retval = set_comm_sched_attr("osnoise/", &params->sched_param);
 		if (retval) {
 			err_msg("Failed to set sched parameters\n");
-			goto out_top;
+			goto out_free;
 		}
 	}
 
@@ -597,7 +597,7 @@ int osnoise_top_main(int argc, char **argv)
 		record = osnoise_init_trace_tool("osnoise");
 		if (!record) {
 			err_msg("Failed to enable the trace instance\n");
-			goto out_top;
+			goto out_free;
 		}
 
 		if (params->events) {
@@ -649,6 +649,7 @@ int osnoise_top_main(int argc, char **argv)
 out_top:
 	trace_events_destroy(&record->trace, params->events);
 	params->events = NULL;
+out_free:
 	osnoise_free_top(tool->data);
 	osnoise_destroy_tool(record);
 	osnoise_destroy_tool(tool);
diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/src/timerlat_hist.c
index dc908126c610..f3ec628f5e51 100644
--- a/tools/tracing/rtla/src/timerlat_hist.c
+++ b/tools/tracing/rtla/src/timerlat_hist.c
@@ -821,7 +821,7 @@ int timerlat_hist_main(int argc, char *argv[])
 	retval = timerlat_hist_apply_config(tool, params);
 	if (retval) {
 		err_msg("Could not apply config\n");
-		goto out_hist;
+		goto out_free;
 	}
 
 	trace = &tool->trace;
@@ -829,14 +829,14 @@ int timerlat_hist_main(int argc, char *argv[])
 	retval = enable_timerlat(trace);
 	if (retval) {
 		err_msg("Failed to enable timerlat tracer\n");
-		goto out_hist;
+		goto out_free;
 	}
 
 	if (params->set_sched) {
 		retval = set_comm_sched_attr("timerlat/", &params->sched_param);
 		if (retval) {
 			err_msg("Failed to set sched parameters\n");
-			goto out_hist;
+			goto out_free;
 		}
 	}
 
@@ -844,7 +844,7 @@ int timerlat_hist_main(int argc, char *argv[])
 		dma_latency_fd = set_cpu_dma_latency(params->dma_latency);
 		if (dma_latency_fd < 0) {
 			err_msg("Could not set /dev/cpu_dma_latency.\n");
-			goto out_hist;
+			goto out_free;
 		}
 	}
 
@@ -854,7 +854,7 @@ int timerlat_hist_main(int argc, char *argv[])
 		record = osnoise_init_trace_tool("timerlat");
 		if (!record) {
 			err_msg("Failed to enable the trace instance\n");
-			goto out_hist;
+			goto out_free;
 		}
 
 		if (params->events) {
@@ -904,6 +904,7 @@ int timerlat_hist_main(int argc, char *argv[])
 		close(dma_latency_fd);
 	trace_events_destroy(&record->trace, params->events);
 	params->events = NULL;
+out_free:
 	timerlat_free_histogram(tool->data);
 	osnoise_destroy_tool(record);
 	osnoise_destroy_tool(tool);
diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 1f754c3df53f..35452a1d45e9 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -612,7 +612,7 @@ int timerlat_top_main(int argc, char *argv[])
 	retval = timerlat_top_apply_config(top, params);
 	if (retval) {
 		err_msg("Could not apply config\n");
-		goto out_top;
+		goto out_free;
 	}
 
 	trace = &top->trace;
@@ -620,14 +620,14 @@ int timerlat_top_main(int argc, char *argv[])
 	retval = enable_timerlat(trace);
 	if (retval) {
 		err_msg("Failed to enable timerlat tracer\n");
-		goto out_top;
+		goto out_free;
 	}
 
 	if (params->set_sched) {
 		retval = set_comm_sched_attr("timerlat/", &params->sched_param);
 		if (retval) {
 			err_msg("Failed to set sched parameters\n");
-			goto out_top;
+			goto out_free;
 		}
 	}
 
@@ -635,7 +635,7 @@ int timerlat_top_main(int argc, char *argv[])
 		dma_latency_fd = set_cpu_dma_latency(params->dma_latency);
 		if (dma_latency_fd < 0) {
 			err_msg("Could not set /dev/cpu_dma_latency.\n");
-			goto out_top;
+			goto out_free;
 		}
 	}
 
@@ -645,7 +645,7 @@ int timerlat_top_main(int argc, char *argv[])
 		record = osnoise_init_trace_tool("timerlat");
 		if (!record) {
 			err_msg("Failed to enable the trace instance\n");
-			goto out_top;
+			goto out_free;
 		}
 
 		if (params->events) {
@@ -699,6 +699,7 @@ int timerlat_top_main(int argc, char *argv[])
 		close(dma_latency_fd);
 	trace_events_destroy(&record->trace, params->events);
 	params->events = NULL;
+out_free:
 	timerlat_free_top(top->data);
 	osnoise_destroy_tool(record);
 	osnoise_destroy_tool(top);
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] rtla: Don't overwrite existing directory mode
  2022-04-15 13:36 [PATCH 0/3] rtla: v5.18-rc2 Fixes Daniel Bristot de Oliveira
  2022-04-15 13:36 ` [PATCH 1/3] rtla: Avoid record NULL pointer dereference Daniel Bristot de Oliveira
@ 2022-04-15 13:36 ` Daniel Bristot de Oliveira
  2022-04-15 13:36 ` [PATCH 3/3] rtla: Minor grammar fix for rtla README Daniel Bristot de Oliveira
  2022-04-19 16:23 ` [PATCH 0/3] rtla: v5.18-rc2 Fixes Daniel Bristot de Oliveira
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-04-15 13:36 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-trace-devel, lkml, Daniel Bristot de Oliveira, John Kacur,
	Daniel Bristot de Oliveria

From: John Kacur <jkacur@redhat.com>

The mode on /usr/bin is often 555 these days,
but make install on rtla overwrites this with 755

Fix this by preserving the current directory if it exists.

Link: https://lore.kernel.org/r/20220402043939.6962-1-jkacur@redhat.com

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Daniel Bristot de Oliveria <bristot@redhat.com>
Fixes: 79ce8f43ac5a ("rtla: Real-Time Linux Analysis tool")
Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 tools/tracing/rtla/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile
index 5a1eda617992..4b635d4de018 100644
--- a/tools/tracing/rtla/Makefile
+++ b/tools/tracing/rtla/Makefile
@@ -23,6 +23,7 @@ $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/)
 $(call allow-override,LDCONFIG,ldconfig)
 
 INSTALL	=	install
+MKDIR	=	mkdir
 FOPTS	:=	-flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \
 		-fasynchronous-unwind-tables -fstack-clash-protection
 WOPTS	:= 	-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized
@@ -68,7 +69,7 @@ static: $(OBJ)
 
 .PHONY: install
 install: doc_install
-	$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
+	$(MKDIR) -p $(DESTDIR)$(BINDIR)
 	$(INSTALL) rtla -m 755 $(DESTDIR)$(BINDIR)
 	$(STRIP) $(DESTDIR)$(BINDIR)/rtla
 	@test ! -f $(DESTDIR)$(BINDIR)/osnoise || rm $(DESTDIR)$(BINDIR)/osnoise
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] rtla: Minor grammar fix for rtla README
  2022-04-15 13:36 [PATCH 0/3] rtla: v5.18-rc2 Fixes Daniel Bristot de Oliveira
  2022-04-15 13:36 ` [PATCH 1/3] rtla: Avoid record NULL pointer dereference Daniel Bristot de Oliveira
  2022-04-15 13:36 ` [PATCH 2/3] rtla: Don't overwrite existing directory mode Daniel Bristot de Oliveira
@ 2022-04-15 13:36 ` Daniel Bristot de Oliveira
  2022-04-19 16:23 ` [PATCH 0/3] rtla: v5.18-rc2 Fixes Daniel Bristot de Oliveira
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-04-15 13:36 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-trace-devel, lkml, Daniel Bristot de Oliveira, John Kacur

From: John Kacur <jkacur@redhat.com>

- Change to "The rtla meta-tool includes"
- Remove an unnecessary "But, "
- Adjust the formatting of the paragraph resulting from the changes.
- Simplify the wording for the libraries and tools.

Link: https://lore.kernel.org/r/20220408161012.10544-1-jkacur@redhat.com/

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Daniel Bristot de Oliveria <bristot@kernel.org>
Fixes: 79ce8f43ac5a ("rtla: Real-Time Linux Analysis tool")
Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 tools/tracing/rtla/README.txt | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/tracing/rtla/README.txt b/tools/tracing/rtla/README.txt
index 6c88446f7e74..0fbad2640b8c 100644
--- a/tools/tracing/rtla/README.txt
+++ b/tools/tracing/rtla/README.txt
@@ -1,15 +1,13 @@
 RTLA: Real-Time Linux Analysis tools
 
-The rtla is a meta-tool that includes a set of commands that
-aims to analyze the real-time properties of Linux. But, instead of
-testing Linux as a black box, rtla leverages kernel tracing
-capabilities to provide precise information about the properties
-and root causes of unexpected results.
+The rtla meta-tool includes a set of commands that aims to analyze
+the real-time properties of Linux. Instead of testing Linux as a black box,
+rtla leverages kernel tracing capabilities to provide precise information
+about the properties and root causes of unexpected results.
 
 Installing RTLA
 
-RTLA depends on some libraries and tools. More precisely, it depends on the
-following libraries:
+RTLA depends on the following libraries and tools:
 
  - libtracefs
  - libtraceevent
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] rtla: v5.18-rc2 Fixes
  2022-04-15 13:36 [PATCH 0/3] rtla: v5.18-rc2 Fixes Daniel Bristot de Oliveira
                   ` (2 preceding siblings ...)
  2022-04-15 13:36 ` [PATCH 3/3] rtla: Minor grammar fix for rtla README Daniel Bristot de Oliveira
@ 2022-04-19 16:23 ` Daniel Bristot de Oliveira
  3 siblings, 0 replies; 5+ messages in thread
From: Daniel Bristot de Oliveira @ 2022-04-19 16:23 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-devel

Steven,

Please ignore this email thread. For some reason I do not know, red hat's smtp
is converting data to base64...

On 4/15/22 15:36, Daniel Bristot de Oliveira wrote:
> Steven,
> 
> Here are some fixes for rtla.
> 
> I do not include "rtla/Makefile: Properly handle dependencies"
> because I will make two changes to it:
>         -  I need to check rst2man only in the make install phase
>         -  I will remove procps-devel dependency on another patch
> 
> I will send a v2 of the "Properly handle dependencies" and the removal
> of procps-devel dependencies next week. But these ones are already ready.



> John Kacur (2):
>   rtla: Don't overwrite existing directory mode
>   rtla: Minor grammar fix for rtla README
> 
> Wan Jiabing (1):
>   rtla: Avoid record NULL pointer dereference
> 
>  tools/tracing/rtla/Makefile            |  3 ++-
>  tools/tracing/rtla/README.txt          | 12 +++++-------
>  tools/tracing/rtla/src/osnoise_hist.c  |  5 +++--
>  tools/tracing/rtla/src/osnoise_top.c   |  9 +++++----
>  tools/tracing/rtla/src/timerlat_hist.c | 11 ++++++-----
>  tools/tracing/rtla/src/timerlat_top.c  | 11 ++++++-----
>  6 files changed, 27 insertions(+), 24 deletions(-)
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-19 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-15 13:36 [PATCH 0/3] rtla: v5.18-rc2 Fixes Daniel Bristot de Oliveira
2022-04-15 13:36 ` [PATCH 1/3] rtla: Avoid record NULL pointer dereference Daniel Bristot de Oliveira
2022-04-15 13:36 ` [PATCH 2/3] rtla: Don't overwrite existing directory mode Daniel Bristot de Oliveira
2022-04-15 13:36 ` [PATCH 3/3] rtla: Minor grammar fix for rtla README Daniel Bristot de Oliveira
2022-04-19 16:23 ` [PATCH 0/3] rtla: v5.18-rc2 Fixes Daniel Bristot de Oliveira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).