Patch "perf/x86/intel/pt: Fix a topa_entry base address calculation" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf/x86/intel/pt: Fix a topa_entry base address calculation

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     perf-x86-intel-pt-fix-a-topa_entry-base-address-calc.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 15ed75256afc770736a0c146ea77089a2267d168
Author: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Date:   Mon Jun 24 23:10:56 2024 +0300

    perf/x86/intel/pt: Fix a topa_entry base address calculation
    
    [ Upstream commit ad97196379d0b8cb24ef3d5006978a6554e6467f ]
    
    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 <dave.hansen@xxxxxxxxxxxxxxx>
    Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Cc: stable@xxxxxxxxxxxxxxx
    Link: https://lore.kernel.org/r/20240624201101.60186-3-adrian.hunter@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
index 1fe74019ee3c8..87cca56228856 100644
--- a/arch/x86/events/intel/pt.c
+++ b/arch/x86/events/intel/pt.c
@@ -816,7 +816,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);
 }
 
 /**




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux