<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/tools/tracing, branch master</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Merge tag 'trace-rtla-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace</title>
<updated>2026-04-16T00:48:24+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-04-16T00:48:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9e1e9d660255d7216067193d774f338d08d8528d'/>
<id>9e1e9d660255d7216067193d774f338d08d8528d</id>
<content type='text'>
Pull RTLA updates from Steven Rostedt:

 - Simplify option parsing

   Auto-generate getopt_long() optstring for short options from long
   options array, avoiding the need to specify it manually and reducing
   the surface for mistakes.

 - Add unit tests

   Implement unit tests (make unit-tests) using libcheck, next to
   existing runtime tests (make check). Currently, three functions from
   utils.c are tested.

 - Add --stack-format option

   In addition to stopping stack pointer decoding (with -s/--stack
   option) on first unresolvable pointer, allow also skipping
   unresolvable pointers and displaying everything, configurable with a
   new option.

 - Unify number of CPUs into one global variable

   Use one global variable, nr_cpus, to store the number of CPUs instead
   of retrieving it and passing it at multiple places.

 - Fix behavior in various corner cases

   Make RTLA behave correctly in several corner cases: memory allocation
   failure, invalid value read from kernel side, thread creation
   failure, malformed time value input, and read/write failure or
   interruption by signal.

 - Improve string handling

   Simplify several places in the code that handle strings, including
   parsing of action arguments. A few new helper functions and variables
   are added for that purpose.

 - Get rid of magic numbers

   Few places handling paths use a magic number of 1024. Replace it with
   MAX_PATH and ARRAY_SIZE() macro.

 - Unify threshold handling

   Code that handles response to latency threshold is duplicated between
   tools, which has led to bugs in the past. Unify it into a new helper
   as much as possible.

 - Fix segfault on SIGINT during cleanup

   The SIGINT handler touches dynamically allocated memory. Detach it
   before freeing it during cleanup to prevent segmentation fault and
   discarding of output buffers. Also, properly document SIGINT handling
   while at it.

* tag 'trace-rtla-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: (28 commits)
  Documentation/rtla: Document SIGINT behavior
  rtla: Fix segfault on multiple SIGINTs
  rtla/utils: Fix loop condition in PID validation
  rtla/utils: Fix resource leak in set_comm_sched_attr()
  rtla/trace: Fix I/O handling in save_trace_to_file()
  rtla/trace: Fix write loop in trace_event_save_hist()
  rtla/timerlat: Simplify RTLA_NO_BPF environment variable check
  rtla: Use str_has_prefix() for option prefix check
  rtla: Enforce exact match for time unit suffixes
  rtla: Use str_has_prefix() for prefix checks
  rtla: Add str_has_prefix() helper function
  rtla: Handle pthread_create() failure properly
  rtla/timerlat: Add bounds check for softirq vector
  rtla: Simplify code by caching string lengths
  rtla: Replace magic number with MAX_PATH
  rtla: Introduce common_threshold_handler() helper
  rtla/actions: Simplify argument parsing
  rtla: Use strdup() to simplify code
  rtla: Exit on memory allocation failures during initialization
  tools/rtla: Remove unneeded nr_cpus from for_each_monitored_cpu
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull RTLA updates from Steven Rostedt:

 - Simplify option parsing

   Auto-generate getopt_long() optstring for short options from long
   options array, avoiding the need to specify it manually and reducing
   the surface for mistakes.

 - Add unit tests

   Implement unit tests (make unit-tests) using libcheck, next to
   existing runtime tests (make check). Currently, three functions from
   utils.c are tested.

 - Add --stack-format option

   In addition to stopping stack pointer decoding (with -s/--stack
   option) on first unresolvable pointer, allow also skipping
   unresolvable pointers and displaying everything, configurable with a
   new option.

 - Unify number of CPUs into one global variable

   Use one global variable, nr_cpus, to store the number of CPUs instead
   of retrieving it and passing it at multiple places.

 - Fix behavior in various corner cases

   Make RTLA behave correctly in several corner cases: memory allocation
   failure, invalid value read from kernel side, thread creation
   failure, malformed time value input, and read/write failure or
   interruption by signal.

 - Improve string handling

   Simplify several places in the code that handle strings, including
   parsing of action arguments. A few new helper functions and variables
   are added for that purpose.

 - Get rid of magic numbers

   Few places handling paths use a magic number of 1024. Replace it with
   MAX_PATH and ARRAY_SIZE() macro.

 - Unify threshold handling

   Code that handles response to latency threshold is duplicated between
   tools, which has led to bugs in the past. Unify it into a new helper
   as much as possible.

 - Fix segfault on SIGINT during cleanup

   The SIGINT handler touches dynamically allocated memory. Detach it
   before freeing it during cleanup to prevent segmentation fault and
   discarding of output buffers. Also, properly document SIGINT handling
   while at it.

* tag 'trace-rtla-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: (28 commits)
  Documentation/rtla: Document SIGINT behavior
  rtla: Fix segfault on multiple SIGINTs
  rtla/utils: Fix loop condition in PID validation
  rtla/utils: Fix resource leak in set_comm_sched_attr()
  rtla/trace: Fix I/O handling in save_trace_to_file()
  rtla/trace: Fix write loop in trace_event_save_hist()
  rtla/timerlat: Simplify RTLA_NO_BPF environment variable check
  rtla: Use str_has_prefix() for option prefix check
  rtla: Enforce exact match for time unit suffixes
  rtla: Use str_has_prefix() for prefix checks
  rtla: Add str_has_prefix() helper function
  rtla: Handle pthread_create() failure properly
  rtla/timerlat: Add bounds check for softirq vector
  rtla: Simplify code by caching string lengths
  rtla: Replace magic number with MAX_PATH
  rtla: Introduce common_threshold_handler() helper
  rtla/actions: Simplify argument parsing
  rtla: Use strdup() to simplify code
  rtla: Exit on memory allocation failures during initialization
  tools/rtla: Remove unneeded nr_cpus from for_each_monitored_cpu
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla: Fix build without libbpf header</title>
<updated>2026-03-30T16:44:48+00:00</updated>
<author>
<name>Tomas Glozar</name>
<email>tglozar@redhat.com</email>
</author>
<published>2026-03-30T09:12:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2e8b1a1d12ae3338efeb1c3de3eb4e9324b87a28'/>
<id>2e8b1a1d12ae3338efeb1c3de3eb4e9324b87a28</id>
<content type='text'>
rtla supports building without libbpf. However, BPF actions
patchset [1] adds an include of bpf/libbpf.h into timerlat_bpf.h,
which breaks build on systems that don't have libbpf headers
installed.

This is a leftover from a draft version of the patchset where
timerlat_bpf_set_action() (which takes a struct bpf_program * argument)
was defined in the header. timerlat_bpf.c already includes bpf/libbpf.h
via timerlat.skel.h when libbpf is present.

Remove the redundant include to fix build on systems without libbpf
headers.

[1] https://lore.kernel.org/linux-trace-kernel/20251126144205.331954-1-tglozar@redhat.com/T/

Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: Luis Goncalves &lt;lgoncalv@redhat.com&gt;
Cc: Crystal Wood &lt;crwood@redhat.com&gt;
Cc: Costa Shulyupin &lt;costa.shul@redhat.com&gt;
Link: https://patch.msgid.link/20260330091207.16184-1-tglozar@redhat.com
Reported-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Closes: https://lore.kernel.org/linux-trace-kernel/20260329122202.65a8b575@robin/
Fixes: 8cd0f08ac72e ("rtla/timerlat: Support tail call from BPF program")
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
Reviewed-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
rtla supports building without libbpf. However, BPF actions
patchset [1] adds an include of bpf/libbpf.h into timerlat_bpf.h,
which breaks build on systems that don't have libbpf headers
installed.

This is a leftover from a draft version of the patchset where
timerlat_bpf_set_action() (which takes a struct bpf_program * argument)
was defined in the header. timerlat_bpf.c already includes bpf/libbpf.h
via timerlat.skel.h when libbpf is present.

Remove the redundant include to fix build on systems without libbpf
headers.

[1] https://lore.kernel.org/linux-trace-kernel/20251126144205.331954-1-tglozar@redhat.com/T/

Cc: John Kacur &lt;jkacur@redhat.com&gt;
Cc: Luis Goncalves &lt;lgoncalv@redhat.com&gt;
Cc: Crystal Wood &lt;crwood@redhat.com&gt;
Cc: Costa Shulyupin &lt;costa.shul@redhat.com&gt;
Link: https://patch.msgid.link/20260330091207.16184-1-tglozar@redhat.com
Reported-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Closes: https://lore.kernel.org/linux-trace-kernel/20260329122202.65a8b575@robin/
Fixes: 8cd0f08ac72e ("rtla/timerlat: Support tail call from BPF program")
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
Reviewed-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla: Fix segfault on multiple SIGINTs</title>
<updated>2026-03-20T13:41:36+00:00</updated>
<author>
<name>Tomas Glozar</name>
<email>tglozar@redhat.com</email>
</author>
<published>2026-03-10T16:07:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=be8058f31b4e237604e4ce7599593ab68dc69ae7'/>
<id>be8058f31b4e237604e4ce7599593ab68dc69ae7</id>
<content type='text'>
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 &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260310160725.144443-1-tglozar@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260310160725.144443-1-tglozar@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla/utils: Fix loop condition in PID validation</title>
<updated>2026-03-11T14:29:50+00:00</updated>
<author>
<name>Wander Lairson Costa</name>
<email>wander@redhat.com</email>
</author>
<published>2026-03-09T19:46:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=99261ccdc0f346b1f21ae3718b2b3c0dd69c04b4'/>
<id>99261ccdc0f346b1f21ae3718b2b3c0dd69c04b4</id>
<content type='text'>
The procfs_is_workload_pid() function iterates through a directory
entry name to validate if it represents a process ID. The loop
condition checks if the pointer t_name is non-NULL, but since
incrementing a pointer never makes it NULL, this condition is always
true within the loop's context. Although the inner isdigit() check
catches the NUL terminator and breaks out of the loop, the condition
is semantically misleading and not idiomatic for C string processing.

Correct the loop condition from checking the pointer (t_name) to
checking the character it points to (*t_name). This ensures the loop
terminates when the NUL terminator is reached, aligning with standard
C string iteration practices. While the original code functioned
correctly due to the existing character validation, this change
improves code clarity and maintainability.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-19-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The procfs_is_workload_pid() function iterates through a directory
entry name to validate if it represents a process ID. The loop
condition checks if the pointer t_name is non-NULL, but since
incrementing a pointer never makes it NULL, this condition is always
true within the loop's context. Although the inner isdigit() check
catches the NUL terminator and breaks out of the loop, the condition
is semantically misleading and not idiomatic for C string processing.

Correct the loop condition from checking the pointer (t_name) to
checking the character it points to (*t_name). This ensures the loop
terminates when the NUL terminator is reached, aligning with standard
C string iteration practices. While the original code functioned
correctly due to the existing character validation, this change
improves code clarity and maintainability.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-19-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla/utils: Fix resource leak in set_comm_sched_attr()</title>
<updated>2026-03-11T14:29:50+00:00</updated>
<author>
<name>Wander Lairson Costa</name>
<email>wander@redhat.com</email>
</author>
<published>2026-03-09T19:46:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=5b6dc659ad792c72b3ff1be8039ae2945e030928'/>
<id>5b6dc659ad792c72b3ff1be8039ae2945e030928</id>
<content type='text'>
The set_comm_sched_attr() function opens the /proc directory via
opendir() but fails to call closedir() on its successful exit path.
If the function iterates through all processes without error, it
returns 0 directly, leaking the DIR stream pointer.

Fix this by refactoring the function to use a single exit path. A
retval variable is introduced to track the success or failure status.
All exit points now jump to a unified out label that calls closedir()
before the function returns, ensuring the resource is always freed.

Fixes: dada03db9bb19 ("rtla: Remove procps-ng dependency")
Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-18-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The set_comm_sched_attr() function opens the /proc directory via
opendir() but fails to call closedir() on its successful exit path.
If the function iterates through all processes without error, it
returns 0 directly, leaking the DIR stream pointer.

Fix this by refactoring the function to use a single exit path. A
retval variable is introduced to track the success or failure status.
All exit points now jump to a unified out label that calls closedir()
before the function returns, ensuring the resource is always freed.

Fixes: dada03db9bb19 ("rtla: Remove procps-ng dependency")
Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-18-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla/trace: Fix I/O handling in save_trace_to_file()</title>
<updated>2026-03-11T14:29:50+00:00</updated>
<author>
<name>Wander Lairson Costa</name>
<email>wander@redhat.com</email>
</author>
<published>2026-03-09T19:46:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=47dd74f68c0c068fdd29cdf9fe1860a19209bc1f'/>
<id>47dd74f68c0c068fdd29cdf9fe1860a19209bc1f</id>
<content type='text'>
The read/write loop in save_trace_to_file() does not correctly handle
errors from the read() and write() system calls. If either call is
interrupted by a signal, it returns -1 with errno set to EINTR, but
the code treats this as a fatal error and aborts the save operation.
Additionally, write() may perform a partial write, returning fewer
bytes than requested, which the code does not handle.

Fix the I/O loop by introducing proper error handling. The return
value of read() is now stored in a ssize_t variable and checked for
errors, with EINTR causing a retry. For write(), an inner loop ensures
all bytes are written, handling both EINTR and partial writes. Error
messages now include strerror() output for better debugging.

This follows the same pattern established in the previous commit that
fixed trace_event_save_hist(), ensuring consistent and robust I/O
handling throughout the trace saving code.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-17-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The read/write loop in save_trace_to_file() does not correctly handle
errors from the read() and write() system calls. If either call is
interrupted by a signal, it returns -1 with errno set to EINTR, but
the code treats this as a fatal error and aborts the save operation.
Additionally, write() may perform a partial write, returning fewer
bytes than requested, which the code does not handle.

Fix the I/O loop by introducing proper error handling. The return
value of read() is now stored in a ssize_t variable and checked for
errors, with EINTR causing a retry. For write(), an inner loop ensures
all bytes are written, handling both EINTR and partial writes. Error
messages now include strerror() output for better debugging.

This follows the same pattern established in the previous commit that
fixed trace_event_save_hist(), ensuring consistent and robust I/O
handling throughout the trace saving code.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-17-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla/trace: Fix write loop in trace_event_save_hist()</title>
<updated>2026-03-11T14:29:50+00:00</updated>
<author>
<name>Wander Lairson Costa</name>
<email>wander@redhat.com</email>
</author>
<published>2026-03-09T19:46:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=4bf4ef5292b9253d8607c61a875d9f6b14129976'/>
<id>4bf4ef5292b9253d8607c61a875d9f6b14129976</id>
<content type='text'>
The write loop in trace_event_save_hist() does not correctly handle
errors from the write() system call. If write() returns -1, this value
is added to the loop index, leading to an incorrect memory access on
the next iteration and potentially an infinite loop. The loop also
fails to handle EINTR.

Fix the write loop by introducing proper error handling. The return
value of write() is now stored in a ssize_t variable and checked for
errors. The loop retries the call if interrupted by a signal and breaks
on any other error after logging it with strerror().

Additionally, change the index variable type from int to size_t to
match the type used for buffer sizes and by strlen(), improving type
safety.

Fixes: 761916fd02c2 ("rtla/trace: Save event histogram output to a file")
Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-16-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The write loop in trace_event_save_hist() does not correctly handle
errors from the write() system call. If write() returns -1, this value
is added to the loop index, leading to an incorrect memory access on
the next iteration and potentially an infinite loop. The loop also
fails to handle EINTR.

Fix the write loop by introducing proper error handling. The return
value of write() is now stored in a ssize_t variable and checked for
errors. The loop retries the call if interrupted by a signal and breaks
on any other error after logging it with strerror().

Additionally, change the index variable type from int to size_t to
match the type used for buffer sizes and by strlen(), improving type
safety.

Fixes: 761916fd02c2 ("rtla/trace: Save event histogram output to a file")
Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-16-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla/timerlat: Simplify RTLA_NO_BPF environment variable check</title>
<updated>2026-03-11T14:29:50+00:00</updated>
<author>
<name>Wander Lairson Costa</name>
<email>wander@redhat.com</email>
</author>
<published>2026-03-09T19:46:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=48fbcd4db34b5ea9135801ffe4585a22681c0815'/>
<id>48fbcd4db34b5ea9135801ffe4585a22681c0815</id>
<content type='text'>
The code that checks the RTLA_NO_BPF environment variable calls
getenv() twice and uses strncmp() with a length of 2 to compare
against the single-character string "1". This is inefficient and
the comparison length is unnecessarily long.

Store the result of getenv() in a local variable to avoid the
redundant call, and replace strncmp() with strncmp_static() for
the exact match comparison. This follows the same pattern
established in recent commits that improved string comparison
consistency throughout the rtla codebase.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-15-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The code that checks the RTLA_NO_BPF environment variable calls
getenv() twice and uses strncmp() with a length of 2 to compare
against the single-character string "1". This is inefficient and
the comparison length is unnecessarily long.

Store the result of getenv() in a local variable to avoid the
redundant call, and replace strncmp() with strncmp_static() for
the exact match comparison. This follows the same pattern
established in recent commits that improved string comparison
consistency throughout the rtla codebase.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-15-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla: Use str_has_prefix() for option prefix check</title>
<updated>2026-03-11T14:29:50+00:00</updated>
<author>
<name>Wander Lairson Costa</name>
<email>wander@redhat.com</email>
</author>
<published>2026-03-09T19:46:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=ea5ea8359cd68037d8a093df67d55b750818ab8f'/>
<id>ea5ea8359cd68037d8a093df67d55b750818ab8f</id>
<content type='text'>
The argument parsing code in timerlat_main() and osnoise_main() uses
strncmp() with a length of 1 to check if the first argument starts
with a dash, indicating an option flag was passed.

Replace this pattern with str_has_prefix() for consistency with the
rest of the codebase. While character comparison would be slightly
more efficient, using str_has_prefix() provides better readability
and maintains a uniform coding style throughout the rtla tool.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-14-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The argument parsing code in timerlat_main() and osnoise_main() uses
strncmp() with a length of 1 to check if the first argument starts
with a dash, indicating an option flag was passed.

Replace this pattern with str_has_prefix() for consistency with the
rest of the codebase. While character comparison would be slightly
more efficient, using str_has_prefix() provides better readability
and maintains a uniform coding style throughout the rtla tool.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-14-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rtla: Enforce exact match for time unit suffixes</title>
<updated>2026-03-11T14:29:50+00:00</updated>
<author>
<name>Wander Lairson Costa</name>
<email>wander@redhat.com</email>
</author>
<published>2026-03-09T19:46:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b3910a739235f89f616345dda1f8303d9ccb99fb'/>
<id>b3910a739235f89f616345dda1f8303d9ccb99fb</id>
<content type='text'>
The parse_ns_duration() function currently uses prefix matching for
detecting time units. This approach is problematic as it silently
accepts malformed strings such as "100nsx" or "100us_invalid" by
ignoring the trailing characters, leading to potential configuration
errors.

Introduce a match_time_unit() helper that checks the suffix matches
exactly and is followed by either end-of-string or a ':' delimiter.
The ':' is needed because parse_ns_duration() is also called from
get_long_ns_after_colon() when parsing SCHED_DEADLINE priority
specifications in the format "d:runtime:period" (e.g., "d:10ms:100ms").

A plain strcmp() would reject valid deadline strings because the suffix
"ms" is followed by ":100ms", not end-of-string. Similarly,
strncmp_static() would fail because ARRAY_SIZE() includes the NUL
terminator, making it equivalent to strcmp() for this comparison.

The match_time_unit() helper solves both problems: it rejects malformed
input like "100msx" while correctly handling the colon-delimited
deadline format.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-13-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The parse_ns_duration() function currently uses prefix matching for
detecting time units. This approach is problematic as it silently
accepts malformed strings such as "100nsx" or "100us_invalid" by
ignoring the trailing characters, leading to potential configuration
errors.

Introduce a match_time_unit() helper that checks the suffix matches
exactly and is followed by either end-of-string or a ':' delimiter.
The ':' is needed because parse_ns_duration() is also called from
get_long_ns_after_colon() when parsing SCHED_DEADLINE priority
specifications in the format "d:runtime:period" (e.g., "d:10ms:100ms").

A plain strcmp() would reject valid deadline strings because the suffix
"ms" is followed by ":100ms", not end-of-string. Similarly,
strncmp_static() would fail because ARRAY_SIZE() includes the NUL
terminator, making it equivalent to strcmp() for this comparison.

The match_time_unit() helper solves both problems: it rejects malformed
input like "100msx" while correctly handling the colon-delimited
deadline format.

Signed-off-by: Wander Lairson Costa &lt;wander@redhat.com&gt;
Link: https://lore.kernel.org/r/20260309195040.1019085-13-wander@redhat.com
Signed-off-by: Tomas Glozar &lt;tglozar@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
