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: <540469c3-9bc5-444e-87da-95dc27fc481b@kylinos.cn>
Date: Thu, 4 Sep 2025 13:23:55 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: "Rafael J . wysocki" <rafael@...nel.org>,
 Saravana Kannan <saravanak@...gle.com>, zhenglifeng
 <zhenglifeng1@...wei.com>, linux-pm@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/3] cpufreq: Always enforce policy limits even without
 frequency table


在 2025/9/4 12:48, Viresh Kumar 写道:
> On 04-09-25, 11:22, Zihuan Zhang wrote:
>> Currently, cpufreq_frequency_table_verify() simply returns when the driver’s
>> frequency table is missing (policy->freq_table == NULL).
>> This means that cpufreq_verify_within_cpu_limits() is not invoked in such
>> cases, leaving policy->min and policy->max unchecked.
>>
>> Some cpufreq drivers handle this manually by calling
>> cpufreq_verify_within_cpu_limits() even when no frequency table is present,
>> in order to ensure the policy stays within CPU limits.
>>
>> To avoid this inconsistency and potential misuse, make
>> cpufreq_generic_frequency_table_verify() always call
>> cpufreq_verify_within_cpu_limits(), regardless of whether policy->freq_table
>> is available. This unifies the behavior across all drivers and makes the helper
>> safe to use universally.
>>
>> Signed-off-by: Zihuan Zhang <zhangzihuan@...inos.cn>
>> ---
>>   drivers/cpufreq/freq_table.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
>> index d5111ee56e38..f4b05dcc479b 100644
>> --- a/drivers/cpufreq/freq_table.c
>> +++ b/drivers/cpufreq/freq_table.c
>> @@ -105,6 +105,7 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_verify);
>>    */
>>   int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy)
>>   {
>> +	cpufreq_verify_within_cpu_limits(policy);
> So if we have a freq-table, we will call this twice now. Why make it
> bad for the existing users ?


Just to clarify, in the third patch of this series we remove
cpufreq_generic_frequency_table_verify() from the table_verify path,
so cpufreq_verify_within_cpu_limits() is now only called here. There
won’t be any duplicate invocation for drivers that already have a
frequency table.

This also resolves the semantic concern, since the helper is no
longer invoked outside of this context.

Thanks!


> And then the name of this function, it is all about freq-table. If it
> isn't there, not sure we should call it at all.


As it stands, only drivers that have a frequency table actually call
cpufreq_generic_frequency_table_verify(). Drivers without a table
implement their own verification logic. So in practice, this helper
is still only used in the context of a frequency table, keeping the
semantics consistent with its name.

>>   	if (!policy->freq_table)
>>   		return -ENODEV;
>>   
>> -- 
>> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ