netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg
@ 2019-02-04 16:36 Eric Dumazet
  2019-02-05  3:19 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eric Dumazet @ 2019-02-04 16:36 UTC (permalink / raw)
  To: David S . Miller
  Cc: netdev, Eric Dumazet, Eric Dumazet, David Howells, syzbot

When either "goto wait_interrupted;" or "goto wait_error;"
paths are taken, socket lock has already been released.

This patch fixes following syzbot splat :

WARNING: bad unlock balance detected!
5.0.0-rc4+ #59 Not tainted
-------------------------------------
syz-executor223/8256 is trying to release lock (sk_lock-AF_RXRPC) at:
[<ffffffff86651353>] rxrpc_recvmsg+0x6d3/0x3099 net/rxrpc/recvmsg.c:598
but there are no more locks to release!

other info that might help us debug this:
1 lock held by syz-executor223/8256:
 #0: 00000000fa9ed0f4 (slock-AF_RXRPC){+...}, at: spin_lock_bh include/linux/spinlock.h:334 [inline]
 #0: 00000000fa9ed0f4 (slock-AF_RXRPC){+...}, at: release_sock+0x20/0x1c0 net/core/sock.c:2798

stack backtrace:
CPU: 1 PID: 8256 Comm: syz-executor223 Not tainted 5.0.0-rc4+ #59
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x172/0x1f0 lib/dump_stack.c:113
 print_unlock_imbalance_bug kernel/locking/lockdep.c:3391 [inline]
 print_unlock_imbalance_bug.cold+0x114/0x123 kernel/locking/lockdep.c:3368
 __lock_release kernel/locking/lockdep.c:3601 [inline]
 lock_release+0x67e/0xa00 kernel/locking/lockdep.c:3860
 sock_release_ownership include/net/sock.h:1471 [inline]
 release_sock+0x183/0x1c0 net/core/sock.c:2808
 rxrpc_recvmsg+0x6d3/0x3099 net/rxrpc/recvmsg.c:598
 sock_recvmsg_nosec net/socket.c:794 [inline]
 sock_recvmsg net/socket.c:801 [inline]
 sock_recvmsg+0xd0/0x110 net/socket.c:797
 __sys_recvfrom+0x1ff/0x350 net/socket.c:1845
 __do_sys_recvfrom net/socket.c:1863 [inline]
 __se_sys_recvfrom net/socket.c:1859 [inline]
 __x64_sys_recvfrom+0xe1/0x1a0 net/socket.c:1859
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446379
Code: e8 2c b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b 09 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fe5da89fd98 EFLAGS: 00000246 ORIG_RAX: 000000000000002d
RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 0000000000446379
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c
R13: 0000000000000000 R14: 0000000000000000 R15: 20c49ba5e353f7cf

Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: David Howells <dhowells@redhat.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
---
 net/rxrpc/recvmsg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
index eaf19ebaa964e6442cfa4117f862fb4aca9b2345..3f7bb11f3290e57fe27007cb2ce57936f6ae47f4 100644
--- a/net/rxrpc/recvmsg.c
+++ b/net/rxrpc/recvmsg.c
@@ -596,6 +596,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
 	}
 error_no_call:
 	release_sock(&rx->sk);
+error_trace:
 	trace_rxrpc_recvmsg(call, rxrpc_recvmsg_return, 0, 0, 0, ret);
 	return ret;
 
@@ -604,7 +605,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
 wait_error:
 	finish_wait(sk_sleep(&rx->sk), &wait);
 	call = NULL;
-	goto error_no_call;
+	goto error_trace;
 }
 
 /**
-- 
2.20.1.611.gfbb209baf1-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg
  2019-02-04 16:36 [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg Eric Dumazet
@ 2019-02-05  3:19 ` David Miller
  2019-02-06 18:55 ` David Miller
  2019-02-06 21:05 ` David Howells
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-02-05  3:19 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, eric.dumazet, dhowells, syzkaller

From: Eric Dumazet <edumazet@google.com>
Date: Mon,  4 Feb 2019 08:36:06 -0800

> When either "goto wait_interrupted;" or "goto wait_error;"
> paths are taken, socket lock has already been released.
> 
> This patch fixes following syzbot splat :
 ...
> Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: David Howells <dhowells@redhat.com>
> Reported-by: syzbot <syzkaller@googlegroups.com>

David H., please take a look at this.

I can apply it directly and queue it up for -stable, just let me
know.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg
  2019-02-04 16:36 [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg Eric Dumazet
  2019-02-05  3:19 ` David Miller
@ 2019-02-06 18:55 ` David Miller
  2019-02-06 19:02   ` David Miller
  2019-02-06 21:05 ` David Howells
  2 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2019-02-06 18:55 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, eric.dumazet, dhowells, syzkaller

From: Eric Dumazet <edumazet@google.com>
Date: Mon,  4 Feb 2019 08:36:06 -0800

> When either "goto wait_interrupted;" or "goto wait_error;"
> paths are taken, socket lock has already been released.
> 
> This patch fixes following syzbot splat :
 ...
> Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: David Howells <dhowells@redhat.com>
> Reported-by: syzbot <syzkaller@googlegroups.com>

Series applied, thanks Eric.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg
  2019-02-06 18:55 ` David Miller
@ 2019-02-06 19:02   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2019-02-06 19:02 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, eric.dumazet, dhowells, syzkaller

From: David Miller <davem@davemloft.net>
Date: Wed, 06 Feb 2019 10:55:48 -0800 (PST)

> From: Eric Dumazet <edumazet@google.com>
> Date: Mon,  4 Feb 2019 08:36:06 -0800
> 
>> When either "goto wait_interrupted;" or "goto wait_error;"
>> paths are taken, socket lock has already been released.
>> 
>> This patch fixes following syzbot splat :
>  ...
>> Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>> Cc: David Howells <dhowells@redhat.com>
>> Reported-by: syzbot <syzkaller@googlegroups.com>
> 
> Series applied, thanks Eric.

Of course, I meant:

Patch applied and queued up for -stable.

Sometimes I guess I am on autopilot :-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg
  2019-02-04 16:36 [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg Eric Dumazet
  2019-02-05  3:19 ` David Miller
  2019-02-06 18:55 ` David Miller
@ 2019-02-06 21:05 ` David Howells
  2 siblings, 0 replies; 5+ messages in thread
From: David Howells @ 2019-02-06 21:05 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: dhowells, David S . Miller, netdev, Eric Dumazet, syzbot

Eric Dumazet <edumazet@google.com> wrote:

> When either "goto wait_interrupted;" or "goto wait_error;"
> paths are taken, socket lock has already been released.
> 
> This patch fixes following syzbot splat :
> 
> WARNING: bad unlock balance detected!
> 5.0.0-rc4+ #59 Not tainted
> -------------------------------------
> syz-executor223/8256 is trying to release lock (sk_lock-AF_RXRPC) at:
> [<ffffffff86651353>] rxrpc_recvmsg+0x6d3/0x3099 net/rxrpc/recvmsg.c:598
> but there are no more locks to release!
> 
> other info that might help us debug this:
> 1 lock held by syz-executor223/8256:
>  #0: 00000000fa9ed0f4 (slock-AF_RXRPC){+...}, at: spin_lock_bh include/linux/spinlock.h:334 [inline]
>  #0: 00000000fa9ed0f4 (slock-AF_RXRPC){+...}, at: release_sock+0x20/0x1c0 net/core/sock.c:2798
> 
> stack backtrace:
> CPU: 1 PID: 8256 Comm: syz-executor223 Not tainted 5.0.0-rc4+ #59
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:77 [inline]
>  dump_stack+0x172/0x1f0 lib/dump_stack.c:113
>  print_unlock_imbalance_bug kernel/locking/lockdep.c:3391 [inline]
>  print_unlock_imbalance_bug.cold+0x114/0x123 kernel/locking/lockdep.c:3368
>  __lock_release kernel/locking/lockdep.c:3601 [inline]
>  lock_release+0x67e/0xa00 kernel/locking/lockdep.c:3860
>  sock_release_ownership include/net/sock.h:1471 [inline]
>  release_sock+0x183/0x1c0 net/core/sock.c:2808
>  rxrpc_recvmsg+0x6d3/0x3099 net/rxrpc/recvmsg.c:598
>  sock_recvmsg_nosec net/socket.c:794 [inline]
>  sock_recvmsg net/socket.c:801 [inline]
>  sock_recvmsg+0xd0/0x110 net/socket.c:797
>  __sys_recvfrom+0x1ff/0x350 net/socket.c:1845
>  __do_sys_recvfrom net/socket.c:1863 [inline]
>  __se_sys_recvfrom net/socket.c:1859 [inline]
>  __x64_sys_recvfrom+0xe1/0x1a0 net/socket.c:1859
>  do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x446379
> Code: e8 2c b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b 09 fc ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007fe5da89fd98 EFLAGS: 00000246 ORIG_RAX: 000000000000002d
> RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 0000000000446379
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
> RBP: 00000000006dbc20 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dbc2c
> R13: 0000000000000000 R14: 0000000000000000 R15: 20c49ba5e353f7cf
> 
> Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: David Howells <dhowells@redhat.com>
> Reported-by: syzbot <syzkaller@googlegroups.com>

Acked-by: David Howells <dhowells@redhat.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-06 21:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 16:36 [PATCH net] rxrpc: bad unlock balance in rxrpc_recvmsg Eric Dumazet
2019-02-05  3:19 ` David Miller
2019-02-06 18:55 ` David Miller
2019-02-06 19:02   ` David Miller
2019-02-06 21:05 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).