| 6ea8a206 | 12-Jan-2026 |
Costa Shulyupin <costa.shul@redhat.com> |
rtla: Fix parse_cpu_set() bug introduced by strtoi()
The patch 'Replace atoi() with a robust strtoi()' introduced a bug in parse_cpu_set(), which relies on partial parsing of the input string.
The
rtla: Fix parse_cpu_set() bug introduced by strtoi()
The patch 'Replace atoi() with a robust strtoi()' introduced a bug in parse_cpu_set(), which relies on partial parsing of the input string.
The function parses CPU specifications like '0-3,5' by incrementing a pointer through the string. strtoi() rejects strings with trailing characters, causing parse_cpu_set() to fail on any CPU list with multiple entries.
Restore the original use of atoi() in parse_cpu_set().
Fixes: 7e9dfccf8f11 ("rtla: Replace atoi() with a robust strtoi()") Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Link: https://lore.kernel.org/r/20260112192642.212848-2-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| fb8b8183 | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Fix parse_cpu_set() return value documentation
Correct the return value documentation for parse_cpu_set() function in utils.c. The comment incorrectly stated that the function returns 1 on suc
rtla: Fix parse_cpu_set() return value documentation
Correct the return value documentation for parse_cpu_set() function in utils.c. The comment incorrectly stated that the function returns 1 on success and 0 on failure, but the actual implementation returns 0 on success and 1 on failure, following the common error-on-nonzero convention used throughout the codebase.
This documentation fix ensures that developers reading the code understand the correct return value semantics and prevents potential misuse of the function's return value in conditional checks.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-18-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 33e3c807 | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Ensure null termination after read operations in utils.c
Add explicit null termination and buffer initialization for read() operations in procfs_is_workload_pid() and get_self_cgroup() functio
rtla: Ensure null termination after read operations in utils.c
Add explicit null termination and buffer initialization for read() operations in procfs_is_workload_pid() and get_self_cgroup() functions. The read() system call does not null-terminate the data it reads, and when the buffer is filled to capacity, subsequent string operations will read past the buffer boundary searching for a null terminator.
In procfs_is_workload_pid(), explicitly set buffer[MAX_PATH-1] to '\0' to ensure the buffer is always null-terminated before passing it to strncmp(). In get_self_cgroup(), use memset() to zero the path buffer before reading, which ensures null termination when retval is less than MAX_PATH. Additionally, set path[MAX_PATH-1] to '\0' after the read to handle the case where the buffer is filled completely.
These defensive buffer handling practices prevent potential buffer overruns and align with the ongoing buffer safety improvements across the rtla codebase.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-17-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| af2962d6 | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Make stop_tracing variable volatile
The stop_tracing global variable is accessed from both the signal handler context and the main program flow without synchronization. This creates a potentia
rtla: Make stop_tracing variable volatile
The stop_tracing global variable is accessed from both the signal handler context and the main program flow without synchronization. This creates a potential race condition where compiler optimizations could cache the variable value in registers, preventing the signal handler's updates from being visible to other parts of the program.
Add the volatile qualifier to stop_tracing in both common.c and common.h to ensure all accesses to this variable bypass compiler optimizations and read directly from memory. This guarantees that when the signal handler sets stop_tracing, the change is immediately visible to the main program loop, preventing potential hangs or delayed shutdown when termination signals are received.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-16-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 02689ae3 | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Add generated output files to gitignore
The rtla tool generates various output files during testing and execution, including custom trace outputs and histogram data. These files are artifacts
rtla: Add generated output files to gitignore
The rtla tool generates various output files during testing and execution, including custom trace outputs and histogram data. These files are artifacts of running the tool with different options and should not be tracked in version control.
Add gitignore entries for custom_filename.txt, osnoise_irq_noise_hist.txt, osnoise_trace.txt, and timerlat_trace.txt to prevent accidentally committing these generated files. This aligns with the existing pattern of ignoring build artifacts and generated headers like *.skel.h.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-15-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| a0890f9d | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Fix NULL pointer dereference in actions_parse
The actions_parse() function uses strtok() to tokenize the trigger string, but does not check if the returned token is NULL before passing it to s
rtla: Fix NULL pointer dereference in actions_parse
The actions_parse() function uses strtok() to tokenize the trigger string, but does not check if the returned token is NULL before passing it to strcmp(). If the trigger parameter is an empty string or contains only delimiter characters, strtok() returns NULL, causing strcmp() to dereference a NULL pointer and crash the program.
This issue can be triggered by malformed user input or edge cases in trigger string parsing. Add a NULL check immediately after the strtok() call to validate that a token was successfully extracted before using it. If no token is found, the function now returns -1 to indicate a parsing error.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-13-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| f3cc3e4b | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Remove unused headers
Remove unused includes for <errno.h> and <signal.h> to clean up the code and reduce unnecessary dependencies.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Lin
rtla: Remove unused headers
Remove unused includes for <errno.h> and <signal.h> to clean up the code and reduce unnecessary dependencies.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-12-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| d849f3af | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Remove redundant memset after calloc
The actions struct is allocated using calloc, which already returns zeroed memory. The subsequent memset call to zero the 'present' member is therefore red
rtla: Remove redundant memset after calloc
The actions struct is allocated using calloc, which already returns zeroed memory. The subsequent memset call to zero the 'present' member is therefore redundant.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-10-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 9bf942f3 | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Use standard exit codes for result enum
The result enum defines custom values for PASSED, ERROR, and FAILED. These values correspond to standard exit codes EXIT_SUCCESS and EXIT_FAILURE.
Upda
rtla: Use standard exit codes for result enum
The result enum defines custom values for PASSED, ERROR, and FAILED. These values correspond to standard exit codes EXIT_SUCCESS and EXIT_FAILURE.
Update the enum to use the standard macros EXIT_SUCCESS and EXIT_FAILURE to improve readability and adherence to standard C practices.
The FAILED value is implicitly assigned EXIT_FAILURE + 1, so there is no need to assign an explicit value.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-9-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 7e9dfccf | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Replace atoi() with a robust strtoi()
The atoi() function does not perform error checking, which can lead to undefined behavior when parsing invalid or out-of-range strings. This can cause iss
rtla: Replace atoi() with a robust strtoi()
The atoi() function does not perform error checking, which can lead to undefined behavior when parsing invalid or out-of-range strings. This can cause issues when parsing user-provided numerical inputs, such as signal numbers, PIDs, or CPU lists.
To address this, introduce a new strtoi() helper function that safely converts a string to an integer. This function validates the input and checks for overflows, returning a negative value on failure.
Replace all calls to atoi() with the new strtoi() function and add proper error handling to make the parsing more robust and prevent potential issues.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-5-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 648634d1 | 06-Jan-2026 |
Wander Lairson Costa <wander@redhat.com> |
rtla: Introduce for_each_action() helper
The for loop to iterate over the list of actions is used in more than one place. To avoid code duplication and improve readability, introduce a for_each_acti
rtla: Introduce for_each_action() helper
The for loop to iterate over the list of actions is used in more than one place. To avoid code duplication and improve readability, introduce a for_each_action() helper macro.
Replace the open-coded for loops with the new helper.
Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260106133655.249887-4-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 2a3a2533 | 24-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Deduplicate cgroup path opening code
Both set_pid_cgroup() and set_comm_cgroup() functions contain identical code for opening the cgroup.procs file.
Extract this common code into a new
tools/rtla: Deduplicate cgroup path opening code
Both set_pid_cgroup() and set_comm_cgroup() functions contain identical code for opening the cgroup.procs file.
Extract this common code into a new helper function open_cgroup_procs() to reduce code duplication and improve maintainability.
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251224125058.1771519-1-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 0576be46 | 09-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Consolidate -H/--house-keeping option parsing
Each rtla tool duplicates parsing of -H/--house-keeping.
Migrate the option parsing from individual tools to the common_parse_options().
S
tools/rtla: Consolidate -H/--house-keeping option parsing
Each rtla tool duplicates parsing of -H/--house-keeping.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251209100047.2692515-8-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 5cc90b14 | 09-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Consolidate -P/--priority option parsing
Each rtla tool duplicates parsing of -P/--priority.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-
tools/rtla: Consolidate -P/--priority option parsing
Each rtla tool duplicates parsing of -P/--priority.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251209100047.2692515-7-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| c93c25fc | 09-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Consolidate -e/--event option parsing
Each rtla tool duplicates parsing of -e/--event.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Co
tools/rtla: Consolidate -e/--event option parsing
Each rtla tool duplicates parsing of -e/--event.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251209100047.2692515-6-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 76975581 | 09-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Consolidate -d/--duration option parsing
Each rtla tool duplicates parsing of -d/--duration.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-
tools/rtla: Consolidate -d/--duration option parsing
Each rtla tool duplicates parsing of -d/--duration.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251209100047.2692515-5-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| fd788c49 | 09-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Consolidate -D/--debug option parsing
Each rtla tool duplicates parsing of -D/--debug.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Co
tools/rtla: Consolidate -D/--debug option parsing
Each rtla tool duplicates parsing of -D/--debug.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251209100047.2692515-4-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| edb23c83 | 09-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Consolidate -C/--cgroup option parsing
Each rtla tool duplicates parsing of -C/--cgroup.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by:
tools/rtla: Consolidate -C/--cgroup option parsing
Each rtla tool duplicates parsing of -C/--cgroup.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251209100047.2692515-3-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 28dc4459 | 09-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Consolidate -c/--cpus option parsing
Each rtla tool duplicates parsing of -c/--cpus.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Cost
tools/rtla: Consolidate -c/--cpus option parsing
Each rtla tool duplicates parsing of -c/--cpus.
Migrate the option parsing from individual tools to the common_parse_options().
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251209100047.2692515-2-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 850cd24c | 09-Dec-2025 |
Costa Shulyupin <costa.shul@redhat.com> |
tools/rtla: Add common_parse_options()
Each rtla tool duplicates parsing of many common options. This creates maintenance overhead and risks inconsistencies when updating these options.
Add common_
tools/rtla: Add common_parse_options()
Each rtla tool duplicates parsing of many common options. This creates maintenance overhead and risks inconsistencies when updating these options.
Add common_parse_options() to centralize parsing of options used across all tools.
Common options to be migrated in future patches.
Changes since v1: - restore opterr
Signed-off-by: Costa Shulyupin <costa.shul@redhat.com> Link: https://lore.kernel.org/r/20251209100047.2692515-1-costa.shul@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| fbb8ed66 | 26-Nov-2025 |
Tomas Glozar <tglozar@redhat.com> |
rtla/tests: Run Test::Harness in verbose mode
Add -v flag to prove command to also print the names of tests that succeeded, not only those that failed, to allow easier debugging of the test suite.
rtla/tests: Run Test::Harness in verbose mode
Add -v flag to prove command to also print the names of tests that succeeded, not only those that failed, to allow easier debugging of the test suite.
Also, drop printing the option and value to stdout in check_with_osnoise_options, which was a debugging print that was accidentally left in the final commit, and which would be otherwise now visible in make check output, as stdout is no longer suppressed.
Suggested-by: Crystal Wood <crwood@redhat.com> Reviewed-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20251126144205.331954-6-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 5525aebd | 26-Nov-2025 |
Tomas Glozar <tglozar@redhat.com> |
rtla/tests: Test BPF action program
Add a test that implements a BPF program writing to a test map, which is attached to RTLA via --bpf-action to be executed on theshold overflow.
A combination of
rtla/tests: Test BPF action program
Add a test that implements a BPF program writing to a test map, which is attached to RTLA via --bpf-action to be executed on theshold overflow.
A combination of --on-threshold shell with bpftool (which is always present if BPF support is enabled) is used to check whether the BPF program has executed successfully.
Suggested-by: Crystal Wood <crwood@redhat.com> Link: https://lore.kernel.org/r/20251126144205.331954-5-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 0304a3b7 | 26-Nov-2025 |
Tomas Glozar <tglozar@redhat.com> |
rtla/timerlat: Add example for BPF action program
Add an example BPF action program that prints the measured latency to the tracefs buffer via bpf_printk().
A new Makefile target, "examples", is ad
rtla/timerlat: Add example for BPF action program
Add an example BPF action program that prints the measured latency to the tracefs buffer via bpf_printk().
A new Makefile target, "examples", is added to build the example. In addition, "sample/" subfolder is renamed to "example".
If BPF skeleton support is unavailable or disabled, a warning will be displayed when building the BPF action program example.
Link: https://lore.kernel.org/r/20251126144205.331954-4-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| f967d1ec | 26-Nov-2025 |
Tomas Glozar <tglozar@redhat.com> |
rtla/timerlat: Add --bpf-action option
Add option --bpf-action that allows the user to attach an external BPF program that will be executed via BPF tail call on latency threshold overflow.
Executin
rtla/timerlat: Add --bpf-action option
Add option --bpf-action that allows the user to attach an external BPF program that will be executed via BPF tail call on latency threshold overflow.
Executing additional BPF code on latency threshold overflow allows doing low-latency and in-kernel troubleshooting of the cause of the overflow.
The option takes an argument, which is a path to a BPF ELF file expected to contain a function named "action_handler" in a section named "tp/timerlat_action" (the section is necessary for libbpf to assign the correct BPF program type to it).
Link: https://lore.kernel.org/r/20251126144205.331954-3-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|
| 8cd0f08a | 26-Nov-2025 |
Tomas Glozar <tglozar@redhat.com> |
rtla/timerlat: Support tail call from BPF program
Add a map to the rtla-timerlat BPF program that holds a file descriptor of another BPF program, to be executed on threshold overflow.
timerlat_bpf_
rtla/timerlat: Support tail call from BPF program
Add a map to the rtla-timerlat BPF program that holds a file descriptor of another BPF program, to be executed on threshold overflow.
timerlat_bpf_set_action() is added as an interface to set the program.
Link: https://lore.kernel.org/r/20251126144205.331954-2-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
show more ...
|