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 A032C46DFFD; Tue, 21 Jul 2026 19:05:48 +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=1784660749; cv=none; b=lBaV3gnTNE+Y4czWyUdoyCw1mIMJI6svQSo13pIBnBWnFvk4Z6tpufieXreaqTAGdzMPIsBpanR60oZhT/S/0lKQ13GBzPIbHgKG5R6iv6kupz8Omlfass1vZkWqQ7jX7EK7QUpVSPRU5dlJbNLtsgqGXegqbeOMy2K2zRCjTBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784660749; c=relaxed/simple; bh=Il7qo//++jdLPnNDCKybX00sCtsJ5sJZ5UHwbpySFsU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oVL/6cM3fqPSnFX7K2wRrzfp8660vCa0goEbLCwOP81HrX+Q/dB2hRLeGr2s2C4WmYfgXXdbERsNLC19x9NbN35a6BLTDILljr2/fZTGbjfopvT9pGUeherfbFDmhyCFVho2clHzs5cT9sfvDxa/BTd2CCuwUez6adoRuix6U1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nWY7xyzH; 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="nWY7xyzH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C93A91F000E9; Tue, 21 Jul 2026 19:05:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784660748; bh=n2juXWYKd9GgoYMCheFU4eMqh5bMAWy6aI2sNXpvoXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nWY7xyzHcfElxfOtin16AewLSdtbx9A/KdOSLZr3yVb5rYXGLY1s2HHR8jkt8uLX7 Amd1kQCD4HvySuXKbgsbUm0fuj5+C7QO8SyPoJL+5kXzyxM5/B7+gIDpgVD/sVWWe6 ty84oGeywYUqoJOtq/2oNlvW1QoqAfXTUx8YW5xU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, sashiko-bot , Adrian Hunter , James Clark , Leo Yan , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 7.1 1096/2077] perf cs-etm: Require full global header in auxtrace_info size check Date: Tue, 21 Jul 2026 17:12:49 +0200 Message-ID: <20260721152618.671991599@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@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 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnaldo Carvalho de Melo [ Upstream commit 78d8ba680126f3545e8d0fba667e12d79fd4353b ] cs_etm__process_auxtrace_info() checks that header.size covers event_header_size + INFO_HEADER_SIZE (16 bytes total), but then accesses ptr[CS_PMU_TYPE_CPUS] at offset 24 from the start of the event. A crafted 16-byte auxtrace_info event passes the size check but reads out-of-bounds. Include CS_ETM_HEADER_SIZE in the minimum size check so that the global header entries (version, pmu_type_cpus, snapshot) are guaranteed to fit within the event. Fixes: 55c1de9973d66516 ("perf cs-etm: Print auxtrace info even if OpenCSD isn't linked") Reported-by: sashiko-bot Cc: Adrian Hunter Cc: James Clark Cc: Leo Yan Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/cs-etm-base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/cs-etm-base.c b/tools/perf/util/cs-etm-base.c index 4abe416e3febd2..aebef71d3a0a1d 100644 --- a/tools/perf/util/cs-etm-base.c +++ b/tools/perf/util/cs-etm-base.c @@ -170,7 +170,9 @@ int cs_etm__process_auxtrace_info(union perf_event *event, u64 *ptr = NULL; u64 hdr_version; - if (auxtrace_info->header.size < (event_header_size + INFO_HEADER_SIZE)) + /* Ensure priv[] is large enough for the global header entries */ + if (auxtrace_info->header.size < (event_header_size + INFO_HEADER_SIZE + + CS_ETM_HEADER_SIZE)) return -EINVAL; /* First the global part */ -- 2.53.0