rtla: Updates for 5.20
Steven Rostedt
maintainerPATCH 3/4 rtla: Fix double free
In reply to Steven RostedtFrom: Andreas Schwab <[email protected]>
Avoid double free by making trace_instance_destroy indempotent. When trace_instance_init fails, it calls trace_instance_destroy, but its only caller osnoise_destroy_tool calls it again.
--- tools/tracing/rtla/src/trace.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/tracing/rtla/src/trace.c +7 -2
@@ -134,13 +134,18 @@ void trace_instance_destroy(struct trace_instance *trace)if (trace->inst) {disable_tracer (trace->inst);destroy_instance (trace->inst); + trace->inst =NULL ; } -if (trace->seq) +if (trace->seq) {free (trace->seq); + trace->seq =NULL ; + } -if (trace->tep) +if (trace->tep) {tep_free (trace->tep); + trace->tep =NULL ; + } }/*
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 1/4 rtla/utils: Use calloc and check the potential memory allocation failure
In reply to Steven RostedtFrom: jianchunfu <[email protected]>
Replace malloc with calloc and add memory allocating check of mon_cpus before used.
--- tools/tracing/rtla/src/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/tracing/rtla/src/utils.c +3 -2
@@ -106,8 +106,9 @@ int parse_cpu_list(char *cpu_list, char **monitored_cpus) nr_cpus =sysconf (_SC_NPROCESSORS_CONF); - mon_cpus =malloc (nr_cpus *sizeof (char )); -memset (mon_cpus,0 , (nr_cpus *sizeof (char ))); + mon_cpus =calloc (nr_cpus,sizeof (char )); +if (!mon_cpus) + goto err;for (p = cpu_list; *p; ) { cpu =atoi (p);
Signature · 1 line
2.35.1
Steven Rostedt
maintainerPATCH 2/4 rtla: Fix Makefile when called from -C tools/
In reply to Steven RostedtFrom: Daniel Bristot de Oliveira <[email protected]>
Sedat Dilek reported an error on rtla Makefile when running:
$ make -C tools/ clean
[...]
make[2]: Entering directory
'/home/dileks/src/linux-kernel/git/tools/tracing/rtla'
[...]
'/home/dileks/src/linux-kernel/git/Documentation/tools/rtla'
/bin/sh: 1: test: rtla-make[2]:: unexpected operator <------ The problem
rm: cannot remove '/home/dileks/src/linux-kernel/git': Is a directory
make[2]: *** [Makefile:120: clean] Error 1
make[2]: Leaving directoryThis occurred because the rtla calls kernel's Makefile to get the version in silence mode, e.g.,
$ make -sC ../../.. kernelversion
5.19.0-rc4But the -s is being ignored when rtla's makefile is called indirectly, so the output looks like this:
$ make -C ../../.. kernelversion
make: Entering directory '/root/linux'
5.19.0-rc4
make: Leaving directory '/root/linux'Using 'grep -v make' avoids this problem, e.g.,
$ make -C ../../.. kernelversion | grep -v make
5.19.0-rc4Thus, add | grep -v make.
--- tools/tracing/rtla/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/rtla/Makefile +1 -1
@@ -1,6 +1,6 @@ NAME := rtla # Follow the kernel version -VERSION := $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelversion) +VERSION := $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelversion | grep -v make) # From libtracefs: # Makefiles suck: This macro sets a default value of $(2) for the
Signature · 1 line
2.35.1
Steven Rostedt
maintainercover rtla: Updates for 5.20
Andreas Schwab (2):
rtla: Fix double free
rtla: Define syscall numbers for riscv
Daniel Bristot de Oliveira (1):
rtla: Fix Makefile when called from -C tools/
jianchunfu (1):
rtla/utils: Use calloc and check the potential memory allocation failure
----
tools/tracing/rtla/Makefile | 2 +- tools/tracing/rtla/src/trace.c | 9 +++++++-- tools/tracing/rtla/src/utils.c | 7 ++++--- 3 files changed, 12 insertions(+), 6 deletions(-)
Steven Rostedt
maintainerPATCH 4/4 rtla: Define syscall numbers for riscv
From: Andreas Schwab <[email protected]>
RISC-V uses the same (generic) syscall numbers as ARM64.
--- tools/tracing/rtla/src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/rtla/src/utils.c +1 -1
@@ -225,7 +225,7 @@ long parse_ns_duration(char *val)#elif __arm__# define __NR_sched_setattr 380# define __NR_sched_getattr 381 -#elif __aarch64__ +#elif __aarch64__ || __riscv# define __NR_sched_setattr 274# define __NR_sched_getattr 275#elif __powerpc__
Signature · 1 line
2.35.1