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>] [day] [month] [year] [list]
Message-ID: <87pmkvkqw6.ffs@tglx>
Date:   Tue, 03 May 2022 09:38:01 +0200
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Hillf Danton <hdanton@...a.com>
Cc:     Thomas Pfaff <tpfaff@....com>, linux-kernel@...r.kernel.org,
        Marc Zyngier <maz@...nel.org>
Subject: Re: [PATCH v3] irq/core: synchronize irq_thread startup

Hillf,

On Tue, May 03 2022 at 08:42, Hillf Danton wrote:
> On Mon, 02 May 2022 21:24:45 +0200 Thomas Gleixner  wrote:
>> On Tue, May 03 2022 at 00:01, Hillf Danton wrote:
>> > +	if (!waked)
>> > +		wake_threads_waitq(desc);
>> 
>> That's a guarantee to make desc->threads_active go negative in the case
>> that the thread was never woken by a hard interrupt handler. IOW, you
>> created a new problem which did not exist before.
>
> The count of active threads would not drop below zero with the change,
> given the comment in __irq_wake_thread(). It is incremented before
> wakeup.

There is no guarantee that the wake-up happens via __irq_wake_thread().
kthread_stop() does a wake-up too, but that obviously _cannot_ increment
the active counter because it does not know about it at all.

   create_thread()
      thread_fn()
        woken = false;
        wait_for_wakeup_or_stop()       <- Stop is set, no interrupt happened
                                        <- ergo woken == false   
        if (!woken)
      	  wake_threads_waitq(desc)
            atomic_dec_and_test(..)   <- underflow

>> The problem discussed here is not a problem in irq_thread(), it's a
>> problem of not reaching this function in the first place. See the on
>> point analysis in Thomas Pfaffs patch.
>
> Well why is the count above zero without wakeup? IOW why is there imbalance
> in count if the irq thread never gets a CPU to run?

Look at kthread() and the condition under which threadfn() is invoked.

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ