diff options
| author | Donggeun Yoo <donggeunyoo.kernel@gmail.com> | 2026-09-14 22:23:46 +0900 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2026-10-15 18:44:16 -0400 |
| commit | 289e2a775de434ccab2d107076bc78362ce288bd (patch) | |
| tree | 6ef9cd92678f695c18e7e5d426b1c887cedeffec /kernel/trace/trace_stack.c | |
| parent | 91c14d6c13096091c56304120aaa26e479130b8b (diff) | |
tracing: Clamp the printed end of a histogram bucket at U64_MAX
A key with the ".buckets=N" modifier is stored as the start of its bucket,
and hist_trigger_print_key() prints the range it covers as start to
start + N - 1. That addition overflows once the start is within N of
U64_MAX:
# echo 'hist:keys=offset.buckets=10' >> \
events/syscalls/sys_enter_lseek/trigger
# ./seeker 5 -1 # lseek(0, 5) and lseek(0, -1)
# cat events/syscalls/sys_enter_lseek/hist
...
{ offset: ~ 18446744073709551610-3 } hitcount: 1
{ offset: ~ 0-9 } hitcount: 1
...
18446744073709551610 + 10 - 1 does not fit in 64 bits, so the range ends
below where it starts.
The bucket does end at U64_MAX: it holds every value hist_field_bucket()
maps onto its start, and there is no value above U64_MAX. Clamp the printed
end there. Printed honestly the group is shorter than the size asked for,
which histogram.rst does not mention, so say it there.
Link: https://patch.msgid.link/20260914132346.2234731-1-donggeunyoo.kernel@gmail.com
Fixes: de9a48a360b7 ("tracing: Add linear buckets to histogram logic")
Signed-off-by: Donggeun Yoo <donggeunyoo.kernel@gmail.com>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_stack.c')
0 files changed, 0 insertions, 0 deletions
