Repository navigation
Commit 6bb19f4
telemetry: performance_monitor: bound extended perf data reply
get_extended_performance_data() writes one 48-byte ext_perf_data_item
for every enabled core and every occupied performance slot, and never
looks at the size of the buffer it writes to. The IPC4 BaseFW
LARGE_CONFIG_GET for IPC4_EXTENDED_GLOBAL_PERF_DATA hands it
ipc->comp_data, a SOF_IPC_MSG_MAX_SIZE (4096 byte) heap block, which
holds 85 items after the count word.
A slot is taken for every component the host creates, and while
measurements are started it stays taken after the component is freed.
CONFIG_SOF_TELEMETRY_MAX_COMP_ENTRIES defaults to 88 (170 without
SOF_TELEMETRY_MODULE_RESOURCES), so 85 components on one core are
enough for the report to run past the end of comp_data: up to 372
bytes with 5 cores and 88 slots, about 4 KiB with 170 slots. The
reply size check in ipc4_get_large_config_module_instance() runs only
after the getter has written. Through a VENDOR_CONFIG_PARAM get the
same getter is reached with data pointing after earlier TLV replies
inside comp_data, so the whole buffer size is not a safe bound there.
Pass the buffer size to get_extended_performance_data() and refuse
the request with -ENOBUFS, reported as IPC4_OUT_OF_MEMORY, when the
items do not all fit, instead of returning a report the host cannot
tell apart from a complete one. The size is the in/out data_off_size,
the host max reply length that the vendor config path narrows to the
room left after its TLV header, capped at SOF_IPC_MSG_MAX_SIZE.
Reports that fit are unchanged. The 16-byte global and I/O perf
reports cannot exceed the buffer with the configured slot counts.
Signed-off-by: Shrushti P K <shrusthi@labs.digiscrypt.com>1 parent d3bceb8 commit 6bb19f4
3 files changed
Lines changed: 33 additions & 5 deletions
File tree
- src
- include/sof/debug/telemetry
- kernel
- audio
- debug/telemetry
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | | - | |
| 128 | + | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
176 | 179 | | |
177 | 180 | | |
178 | 181 | | |
179 | | - | |
| 182 | + | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
739 | 741 | | |
740 | 742 | | |
741 | 743 | | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
742 | 749 | | |
743 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
744 | 753 | | |
745 | 754 | | |
746 | 755 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
403 | | - | |
| 403 | + | |
| 404 | + | |
404 | 405 | | |
405 | 406 | | |
406 | 407 | | |
| |||
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
416 | 431 | | |
417 | 432 | | |
418 | 433 | | |
| |||
0 commit comments