syzbot


WARNING: refcount bug in smap_release_sock
Status: fixed on 2018/08/07 13:43
Reported-by: syzbot+d464d2c20c717ef5a6a8@syzkaller.appspotmail.com
Fix commit: 7ebc14d507b4 bpf: sockmap, consume_skb in close path 547b3aa451ae bpf: sockmap, error path can not release psock in multi-map case
First crash: 1438d, last: 1399d

Sample crash report:
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 1 PID: 4553 at lib/refcount.c:187 refcount_sub_and_test+0x2e7/0x350 lib/refcount.c:187
Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 4553 Comm: syz-executor417 Not tainted 4.18.0-rc5+ #150
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 panic+0x238/0x4e7 kernel/panic.c:184
 __warn.cold.8+0x163/0x1ba kernel/panic.c:536
 report_bug+0x252/0x2d0 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:178 [inline]
 do_error_trap+0x1fc/0x4d0 arch/x86/kernel/traps.c:296
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:992
RIP: 0010:refcount_sub_and_test+0x2e7/0x350 lib/refcount.c:187
Code: 89 de e8 2c a7 1c fe 84 db 74 07 31 db e9 46 ff ff ff e8 4c a6 1c fe 48 c7 c7 c0 49 1a 88 c6 05 e5 61 3a 06 01 e8 89 c9 e7 fd <0f> 0b 31 db e9 25 ff ff ff 48 8b bd 28 ff ff ff 89 85 34 ff ff ff 
RSP: 0018:ffff8801c36f7780 EFLAGS: 00010286
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff81631821 RDI: ffff8801c36f7458
RBP: ffff8801c36f7868 R08: ffff8801aacd0740 R09: 0000000000000006
R10: 0000000000000000 R11: 0000000000000000 R12: 00000000ffffffff
R13: ffff8801c36f7840 R14: 0000000000000001 R15: 0000000000000000
 refcount_dec_and_test+0x1a/0x20 lib/refcount.c:212
 smap_release_sock+0x76/0x320 kernel/bpf/sockmap.c:1453
 sock_hash_ctx_update_elem.isra.27+0x8cb/0x1690 kernel/bpf/sockmap.c:2396
 sock_hash_update_elem+0x157/0x2f0 kernel/bpf/sockmap.c:2418
 map_update_elem+0x5c4/0xc90 kernel/bpf/syscall.c:765
 __do_sys_bpf kernel/bpf/syscall.c:2296 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:2267 [inline]
 __x64_sys_bpf+0x32d/0x510 kernel/bpf/syscall.c:2267
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x445929
Code: e8 3c b6 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 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 2b 12 fc ff c3 66 2e 0f 1f 84 00 00 00 00 
RSP: 002b:00007fdea042edb8 EFLAGS: 00000297 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00000000006dac44 RCX: 0000000000445929
RDX: 0000000000000020 RSI: 0000000020000180 RDI: 0000000000000002
RBP: 00000000006dac40 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000000
R13: 00007ffe98ad5fdf R14: 00007fdea042f9c0 R15: 0000000000000009
Dumping ftrace buffer:
   (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (55):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2018/07/17 01:08 upstream 706bf68b4339 40cb0c9a .config log report syz C
ci-upstream-kasan-gce-root 2018/07/16 09:23 upstream 9d3cce1e8b85 92a49505 .config log report syz C
ci-upstream-kasan-gce-root 2018/07/15 23:32 upstream 37b5dca2898d 92a49505 .config log report syz C
ci-upstream-kasan-gce-root 2018/07/13 15:49 upstream 63f047771621 92a49505 .config log report syz C
ci-upstream-kasan-gce-root 2018/07/09 17:23 upstream 1e4b044d2251 f25e5770 .config log report syz C
ci-upstream-kasan-gce-root 2018/07/07 08:39 upstream 29119529d8de 6c0c0099 .config log report syz C
ci-upstream-kasan-gce-root 2018/07/07 05:28 upstream 29119529d8de 6c0c0099 .config log report syz C
ci-upstream-kasan-gce-root 2018/07/04 16:16 upstream fc36def997cf 317fc8ea .config log report syz C
ci-upstream-kasan-gce-root 2018/06/22 10:06 upstream 27db64f65f1b 095ef806 .config log report syz C
ci-upstream-bpf-kasan-gce 2018/07/07 20:07 bpf c48424d993fa ab89aea9 .config log report syz C
ci-upstream-bpf-kasan-gce 2018/07/07 08:43 bpf c48424d993fa 6c0c0099 .config log report syz C
ci-upstream-bpf-kasan-gce 2018/07/06 21:26 bpf c48424d993fa 9636bc93 .config log report syz C
ci-upstream-net-kasan-gce 2018/07/21 00:19 net-next eecd6857709e af255b09 .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/07/19 17:01 bpf-next 8ae71e76cf1f 49f35839 .config log report syz C
ci-upstream-net-kasan-gce 2018/07/19 13:04 net-next 3bc950c34b28 49f35839 .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/07/19 01:04 bpf-next 8ae71e76cf1f 49f35839 .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/07/16 12:25 bpf-next 13f7432bdd8e 92a49505 .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/07/15 16:21 bpf-next 13f7432bdd8e 92a49505 .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/07/14 15:35 bpf-next d23b27c02f03 92a49505 .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/07/12 14:26 bpf-next 671dffa7de7b 06c33b3a .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/07/12 09:28 bpf-next 671dffa7de7b 2e0e3130 .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/07/08 07:21 bpf-next d90c936fb318 c9a7a4dc .config log report syz C
ci-upstream-bpf-next-kasan-gce 2018/06/22 07:34 bpf-next f0dc7f9c6dd9 095ef806 .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2018/07/08 06:55 linux-next 526674536360 c9a7a4dc .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2018/07/08 05:59 linux-next 526674536360 c9a7a4dc .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2018/07/08 04:19 linux-next 526674536360 c9a7a4dc .config log report syz C
ci-upstream-bpf-kasan-gce 2018/07/07 21:13 bpf c48424d993fa ab89aea9 .config log report
ci-upstream-bpf-kasan-gce 2018/07/07 21:03 bpf c48424d993fa ab89aea9 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/22 04:26 bpf-next 8ae71e76cf1f 8cc079c3 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/20 18:37 bpf-next 8ae71e76cf1f 49f35839 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/19 05:07 bpf-next 8ae71e76cf1f 49f35839 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/18 23:15 bpf-next 8ae71e76cf1f 49f35839 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/17 20:45 bpf-next dc989d2ce2c2 6d5bd5b5 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/17 18:55 bpf-next dc989d2ce2c2 6d5bd5b5 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/17 08:52 bpf-next 301f935be9e0 13761366 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/17 00:33 bpf-next 301f935be9e0 40cb0c9a .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/15 03:41 bpf-next 2d3feca8c44f 92a49505 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/14 16:52 bpf-next 2d3feca8c44f 92a49505 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/12 02:28 bpf-next 671dffa7de7b 2e0e3130 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/11 20:05 bpf-next d90c936fb318 2e0e3130 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/09 23:46 bpf-next d90c936fb318 f25e5770 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/08 21:13 bpf-next d90c936fb318 f25e5770 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/08 05:06 bpf-next d90c936fb318 c9a7a4dc .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/07 15:12 bpf-next d90c936fb318 ab89aea9 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/05 15:40 bpf-next 6fcf9b1d4d6c f525fd72 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/05 01:55 bpf-next 2bdea157b999 e1b966c6 .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/04 17:29 bpf-next 2bdea157b999 317fc8ea .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/04 13:18 bpf-next 2bdea157b999 317fc8ea .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/04 13:12 bpf-next 2bdea157b999 317fc8ea .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/04 11:12 bpf-next 2bdea157b999 317fc8ea .config log report
ci-upstream-bpf-next-kasan-gce 2018/07/02 12:42 bpf-next 0b9e3d543f9f dba0b50e .config log report
ci-upstream-bpf-next-kasan-gce 2018/06/25 16:23 bpf-next f0dc7f9c6dd9 2064fc5c .config log report
ci-upstream-bpf-next-kasan-gce 2018/06/24 20:29 bpf-next f0dc7f9c6dd9 2064fc5c .config log report
ci-upstream-bpf-next-kasan-gce 2018/06/22 05:00 bpf-next f0dc7f9c6dd9 095ef806 .config log report
ci-upstream-bpf-next-kasan-gce 2018/06/13 04:18 bpf-next 75d4e704fa8d 6dcbc435 .config log report