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]
Date:   Tue, 22 Mar 2022 23:58:09 +0100
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Vincent Donnefort <vincent.donnefort@....com>,
        Steven Price <steven.price@....com>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, Baokun Li <libaokun1@...wei.com>,
        Dongli Zhang <dongli.zhang@...cle.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Valentin Schneider <valentin.schneider@....com>,
        Yuan ZhaoXiong <yuanzhaoxiong@...du.com>,
        YueHaibing <yuehaibing@...wei.com>,
        Dietmar Eggemann <dietmar.eggemann@....com>
Subject: Re: [PATCH v2] cpu/hotplug: Set st->cpu earlier

On Tue, Mar 22 2022 at 15:59, Vincent Donnefort wrote:
> On 22/03/2022 15:31, Thomas Gleixner wrote:
>> On Wed, Mar 16 2022 at 15:36, Steven Price wrote:
>>> Setting the 'cpu' member of struct cpuhp_cpu_state in cpuhp_create() is
>>> too late as other callbacks can be made before that point.
>> 
>> What?
>> 
>>          CPUHP_OFFLINE = 0,
>>          CPUHP_CREATE_THREADS,
>> 
>> The create threads callback is the very first callback which is invoked
>> for a to be plugged CPU on the control CPU. So which earlier callback
>> can be invoked and fail?
>> 
>> Thanks,
>> 
>>          tglx
>
>
> CPUHP_CREATE_THREADS itself can fail, before st->cpu is set.

Sure. But that does not explain the problem.

> Also, that value is used outside of the callbacks (cpuhp_set_state()
> in _cpu_up()).

And why on earth is this not spelled out in the changelog?

> But indeed this description could be refined a bit.

Indeed. But the description is not the only problem here:

It's completely uncomprehensible from the code in _cpu_up() _WHY_ this

     st->cpu = cpu;
     
assignment has to be there.

It's non-sensical if you really think about it, right?

That said, I'm pretty sure you can come up with:

 - a proper one time initialization of @st which solves your problem

 - a proper changelog which explains it

Thanks,

        tglx

Powered by blists - more mailing lists