syzbot


general protection fault in xsk_map_update_elem

Status: fixed on 2019/10/15 23:40
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+491c1b7565ba9069ecae@syzkaller.appspotmail.com
Fix commit: fcd30ae0665c bpf/xskmap: Return ERR_PTR for failure case instead of NULL.
First crash: 1650d, last: 1645d
Cause bisection: introduced by (bisect log) :
commit 0402acd683c678874df6bdbc23530ca07ea19353
Author: BjΓΆrn TΓΆpel <bjorn.topel@intel.com>
Date: Thu Aug 15 09:30:13 2019 +0000

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

Crash: general protection fault in xsk_map_update_elem (log)
Repro: C syz .config
  
Discussions (3)
Title Replies (including bot) Last reply
[PATCH net] bpf/xskmap: Return ERR_PTR for failure case instead of NULL. 3 (3) 2019/09/25 20:19
[PATCH net] bpf/xskmap: Return ERR_PTR for failure case instead of NULL. 1 (1) 2019/09/24 16:24
general protection fault in xsk_map_update_elem 2 (3) 2019/09/24 05:05

Sample crash report:
RDX: 0000000000000020 RSI: 0000000020000100 RDI: 0000000000000002
RBP: 0000000000000005 R08: 0000000000000001 R09: 00007ffc84560033
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: 8639 Comm: syz-executor358 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:ffff88808e55fbb8 EFLAGS: 00010246
RAX: dffffc0000000000 RBX: ffff8880925d5c90 RCX: ffffffff81868070
RDX: 0000000000000000 RSI: ffffffff81868085 RDI: 0000000000000001
RBP: ffff88808e55fc78 R08: ffff8880a15823c0 R09: ffffed1011cabf65
R10: ffffed1011cabf64 R11: 0000000000000003 R12: 0000000000000000
R13: ffff8880925d5ca0 R14: ffff888089fac040 R15: ffff8880925d56c0
FS:  00005555564a7880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000040 CR3: 00000000a4d9c000 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:00007ffc8456cd78 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ffc8456cd80 RCX: 0000000000440709
RDX: 0000000000000020 RSI: 0000000020000100 RDI: 0000000000000002
RBP: 0000000000000005 R08: 0000000000000001 R09: 00007ffc84560033
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401ff0
R13: 0000000000402080 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace 0c52e667328a1061 ]---
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:ffff88808e55fbb8 EFLAGS: 00010246
RAX: dffffc0000000000 RBX: ffff8880925d5c90 RCX: ffffffff81868070
RDX: 0000000000000000 RSI: ffffffff81868085 RDI: 0000000000000001
RBP: ffff88808e55fc78 R08: ffff8880a15823c0 R09: ffffed1011cabf65
R10: ffffed1011cabf64 R11: 0000000000000003 R12: 0000000000000000
R13: ffff8880925d5ca0 R14: ffff888089fac040 R15: ffff8880925d56c0
FS:  00005555564a7880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000040 CR3: 00000000a4d9c000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (12):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/09/21 09:27 net-old e84622ce2448 d96e88f3 .config console log report syz C ci-upstream-net-this-kasan-gce
2019/09/21 09:21 net-next-old b41dae061bbd d96e88f3 .config console log report syz C ci-upstream-net-kasan-gce
2019/09/26 07:41 net-old 99dcb8432af0 24d405a3 .config console log report ci-upstream-net-this-kasan-gce
2019/09/23 02:19 net-old 24ccb0ab95bf d96e88f3 .config console log report ci-upstream-net-this-kasan-gce
2019/09/22 11:55 net-old 24ccb0ab95bf d96e88f3 .config console log report ci-upstream-net-this-kasan-gce
2019/09/21 23:02 net-old 7b09c2d052db d96e88f3 .config console log report ci-upstream-net-this-kasan-gce
2019/09/21 08:48 net-old e84622ce2448 d96e88f3 .config console log report ci-upstream-net-this-kasan-gce
2019/09/22 19:30 net-next-old b41dae061bbd d96e88f3 .config console log report ci-upstream-net-kasan-gce
2019/09/22 11:32 net-next-old b41dae061bbd d96e88f3 .config console log report ci-upstream-net-kasan-gce
2019/09/21 12:01 net-next-old b41dae061bbd d96e88f3 .config console log report ci-upstream-net-kasan-gce
2019/09/21 08:49 net-next-old b41dae061bbd d96e88f3 .config console log report ci-upstream-net-kasan-gce
2019/09/22 12:01 linux-next b5b3bd898ba9 d96e88f3 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.