syzbot


KASAN: use-after-free Write in addrconf_ifdown

Status: auto-closed as invalid on 2022/08/22 22:22
Reported-by: syzbot+27ed3a069019310be0a9@syzkaller.appspotmail.com
First crash: 943d, last: 943d

Sample crash report:
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
==================================================================
BUG: KASAN: use-after-free in __write_once_size include/linux/compiler.h:295 [inline]
BUG: KASAN: use-after-free in __hlist_del include/linux/list.h:771 [inline]
BUG: KASAN: use-after-free in detach_timer kernel/time/timer.c:824 [inline]
BUG: KASAN: use-after-free in detach_if_pending kernel/time/timer.c:841 [inline]
BUG: KASAN: use-after-free in del_timer+0x279/0x460 kernel/time/timer.c:1212
Write of size 8 at addr ffff8881d48631c0 by task kworker/u4:0/12165

CPU: 1 PID: 12165 Comm: kworker/u4:0 Not tainted 5.4.180-syzkaller-00005-gcefc335374d2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18e/0x1d5 lib/dump_stack.c:118
 print_address_description+0x8c/0x630 mm/kasan/report.c:384
 __kasan_report+0xf6/0x130 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 __write_once_size include/linux/compiler.h:295 [inline]
 __hlist_del include/linux/list.h:771 [inline]
 detach_timer kernel/time/timer.c:824 [inline]
 detach_if_pending kernel/time/timer.c:841 [inline]
 del_timer+0x279/0x460 kernel/time/timer.c:1212
 addrconf_del_rs_timer net/ipv6/addrconf.c:305 [inline]
 addrconf_ifdown+0x520/0x1480 net/ipv6/addrconf.c:3803
 addrconf_notify+0x36f/0xe60 net/ipv6/addrconf.c:3669
 notifier_call_chain kernel/notifier.c:98 [inline]
 __raw_notifier_call_chain kernel/notifier.c:399 [inline]
 raw_notifier_call_chain+0x9d/0x110 kernel/notifier.c:406
 call_netdevice_notifiers_info net/core/dev.c:1670 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:1682 [inline]
 call_netdevice_notifiers net/core/dev.c:1696 [inline]
 dev_close_many+0x2e8/0x450 net/core/dev.c:1439
 rollback_registered_many+0x3f9/0x1190 net/core/dev.c:8593
 unregister_netdevice_many net/core/dev.c:9773 [inline]
 default_device_exit_batch+0x41c/0x660 net/core/dev.c:10244
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x6ee/0xca0 net/core/net_namespace.c:602
 process_one_work+0x6ca/0xc40 kernel/workqueue.c:2287
 worker_thread+0xae0/0x1440 kernel/workqueue.c:2433
 kthread+0x2d8/0x360 kernel/kthread.c:288
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the page:
page:ffffea00075218c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x8000000000000000()
raw: 8000000000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x146dc0(GFP_USER|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_COMP|__GFP_ZERO)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x194/0x380 mm/page_alloc.c:2171
 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x2ab/0x6f0 mm/page_alloc.c:4857
 __alloc_pages include/linux/gfp.h:503 [inline]
 __alloc_pages_node include/linux/gfp.h:516 [inline]
 alloc_pages_node include/linux/gfp.h:530 [inline]
 kmalloc_order mm/slab_common.c:1342 [inline]
 kmalloc_order_trace+0x2a/0xf0 mm/slab_common.c:1358
 __kmalloc_node include/linux/slab.h:422 [inline]
 kmalloc_node include/linux/slab.h:599 [inline]
 kvmalloc_node+0x7e/0xf0 mm/util.c:564
 kvmalloc include/linux/mm.h:758 [inline]
 kvzalloc include/linux/mm.h:766 [inline]
 alloc_netdev_mqs+0x86/0xc30 net/core/dev.c:9597
 tun_set_iff+0x4f9/0x1050 drivers/net/tun.c:2813
 __tun_chr_ioctl+0x69a/0x1ba0 drivers/net/tun.c:3148
 do_vfs_ioctl+0x6d1/0x15b0 fs/ioctl.c:47
 ksys_ioctl fs/ioctl.c:742 [inline]
 __do_sys_ioctl fs/ioctl.c:749 [inline]
 __se_sys_ioctl fs/ioctl.c:747 [inline]
 __x64_sys_ioctl+0xd4/0x110 fs/ioctl.c:747
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1176 [inline]
 __free_pages_ok+0x7c6/0x900 mm/page_alloc.c:1438
 free_the_page mm/page_alloc.c:4919 [inline]
 __free_pages+0x45/0x1d0 mm/page_alloc.c:4925
 kfree+0x1ef/0x260 mm/slub.c:4068
 device_release+0x70/0x1a0 drivers/base/core.c:1776
 kobject_cleanup lib/kobject.c:708 [inline]
 kobject_release+0x1f3/0x3d0 lib/kobject.c:739
 netdev_run_todo+0xae7/0xc80 net/core/dev.c:9456
 tun_detach drivers/net/tun.c:751 [inline]
 tun_chr_close+0xc0/0xd0 drivers/net/tun.c:3522
 __fput+0x261/0x680 fs/file_table.c:281
 task_work_run+0x186/0x1b0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x1ba/0x1d0 arch/x86/entry/common.c:163
 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Memory state around the buggy address:
 ffff8881d4863080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881d4863100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8881d4863180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                           ^
 ffff8881d4863200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881d4863280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/04/24 22:22 android12-5.4 cefc335374d2 131df97d .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in addrconf_ifdown
* Struck through repros no longer work on HEAD.