syzbot


KASAN: use-after-free Read in vlan_dev_real_dev

Status: auto-closed as invalid on 2021/08/24 06:33
Reported-by: syzbot+944af49d74bdd9175f4b@syzkaller.appspotmail.com
First crash: 646d, last: 525d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in vlan_dev_real_dev (2) C error 7 345d 357d 22/24 fixed on 2022/03/08 16:11

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in is_vlan_dev include/linux/if_vlan.h:74 [inline]
BUG: KASAN: use-after-free in vlan_dev_real_dev+0xf9/0x120 net/8021q/vlan_core.c:105
Read of size 4 at addr ffff88805e5d60c4 by task kworker/u4:12/14924

CPU: 0 PID: 14924 Comm: kworker/u4:12 Not tainted 5.12.0-rc6-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:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:232
 __kasan_report mm/kasan/report.c:399 [inline]
 kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416
 is_vlan_dev include/linux/if_vlan.h:74 [inline]
 vlan_dev_real_dev+0xf9/0x120 net/8021q/vlan_core.c:105
 rdma_vlan_dev_real_dev include/rdma/ib_addr.h:267 [inline]
 is_eth_port_of_netdev_filter.part.0+0xca/0x2c0 drivers/infiniband/core/roce_gid_mgmt.c:157
 is_eth_port_of_netdev_filter+0x28/0x40 drivers/infiniband/core/roce_gid_mgmt.c:153
 ib_enum_roce_netdev+0x18f/0x2b0 drivers/infiniband/core/device.c:2301
 ib_enum_all_roce_netdevs+0xbd/0x130 drivers/infiniband/core/device.c:2330
 netdevice_event_work_handler+0x9c/0x1b0 drivers/infiniband/core/roce_gid_mgmt.c:626
 process_one_work+0x98d/0x1600 kernel/workqueue.c:2275
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
 kthread+0x3b1/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Allocated by task 31946:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:427 [inline]
 ____kasan_kmalloc mm/kasan/common.c:506 [inline]
 ____kasan_kmalloc mm/kasan/common.c:465 [inline]
 __kasan_kmalloc+0x99/0xc0 mm/kasan/common.c:515
 kmalloc_node include/linux/slab.h:577 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:587
 kvmalloc include/linux/mm.h:785 [inline]
 kvzalloc include/linux/mm.h:793 [inline]
 alloc_netdev_mqs+0x97/0xeb0 net/core/dev.c:10696
 rtnl_create_link+0x1a4/0xae0 net/core/rtnetlink.c:3171
 __rtnl_newlink+0xf72/0x1710 net/core/rtnetlink.c:3433
 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3491
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5553
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927
 sock_sendmsg_nosec net/socket.c:654 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:674
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2404
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 31940:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
 ____kasan_slab_free mm/kasan/common.c:360 [inline]
 ____kasan_slab_free mm/kasan/common.c:325 [inline]
 __kasan_slab_free+0xf5/0x130 mm/kasan/common.c:367
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1562 [inline]
 slab_free_freelist_hook+0x92/0x210 mm/slub.c:1600
 slab_free mm/slub.c:3161 [inline]
 kfree+0xe5/0x7f0 mm/slub.c:4213
 kvfree+0x42/0x50 mm/util.c:616
 device_release+0x9f/0x240 drivers/base/core.c:2108
 kobject_cleanup lib/kobject.c:705 [inline]
 kobject_release lib/kobject.c:736 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1c8/0x540 lib/kobject.c:753
 put_device+0x1b/0x30 drivers/base/core.c:3341
 free_netdev+0x43b/0x620 net/core/dev.c:10827
 ppp_destroy_interface+0x2ab/0x340 drivers/net/ppp/ppp_generic.c:3364
 ppp_release+0x1bf/0x240 drivers/net/ppp/ppp_generic.c:410
 __fput+0x288/0x920 fs/file_table.c:280
 task_work_run+0xdd/0x1a0 kernel/task_work.c:140
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
 exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88805e5d6000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 196 bytes inside of
 4096-byte region [ffff88805e5d6000, ffff88805e5d7000)
The buggy address belongs to the page:
page:ffffea0001797400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5e5d0
head:ffffea0001797400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head)
raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888010442140
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88805e5d5f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805e5d6000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805e5d6080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff88805e5d6100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805e5d6180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (6):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-net-this-kasan-gce 2021/04/16 13:30 net 0e0704bb9ea0 7e2b734b .config log report info KASAN: use-after-free Read in vlan_dev_real_dev
ci-upstream-net-kasan-gce 2021/04/26 06:32 net-next 95aafe911db6 2a82f1b3 .config log report info KASAN: use-after-free Read in vlan_dev_real_dev
ci-upstream-net-kasan-gce 2021/02/22 18:59 net-next d310ec03a34e c26fb06b .config log report info KASAN: use-after-free Read in vlan_dev_real_dev
ci-upstream-net-this-kasan-gce 2021/01/11 05:38 net f97844f9c518 2c1f2513 .config log report info
ci-upstream-net-this-kasan-gce 2020/12/26 19:16 net 1f45dc220667 821e0b09 .config log report info
ci-upstream-net-kasan-gce 2021/01/07 19:38 net-next 8209f5bc3b67 c104d4a3 .config log report info
* Struck through repros no longer work on HEAD.