rtla: v5.18-rc4 fixes
cover rtla: v5.18-rc4 fixes
Hi Steven,
Here are some v5.18-rc4 fixes for RTLA that I think are ready to be queued.
Daniel Bristot de Oliveira (1):
rtla: Fix __set_sched_attr error message
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 ++++++----- tools/tracing/rtla/src/utils.c | 2 +- 7 files changed, 28 insertions(+), 25 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/4 rtla: Avoid record NULL pointer dereference
From: Wan Jiabing <[email protected]>
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.
--- 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(-)
tools/tracing/rtla/src/osnoise_hist.c +3 -2
@@ -809,7 +809,7 @@ int osnoise_hist_main(int argc, char *argv[]) retval =set_comm_sched_attr ("osnoise/" , ¶ms->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);
tools/tracing/rtla/src/osnoise_top.c +5 -4
@@ -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/" , ¶ms->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);
tools/tracing/rtla/src/timerlat_hist.c +6 -5
@@ -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/" , ¶ms->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);
tools/tracing/rtla/src/timerlat_top.c +6 -5
@@ -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/" , ¶ms->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);
Signature · 1 line
2.32.0
PATCH 2/4 rtla: Don't overwrite existing directory mode
In reply to Daniel Bristot de OliveiraFrom: John Kacur <[email protected]>
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.
--- tools/tracing/rtla/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/tracing/rtla/Makefile +2 -1
@@ -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
Signature · 1 line
2.32.0
PATCH 3/4 rtla: Minor grammar fix for rtla README
In reply to Daniel Bristot de OliveiraFrom: John Kacur <[email protected]>
- 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.
--- tools/tracing/rtla/README.txt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
tools/tracing/rtla/README.txt +5 -7
@@ -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
Signature · 1 line
2.32.0
PATCH 4/4 rtla: Fix __set_sched_attr error message
In reply to Daniel Bristot de Oliveirartla's function __set_sched_attr() was borrowed from stalld, but I forgot to update the error message to something meaningful for rtla.
Update the error message from:
boost_with_deadline failed to boost pid PID: STRERROR
to a proper one:
Failed to set sched attributes to the pid PID: STRERROR
--- tools/tracing/rtla/src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/rtla/src/utils.c +1 -1
@@ -255,7 +255,7 @@ int __set_sched_attr(int pid, struct sched_attr *attr) retval =sched_setattr (pid, attr, flags);if (retval <0 ) { -err_msg ("boost_with_deadline failed to boost pid %d: %s\n" , +err_msg ("Failed to set sched attributes to the pid %d: %s\n" , pid,strerror (errno));return 1 ; }
Signature · 1 line
2.32.0