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: <a41e88a82b4d7433dded23e9fbd0465ad8529e36.camel@redhat.com>
Date:   Tue, 17 Nov 2020 09:38:45 +0100
From:   Paolo Abeni <pabeni@...hat.com>
To:     Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc:     netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        linux-sparse@...r.kernel.org
Subject: Re: [PATCH net-next] net: add annotation for sock_{lock,unlock}_fast

Hello,

Thank you for the feedback!

On Mon, 2020-11-16 at 23:27 +0100, Luc Van Oostenryck wrote:
> > @@ -1606,10 +1607,12 @@ bool lock_sock_fast(struct sock *sk);
> >   */
> >  static inline void unlock_sock_fast(struct sock *sk, bool slow)
> >  {
> > -	if (slow)
> > +	if (slow) {
> >  		release_sock(sk);
> > -	else
> > +		__release(&sk->sk_lock.slock);
> 
> The correct solution would be to annotate the declaration of
> release_sock() with '__releases(&sk->sk_lock.slock)'.

If I add such annotation to release_sock(), I'll get several sparse
warnings for context imbalance (on each lock_sock()/release_sock()
pair), unless I also add an '__acquires()' annotation to lock_sock(). 

The above does not look correct to me ?!? When release_sock() completes
the socket spin lock is not held. The annotation added above is
somewhat an artifact to let unlock_sock_fast() matches lock_sock_fast()
from sparse perspective. I intentionally avoided changing
the release_sock() annotation to avoid introducing more artifacts.

The proposed schema is not 100% accurate, as it will also allow e.g. a
really-not-fitting bh_lock_sock()/unlock_sock_fast() pair, but I could
not come-up with anything better.

Can we go with the schema I proposed?

Thanks,

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ