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:	Sat, 01 Jan 2011 22:28:45 +0100
From:	Stefani Seibold <stefani@...bold.net>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH] UDPCP Communication Protocol

Am Freitag, den 31.12.2010, 13:00 +0100 schrieb Eric Dumazet:
> Le vendredi 31 décembre 2010 à 12:25 +0100, Eric Dumazet a écrit :
> > Le vendredi 31 décembre 2010 à 10:29 +0100, stefani@...bold.net a
> > écrit :
> > > +		if (!list_empty(&usk->destlist)) {
> > > +			state->sk = (struct sock *)usk;
> > > +			state->dest = list_first_entry(&usk->destlist,
> > > +					struct udpcp_dest, list);
> > > +			sock_hold(state->sk);
> > > +
> > > +			if (atomic_read(&state->sk->sk_refcnt) != 1) {
> > > +				spin_unlock_irqrestore(&spinlock, flags);
> > > +				return state;
> > > +			}
> > > +			atomic_dec(&state->sk->sk_refcnt);
> > > +		}
> > > +
> > 
> > I am trying to understand what you are doing here.
> > 
> > It seems racy to me.
> > 
> > Apparently, what you want is to take a reference only if actual
> > sk_refcnt is not zero.
> > 
> > I suggest using atomic_inc_notzero(&state->sk->sk_refcnt) to avoid the
> > race in atomic_dec().
> > 
> > 
> 
> Before you ask why its racy, this is because UDP sockets are RCU
> protected, and RCU lookups depend on sk_refcnt being zero or not.
> 
> Doing an sk_refcnt increment/decrement opens a race window for the
> concurrent lookups.
> 

I still revamped the whole /proc/net/udpcp thing and hope it is now race
free.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ