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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca1972cec9724189b5a97a09069f3ee4f8c3f97c.camel@siemens.com>
Date:   Tue, 20 Dec 2022 06:58:41 +0000
From:   "Sverdlin, Alexander" <alexander.sverdlin@...mens.com>
To:     "manfred@...orfullife.com" <manfred@...orfullife.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
CC:     "1vier1@....de" <1vier1@....de>,
        "tglx@...utronix.de" <tglx@...utronix.de>
Subject: Re: [PATCH 3/3] kernel/irq/manage.c: disable_irq() might sleep.

Hi Manfred!

On Fri, 2022-12-16 at 16:04 +0100, Manfred Spraul wrote:
> With the introduction of threaded interrupt handlers, it is virtually
> never safe to call disable_irq() from non-premptible context.
> 
> Thus: Update the documentation, add a might_sleep() to catch any
> offenders.
> 
> Fixes: 3aa551c9b4c4 ("genirq: add threaded interrupt handler
> support")
> 
> Signed-off-by: Manfred Spraul <manfred@...orfullife.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: "Sverdlin, Alexander" <alexander.sverdlin@...mens.com>
> ---
>  kernel/irq/manage.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 5b7cf28df290..8ce75495e04f 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -723,10 +723,13 @@ EXPORT_SYMBOL(disable_irq_nosync);
>   *     to complete before returning. If you use this function while
>   *     holding a resource the IRQ handler may need you will
> deadlock.
>   *
> - *     This function may be called - with care - from IRQ context.
> + *     Can only be called from preemptible code as it might sleep
> when
> + *     an interrupt thread is associated to @irq.
> + *
>   */
>  void disable_irq(unsigned int irq)
>  {
> +       might_sleep();

I'm not sure about this, latest wait_event() inside synchronize_irq()
has it already.

>         if (!__disable_irq_nosync(irq))
>                 synchronize_irq(irq);
>  }

-- 
Alexander Sverdlin
Siemens AG
www.siemens.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ