mirror of
https://github.com/torvalds/linux.git
synced 2026-11-10 17:11:02 +01:00
perf intel-pt: Fix off-by-one in auxtrace_info minimum size check
min_sz is set to sizeof(u64) * INTEL_PT_PER_CPU_MMAPS, but the code
accesses auxtrace_info->priv[INTEL_PT_PER_CPU_MMAPS], which requires
at least INTEL_PT_PER_CPU_MMAPS + 1 elements. A file with exactly
min_sz bytes of priv data passes the size check but the access reads
one u64 past the validated region.
Use (INTEL_PT_PER_CPU_MMAPS + 1) to ensure the highest accessed index
is within bounds.
Fixes: 90e457f7be ("perf tools: Add Intel PT support")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
96fcc9ea5f
commit
c4362d5e1a
|
|
@ -4432,7 +4432,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
|
|||
struct perf_session *session)
|
||||
{
|
||||
struct perf_record_auxtrace_info *auxtrace_info = &event->auxtrace_info;
|
||||
size_t min_sz = sizeof(u64) * INTEL_PT_PER_CPU_MMAPS;
|
||||
size_t min_sz = sizeof(u64) * (INTEL_PT_PER_CPU_MMAPS + 1);
|
||||
struct intel_pt *pt;
|
||||
void *info_end;
|
||||
__u64 *info;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user