general protection fault in xsk_map_update_elem

From: syzbot
Date: Mon Sep 23 2019 - 11:49:16 EST


Hello,

syzbot found the following crash on:

HEAD commit: b41dae06 Merge tag 'xfs-5.4-merge-7' of git://git.kernel.o..
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=130b25ad600000
kernel config: https://syzkaller.appspot.com/x/.config?x=dfcf592db22b9132
dashboard link: https://syzkaller.appspot.com/bug?extid=491c1b7565ba9069ecae
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=155a0c29600000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=172bf6d9600000

The bug was bisected to:

commit 0402acd683c678874df6bdbc23530ca07ea19353
Author: BjÃrn TÃpel <bjorn.topel@xxxxxxxxx>
Date: Thu Aug 15 09:30:13 2019 +0000

xsk: remove AF_XDP socket from map when the socket is released

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10d4a823600000
final crash: https://syzkaller.appspot.com/x/report.txt?x=12d4a823600000
console output: https://syzkaller.appspot.com/x/log.txt?x=14d4a823600000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+491c1b7565ba9069ecae@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 0402acd683c6 ("xsk: remove AF_XDP socket from map when the socket is released")

RDX: 0000000000000020 RSI: 0000000020000100 RDI: 0000000000000002
RBP: 0000000000000005 R08: 0000000000000001 R09: 00007ffef4500033
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401ff0
R13: 0000000000402080 R14: 0000000000000000 R15: 0000000000000000
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: 1 PID: 8878 Comm: syz-executor835 Not tainted 5.3.0+ #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__list_add include/linux/list.h:64 [inline]
RIP: 0010:list_add_tail include/linux/list.h:93 [inline]
RIP: 0010:xsk_map_sock_add kernel/bpf/xskmap.c:62 [inline]
RIP: 0010:xsk_map_update_elem+0x79c/0xac0 kernel/bpf/xskmap.c:265
Code: 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 ef 02 00 00 4c 89 e2 4d 89 a7 d8 05 00 00 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 c0 02 00 00 49 8d 7c 24 08 49 8d 87 d0 05 00 00
RSP: 0018:ffff88809a517bb8 EFLAGS: 00010246
RAX: dffffc0000000000 RBX: ffff88809ccc49d0 RCX: ffffffff81868070
RDX: 0000000000000000 RSI: ffffffff81868085 RDI: 0000000000000001
RBP: ffff88809a517c78 R08: ffff8880a10d2000 R09: ffffed10134a2f65
R10: ffffed10134a2f64 R11: 0000000000000003 R12: 0000000000000000
R13: ffff88809ccc49e0 R14: ffff888089db5580 R15: ffff88809ccc4400
FS: 0000555555df2880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000040 CR3: 00000000985e5000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
map_update_elem+0xc82/0x10b0 kernel/bpf/syscall.c:966
__do_sys_bpf+0x8b5/0x3350 kernel/bpf/syscall.c:2854
__se_sys_bpf kernel/bpf/syscall.c:2825 [inline]
__x64_sys_bpf+0x73/0xb0 kernel/bpf/syscall.c:2825
do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440709
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 5b 14 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffef4503478 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ffef4503480 RCX: 0000000000440709
RDX: 0000000000000020 RSI: 0000000020000100 RDI: 0000000000000002
RBP: 0000000000000005 R08: 0000000000000001 R09: 00007ffef4500033
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401ff0
R13: 0000000000402080 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace a95b9b926f856077 ]---
RIP: 0010:__list_add include/linux/list.h:64 [inline]
RIP: 0010:list_add_tail include/linux/list.h:93 [inline]
RIP: 0010:xsk_map_sock_add kernel/bpf/xskmap.c:62 [inline]
RIP: 0010:xsk_map_update_elem+0x79c/0xac0 kernel/bpf/xskmap.c:265
Code: 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 ef 02 00 00 4c 89 e2 4d 89 a7 d8 05 00 00 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 c0 02 00 00 49 8d 7c 24 08 49 8d 87 d0 05 00 00
RSP: 0018:ffff88809a517bb8 EFLAGS: 00010246
RAX: dffffc0000000000 RBX: ffff88809ccc49d0 RCX: ffffffff81868070
RDX: 0000000000000000 RSI: ffffffff81868085 RDI: 0000000000000001
RBP: ffff88809a517c78 R08: ffff8880a10d2000 R09: ffffed10134a2f65
R10: ffffed10134a2f64 R11: 0000000000000003 R12: 0000000000000000
R13: ffff88809ccc49e0 R14: ffff888089db5580 R15: ffff88809ccc4400
FS: 0000555555df2880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000040 CR3: 00000000985e5000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This bug 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 syzkaller@xxxxxxxxxxxxxxxxx

syzbot will keep track of this bug report. 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 bug, for details see:
https://goo.gl/tpsmEJ#testing-patches