From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Ruidong Tian <tianruidong@linux.alibaba.com>,
linux-kernel@vger.kernel.org
Cc: alexander.shishkin@linux.intel.com, coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org, mike.leach@linaro.org,
james.clark@arm.com
Subject: Re: [PATCH v3 1/1] coresight: tmc: Explicit type conversions to prevent integer overflow
Date: Fri, 4 Aug 2023 14:16:30 +0100 [thread overview]
Message-ID: <a9349988-6153-05f7-10de-4af47b49761c@arm.com> (raw)
In-Reply-To: <20230804081514.120171-2-tianruidong@linux.alibaba.com>
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
prev parent reply other threads:[~2023-08-04 13:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-14 8:43 [RESEND PATCH] " Ruidong Tian
2023-07-24 15:38 ` James Clark
2023-08-02 12:25 ` Ruidong Tian
2023-08-02 12:32 ` James Clark
2023-08-03 2:33 ` [PATCH v2] " Ruidong Tian
2023-08-03 16:19 ` Suzuki K Poulose
2023-08-04 3:06 ` Ruidong Tian
2023-08-04 8:15 ` [PATCH v3 0/1] coresight: tmc: Explicit type conversions to Ruidong Tian
2023-08-04 8:15 ` [PATCH v3 1/1] coresight: tmc: Explicit type conversions to prevent integer overflow Ruidong Tian
2023-08-04 13:16 ` Suzuki K Poulose [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9349988-6153-05f7-10de-4af47b49761c@arm.com \
--to=suzuki.poulose@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=tianruidong@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®