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: <CAD=FV=VP+DDQbdb-pD2JJKrZ+MrkgcuyzBj4H-4oTDVvBpTOtQ@mail.gmail.com>
Date: Thu, 9 May 2024 12:34:59 -0700
From: Doug Anderson <dianders@...omium.org>
To: Stephen Boyd <swboyd@...omium.org>
Cc: Konrad Dybcio <konrad.dybcio@...aro.org>, Bjorn Andersson <andersson@...nel.org>, 
	linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org, 
	patches@...ts.linux.dev, Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH] soc: qcom: rpmh-rsc: Ensure irqs aren't disabled by
 rpmh_rsc_send_data() callers

Hi,

On Thu, May 9, 2024 at 11:41 AM Stephen Boyd <swboyd@...omium.org> wrote:
>
> Dan pointed out that Smatch is concerned about this code because it uses
> spin_lock_irqsave() and then calls wait_event_lock_irq() which enables
> irqs before going to sleep. The comment above the function says it
> should be called with interrupts enabled, but we simply hope that's true
> without really confirming that. Let's add a might_sleep() here to
> confirm that interrupts and preemption aren't disabled. Once we do that,
> we can change the lock to be non-saving, spin_lock_irq(), to clarify
> that we don't expect irqs to be disabled. If irqs are disabled by
> callers they're going to be enabled anyway in the wait_event_lock_irq()
> call which would be bad.
>
> This should make Smatch happier and find bad callers faster with the
> might_sleep(). We can drop the WARN_ON() in the caller because we have
> the might_sleep() now, simplifying the code.
>
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lore.kernel.org/r/911181ed-c430-4592-ad26-4dc948834e08@moroto.mountain
> Fixes: 2bc20f3c8487 ("soc: qcom: rpmh-rsc: Sleep waiting for tcs slots to be free")
> Cc: Douglas Anderson <dianders@...omium.org>
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> ---
>  drivers/soc/qcom/rpmh-rsc.c | 7 ++++---
>  drivers/soc/qcom/rpmh.c     | 1 -
>  2 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Douglas Anderson <dianders@...omium.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ