diff options
| author | David E. Garcia Porras <[email protected]> | 2026-08-18 15:00:22 -0600 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2026-09-03 13:37:34 +0530 |
| commit | d34a39df779aa55a2dd929717a32e48c3a80df66 (patch) | |
| tree | b28cd12ecca61fe406b5606264ef5f80dfb1fe48 /platform/common/objects.mk | |
| parent | d97cfb33ae1ac0d9eebce1a03c96497a1f8f4c67 (diff) | |
lib: sbi_pmu: Match raw event selector only against raw event map entries
sbi_pmu_event_get_info() walks hw_event_map[] to decide whether a
requested event is supported. For SBI_PMU_EVENT_RAW_IDX and
SBI_PMU_EVENT_RAW_V2_IDX it compares the requested event_data against
temp->select / temp->select_mask without first checking that the map
entry being examined is itself a raw event entry.
Non-raw hardware event entries are added via sbi_pmu_add_hw_event_counter_map(),
leave select and select_mask at zero, hence they satisfy:
temp->select == (event_data & temp->select_mask)
so the first non-raw entry visited will always match.
The issue's observability depends purely on the ordering of hw_event_map[]:
if the platform registers its raw events last, every raw event query, including
unsupported ones, will be reported as supported.
Fix it by checking event_idx against temp->start_idx and temp->end_idx before
comparing select/select_mask.
Fixes: e4345842168b ("lib: sbi_pmu: Implement SBI PMU event info function")
Signed-off-by: David E. Garcia Porras <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'platform/common/objects.mk')
0 files changed, 0 insertions, 0 deletions
