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] [day] [month] [year] [list]
Message-ID: <CAMB2axO4hmeRtGFWW58Rx6PCLgLi3Dr+Uiq6JScw+Wm5AcrkLA@mail.gmail.com>
Date: Wed, 26 Nov 2025 13:52:25 -0800
From: Amery Hung <ameryhung@...il.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: David Laight <david.laight.linux@...il.com>, 
	Kumar Kartikeya Dwivedi <memxor@...il.com>, bpf@...r.kernel.org, netdev@...r.kernel.org, 
	alexei.starovoitov@...il.com, andrii@...nel.org, daniel@...earbox.net, 
	kernel-team@...a.com
Subject: Re: [PATCH bpf-next v1 1/1] bpf: Annotate rqspinlock lock acquiring
 functions with __must_check

On Tue, Nov 25, 2025 at 3:35 PM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Thu, Nov 20, 2025 at 12:12 PM Amery Hung <ameryhung@...il.com> wrote:
> >
> > On Tue, Nov 18, 2025 at 2:42 AM David Laight
> > <david.laight.linux@...il.com> wrote:
> > >
> > > On Tue, 18 Nov 2025 05:16:50 -0500
> > > Kumar Kartikeya Dwivedi <memxor@...il.com> wrote:
> > >
> > > > On Mon, 17 Nov 2025 at 14:15, Amery Hung <ameryhung@...il.com> wrote:
> > > > >
> > > > > Locking a resilient queued spinlock can fail when deadlock or timeout
> > > > > happen. Mark the lock acquring functions with __must_check to make sure
> > > > > callers always handle the returned error.
> > > > >
> > > > > Suggested-by: Andrii Nakryiko <andrii@...nel.org>
> > > > > Signed-off-by: Amery Hung <ameryhung@...il.com>
> > > > > ---
> > > >
> > > > Looks like it's working :)
> > > > I would just explicitly ignore with (void) cast the locktorture case.
> > >
> > > I'm not sure that works - I usually have to try a lot harder to ignore
> > > a '__must_check' result.
> >
> > Thanks for the heads up.
> >
> > Indeed, gcc still complains about it even casting the return to (void)
> > while clang does not.
> >
> > I have to silence the warning by:
> >
> > #pragma GCC diagnostic push
> > #pragma GCC diagnostic ignored "-Wunused-result"
> >        raw_res_spin_lock(&rqspinlock);
> > #pragma GCC diagnostic pop
> >
>
> For BPF selftests we have
>
> #define __sink(expr) asm volatile("" : "+g"(expr))
>
> Try if that works here?

Thanks for the tip.

In v2, I decided to return the error to the caller to align with
another test case, where the lock (ww_mutex) can also fail and has
__must_check annotation.

>
> > Thanks!
> > Amery
> >
> > >
> > >         David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ