From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 439D263C; Thu, 15 Aug 2024 14:28:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723732134; cv=none; b=gtp5C7UzS/IPHVf4j53Zje3bR5l+sVoKU0ofFqStnDzAHlOiefAF7IpNADFYBnZGZ/Dzn5IiC5rbhgehetjNI1pFgh6A6rLSrFIfYpsdO2XBHHnQuEtDx26ROXz1o63Iva8tX7RcNiVQzHT7QNTEPNaUbRK0vi5le+X2yzrxTr8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723732134; c=relaxed/simple; bh=1TaSjRxwJJvSFsIAkOzhQfmalzY57QR9w44E5VAcc8U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mO1awIuVy+K9hSTk1JYnMi79EYzJLsupbnIo7Q0t4OAcP7KWWVAz/EmT+kyBcAYOxbvUDXlQcefslWxWq/Cs+IS3AFhFE53xSO7Bs/6XGewZb+/Y+mTZKSo61sR4CO7J7oBRWKPD7CFy6vAOchtq2MYiiT7ntrzRpaqjqtLNZXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NVBAnxtb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NVBAnxtb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45105C32786; Thu, 15 Aug 2024 14:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723732133; bh=1TaSjRxwJJvSFsIAkOzhQfmalzY57QR9w44E5VAcc8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NVBAnxtbjgNb7cZ3Z3yZmx47Wo/YpQCoGnh54YVBk6/dh2Mz3BzfRb17qIchTT2Ho IeXDmUThXPuaPO47BLF2HdSF3+hR0E50mirQJUAEKsGHRufSL4eG7I1zsj4QdMJJME 3Ut0EGA0b4LXAO0fuVP91BWfKNuy0OJ2hfTarbdQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Adrian Hunter , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.10 053/352] perf/x86/intel/pt: Fix pt_topa_entry_for_page() address calculation Date: Thu, 15 Aug 2024 15:21:59 +0200 Message-ID: <20240815131921.289970903@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240815131919.196120297@linuxfoundation.org> References: <20240815131919.196120297@linuxfoundation.org> User-Agent: quilt/0.67 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: Adrian Hunter [ Upstream commit 3520b251dcae2b4a27b95cd6f745c54fd658bda5 ] Currently, perf allocates an array of page pointers which is limited in size by MAX_PAGE_ORDER. That in turn limits the maximum Intel PT buffer size to 2GiB. Should that limitation be lifted, the Intel PT driver can support larger sizes, except for one calculation in pt_topa_entry_for_page(), which is limited to 32-bits. Fix pt_topa_entry_for_page() address calculation by adding a cast. Fixes: 39152ee51b77 ("perf/x86/intel/pt: Get rid of reverse lookup table for ToPA") Signed-off-by: Adrian Hunter Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20240624201101.60186-4-adrian.hunter@intel.com Signed-off-by: Sasha Levin --- arch/x86/events/intel/pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index 5667b8b994e34..d97d34b4669be 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c @@ -973,7 +973,7 @@ pt_topa_entry_for_page(struct pt_buffer *buf, unsigned int pg) * order allocations, there shouldn't be many of these. */ list_for_each_entry(topa, &buf->tables, list) { - if (topa->offset + topa->size > pg << PAGE_SHIFT) + if (topa->offset + topa->size > (unsigned long)pg << PAGE_SHIFT) goto found; } -- 2.43.0