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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <528d1719-27cf-5264-5c76-0c279c770c88@didichuxing.com>
Date:   Thu, 31 Aug 2023 11:07:43 +0800
From:   Honglei Wang <wanghonglei@...ichuxing.com>
To:     牛若飞 <nrf233@...il.com>, <peterz@...radead.org>
CC:     <coonwel@...il.com>, <qiang.zhang1211@...il.com>,
        <dietmar.eggemann@....com>, <rostedt@...dmis.org>,
        <bsegall@...gle.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched/fair: Fix burst unit mismatch error for cgroup v2
 cfsb.



On 2023/8/30 17:19, 牛若飞 wrote:
> Cc:  linux-kernel@...r.kernel.org
> 
> 
> NiuRuofei <nrf233@...il.com> 于2023年8月9日周三 14:27写道:
>>
>> The burstable CFS controller is introduced:
>> Link: https://lore.kernel.org/lkml/20210316044931.39733-2-changhuaixin@linux.alibaba.com/
>>
>> The original patch directly used the 'cpu.max' interface file, and it handles the unit conversion
>> when cpu_period_quota_parse() function called(something like this, *burstp *= NSEC_PER_USEC;), it works fine.
>>
>> However, in the official version,  the single "cpu.max" file was split into 'cpu.max' and 'cpu.max.burst' interface files,
>> and we don't parse 'burst' in cpu_period_quota_parse() function anymore. Instead, we call tg_get_cfs_burst() to get burst value,
>> which return burst_time in microseconds. This could result in a unit mismatch bug.
>>
>> We can easily reproduce this bug using the following steps:
>>          bash:/sys/fs/cgroup/mycgroup$ echo 25000 | sudo tee cpu.max.burst
>>          25000
>>          bash:/sys/fs/cgroup/mycgroup$ echo 50000 100000 | sudo tee cpu.max
>>          50000 100000
>>          bash:/sys/fs/cgroup/mycgroup$ cat cpu.max.burst
>>          25
>>
>> Signed-off-by: NiuRuofei <nrf233@...il.com>
>> ---
>>   kernel/sched/core.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index c52c2eba7c73..e635598486a9 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -11380,7 +11380,7 @@ static ssize_t cpu_max_write(struct kernfs_open_file *of,
>>   {
>>          struct task_group *tg = css_tg(of_css(of));
>>          u64 period = tg_get_cfs_period(tg);
>> -       u64 burst = tg_get_cfs_burst(tg);
>> +       u64 burst = tg_get_cfs_burst(tg) * NSEC_PER_USEC;
>>          u64 quota;
>>          int ret;
>>
>> --
>> 2.30.1 (Apple Git-130)
>>
Seems we had a similar fix for this one from Kailun here:
https://lkml.org/lkml/2021/9/10/782

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ