[syzbot] general protection fault in inet_csk_accept

21 views
Skip to first unread message

syzbot

unread,
Dec 10, 2021, 6:09:22 AM12/10/21
to da...@davemloft.net, dsa...@kernel.org, edum...@google.com, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com, yosh...@linux-ipv6.org
Hello,

syzbot found the following issue on:

HEAD commit: 2a987e65025e Merge tag 'perf-tools-fixes-for-v5.16-2021-12..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=166f73adb00000
kernel config: https://syzkaller.appspot.com/x/.config?x=221ffc09e39ebbd1
dashboard link: https://syzkaller.appspot.com/bug?extid=e4d843bb96a9431e6331
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=16280ae5b00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1000fdc5b00000

The issue was bisected to:

commit 7f700334be9aeb91d5d86ef9ad2d901b9b453e9b
Author: Eric Dumazet <edum...@google.com>
Date: Mon Mar 29 18:39:51 2021 +0000

ip6_gre: proper dev_{hold|put} in ndo_[un]init methods

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=117fe575b00000
final oops: https://syzkaller.appspot.com/x/report.txt?x=137fe575b00000
console output: https://syzkaller.appspot.com/x/log.txt?x=157fe575b00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+e4d843...@syzkaller.appspotmail.com
Fixes: 7f700334be9a ("ip6_gre: proper dev_{hold|put} in ndo_[un]init methods")

general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 PID: 6550 Comm: syz-executor122 Not tainted 5.16.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__lock_acquire+0xd7d/0x54a0 kernel/locking/lockdep.c:4897
Code: 0f 0e 41 be 01 00 00 00 0f 86 c8 00 00 00 89 05 69 cc 0f 0e e9 bd 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 da 48 c1 ea 03 <80> 3c 02 00 0f 85 f3 2f 00 00 48 81 3b 20 75 17 8f 0f 84 52 f3 ff
RSP: 0018:ffffc90001f2f818 EFLAGS: 00010016
RAX: dffffc0000000000 RBX: 0000000000000018 RCX: 0000000000000000
RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000000 R11: 000000000000000a R12: 0000000000000000
R13: ffff88801b98d700 R14: 0000000000000000 R15: 0000000000000001
FS: 00007f177cd3d700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f177cd1b268 CR3: 000000001dd55000 CR4: 0000000000350ee0
Call Trace:
<TASK>
lock_acquire kernel/locking/lockdep.c:5637 [inline]
lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162
finish_wait+0xc0/0x270 kernel/sched/wait.c:400
inet_csk_wait_for_connect net/ipv4/inet_connection_sock.c:464 [inline]
inet_csk_accept+0x7de/0x9d0 net/ipv4/inet_connection_sock.c:497
mptcp_accept+0xe5/0x500 net/mptcp/protocol.c:2865
inet_accept+0xe4/0x7b0 net/ipv4/af_inet.c:739
mptcp_stream_accept+0x2e7/0x10e0 net/mptcp/protocol.c:3345
do_accept+0x382/0x510 net/socket.c:1773
__sys_accept4_file+0x7e/0xe0 net/socket.c:1816
__sys_accept4+0xb0/0x100 net/socket.c:1846
__do_sys_accept net/socket.c:1864 [inline]
__se_sys_accept net/socket.c:1861 [inline]
__x64_sys_accept+0x71/0xb0 net/socket.c:1861
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+0x44/0xae
RIP: 0033:0x7f177cd8b8e9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 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:00007f177cd3d308 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
RAX: ffffffffffffffda RBX: 00007f177ce13408 RCX: 00007f177cd8b8e9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007f177ce13400 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f177ce1340c
R13: 00007f177cde1004 R14: 6d705f706374706d R15: 0000000000022000
</TASK>
Modules linked in:
---[ end trace 77ed64e4985d56c9 ]---
RIP: 0010:__lock_acquire+0xd7d/0x54a0 kernel/locking/lockdep.c:4897
Code: 0f 0e 41 be 01 00 00 00 0f 86 c8 00 00 00 89 05 69 cc 0f 0e e9 bd 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 da 48 c1 ea 03 <80> 3c 02 00 0f 85 f3 2f 00 00 48 81 3b 20 75 17 8f 0f 84 52 f3 ff
RSP: 0018:ffffc90001f2f818 EFLAGS: 00010016
RAX: dffffc0000000000 RBX: 0000000000000018 RCX: 0000000000000000
RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000000 R11: 000000000000000a R12: 0000000000000000
R13: ffff88801b98d700 R14: 0000000000000000 R15: 0000000000000001
FS: 00007f177cd3d700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f177cd1b268 CR3: 000000001dd55000 CR4: 0000000000350ee0
----------------
Code disassembly (best guess):
0: 0f 0e femms
2: 41 be 01 00 00 00 mov $0x1,%r14d
8: 0f 86 c8 00 00 00 jbe 0xd6
e: 89 05 69 cc 0f 0e mov %eax,0xe0fcc69(%rip) # 0xe0fcc7d
14: e9 bd 00 00 00 jmpq 0xd6
19: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
20: fc ff df
23: 48 89 da mov %rbx,%rdx
26: 48 c1 ea 03 shr $0x3,%rdx
* 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2e: 0f 85 f3 2f 00 00 jne 0x3027
34: 48 81 3b 20 75 17 8f cmpq $0xffffffff8f177520,(%rbx)
3b: 0f .byte 0xf
3c: 84 52 f3 test %dl,-0xd(%rdx)
3f: ff .byte 0xff


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

Eric Dumazet

unread,
Dec 10, 2021, 6:13:14 AM12/10/21
to syzbot, Paolo Abeni, Florian Westphal, da...@davemloft.net, dsa...@kernel.org, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com, yosh...@linux-ipv6.org
On Fri, Dec 10, 2021 at 3:09 AM syzbot
<syzbot+e4d843...@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 2a987e65025e Merge tag 'perf-tools-fixes-for-v5.16-2021-12..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=166f73adb00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=221ffc09e39ebbd1
> dashboard link: https://syzkaller.appspot.com/bug?extid=e4d843bb96a9431e6331
> 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=16280ae5b00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1000fdc5b00000
>
> The issue was bisected to:
>

Note to MPTCP maintainers, I think this issue is MPTCP one, and the
bisection result
shown here seems not relevant.

The C repro is however correct, I trigger an immediate crash.

Paolo Abeni

unread,
Dec 10, 2021, 7:27:57 AM12/10/21
to syzbot, syzkall...@googlegroups.com
On Fri, 2021-12-10 at 03:09 -0800, syzbot wrote:
> HEAD commit: 2a987e65025e Merge tag 'perf-tools-fixes-for-v5.16-2021-12..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=166f73adb00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=221ffc09e39ebbd1
> dashboard link: https://syzkaller.appspot.com/bug?extid=e4d843bb96a9431e6331
> 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=16280ae5b00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1000fdc5b00000
>

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
---
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 7b96be1e9f14..afd4c6ddad0c 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1275,10 +1275,16 @@ static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net,
}

lock_sock(sk);
+ /* don't touch subflows for listener sockets */
+ if (sk->sk_state == TCP_LISTEN)
+ goto unlock_next;
+
remove_subflow = lookup_subflow_by_saddr(&msk->conn_list, addr);
mptcp_pm_remove_anno_addr(msk, addr, remove_subflow);
if (remove_subflow)
mptcp_pm_remove_subflow(msk, &list);
+
+unlock_next:
release_sock(sk);

next:
@@ -1318,10 +1324,16 @@ static int mptcp_nl_remove_id_zero_address(struct net *net,
goto next;

lock_sock(sk);
+ /* don't touch subflows for listener sockets */
+ if (sk->sk_state == TCP_LISTEN)
+ goto unlock_next;
+
spin_lock_bh(&msk->pm.lock);
mptcp_pm_remove_addr(msk, &list);
mptcp_pm_nl_rm_subflow_received(msk, &list);
spin_unlock_bh(&msk->pm.lock);
+
+unlock_next:
release_sock(sk);

next:

Paolo Abeni

unread,
Dec 10, 2021, 9:38:03 AM12/10/21
to Eric Dumazet, syzbot, Florian Westphal, da...@davemloft.net, dsa...@kernel.org, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com, yosh...@linux-ipv6.org
On Fri, 2021-12-10 at 03:13 -0800, Eric Dumazet wrote:
> On Fri, Dec 10, 2021 at 3:09 AM syzbot
> <syzbot+e4d843...@syzkaller.appspotmail.com> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit: 2a987e65025e Merge tag 'perf-tools-fixes-for-v5.16-2021-12..
> > git tree: upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=166f73adb00000
> > kernel config: https://syzkaller.appspot.com/x/.config?x=221ffc09e39ebbd1
> > dashboard link: https://syzkaller.appspot.com/bug?extid=e4d843bb96a9431e6331
> > 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=16280ae5b00000
> > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1000fdc5b00000
> >
> > The issue was bisected to:
> >
>
> Note to MPTCP maintainers, I think this issue is MPTCP one, 

Indeed it is, thanks for the head-up!

> and the bisection result shown here seems not relevant.

yep.

> The C repro is however correct, I trigger an immediate crash.

The repro is not triggering here - but I'm using a different kconfig.
Still the repro itself gives a good hint on the root cause. I'm testing
a patch with syzbot.

Thanks!

Paolo


syzbot

unread,
Dec 10, 2021, 10:45:11 AM12/10/21
to pab...@redhat.com, syzkall...@googlegroups.com
Hello,

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

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

Tested on:

commit: 92816e26 selftests: net: Correct ping6 expected rc fro..
git tree: net
kernel config: https://syzkaller.appspot.com/x/.config?x=221ffc09e39ebbd1
dashboard link: https://syzkaller.appspot.com/bug?extid=e4d843bb96a9431e6331
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=104c03e5b00000

Note: testing is done by a robot and is best-effort only.

Paolo Abeni

unread,
Dec 10, 2021, 1:26:28 PM12/10/21
to syzbot, syzkall...@googlegroups.com
On Fri, 2021-12-10 at 03:09 -0800, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 2a987e65025e Merge tag 'perf-tools-fixes-for-v5.16-2021-12..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=166f73adb00000
> kernel config: https://syzkaller.appspot.com/x/.config?x=221ffc09e39ebbd1
> dashboard link: https://syzkaller.appspot.com/bug?extid=e4d843bb96a9431e6331
> 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=16280ae5b00000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1000fdc5b00000

whoops, possibly better fix
---
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 4ff8d55cbe82..3186d33b5208 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -700,6 +700,9 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,

msk_owned_by_me(msk);

+ if (sk->sk_state == TCP_LISTEN)
+ return;
+
if (!rm_list->nr)
return;

syzbot

unread,
Dec 10, 2021, 1:42:10 PM12/10/21
to pab...@redhat.com, syzkall...@googlegroups.com
Hello,

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

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

Tested on:

commit: ab443c53 sch_cake: do not call cake_destroy() from cak..
git tree: net
kernel config: https://syzkaller.appspot.com/x/.config?x=221ffc09e39ebbd1
dashboard link: https://syzkaller.appspot.com/bug?extid=e4d843bb96a9431e6331
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=149a4b55b00000
Reply all
Reply to author
Forward
0 new messages