Skip to content

Commit d651542

Browse files
walaclenticularis39
authored andcommitted
rtla/timerlat: Add bounds check for softirq vector
Add bounds checking when accessing the softirq_name array using the vector value from kernel trace data. The vector field from the osnoise:softirq_noise event is used directly as an array index without validation, which could cause an out-of-bounds read if the kernel provides an unexpected vector value. The softirq_name array contains 10 elements corresponding to the standard Linux softirq vectors. While the kernel should only provide valid vector values in the range 0-9, defensive programming requires validating untrusted input before using it as an array index. If an out-of-range vector is encountered, display the word UNKNOWN instead of attempting to read beyond the array bounds. Signed-off-by: Wander Lairson Costa <wander@redhat.com> Link: https://lore.kernel.org/r/20260309195040.1019085-9-wander@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com>
1 parent f79720e commit d651542

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/tracing/rtla/src/timerlat_aa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ static int timerlat_aa_softirq_handler(struct trace_seq *s, struct tep_record *r
417417
taa_data->thread_softirq_sum += duration;
418418

419419
trace_seq_printf(taa_data->softirqs_seq, " %24s:%-3llu %.*s %9.2f us\n",
420-
softirq_name[vector], vector,
421-
24, spaces,
420+
vector < ARRAY_SIZE(softirq_name) ? softirq_name[vector] : "UNKNOWN",
421+
vector, 24, spaces,
422422
ns_to_usf(duration));
423423
return 0;
424424
}

0 commit comments

Comments
 (0)