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]
Date:   Fri, 28 Oct 2022 16:27:56 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     netdev@...r.kernel.org, Cong Wang <cong.wang@...edance.com>,
        shaozhengchao <shaozhengchao@...wei.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Tom Herbert <tom@...bertland.com>,
        Eric Dumazet <edumazet@...gle.com>
Subject: Re: [Patch net] kcm: fix a race condition in kcm_recvmsg()

On Fri, 28 Oct 2022 12:21:11 -0700 Cong Wang wrote:
> On Tue, Oct 25, 2022 at 04:02:22PM -0700, Jakub Kicinski wrote:
> > On Sat, 22 Oct 2022 19:30:44 -0700 Cong Wang wrote:  
> > > +			spin_lock_bh(&mux->rx_lock);
> > >  			KCM_STATS_INCR(kcm->stats.rx_msgs);
> > >  			skb_unlink(skb, &sk->sk_receive_queue);
> > > +			spin_unlock_bh(&mux->rx_lock);  
> > 
> > Why not switch to __skb_unlink() at the same time?
> > Abundance of caution?  
> 
> What gain do we have? Since we have rx_lock, skb queue lock should never
> be contended?

I was thinking mostly about readability, the performance is secondary.
Other parts of the code use unlocked skb queue helpers so it may be
confusing to a reader why this on isn't, and therefore what lock
protects the queue. But no strong feelings.

Powered by blists - more mailing lists