lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0334300a-ae81-4b55-a3b0-c6137e13be6a@linaro.org>
Date: Tue, 18 Nov 2025 14:56:33 +0000
From: James Clark <james.clark@...aro.org>
To: Leo Yan <leo.yan@....com>
Cc: Suzuki K Poulose <suzuki.poulose@....com>,
 Mike Leach <mike.leach@...aro.org>,
 Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
 Jonathan Corbet <corbet@....net>, coresight@...ts.linaro.org,
 linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
 linux-doc@...r.kernel.org
Subject: Re: [PATCH v4 04/13] coresight: Hide unused ETMv3 format attributes



On 14/11/2025 2:55 pm, Leo Yan wrote:
> On Wed, Nov 12, 2025 at 03:22:10PM +0000, James Clark wrote:
>> ETMv3 only has a few attributes, and setting unused ones results in an
>> error, so hide them to begin with.
>>
>> Signed-off-by: James Clark <james.clark@...aro.org>
>> ---
>>   drivers/hwtracing/coresight/coresight-etm-perf.c | 19 +++++++++++++++++++
>>   1 file changed, 19 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c
>> index 17afa0f4cdee..91132abca244 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm-perf.c
>> +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c
>> @@ -106,8 +106,27 @@ static struct attribute *etm_config_formats_attr[] = {
>>   	NULL,
>>   };
>>   
>> +static umode_t etm_format_attr_is_visible(struct kobject *kobj,
>> +					  struct attribute *attr, int unused)
>> +{
>> +	/* ETM4 has all attributes */
>> +	if (IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X))
>> +		return attr->mode;
>> +
>> +	/* ETM3 only has these attributes */
>> +	if (attr == &format_attr_cycacc.attr ||
>> +	    attr == &format_attr_timestamp.attr ||
>> +	    attr == &format_attr_retstack.attr ||
>> +	    attr == &format_attr_sinkid.attr ||
>> +	    attr == &format_attr_configid.attr)
> 
> Do we support configid for ETM3?
> 

They're "activated" in etm_setup_aux() so this would be for both ETM3 
and 4. But they're only subsequently "enabled" for ETM4. So no, they're 
not supported. I'll hide this attribute too.

I can leave it for a later fix if we want to stop activating them, but I 
don't think it does any harm.

>> +		return attr->mode;
> 
> It is good to give a bit information why only these attributes
> supported, e.g.,
> 
>    /*
>     * ETM3 only support subset attributes (see ETM3X_SUPPORTED_OPTIONS),
>     * keep 'sinkid' attr for specifying sink ID.
>     */
> 
> Two side topics but not issues caused this patch:
> 
> - Since CTXTID/CTXTID2 is only used for ETM4x, we can remove "#if
>    IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X)" from the
>    format_attr_contextid_show() function.

Will change to CONFIG_ARM64 as mentioned on the other thread.

> 
> - etm_parse_event_config() does not check attr->config3, thus user
>    sets 'cc_threshold' it will slip without any error report.

Will ignore this comment as mentioned on patch 7, we're not doing any 
errors for unsupported arguments anymore.

> 
> Thanks,
> Leo
> 
>> +
>> +	return 0;
>> +}
>> +
>>   static const struct attribute_group etm_pmu_format_group = {
>>   	.name   = "format",
>> +	.is_visible = etm_format_attr_is_visible,
>>   	.attrs  = etm_config_formats_attr,
>>   };
>>   
>>
>> -- 
>> 2.34.1
>>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ