mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yeoreum Yun" <yeoreum.yun@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v13 08/14] coresight: etm4x: exclude ss_status from drvdata->config
Date: Sat, 03 Oct 2026 01:33:43 +0000	[thread overview]
Message-ID: <20261003013344.22BF71F00893@smtp.kernel.org> (raw)
In-Reply-To: <20261002-separate_etm_cfg_v2-v13-8-fe429d8d96fb@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] coresight: etm4x: state leakage of single-shot comparator status in perf sessions
--

commit 3d98ebedda262d5221467f55a32e0267bdd2e584
Author: Yeoreum Yun <yeoreum.yun@arm.com>
coresight: etm4x: exclude ss_status from drvdata->config

This patch moves the single-shot comparator status (ss_status) from the
configuration structure to the driver data structure. It updates the usage
of ss_status to clear both TRCSSCSRn_STATUS and TRCSSCSRn_PENDING bits
before writing to the register.

> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index 3900b96e9c7cc..4a8c1070bbcbb 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c

[ ... ]

> @@ -572,11 +572,11 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
>  		etm4x_relaxed_write32(csa, config->res_ctrl[i], TRCRSCTLRn(i));
>  
>  	for (i = 0; i < caps->nr_ss_cmp; i++) {
> -		/* always clear status bit on restart if using single-shot */
> +		/* always clear status and pending bits on restart if using single-shot */
>  		if (config->ss_ctrl[i] || config->ss_pe_cmp[i])
> -			config->ss_status[i] &= ~TRCSSCSRn_STATUS;

[Severity: Medium]
Will this bypass the manual clearing of the TRCSSCSRn_STATUS and
TRCSSCSRn_PENDING bits during perf sessions?

Since enabling a perf session uses a zeroed configuration, config->ss_ctrl[i]
and config->ss_pe_cmp[i] will evaluate to false. Previously, this wasn't an
issue because the entire config structure was zeroed via memset. Now that
ss_status is moved to drvdata, bypassing this check means the bits are not
cleared.

> +			drvdata->ss_status[i] &= ~(TRCSSCSRn_STATUS | TRCSSCSRn_PENDING);
>  		etm4x_relaxed_write32(csa, config->ss_ctrl[i], TRCSSCCRn(i));
> -		etm4x_relaxed_write32(csa, config->ss_status[i], TRCSSCSRn(i));
> +		etm4x_relaxed_write32(csa, drvdata->ss_status[i], TRCSSCSRn(i));

Does this write a stale, unmasked drvdata->ss_status[i] directly to the
TRCSSCSRn hardware register during perf sessions?

If the manual clearing above is skipped, this could cause state leakage and
trigger unintended hardware trace behavior.

>  		if (etm4x_sspcicrn_present(drvdata, i))
>  			etm4x_relaxed_write32(csa, config->ss_pe_cmp[i], TRCSSPCICRn(i));
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261002-separate_etm_cfg_v2-v13-0-fe429d8d96fb@arm.com?part=8

  reply	other threads:[~2026-10-03  1:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 19:03 [PATCH v13 00/14] fix several inconsistencies with sysfs configuration in etmX Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 01/14] coresight: etm4x: read-back TRCSEQSTR at disabling and prohibit modifying seq_state while enabling Yeoreum Yun
2026-10-03  1:33   ` sashiko-bot
2026-10-03  1:47     ` Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 02/14] coresight: etm4x: prohibit modifying cntr_val while session is enabled Yeoreum Yun
2026-10-03  1:33   ` sashiko-bot
2026-10-03  1:50     ` Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 03/14] coresight: etm3x: prohibit modifying cntr_val and reset " Yeoreum Yun
2026-10-03  1:33   ` sashiko-bot
2026-10-03  2:02     ` Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 04/14] coresight: etm4x: fix inconsistencies with sysfs configuration Yeoreum Yun
2026-10-03  1:33   ` sashiko-bot
2026-10-03  2:30     ` Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 05/14] coresight: etm3x: " Yeoreum Yun
2026-10-03  1:33   ` sashiko-bot
2026-10-03  2:47     ` Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 06/14] coresight: etm3x: remove redundant cpu online check on etm_enable_sysfs() Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 07/14] coresight: etm4x: introduce struct etm4_caps Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 08/14] coresight: etm4x: exclude ss_status from drvdata->config Yeoreum Yun
2026-10-03  1:33   ` sashiko-bot [this message]
2026-10-03  2:38     ` Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 09/14] coresight: etm4x: remove s_ex_level from config Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 10/14] coresight: etm4x: rename local config as curr_config referring drvdata->curr_config Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 11/14] coresight: etm4x: rename drvdata->config to sysfs_config Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 12/14] coresight: etm3x: introduce struct etm_caps Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 13/14] coresight: etm3x: rename local config as curr_config referring drvdata->curr_config Yeoreum Yun
2026-10-02 19:03 ` [PATCH v13 14/14] coresight: etm3x: rename drvdata->config to sysfs_config Yeoreum Yun
2026-10-03  2:49 ` [PATCH v13 00/14] fix several inconsistencies with sysfs configuration in etmX Yeoreum Yun

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=20261003013344.22BF71F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yeoreum.yun@arm.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®