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: <qkdw5artkb7vz2tnjkdxivvfkwchna7fxkyo4go6nwb4kc3gv3@t7xt3rrvyvja>
Date: Tue, 28 May 2024 19:08:41 -0700
From: Bjorn Andersson <andersson@...nel.org>
To: Chris Lew <quic_clew@...cinc.com>
Cc: Baolin Wang <baolin.wang@...ux.alibaba.com>, 
	Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>, 
	Waiman Long <longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>, 
	Jonathan Corbet <corbet@....net>, Mathieu Poirier <mathieu.poirier@...aro.org>, 
	Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, 
	Conor Dooley <conor+dt@...nel.org>, Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>, 
	Konrad Dybcio <konrad.dybcio@...aro.org>, linux-remoteproc@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-doc@...r.kernel.org, linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: Re: [PATCH v2 3/4] soc: qcom: smem: Add
 qcom_smem_bust_hwspin_lock_by_host()

On Tue, May 28, 2024 at 03:50:25PM -0700, Chris Lew wrote:
> 
> 
> On 5/28/2024 2:55 PM, Bjorn Andersson wrote:
> > On Fri, May 24, 2024 at 06:26:42PM GMT, Chris Lew wrote:
> > > Add qcom_smem_bust_hwspin_lock_by_host to enable remoteproc to bust the
> > > hwspin_lock owned by smem. In the event the remoteproc crashes
> > > unexpectedly, the remoteproc driver can invoke this API to try and bust
> > > the hwspin_lock and release the lock if still held by the remoteproc
> > > device.
> > > 
> > > Signed-off-by: Chris Lew <quic_clew@...cinc.com>
> > > ---
> > >   drivers/soc/qcom/smem.c       | 28 ++++++++++++++++++++++++++++
> > >   include/linux/soc/qcom/smem.h |  2 ++
> > >   2 files changed, 30 insertions(+)
> > > 
> > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> > > index 7191fa0c087f..683599990387 100644
> > > --- a/drivers/soc/qcom/smem.c
> > > +++ b/drivers/soc/qcom/smem.c
> ...
> > > + *
> > > + * Context: Process context.
> > > + *
> > > + * Returns: 0 on success, otherwise negative errno.
> > > + */
> > > +int qcom_smem_bust_hwspin_lock_by_host(unsigned host)
> > > +{
> > > +	if (!__smem)
> > > +		return -EPROBE_DEFER;
> > 
> > This would be called at a time where -EPROBE_DEFER isn't appropriate,
> > the client should invoke qcom_smem_is_available() at probe time to guard
> > against this.
> > 
> 
> Should we keep the null pointer check to prevent null pointer dereference
> and return 0? Or would it be better to allow the null pointer deference to
> go through so we can catch misuse of the API and ask clients to use
> qcom_smem_is_available()?
> 

I like the helpful callstack you get from the NULL pointer
dereference...

Regards,
Bjorn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ