lkml.org 
[lkml]   [2023]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 1/1] coresight: tmc: Explicit type conversions to prevent integer overflow
From
On 04/08/2023 09:15, Ruidong Tian wrote:
> Perf cs_etm session executed unexpectedly when AUX buffer > 1G.
>
> perf record -C 0 -m ,2G -e cs_etm// -- <workload>
> [ perf record: Captured and wrote 2.615 MB perf.data ]
>
> Perf only collect about 2M perf data rather than 2G. This is becasuse
> the operation, "nr_pages << PAGE_SHIFT", in coresight tmc driver, will
> overflow when nr_pages >= 0x80000(correspond to 1G AUX buffer). The
> overflow cause buffer allocation to fail, and TMC driver will alloc
> minimal buffer size(1M). You can just get about 2M perf data(1M AUX
> buffer + perf data header) at least.
>
> Explicit convert nr_pages to 64 bit to avoid overflow.
>
> Fixes: 22f429f19c41 ("coresight: etm-perf: Add support for ETR backend")
> Signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com>
> Reviewed-by: James Clark <james.clark@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +-
> drivers/hwtracing/coresight/coresight-tmc-etr.c | 5 +++--
> drivers/hwtracing/coresight/coresight-tmc.h | 2 +-
> 3 files changed, 5 insertions(+), 4 deletions(-)


Added additional Fixes tags as required and pushed it here :

https://git.kernel.org/coresight/c/fd380097cdb3

Thanks!
Suzuki

\
 
 \ /
  Last update: 2023-08-04 15:27    [W:0.035 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site