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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 15 Apr 2019 23:50:49 +0800
From:   "chengjian (D)" <cj.chengjian@...wei.com>
To:     Peter Zijlstra <peterz@...radead.org>
CC:     <huawei.libin@...wei.com>, <xiexiuqi@...wei.com>,
        <yangyingliang@...wei.com>, <mingo@...hat.com>,
        <linux-kernel@...r.kernel.org>,
        "chengjian (D)" <cj.chengjian@...wei.com>
Subject: Re: [PATCH] sched/fair: Use 'unsigned long' for
 group_shares,group_runnable


On 2019/4/15 23:25, Peter Zijlstra wrote:
> On Mon, Apr 15, 2019 at 11:20:31PM +0800, chengjian (D) wrote:
>> Hi, Peter
>>
>>
>> On 2019/4/15 20:46, Peter Zijlstra wrote:
>>
>> I write a demo about this, which I described it as overflow.
> I'm not saying there's no overflow, I'm saying there's nothing UB about
> it.
>

Yeah. I got it.

This may not be an undefined behavior,

but rather a bug or logic error caused by overflow.


```cpp


static long calc_group_shares(struct cfs_rq *cfs_rq)
{

     // ......

     shares = (tg_shares * load);   // 1048576 * 9144968455305  = 
-8857549630719655936 (OVERFLOW)
     if (tg_weight)                         // assume tg_weight is 3
         shares /= tg_weight;         //  0xd7068dd8c2daaaab shoule be 
0x2c5be32e18300000
}

```


It will cause `se->runnable_weight` to have an incorrect value in 
reweight_entity().


Thanks.

CHENG Jian


Powered by blists - more mailing lists