syzbot


KASAN: slab-out-of-bounds Read in rhashtable_walk_enter

Status: fixed on 2019/06/24 23:41
Reported-by: syzbot+21ad49ad4c11cbfba8d7@syzkaller.appspotmail.com
Fix commit: 526f5b851a96 tipc: fix modprobe tipc failed after switch order of device registration
First crash: 1796d, last: 1791d
Cause bisection: introduced by (bisect log) :
commit 7e27e8d6130c5e88fac9ddec4249f7f2337fe7f8
Author: Junwei Hu <hujunwei4@huawei.com>
Date: Thu May 16 02:51:15 2019 +0000

  tipc: switch order of device registration to fix a crash

Crash: WARNING: locking bug in rhashtable_walk_enter (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
KASAN: slab-out-of-bounds Read in rhashtable_walk_enter 0 (2) 2019/05/24 17:45

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in __lock_acquire+0x3ba2/0x5490 kernel/locking/lockdep.c:3664
Read of size 8 at addr ffff888216b720c0 by task syz-executor777/8603

CPU: 0 PID: 8603 Comm: syz-executor777 Not tainted 5.2.0-rc1+ #21
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+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:188
 __kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 kasan_report+0x12/0x20 mm/kasan/common.c:614
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 __lock_acquire+0x3ba2/0x5490 kernel/locking/lockdep.c:3664
 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4302
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151
 spin_lock include/linux/spinlock.h:338 [inline]
 rhashtable_walk_enter+0xf9/0x390 lib/rhashtable.c:669
 __tipc_dump_start+0x1fa/0x3c0 net/tipc/socket.c:3414
 tipc_dump_start+0x70/0x90 net/tipc/socket.c:3396
 __netlink_dump_start+0x4f8/0x7d0 net/netlink/af_netlink.c:2351
 netlink_dump_start include/linux/netlink.h:226 [inline]
 tipc_sock_diag_handler_dump+0x1d9/0x270 net/tipc/diag.c:91
 __sock_diag_cmd net/core/sock_diag.c:232 [inline]
 sock_diag_rcv_msg+0x319/0x410 net/core/sock_diag.c:263
 netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2486
 sock_diag_rcv+0x2b/0x40 net/core/sock_diag.c:274
 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
 netlink_unicast+0x531/0x710 net/netlink/af_netlink.c:1337
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1926
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:671
 ___sys_sendmsg+0x803/0x920 net/socket.c:2292
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2330
 __do_sys_sendmsg net/socket.c:2339 [inline]
 __se_sys_sendmsg net/socket.c:2337 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2337
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4401f9
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 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffdb9395838 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004401f9
RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401a80
R13: 0000000000401b10 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 1:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc mm/kasan/common.c:489 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:462
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:503
 kmem_cache_alloc_trace+0x151/0x750 mm/slab.c:3555
 kmalloc include/linux/slab.h:547 [inline]
 kzalloc include/linux/slab.h:742 [inline]
 call_usermodehelper_setup+0x9b/0x320 kernel/umh.c:385
 kobject_uevent_env+0xf88/0x101d lib/kobject_uevent.c:613
 kobject_uevent+0x20/0x26 lib/kobject_uevent.c:641
 rx_queue_add_kobject net/core/net-sysfs.c:942 [inline]
 net_rx_queue_update_kobjects+0x132/0x470 net/core/net-sysfs.c:960
 register_queue_kobjects net/core/net-sysfs.c:1531 [inline]
 netdev_register_kobject+0x278/0x3b0 net/core/net-sysfs.c:1754
 register_netdevice+0x875/0xff0 net/core/dev.c:8743
 __ip_tunnel_create+0x36b/0x530 net/ipv4/ip_tunnel.c:282
 ip_tunnel_init_net+0x375/0x9e0 net/ipv4/ip_tunnel.c:1073
 erspan_init_net+0x2a/0x30 net/ipv4/ip_gre.c:1594
 ops_init+0xb3/0x410 net/core/net_namespace.c:129
 __register_pernet_operations net/core/net_namespace.c:1092 [inline]
 register_pernet_operations+0x382/0x7f0 net/core/net_namespace.c:1163
 register_pernet_device+0x2a/0x80 net/core/net_namespace.c:1250
 ipgre_init+0x6f/0x1a4 net/ipv4/ip_gre.c:1624
 do_one_initcall+0x107/0x7ba init/main.c:914
 do_initcall_level init/main.c:982 [inline]
 do_initcalls init/main.c:990 [inline]
 do_basic_setup init/main.c:1008 [inline]
 kernel_init_freeable+0x4d4/0x5c3 init/main.c:1168
 kernel_init+0x12/0x1c5 init/main.c:1086
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

Freed by task 3557:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:451
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:459
 __cache_free mm/slab.c:3432 [inline]
 kfree+0xcf/0x220 mm/slab.c:3755
 call_usermodehelper_freeinfo kernel/umh.c:47 [inline]
 umh_complete kernel/umh.c:61 [inline]
 umh_complete+0x8d/0xa0 kernel/umh.c:50
 call_usermodehelper_exec_async+0x47a/0x740 kernel/umh.c:121
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff888216b72000
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes to the right of
 192-byte region [ffff888216b72000, ffff888216b720c0)
The buggy address belongs to the page:
page:ffffea00085adc80 refcount:1 mapcount:0 mapping:ffff8880aa400040 index:0xffff888216b72000
flags: 0x6fffc0000000200(slab)
raw: 06fffc0000000200 ffffea0008596bc8 ffffea00085ad848 ffff8880aa400040
raw: ffff888216b72000 ffff888216b72000 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888216b71f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888216b72000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888216b72080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                                           ^
 ffff888216b72100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888216b72180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (48):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/05/22 00:04 upstream 5bdd9ad875b6 13427bd9 .config console log report syz C ci-upstream-kasan-gce
2019/05/21 21:29 upstream 5bdd9ad875b6 13427bd9 .config console log report syz C ci-upstream-kasan-gce
2019/05/21 06:09 upstream f49aa1de9836 8285069f .config console log report syz C ci-upstream-kasan-gce-root
2019/05/21 04:37 upstream f49aa1de9836 8285069f .config console log report syz C ci-upstream-kasan-gce-root
2019/05/21 04:12 upstream f49aa1de9836 8285069f .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/05/21 03:39 upstream f49aa1de9836 8285069f .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/05/21 01:48 upstream f49aa1de9836 8285069f .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/05/20 22:25 upstream f49aa1de9836 8285069f .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/05/20 23:21 net-old f49aa1de9836 8285069f .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/20 22:28 net-old f49aa1de9836 8285069f .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/20 21:14 net-old f49aa1de9836 8285069f .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/20 19:58 bpf 6a0a923dfa14 8285069f .config console log report syz C ci-upstream-bpf-kasan-gce
2019/05/19 06:14 net-old 5a35c8ea7c40 5a4461b0 .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/19 02:50 net-old 5a35c8ea7c40 5a4461b0 .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/17 01:21 net-old 510e2ceda031 7fb690f3 .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/17 00:37 net-old 510e2ceda031 7fb690f3 .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/20 21:33 net-next-old f49aa1de9836 8285069f .config console log report syz C ci-upstream-net-kasan-gce
2019/05/20 20:41 net-next-old f49aa1de9836 8285069f .config console log report syz C ci-upstream-net-kasan-gce
2019/05/20 20:19 net-next-old f49aa1de9836 8285069f .config console log report syz C ci-upstream-net-kasan-gce
2019/05/19 05:56 linux-next b1d6682ef9bb 5a4461b0 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/05/20 22:36 net-next-old f49aa1de9836 8285069f .config console log report syz ci-upstream-net-kasan-gce
2019/05/21 18:42 upstream 5bdd9ad875b6 13427bd9 .config console log report ci-upstream-kasan-gce-selinux-root
2019/05/20 20:10 upstream f49aa1de9836 8285069f .config console log report ci-upstream-kasan-gce-root
2019/05/20 19:40 upstream f49aa1de9836 8285069f .config console log report ci-upstream-kasan-gce-386
2019/05/20 19:32 upstream f49aa1de9836 8285069f .config console log report ci-upstream-kasan-gce-386
2019/05/20 19:09 upstream f49aa1de9836 8285069f .config console log report ci-upstream-kasan-gce-386
2019/05/21 05:14 net-old f49aa1de9836 8285069f .config console log report ci-upstream-net-this-kasan-gce
2019/05/20 19:10 bpf 6a0a923dfa14 8285069f .config console log report ci-upstream-bpf-kasan-gce
2019/05/20 19:06 bpf 6a0a923dfa14 8285069f .config console log report ci-upstream-bpf-kasan-gce
2019/05/20 18:47 bpf 6a0a923dfa14 8285069f .config console log report ci-upstream-bpf-kasan-gce
2019/05/20 18:46 bpf 6a0a923dfa14 8285069f .config console log report ci-upstream-bpf-kasan-gce
2019/05/20 00:48 net-old 5a35c8ea7c40 5a4461b0 .config console log report ci-upstream-net-this-kasan-gce
2019/05/19 05:42 net-old 5a35c8ea7c40 5a4461b0 .config console log report ci-upstream-net-this-kasan-gce
2019/05/19 00:27 net-old 5a35c8ea7c40 5a4461b0 .config console log report ci-upstream-net-this-kasan-gce
2019/05/17 14:42 net-old 510e2ceda031 95dfd515 .config console log report ci-upstream-net-this-kasan-gce
2019/05/17 10:08 net-old 510e2ceda031 7fb690f3 .config console log report ci-upstream-net-this-kasan-gce
2019/05/17 00:01 net-old 510e2ceda031 7fb690f3 .config console log report ci-upstream-net-this-kasan-gce
2019/05/16 23:55 net-old 510e2ceda031 7fb690f3 .config console log report ci-upstream-net-this-kasan-gce
2019/05/16 23:41 net-old 510e2ceda031 7fb690f3 .config console log report ci-upstream-net-this-kasan-gce
2019/05/16 23:18 net-old 510e2ceda031 7fb690f3 .config console log report ci-upstream-net-this-kasan-gce
2019/05/22 03:43 bpf-next f49aa1de9836 13427bd9 .config console log report ci-upstream-bpf-next-kasan-gce
2019/05/20 18:47 net-next-old f49aa1de9836 8285069f .config console log report ci-upstream-net-kasan-gce
2019/05/20 18:46 net-next-old f49aa1de9836 8285069f .config console log report ci-upstream-net-kasan-gce
2019/05/20 18:42 net-next-old f49aa1de9836 8285069f .config console log report ci-upstream-net-kasan-gce
2019/05/20 18:25 net-next-old f49aa1de9836 8285069f .config console log report ci-upstream-net-kasan-gce
2019/05/17 06:42 linux-next b1d6682ef9bb 7fb690f3 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.