From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D049390600; Sat, 12 Sep 2026 19:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242974; cv=none; b=nZCCnCr4+poYfMKN15rn/ZEWHl7Q6g8rhGBZ124Kqgd98SzdwVPGjQmxNJgmWMjztyozDoBEkW6S8m+aZxnjqcFRtFvV6Wn0LjG8fMvnG60Ywa1sL3pV5cftZO3P30+hZEIhb842KzvfyYzvFQhBrXG39bKWClfOs4JkZMXbjzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242974; c=relaxed/simple; bh=XVRPjx3Y88LLz1ApJAJOK9MXH0Hebbv6307Wqny76EI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pYzsbiycdqRkbh6wvrYnjO6Nv9XDjwDezHTG0knpPmvt9GeuFgyfgMod5ALQuE8VtPZrsuZsOttwo240rI7OsaCr5lvuqm/j0O1L3/cz2iZPO9J250pegu4/IEGGtKFe4q4/EnPtpIqShHU/nRWmzzXeFe2sDu0HeA6EWC/EBbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GrLLCqdm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GrLLCqdm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BA2E1F00899; Sat, 12 Sep 2026 19:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789242967; bh=Zx2dfUR53WAMbQy3HDCLGJOTjtx6qkyaDMsfqFkDquc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GrLLCqdmH8is6cStbY6AqCCt3d9J8BsdyenF5KRarNyJaXm3HK2vAuoxjIvN9eHn3 oZu9yuNZ7zTpXg3dALiuJhiN1XuIYPiwaGsi9Ny7zEQj2+X7wmSZwmk0Gn2ecXD29n 27Q0X+mM9EjXe35ZxdQA0R4yX0iVYqSeal8X7x58= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, sashiko-bot , Arnaldo Carvalho de Melo , James Clark , Adrian Hunter , Namhyung Kim , Sasha Levin Subject: [PATCH 5.10 589/798] perf intel-bts: Fix off-by-one in auxtrace_info minimum size check Date: Sat, 12 Sep 2026 09:03:37 +0200 Message-ID: <20260912065530.624228872@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnaldo Carvalho de Melo [ Upstream commit b9fb8225951ce27e62a2235a71f3ab01137aaec3 ] Same pattern as the Intel PT fix: min_sz is set to sizeof(u64) * INTEL_BTS_SNAPSHOT_MODE, but the code accesses auxtrace_info->priv[INTEL_BTS_SNAPSHOT_MODE], which requires at least INTEL_BTS_SNAPSHOT_MODE + 1 elements. Use (INTEL_BTS_SNAPSHOT_MODE + 1) to ensure the highest accessed index is within bounds. Fixes: d0170af7004dce9c ("perf tools: Add Intel BTS support") Reported-by: sashiko-bot Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Reviewed-by: James Clark Reviewed-by: Adrian Hunter Signed-off-by: Namhyung Kim Signed-off-by: Sasha Levin --- tools/perf/util/intel-bts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index af1e78d76228d..182ebb89afb30 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c @@ -858,7 +858,7 @@ int intel_bts_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_BTS_SNAPSHOT_MODE; + size_t min_sz = sizeof(u64) * (INTEL_BTS_SNAPSHOT_MODE + 1); struct intel_bts *bts; int err; -- 2.53.0