[syzbot] WARNING: still has locks held in tls_rx_reader_lock

6 views
Skip to first unread message

syzbot

unread,
Jul 20, 2022, 1:09:32 PM7/20/22
to bor...@nvidia.com, b...@vger.kernel.org, dan...@iogearbox.net, da...@davemloft.net, edum...@google.com, john.fa...@gmail.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e22c88799f26 Merge branch '100GbE' of git://git.kernel.org..
git tree: net-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=159aa626080000
kernel config: https://syzkaller.appspot.com/x/.config?x=3c46ba1483fd8356
dashboard link: https://syzkaller.appspot.com/bug?extid=16e72110feb2b653ef27
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11d11d78080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147797ac080000

The issue was bisected to:

commit 4cbc325ed6b4dce4910be06d9d6940a8b919c59b
Author: Jakub Kicinski <ku...@kernel.org>
Date: Fri Jul 15 05:22:25 2022 +0000

tls: rx: allow only one reader at a time

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16966bac080000
final oops: https://syzkaller.appspot.com/x/report.txt?x=15966bac080000
console output: https://syzkaller.appspot.com/x/log.txt?x=11966bac080000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+16e721...@syzkaller.appspotmail.com
Fixes: 4cbc325ed6b4 ("tls: rx: allow only one reader at a time")

====================================
WARNING: syz-executor279/3626 still has locks held!
5.19.0-rc6-syzkaller-01454-ge22c88799f26 #0 Not tainted
------------------------------------
1 lock held by syz-executor279/3626:
#0: ffff888026449ab0 (sk_lock-AF_INET6){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1659 [inline]
#0: ffff888026449ab0 (sk_lock-AF_INET6){+.+.}-{0:0}, at: tls_rx_reader_lock+0x2da/0x4e0 net/tls/tls_sw.c:1817

stack backtrace:
CPU: 0 PID: 3626 Comm: syz-executor279 Not tainted 5.19.0-rc6-syzkaller-01454-ge22c88799f26 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
try_to_freeze include/linux/freezer.h:66 [inline]
get_signal+0x1424/0x2600 kernel/signal.c:2647
arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869
exit_to_user_mode_loop kernel/entry/common.c:166 [inline]
exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201
__syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f66234ef999
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f66234802f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: fffffffffffffe00 RBX: 00007f66235773f0 RCX: 00007f66234ef999
RDX: 00000000000000c1 RSI: 0000000020000080 RDI: 0000000000000003
RBP: 00007f6623545064 R08: 00007f6623480700 R09: 0000000000000000
R10: 00007f6623480700 R11: 0000000000000246 R12: 0100000000000000
R13: e8fece2d4e6d48fb R14: 0cb28def7c465af4 R15: 00007f66235773f8
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Hillf Danton

unread,
Jul 21, 2022, 6:49:31 AM7/21/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Wed, 20 Jul 2022 10:09:31 -0700
> syzbot found the following issue on:
>
> HEAD commit: e22c88799f26 Merge branch '100GbE' of git://git.kernel.org..
> git tree: net-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=159aa626080000
> kernel config: https://syzkaller.appspot.com/x/.config?x=3c46ba1483fd8356
> dashboard link: https://syzkaller.appspot.com/bug?extid=16e72110feb2b653ef27
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11d11d78080000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147797ac080000
>
> The issue was bisected to:
>
> commit 4cbc325ed6b4dce4910be06d9d6940a8b919c59b
> Author: Jakub Kicinski <ku...@kernel.org>
> Date: Fri Jul 15 05:22:25 2022 +0000
>
> tls: rx: allow only one reader at a time
>

Return err after releasing sock lock.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git e22c88799f26

--- y/net/tls/tls_sw.c
+++ t/net/tls/tls_sw.c
@@ -1874,8 +1874,10 @@ int tls_sw_recvmsg(struct sock *sk,

psock = sk_psock_get(sk);
timeo = tls_rx_reader_lock(sk, ctx, flags & MSG_DONTWAIT);
- if (timeo < 0)
- return timeo;
+ if (timeo < 0) {
+ err = timeo;
+ goto end;
+ }
bpf_strp_enabled = sk_psock_strp_enabled(psock);

/* If crypto failed the connection is broken */
@@ -2080,8 +2082,10 @@ ssize_t tls_sw_splice_read(struct socket
int chunk;

timeo = tls_rx_reader_lock(sk, ctx, flags & SPLICE_F_NONBLOCK);
- if (timeo < 0)
- return timeo;
+ if (timeo < 0) {
+ err = timeo;
+ goto splice_read_end;
+ }

if (!skb_queue_empty(&ctx->rx_list)) {
skb = __skb_dequeue(&ctx->rx_list);
--

syzbot

unread,
Jul 21, 2022, 7:02:17 AM7/21/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in tls_rx_reader_unlock

------------[ cut here ]------------
WARNING: CPU: 0 PID: 4109 at net/tls/tls_sw.c:1840 tls_rx_reader_unlock+0x140/0x1c0 net/tls/tls_sw.c:1840
Modules linked in:
CPU: 1 PID: 4109 Comm: syz-executor.0 Not tainted 5.19.0-rc6-syzkaller-01454-ge22c88799f26-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
RIP: 0010:tls_rx_reader_unlock+0x140/0x1c0 net/tls/tls_sw.c:1840
Code: 0f b6 04 02 84 c0 74 02 7e 41 44 0f b6 ab 40 02 00 00 31 ff 44 89 ee e8 fe 12 79 f9 45 84 ed 0f 85 23 ff ff ff e8 f0 16 79 f9 <0f> 0b e9 17 ff ff ff 4c 89 ef e8 91 64 c6 f9 e9 eb fe ff ff 48 89
RSP: 0018:ffffc9000334f9b8 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88807c3d4000 RCX: 0000000000000000
RDX: ffff88807bfc3b00 RSI: ffffffff88015a50 RDI: 0000000000000001
RBP: ffff88807c3d4240 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 000000000008a07a R12: ffff88807e6c2640
R13: 0000000000000000 R14: ffff88807c3d4000 R15: 0000000000000000
FS: 00007f1c67eb0700(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1c67eb0718 CR3: 000000006f5ed000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
tls_sw_recvmsg+0x62b/0x1c20 net/tls/tls_sw.c:2063
inet6_recvmsg+0x115/0x5e0 net/ipv6/af_inet6.c:672
sock_recvmsg_nosec net/socket.c:995 [inline]
sock_recvmsg net/socket.c:1013 [inline]
sock_recvmsg net/socket.c:1009 [inline]
sock_read_iter+0x337/0x470 net/socket.c:1086
call_read_iter include/linux/fs.h:2052 [inline]
new_sync_read+0x4f9/0x5f0 fs/read_write.c:401
vfs_read+0x492/0x5d0 fs/read_write.c:482
ksys_read+0x1e8/0x250 fs/read_write.c:620
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f1c66c89199
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f1c67eb0168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f1c66d9c030 RCX: 00007f1c66c89199
RDX: 00000000000000c1 RSI: 0000000020000080 RDI: 0000000000000003
RBP: 00007f1c66ce313b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff352268cf R14: 00007f1c67eb0300 R15: 0000000000022000
</TASK>


Tested on:

commit: e22c8879 Merge branch '100GbE' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=16c9eaac080000
kernel config: https://syzkaller.appspot.com/x/.config?x=3c46ba1483fd8356
dashboard link: https://syzkaller.appspot.com/bug?extid=16e72110feb2b653ef27
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=1644ab8c080000

Hillf Danton

unread,
Jul 21, 2022, 8:33:18 AM7/21/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Wed, 20 Jul 2022 10:09:31 -0700
> syzbot found the following issue on:
>
> HEAD commit: e22c88799f26 Merge branch '100GbE' of git://git.kernel.org..
> git tree: net-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=159aa626080000
> kernel config: https://syzkaller.appspot.com/x/.config?x=3c46ba1483fd8356
> dashboard link: https://syzkaller.appspot.com/bug?extid=16e72110feb2b653ef27
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11d11d78080000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=147797ac080000
>
> The issue was bisected to:
>
> commit 4cbc325ed6b4dce4910be06d9d6940a8b919c59b
> Author: Jakub Kicinski <ku...@kernel.org>
> Date: Fri Jul 15 05:22:25 2022 +0000
>
> tls: rx: allow only one reader at a time
>

Return err after releasing sock lock.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git e22c88799f26

--- y/net/tls/tls_sw.c
+++ t/net/tls/tls_sw.c
@@ -1818,10 +1818,14 @@ static long tls_rx_reader_lock(struct so
!READ_ONCE(ctx->reader_present), &wait);
remove_wait_queue(&ctx->wq, &wait);

- if (!timeo)
+ if (!timeo) {
+ release_sock(sk);
return -EAGAIN;
- if (signal_pending(current))
+ }
+ if (signal_pending(current)) {
+ release_sock(sk);
return sock_intr_errno(timeo);
+ }
}

WRITE_ONCE(ctx->reader_present, 1);
@@ -1874,8 +1878,11 @@ int tls_sw_recvmsg(struct sock *sk,

psock = sk_psock_get(sk);
timeo = tls_rx_reader_lock(sk, ctx, flags & MSG_DONTWAIT);
- if (timeo < 0)
+ if (timeo < 0) {
+ if (psock)
+ sk_psock_put(sk, psock);
return timeo;
+ }
bpf_strp_enabled = sk_psock_strp_enabled(psock);

/* If crypto failed the connection is broken */
--

syzbot

unread,
Jul 21, 2022, 9:01:12 AM7/21/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+16e721...@syzkaller.appspotmail.com

Tested on:

commit: e22c8879 Merge branch '100GbE' of git://git.kernel.org..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=17c4ab8c080000
kernel config: https://syzkaller.appspot.com/x/.config?x=3c46ba1483fd8356
dashboard link: https://syzkaller.appspot.com/bug?extid=16e72110feb2b653ef27
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=1410d6c2080000

Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages