Date: Tue, 15 Oct 2024 15:31:12 -0700
Subject: [PATCH v3 0/2 RESEND] resolve gtp possible deadlock warning
Fixes deadlock described in this bug:
https://syzkaller.appspot.com/bug?extid=e953a8f3071f5c0a28fd.
Specific crash report here:
https://syzkaller.appspot.com/text?tag=CrashReport&x=14670e07980000.
This bug is a false positive lockdep warning since gtp and smc use completely different socket protocols.
Lockdep thinks that lock_sock() in smc will deadlock with gtp's lock_sock() acquisition.
Adding lockdep annotations on smc socket creation prevents these false positives.
Daniel Yang (2):
Patch from D. Wythe <[email protected]> Move lockdep annotation to separate function for readability.
net/smc/smc_inet.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
Signature · 1 line
2.39.2
PATCH RESEND v3 1/2 resolve gtp possible deadlock warning
From: D. Wythe <[email protected]>
Adds lockdep annotations on smc inet socket creation
--- net/smc/smc_inet.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
net/smc/smc_inet.c +26 -1
@@ -108,14 +108,39 @@ static struct inet_protosw smc_inet6_protosw = { };#endif /* CONFIG_IPV6 */ +static struct lock_class_key smc_slock_keys[2 ]; +static struct lock_class_key smc_keys[2 ]; +static int smc_inet_init_sock (struct sock *sk) {struct net *net =sock_net (sk); +int rc;/* init common smc sock */ smc_sk_init (net, sk,IPPROTO_SMC );/* create clcsock */ -return smc_create_clcsk (net, sk, sk->sk_family); + rc =smc_create_clcsk (net, sk, sk->sk_family); +if (rc) +return rc; + +switch (sk->sk_family) { +case AF_INET : +sock_lock_init_class_and_name (sk,"slock-AF_INET-SMC" , + &smc_slock_keys[0 ], +"sk_lock-AF_INET-SMC" , + &smc_keys[0 ]); +break ; +case AF_INET6 : +sock_lock_init_class_and_name (sk,"slock-AF_INET6-SMC" , + &smc_slock_keys[1 ], +"sk_lock-AF_INET6-SMC" , + &smc_keys[1 ]); +break ; +default : +WARN_ON_ONCE (1 ); + } + +return 0 ; }int __init smc_inet_init (void )
Signature · 1 line
2.39.2
PATCH RESEND v3 2/2 resolve gtp possible deadlock warning
In reply to Daniel YangFrom: Daniel Yang <[email protected]>
Moved lockdep annotation to separate function for readability.
--- net/smc/smc_inet.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
net/smc/smc_inet.c +15 -13
@@ -111,18 +111,7 @@ static struct inet_protosw smc_inet6_protosw = {static struct lock_class_key smc_slock_keys[2 ];static struct lock_class_key smc_keys[2 ]; -static int smc_inet_init_sock (struct sock *sk) -{ -struct net *net =sock_net (sk); -int rc; - -/* init common smc sock */ -smc_sk_init (net, sk,IPPROTO_SMC ); -/* create clcsock */ - rc =smc_create_clcsk (net, sk, sk->sk_family); -if (rc) -return rc; - +static inline void smc_inet_lockdep_annotate (struct sock *sk) {switch (sk->sk_family) {case AF_INET : sock_lock_init_class_and_name(sk, "slock-AF_INET-SMC",
@@ -139,8 +128,21 @@ static int smc_inet_init_sock(struct sock *sk)default :WARN_ON_ONCE (1 ); } +} -return 0 ; +static int smc_inet_init_sock (struct sock *sk) +{ +struct net *net =sock_net (sk); +int rc; + +/* init common smc sock */ +smc_sk_init (net, sk,IPPROTO_SMC ); +/* create clcsock */ + rc =smc_create_clcsk (net, sk, sk->sk_family); +if (!rc) +smc_inet_lockdep_annotate (sk); + +return rc; }int __init smc_inet_init (void )
Signature · 1 line
2.39.2
Re: [PATCH v3 2/2 RESEND] resolve gtp possible deadlock warning
From: Daniel Yang <[email protected]>
Date: Tue, 15 Oct 2024 15:48:05 -0700
Quoted 6 lines
From: Daniel Yang <[email protected]>
Moved lockdep annotation to separate function for readability.
Signed-off-by Daniel Yang <[email protected]>Reported-by [email protected]
This tag is bogus, why not squash to patch 1 ?
Also, patch 1 needs Fixes: tag.
Re: [PATCH v3 2/2 RESEND] resolve gtp possible deadlock warning
Quoted 5 lines · Kuniyuki Iwashima
From: Daniel Yang <[email protected]>
Date: Tue, 15 Oct 2024 15:48:05 -0700Quoted 2 lines
From: Daniel Yang <[email protected]>
Quoted 8 lines
Quoted 4 lines
Moved lockdep annotation to separate function for readability.
Signed-off-by Daniel Yang <[email protected]>Reported-by [email protected]This tag is bogus, why not squash to patch 1 ?
Also, patch 1 needs Fixes: tag.
I wanted to split them up since D. Wythe suggested the fix when I was having trouble finding where the packets were being created so I wanted to give credit.
Re: [PATCH v3 2/2 RESEND] resolve gtp possible deadlock warning
Quoted 12 lines · Daniel Yang
Quoted 10 lines · Kuniyuki Iwashima
From: Daniel Yang <[email protected]>
Date: Tue, 15 Oct 2024 15:48:05 -0700Quoted 6 lines
From: Daniel Yang <[email protected]>
Moved lockdep annotation to separate function for readability.
Signed-off-by Daniel Yang <[email protected]>Reported-by [email protected]
Quoted 7 lines
Quoted 3 lines
This tag is bogus, why not squash to patch 1 ?
Also, patch 1 needs Fixes: tag.
I wanted to split them up since D. Wythe suggested the fix when I was having trouble finding where the packets were being created so I wanted to give credit.
I'll squash and resend with the Fixes: tag and put him in the
Suggested-by: or something since it matters to you.
D. Wythe
maintainerRe: [PATCH v3 2/2 RESEND] resolve gtp possible deadlock warning
In reply to Daniel YangQuoted 48 lines · Daniel Yang
From: Daniel Yang <[email protected]>
Moved lockdep annotation to separate function for readability.
Signed-off-by Daniel Yang <[email protected]>Reported-by [email protected]--- net/smc/smc_inet.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)net/smc/smc_inet.c +8
-13@@ -111,18 +111,7 @@ static struct inet_protosw smc_inet6_protosw = {static struct lock_class_key smc_slock_keys[2 ];static struct lock_class_key smc_keys[2 ]; -static int smc_inet_init_sock (struct sock *sk) -{ -struct net *net =sock_net (sk); -int rc; - -/* init common smc sock */ -smc_sk_init (net, sk,IPPROTO_SMC ); -/* create clcsock */ - rc =smc_create_clcsk (net, sk, sk->sk_family); -if (rc) -return rc; - +static inline void smc_inet_lockdep_annotate (struct sock *sk) {switch (sk->sk_family) {case AF_INET : sock_lock_init_class_and_name(sk, "slock-AF_INET-SMC",@@ -139,8 +128,21 @@ static int smc_inet_init_sock(struct sock *sk)default :WARN_ON_ONCE (1 ); } +} -return 0 ; +static int smc_inet_init_sock (struct sock *sk) +{ +struct net *net =sock_net (sk); +int rc; + +/* init common smc sock */
net/smc/smc_inet.c static int smc_inet_init_sock(struct sock *sk) · line 148
Quoted 10 lines
net/smc/smc_inet.c +7
-0+smc_sk_init (net, sk,IPPROTO_SMC ); +/* create clcsock */ + rc =smc_create_clcsk (net, sk, sk->sk_family); +if (!rc) +smc_inet_lockdep_annotate (sk); + +return rc; }int __init smc_inet_init (void )
I need to check why you said Wang Cong's patch cannot fix the issue. As soon as I reach a conclusion, I'll inform you right away.
D. Wythe
Jakub Kicinski
maintainerQuoted 6 lines · On Tue, 15 Oct 2024 15:48:03 -0700 Daniel Yang wrote:
Subject:
Date: Tue, 15 Oct 2024 15:48:03 -0700
X-Mailer: git-send-email 2.39.2Date: Tue, 15 Oct 2024 15:31:12 -0700
Subject: [PATCH v3 0/2 RESEND] resolve gtp possible deadlock warning
This is garbled as well.
Before you repost please make sure you take a look at:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#tl-dr
Signature · 1 line
pw-bot: cr