Re: general protection fault in __ipv6_sock_mc_join

From: syzbot
Date: Mon Dec 10 2018 - 16:42:06 EST


syzbot has found a reproducer for the following crash on:

HEAD commit: 40e020c129cf Linux 4.20-rc6
git tree: net
console output: https://syzkaller.appspot.com/x/log.txt?x=1296c56d400000
kernel config: https://syzkaller.appspot.com/x/.config?x=c8970c89a0efbb23
dashboard link: https://syzkaller.appspot.com/bug?extid=eb4da3a20fad2e52555d
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15817125400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=129447eb400000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+eb4da3a20fad2e52555d@xxxxxxxxxxxxxxxxxxxxxxxxx

8021q: adding VLAN 0 to HW filter on device team0
Started in network mode
Own node identity ac14141a, cluster identity 4711
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 6008 Comm: syz-executor946 Not tainted 4.20.0-rc6+ #223
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__read_once_size include/linux/compiler.h:182 [inline]
RIP: 0010:__ipv6_sock_mc_join+0x24a/0xc10 net/ipv6/mcast.c:152
Code: 00 00 e8 a9 31 9b fa 48 8b 85 d0 fe ff ff 48 83 c0 60 48 89 c2 48 89 85 c0 fe ff ff 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 32 09 00 00 48 8b 85 d0 fe ff ff 4c 8d ad 10 ff
RSP: 0018:ffff8881cd7b6bc8 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000001 RCX: ffffffff86e459ac
RDX: 000000000000000c RSI: ffffffff86e452c7 RDI: 0000000000000001
RBP: ffff8881cd7b6d18 R08: ffff8881ccad8300 R09: ffffed103b5c5b5f
R10: ffffed103b5c5b5f R11: ffff8881dae2dafb R12: 000000000000000f
R13: ffff8881cd7b6fb4 R14: ffff8881cd7b6fb4 R15: ffff8881bb9c9540
FS: 0000000001a6e880(0000) GS:ffff8881dae00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000080 CR3: 00000001c21ac000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
ipv6_sock_mc_join+0x27/0x30 net/ipv6/mcast.c:208
enable_mcast net/tipc/udp_media.c:395 [inline]
tipc_udp_enable+0x1476/0x1ed0 net/tipc/udp_media.c:757
tipc_enable_bearer+0x9a6/0xf10 net/tipc/bearer.c:302
__tipc_nl_bearer_enable+0x37c/0x4a0 net/tipc/bearer.c:897
tipc_nl_bearer_enable+0x22/0x30 net/tipc/bearer.c:905
genl_family_rcv_msg+0x8a7/0x11a0 net/netlink/genetlink.c:601
genl_rcv_msg+0xc6/0x168 net/netlink/genetlink.c:626
netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2477
genl_rcv+0x28/0x40 net/netlink/genetlink.c:637
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x5a5/0x760 net/netlink/af_netlink.c:1336
netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:621 [inline]
sock_sendmsg+0xd5/0x120 net/socket.c:631
___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
__sys_sendmsg+0x11d/0x280 net/socket.c:2154
__do_sys_sendmsg net/socket.c:2163 [inline]
__se_sys_sendmsg net/socket.c:2161 [inline]
__x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x445d49
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 fb ce fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffe64b73768 EFLAGS: 00000213 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002e0 RCX: 0000000000445d49
RDX: 000000000000c000 RSI: 0000000020000c00 RDI: 0000000000000003
RBP: 00000000006d1018 R08: 0000000000000000 R09: 0000000000000100
R10: 0000000000000000 R11: 0000000000000213 R12: 00000000004030d0
R13: 0000000000403160 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace c6ae3b4cfb2b9359 ]---
RIP: 0010:__read_once_size include/linux/compiler.h:182 [inline]
RIP: 0010:__ipv6_sock_mc_join+0x24a/0xc10 net/ipv6/mcast.c:152
Code: 00 00 e8 a9 31 9b fa 48 8b 85 d0 fe ff ff 48 83 c0 60 48 89 c2 48 89 85 c0 fe ff ff 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 32 09 00 00 48 8b 85 d0 fe ff ff 4c 8d ad 10 ff
RSP: 0018:ffff8881cd7b6bc8 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: 0000000000000001 RCX: ffffffff86e459ac
RDX: 000000000000000c RSI: ffffffff86e452c7 RDI: 0000000000000001
RBP: ffff8881cd7b6d18 R08: ffff8881ccad8300 R09: ffffed103b5c5b5f
R10: ffffed103b5c5b5f R11: ffff8881dae2dafb R12: 000000000000000f
R13: ffff8881cd7b6fb4 R14: ffff8881cd7b6fb4 R15: ffff8881bb9c9540
FS: 0000000001a6e880(0000) GS:ffff8881dae00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000080 CR3: 00000001c21ac000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400