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]
Message-ID: <20230719151817.GB4176673@hu-bjorande-lv.qualcomm.com>
Date:   Wed, 19 Jul 2023 08:18:17 -0700
From:   Bjorn Andersson <quic_bjorande@...cinc.com>
To:     Chengfeng Ye <dg573847474@...il.com>
CC:     <agross@...nel.org>, <andersson@...nel.org>,
        <konrad.dybcio@...aro.org>, <lee@...nel.org>,
        <linux-arm-msm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mfd: qcom-pm8xxx: Fix potential deadlock on
 &chip->pm_irq_lock

On Wed, Jun 28, 2023 at 07:28:40AM +0000, Chengfeng Ye wrote:
> As &chip->pm_irq_lock is acquired by pm8xxx_irq_handler() under irq
> context, other process context code should disable irq before acquiring
> the lock.
> 
> I think .irq_set_type and .irq_get_irqchip_state callbacks should be

You are correct, so please drop "I think", and change "should be" to
"are generally".

> executed from process context without irq disabled by default. Thus the
> same lock acquision should disable irq.
> 
> Possible deadlock scenario
> pm8xxx_irq_set_type()
>     -> pm8xxx_config_irq()
>     -> spin_lock(&chip->pm_irq_lock)
>         <irq interrupt>
>         -> pm8xxx_irq_handler()
>         -> pm8xxx_irq_master_handler()
>         -> pm8xxx_irq_block_handler()
>         -> pm8xxx_read_block_irq()
>         -> spin_lock(&chip->pm_irq_lock) (deadlock here)
> 
> This flaw was found using an experimental static analysis tool we are
> developing for irq-related deadlock.
> 
> The tentative patch fix the potential deadlock by spin_lock_irqsave().

I don't think this is a "tentative patch fix", it is the patch to fix
the issue. I think you can omit this line, because you already described
your problem, and the solution above.

> 
> Signed-off-by: Chengfeng Ye <dg573847474@...il.com>

Reviewed-by: Bjorn Andersson <quic_bjorande@...cinc.com>

Regards,
Bjorn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ