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]
Date:	Wed, 22 Sep 2010 10:38:01 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc:	linux-fsdevel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [2.6.36-rc5] INET?: possible irq lock inversion dependency

Le mercredi 22 septembre 2010 à 10:34 +0200, Eric Dumazet a écrit :

> small bug in my patch , please delete the orphan line :
> 
> >  			af_callback_keys + sk->sk_family,
> 
> 
> >  			af_family_clock_key_strings[sk->sk_family]);
> >  
> 

Updated and booted/tested patch :

 include/net/sock.h |    1 +
 net/core/sock.c    |    8 ++++++--
 net/ipv4/udp.c     |    3 +++
 net/ipv4/udplite.c |    3 +++
 net/ipv6/udp.c     |    3 +++
 net/ipv6/udplite.c |    3 +++
 6 files changed, 19 insertions(+), 2 deletions(-)


diff --git a/include/net/sock.h b/include/net/sock.h
index adab9dc..c5104bc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -800,6 +800,7 @@ struct proto {
 #ifdef SOCK_REFCNT_DEBUG
 	atomic_t		socks;
 #endif
+	struct lock_class_key *callback_key;
 };
 
 extern int proto_register(struct proto *prot, int alloc_slab);
diff --git a/net/core/sock.c b/net/core/sock.c
index b05b9b6..79ef50a 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1210,7 +1210,9 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
 		spin_lock_init(&newsk->sk_dst_lock);
 		rwlock_init(&newsk->sk_callback_lock);
 		lockdep_set_class_and_name(&newsk->sk_callback_lock,
-				af_callback_keys + newsk->sk_family,
+				sk->sk_prot->callback_key ?
+					sk->sk_prot->callback_key :
+					af_callback_keys + newsk->sk_family,
 				af_family_clock_key_strings[newsk->sk_family]);
 
 		newsk->sk_dst_cache	= NULL;
@@ -1965,7 +1967,9 @@ void sock_init_data(struct socket *sock, struct sock *sk)
 	spin_lock_init(&sk->sk_dst_lock);
 	rwlock_init(&sk->sk_callback_lock);
 	lockdep_set_class_and_name(&sk->sk_callback_lock,
-			af_callback_keys + sk->sk_family,
+			sk->sk_prot->callback_key ?
+				sk->sk_prot->callback_key :
+				af_callback_keys + sk->sk_family,
 			af_family_clock_key_strings[sk->sk_family]);
 
 	sk->sk_state_change	=	sock_def_wakeup;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index fb23c2e..c0877b6 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1870,6 +1870,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
 }
 EXPORT_SYMBOL(udp_poll);
 
+static struct lock_class_key udp_callback_key;
+
 struct proto udp_prot = {
 	.name		   = "UDP",
 	.owner		   = THIS_MODULE,
@@ -1899,6 +1901,7 @@ struct proto udp_prot = {
 	.compat_setsockopt = compat_udp_setsockopt,
 	.compat_getsockopt = compat_udp_getsockopt,
 #endif
+	.callback_key	   = &udp_callback_key,
 };
 EXPORT_SYMBOL(udp_prot);
 
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index ab76aa9..51b159d 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -32,6 +32,8 @@ static const struct net_protocol udplite_protocol = {
 	.netns_ok	= 1,
 };
 
+static struct lock_class_key udplite_callback_key;
+
 struct proto 	udplite_prot = {
 	.name		   = "UDP-Lite",
 	.owner		   = THIS_MODULE,
@@ -57,6 +59,7 @@ struct proto 	udplite_prot = {
 	.compat_setsockopt = compat_udp_setsockopt,
 	.compat_getsockopt = compat_udp_getsockopt,
 #endif
+	.callback_key	   = &udplite_callback_key,
 };
 EXPORT_SYMBOL(udplite_prot);
 
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 5acb356..0777934 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1441,6 +1441,8 @@ void udp6_proc_exit(struct net *net) {
 
 /* ------------------------------------------------------------------------ */
 
+static struct lock_class_key udp6_callback_key;
+
 struct proto udpv6_prot = {
 	.name		   = "UDPv6",
 	.owner		   = THIS_MODULE,
@@ -1469,6 +1471,7 @@ struct proto udpv6_prot = {
 	.compat_setsockopt = compat_udpv6_setsockopt,
 	.compat_getsockopt = compat_udpv6_getsockopt,
 #endif
+	.callback_key	   = &udp6_callback_key,
 };
 
 static struct inet_protosw udpv6_protosw = {
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 5f48fad..7bbb627 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -31,6 +31,8 @@ static const struct inet6_protocol udplitev6_protocol = {
 	.flags		=	INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
 };
 
+static struct lock_class_key udp6lite_callback_key;
+
 struct proto udplitev6_prot = {
 	.name		   = "UDPLITEv6",
 	.owner		   = THIS_MODULE,
@@ -55,6 +57,7 @@ struct proto udplitev6_prot = {
 	.compat_setsockopt = compat_udpv6_setsockopt,
 	.compat_getsockopt = compat_udpv6_getsockopt,
 #endif
+	.callback_key	   = &udp6lite_callback_key,
 };
 
 static struct inet_protosw udplite6_protosw = {


--
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