summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Yan <wangyan01@kylinos.cn>2026-08-24 10:55:53 +0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-09-08 17:50:39 -0300
commitd9c7e2ede92ce258a5d4a6cbc55f75acd379c97d (patch)
treebdda704553167a31c42b6bb18a51b2627edb5087
parent537ff9c4271d0903f3652886aa29371a104ea649 (diff)
downloadlinux-next-d9c7e2ede92ce258a5d4a6cbc55f75acd379c97d.tar.gz
linux-next-d9c7e2ede92ce258a5d4a6cbc55f75acd379c97d.zip
perf powerpc-vpadtl: Fix off-by-one in auxtrace_info minimum size check
min_sz is set to sizeof(u64) * POWERPC_VPADTL_TYPE, but the code reads auxtrace_info->priv[POWERPC_VPADTL_TYPE], which needs at least POWERPC_VPADTL_TYPE + 1 elements. POWERPC_VPADTL_TYPE is the first enumerator of the priv index enum (0), so min_sz evaluates to 0 and the check validates only the perf_record_auxtrace_info header itself. A PERF_RECORD_AUXTRACE_INFO event carrying a zero-length priv array then passes the size check, and the subsequent priv[POWERPC_VPADTL_TYPE] read runs one u64 past the validated region. This is the same off-by-one fixed for Intel PT by commit c4362d5e1a5e ("perf intel-pt: Fix off-by-one in auxtrace_info minimum size check") and for Intel BTS by commit b9fb8225951c ("perf intel-bts: Fix off-by-one in auxtrace_info minimum size check"). Use sizeof(u64) * (POWERPC_VPADTL_TYPE + 1) so the highest accessed priv index is covered by the minimum-size validation. Fixes: c4bbd4ec2e50a9ed ("perf powerpc: Process auxtrace events and display in 'perf report -D'") Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Wang Yan <wangyan01@kylinos.cn> Cc: Athira Rajeev <atrajeev@linux.ibm.com> Cc: stable@vger.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/powerpc-vpadtl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/powerpc-vpadtl.c b/tools/perf/util/powerpc-vpadtl.c
index af6783cfdb53..032864e3884a 100644
--- a/tools/perf/util/powerpc-vpadtl.c
+++ b/tools/perf/util/powerpc-vpadtl.c
@@ -683,7 +683,7 @@ int powerpc_vpadtl_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) * POWERPC_VPADTL_TYPE;
+ size_t min_sz = sizeof(u64) * (POWERPC_VPADTL_TYPE + 1);
struct powerpc_vpadtl *vpa;
int err;