diff options
author | Ruidong Tian <tianruidong@linux.alibaba.com> | 2023-08-04 11:15:14 +0300 |
---|---|---|
committer | Suzuki K Poulose <suzuki.poulose@arm.com> | 2023-08-04 12:52:32 +0300 |
commit | fd380097cdb305582b7a1f9476391330299d2c59 (patch) | |
tree | bb1602058ea6bf216140ff1d965a9461d6a274b7 /drivers/net/ntb_netdev.c | |
parent | c00701125cf379f8ce9a4c98cb3cbf9edc3a5672 (diff) | |
download | linux-fd380097cdb305582b7a1f9476391330299d2c59.tar.xz |
coresight: tmc: Explicit type conversions to prevent integer overflow
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")
Fixes: 99443ea19e8b ("coresight: Add generic TMC sg table framework")
Fixes: 2e499bbc1a92 ("coresight: tmc: implementing TMC-ETF AUX space API")
Signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com>
Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230804081514.120171-2-tianruidong@linux.alibaba.com
Diffstat (limited to 'drivers/net/ntb_netdev.c')
0 files changed, 0 insertions, 0 deletions