Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rtla: Fix segfault on multiple SIGINTs

Detach stop_trace() from SIGINT/SIGALRM on tool clean-up to prevent it
from crashing RTLA by accessing freed memory.

This prevents a crash when multiple SIGINTs are received.

Fixes: d6899e560366 ("rtla/timerlat_hist: Abort event processing on second signal")
Fixes: 80967b354a76 ("rtla/timerlat_top: Abort event processing on second signal")
Reviewed-by: Wander Lairson Costa <wander@redhat.com>
Link: https://lore.kernel.org/r/20260310160725.144443-1-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>

+15 -1
+15 -1
tools/tracing/rtla/src/common.c
··· 42 42 } 43 43 44 44 /* 45 + * unset_signals - unsets the signals to stop the tool 46 + */ 47 + static void unset_signals(struct common_params *params) 48 + { 49 + signal(SIGINT, SIG_DFL); 50 + if (params->duration) { 51 + alarm(0); 52 + signal(SIGALRM, SIG_DFL); 53 + } 54 + } 55 + 56 + /* 45 57 * getopt_auto - auto-generates optstring from long_options 46 58 */ 47 59 int getopt_auto(int argc, char **argv, const struct option *long_opts) ··· 363 351 364 352 retval = ops->main(tool); 365 353 if (retval) 366 - goto out_trace; 354 + goto out_signals; 367 355 368 356 if (params->user_workload && !params->user.stopped_running) { 369 357 params->user.should_run = 0; ··· 385 373 if (ops->analyze) 386 374 ops->analyze(tool, stopped); 387 375 376 + out_signals: 377 + unset_signals(params); 388 378 out_trace: 389 379 trace_events_destroy(&tool->record->trace, params->events); 390 380 params->events = NULL;