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 34CEE1A6166; Tue, 30 Jul 2024 16:48:24 +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=1722358104; cv=none; b=Pt2H0wEx04RqMHlWJNrPlu1BM6SVPVhiDQQGT0PwIjqfWL+0eEkAxPX5ZrWL+lmqaDQkQzJXBg/73LCU6t5fK5dZc/kWVoR0ItWM5PaSIqvK5WlTLArbRcIq22D1qP84MLejPW1er1uFY65RH896XuBJx6QF2CIsy29cvwNnL6k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722358104; c=relaxed/simple; bh=ZVLEh6vdvum+pfWsdSrVZbMrw3x5ovOKEl/gmzoyR2o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mvKPUQhtkn27ppBRqNCFCqJx3SXsd2dVwxerlkQ3ve9HbO4Y3AWLDhSAJ+B6FD+yd8hpWIncHUK3n5Od3AjVStr3cGh77+rmdM68S//o65JF31HzGtLBYLFelDD0JxCYz7ZxwGuPalPVRbWTT9pvtA4nDli4gSF9vg7XycyejqU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AqkpuwV+; 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="AqkpuwV+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFCF9C32782; Tue, 30 Jul 2024 16:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722358104; bh=ZVLEh6vdvum+pfWsdSrVZbMrw3x5ovOKEl/gmzoyR2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqkpuwV+765AkigiyhG3HYQFt+xAWnT3JfIyvTkpgTUoTciABAzYRJD85QEu/HrAO 5FG7tb6KchsbBHVSkEqwlEAz0/Z/jMAbOZVC64FTm5zt1WCwE6+qSB8xT5hcKUBRaZ huffKDjAooXzrnJwX8di5i5r+AMj4pb0PXBWIutk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dave Hansen , Adrian Hunter , "Peter Zijlstra (Intel)" Subject: [PATCH 6.1 357/440] perf/x86/intel/pt: Fix a topa_entry base address calculation Date: Tue, 30 Jul 2024 17:49:50 +0200 Message-ID: <20240730151629.759455897@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730151615.753688326@linuxfoundation.org> References: <20240730151615.753688326@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 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrian Hunter commit ad97196379d0b8cb24ef3d5006978a6554e6467f upstream. topa_entry->base is a bit-field. Bit-fields are not promoted to a 64-bit type, even if the underlying type is 64-bit, and so, if necessary, must be cast to a larger type when calculations are done. Fix a topa_entry->base address calculation by adding a cast. Without the cast, the address was limited to 36-bits i.e. 64GiB. The address calculation is used on systems that do not support Multiple Entry ToPA (only Broadwell), and affects physical addresses on or above 64GiB. Instead of writing to the correct address, the address comprising the first 36 bits would be written to. Intel PT snapshot and sampling modes are not affected. Fixes: 52ca9ced3f70 ("perf/x86/intel/pt: Add Intel PT PMU driver") Reported-by: Dave Hansen Signed-off-by: Adrian Hunter Signed-off-by: Peter Zijlstra (Intel) Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240624201101.60186-3-adrian.hunter@intel.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/events/intel/pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c @@ -877,7 +877,7 @@ static void pt_update_head(struct pt *pt */ static void *pt_buffer_region(struct pt_buffer *buf) { - return phys_to_virt(TOPA_ENTRY(buf->cur, buf->cur_idx)->base << TOPA_SHIFT); + return phys_to_virt((phys_addr_t)TOPA_ENTRY(buf->cur, buf->cur_idx)->base << TOPA_SHIFT); } /**