syzbot


KASAN: use-after-free Read in netdevice_event_work_handler

Status: upstream: reported C repro on 2020/07/09 23:54
Reported-by: syzbot+20b90969babe05609947@syzkaller.appspotmail.com
First crash: 826d, last: 484d

Cause bisection: introduced by (bisect log) :
commit d70c47c8dc6902db19555b7ff7e6eeb264d4ac06
Author: Heiner Kallweit <hkallweit1@gmail.com>
Date: Thu Apr 23 19:34:33 2020 +0000

  net: phy: make phy_suspend a no-op if PHY is suspended already

Crash: unregister_netdevice: waiting for DEV to become free (log)
Repro: C syz .config

Fix bisection: fixed by (bisect log) [no-op commit]:
commit 3cfe5815ce0ee87f4979787cc7af23404a02edc1
Author: Dikshita Agarwal <dikshita@codeaurora.org>
Date: Mon Apr 12 06:58:43 2021 +0000

  media: venus: Enable low power setting for encoder

similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in netdevice_event_work_handler 1 237d 237d 0/1 auto-closed as invalid on 2022/06/03 04:22
linux-4.14 KASAN: use-after-free Read in netdevice_event_work_handler (2) syz 3 28d 106d 0/1 upstream: reported syz repro on 2022/06/13 22:07
linux-4.19 KASAN: use-after-free Read in netdevice_event_work_handler C 108 19h57m 753d 0/1 upstream: reported C repro on 2020/09/05 14:15
Patch testing requests:
Created Duration User Patch Repo Result
2022/09/26 08:30 18m upstream report log
2020/08/01 00:31 18m coiby.xu@gmail.com https://github.com/coiby/linux.git syzbot1 OK
2020/07/31 21:48 17m rkovhaev@gmail.com patch upstream OK
2020/07/31 13:39 12m coiby.xu@gmail.com https://github.com/coiby/linux.git syzbot1 report log
2020/07/31 06:28 0m coiby.xu@gmail.com git@github.com:coiby/linux.git syzbot1 error
2020/07/28 14:23 14m rkovhaev@gmail.com upstream report log
2020/07/14 06:07 17m rkovhaev@gmail.com upstream report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in dev_put include/linux/netdevice.h:3853 [inline]
BUG: KASAN: use-after-free in netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:627
Read of size 8 at addr ffff88807b13e568 by task kworker/u4:0/7

CPU: 0 PID: 7 Comm: kworker/u4:0 Not tainted 5.8.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: gid-cache-wq netdevice_event_work_handler
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 dev_put include/linux/netdevice.h:3853 [inline]
 netdevice_event_work_handler+0x15b/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:627
 process_one_work+0x94c/0x1670 kernel/workqueue.c:2269
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2415
 kthread+0x3b5/0x4a0 kernel/kthread.c:291
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293

Allocated by task 13061:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
 kmalloc_node include/linux/slab.h:578 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:574
 kvmalloc include/linux/mm.h:753 [inline]
 kvzalloc include/linux/mm.h:761 [inline]
 alloc_netdev_mqs+0x97/0xdc0 net/core/dev.c:9938
 __ip_tunnel_create+0x201/0x580 net/ipv4/ip_tunnel.c:254
 ip_tunnel_init_net+0x32b/0x980 net/ipv4/ip_tunnel.c:1072
 ops_init+0xaf/0x470 net/core/net_namespace.c:151
 setup_net+0x2d8/0x850 net/core/net_namespace.c:341
 copy_net_ns+0x2cf/0x5e0 net/core/net_namespace.c:482
 create_new_namespaces+0x3f6/0xb10 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0xbd/0x1f0 kernel/nsproxy.c:231
 ksys_unshare+0x36c/0x9a0 kernel/fork.c:2983
 __do_sys_unshare kernel/fork.c:3051 [inline]
 __se_sys_unshare kernel/fork.c:3049 [inline]
 __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3049
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 13061:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3757
 kvfree+0x42/0x50 mm/util.c:603
 device_release+0x71/0x200 drivers/base/core.c:1559
 kobject_cleanup lib/kobject.c:693 [inline]
 kobject_release lib/kobject.c:722 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1c0/0x270 lib/kobject.c:739
 put_device+0x1b/0x30 drivers/base/core.c:2779
 free_netdev+0x35d/0x480 net/core/dev.c:10054
 __ip_tunnel_create+0x48f/0x580 net/ipv4/ip_tunnel.c:274
 ip_tunnel_init_net+0x32b/0x980 net/ipv4/ip_tunnel.c:1072
 ops_init+0xaf/0x470 net/core/net_namespace.c:151
 setup_net+0x2d8/0x850 net/core/net_namespace.c:341
 copy_net_ns+0x2cf/0x5e0 net/core/net_namespace.c:482
 create_new_namespaces+0x3f6/0xb10 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0xbd/0x1f0 kernel/nsproxy.c:231
 ksys_unshare+0x36c/0x9a0 kernel/fork.c:2983
 __do_sys_unshare kernel/fork.c:3051 [inline]
 __se_sys_unshare kernel/fork.c:3049 [inline]
 __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3049
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff88807b13e000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 1384 bytes inside of
 4096-byte region [ffff88807b13e000, ffff88807b13f000)
The buggy address belongs to the page:
page:ffffea0001ec4f80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea0001ec4f80 order:1 compound_mapcount:0
flags: 0xfffe0000010200(slab|head)
raw: 00fffe0000010200 ffffea0001ecce88 ffffea0001987988 ffff8880aa002000
raw: 0000000000000000 ffff88807b13e000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88807b13e400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807b13e480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807b13e500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                          ^
 ffff88807b13e580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807b13e600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (265):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2020/07/09 23:42 upstream 0bddd227f3dc bc238812 .config log report syz C
ci-upstream-kasan-gce-root 2020/07/09 01:49 upstream 0bddd227f3dc bc238812 .config log report syz
ci-upstream-kasan-gce-selinux-root 2021/01/13 11:14 upstream e609571b5ffa a945f0a3 .config log report info
ci-upstream-kasan-gce-selinux-root 2021/01/09 19:27 upstream 996e435fd401 2c1f2513 .config log report info
ci-upstream-kasan-gce-selinux-root 2021/01/06 04:05 upstream 6207214a70bf b1c228e1 .config log report info
ci-upstream-kasan-gce-selinux-root 2020/12/30 05:37 upstream 139711f033f6 0fa352f2 .config log report info
ci-upstream-kasan-gce-selinux-root 2020/12/21 13:46 upstream e37b12e4bb21 04201c06 .config log report info
ci-upstream-kasan-gce-selinux-root 2020/12/16 05:10 upstream d635a69dd498 f213e07e .config log report info
ci-upstream-kasan-gce-smack-root 2020/12/15 06:47 upstream 148842c98a24 97183ed7 .config log report info
ci-upstream-kasan-gce-root 2020/12/13 23:06 upstream 6bff9bb8a292 b22a7ec3 .config log report info
ci-upstream-kasan-gce-selinux-root 2020/12/09 21:17 upstream a68a0262abda c090b4da .config log report info
ci-upstream-kasan-gce 2020/11/23 10:50 upstream 418baf2c28f3 0d27f508 .config log report info
ci-upstream-kasan-gce-386 2020/07/27 20:09 upstream 92ed30191993 cb93dc6a .config log report
ci-upstream-net-this-kasan-gce 2021/01/07 03:37 net 3503ee6c0bec c104d4a3 .config log report info
ci-upstream-net-this-kasan-gce 2021/01/03 18:06 net 4bfc4714849d 79264ae3 .config log report info
ci-upstream-net-this-kasan-gce 2020/12/31 07:49 net 4bfc4714849d 5cc121d6 .config log report info
ci-upstream-net-this-kasan-gce 2020/12/18 20:32 net d64c6f96ba86 04201c06 .config log report info
ci-upstream-net-this-kasan-gce 2020/12/18 17:53 net d64c6f96ba86 04201c06 .config log report info
ci-upstream-net-this-kasan-gce 2020/12/16 15:09 net 3db1a3fa9880 f213e07e .config log report info
ci-upstream-net-this-kasan-gce 2020/12/16 02:07 net 7f376f1917d7 97183ed7 .config log report info
ci-upstream-bpf-kasan-gce 2020/11/17 03:14 bpf 2acc3c1bc8e9 1bf9a662 .config log report info
ci-upstream-net-this-kasan-gce 2020/06/23 21:45 net b835a71ef64a 54566aff .config log report
ci-upstream-net-kasan-gce 2021/01/15 00:02 net-next 0ae5b43d6dde 65a7a854 .config log report info
ci-upstream-net-kasan-gce 2021/01/14 04:07 net-next 679500e385fc 269d24e8 .config log report info
ci-upstream-net-kasan-gce 2021/01/11 04:57 net-next 73b7a6047971 2c1f2513 .config log report info
ci-upstream-net-kasan-gce 2021/01/05 07:41 net-next 3db1a3fa9880 2a28ff1f .config log report info
ci-upstream-net-kasan-gce 2021/01/04 00:08 net-next 3db1a3fa9880 79264ae3 .config log report info
ci-upstream-net-kasan-gce 2021/01/03 13:23 net-next 3db1a3fa9880 79264ae3 .config log report info
ci-upstream-net-kasan-gce 2021/01/03 12:02 net-next 3db1a3fa9880 79264ae3 .config log report info
ci-upstream-net-kasan-gce 2021/01/02 15:01 net-next 3db1a3fa9880 79264ae3 .config log report info
ci-upstream-net-kasan-gce 2021/01/01 14:15 net-next 3db1a3fa9880 79264ae3 .config log report info
ci-upstream-bpf-next-kasan-gce 2020/12/31 23:26 bpf-next 482ec343f40a 79264ae3 .config log report info
ci-upstream-bpf-next-kasan-gce 2020/12/30 15:29 bpf-next f734031bb4c7 ecb8c012 .config log report info
ci-upstream-net-kasan-gce 2020/12/27 07:27 net-next 3db1a3fa9880 821e0b09 .config log report info
ci-upstream-net-kasan-gce 2020/12/25 19:47 net-next 3db1a3fa9880 b982b3ea .config log report info
ci-upstream-net-kasan-gce 2020/12/25 06:55 net-next 3db1a3fa9880 c2c1d1dd .config log report info
ci-upstream-net-kasan-gce 2020/12/24 16:02 net-next 3db1a3fa9880 c2c1d1dd .config log report info
ci-upstream-net-kasan-gce 2020/12/24 14:15 net-next 3db1a3fa9880 c2c1d1dd .config log report info
ci-upstream-bpf-next-kasan-gce 2020/12/24 02:56 bpf-next 00a279e42f67 c2c1d1dd .config log report info
ci-upstream-net-kasan-gce 2020/12/23 22:17 net-next 3db1a3fa9880 c2c1d1dd .config log report info
ci-upstream-net-kasan-gce 2020/12/21 04:45 net-next 3db1a3fa9880 04201c06 .config log report info
ci-upstream-net-kasan-gce 2020/12/21 00:18 net-next 3db1a3fa9880 04201c06 .config log report info
ci-upstream-net-kasan-gce 2020/12/20 12:34 net-next 3db1a3fa9880 04201c06 .config log report info
ci-upstream-net-kasan-gce 2020/12/20 02:58 net-next 3db1a3fa9880 04201c06 .config log report info
ci-upstream-net-kasan-gce 2020/12/19 14:17 net-next 3db1a3fa9880 04201c06 .config log report info
ci-upstream-net-kasan-gce 2020/12/19 12:45 net-next 3db1a3fa9880 04201c06 .config log report info
ci-upstream-net-kasan-gce 2020/12/18 10:39 net-next 3db1a3fa9880 04201c06 .config log report info
ci-upstream-net-kasan-gce 2020/12/10 18:05 net-next a7105e3472bf f900b48c .config log report info
ci-upstream-net-kasan-gce 2020/12/10 09:36 net-next 9125abe7b9cb c090b4da .config log report info
ci-upstream-net-kasan-gce 2020/12/09 02:25 net-next 8e98387b16b8 a7f7f4a4 .config log report info
ci-upstream-net-kasan-gce 2020/12/06 07:31 net-next 00649542f1ba f12ba0c5 .config log report info
ci-upstream-net-kasan-gce 2020/12/05 07:52 net-next 55fd59b003f6 20366b87 .config log report info
ci-upstream-net-kasan-gce 2020/12/03 19:33 net-next cec85994c6b4 e6b0d314 .config log report info
ci-upstream-net-kasan-gce 2020/12/03 05:05 net-next cec85994c6b4 8c9190ef .config log report info
ci-upstream-net-kasan-gce 2020/11/30 03:26 net-next e71d2b957ee4 a0092f9d .config log report info
ci-upstream-net-kasan-gce 2020/11/29 23:03 net-next e71d2b957ee4 a0092f9d .config log report info
ci-upstream-linux-next-kasan-gce-root 2021/01/09 18:36 linux-next 1c925d2030af 2c1f2513 .config log report info
* Struck through repros no longer work on HEAD.