syzbot


KASAN: use-after-free Write in tun_free_netdev

Status: upstream: reported C repro on 2020/07/03 02:06
Reported-by: syzbot+b87a1e46946f6c65c622@syzkaller.appspotmail.com
First crash: 1602d, last: 686d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: slab-out-of-bounds Write in tun_free_netdev (2) syz 4 800d 1323d 0/2 auto-obsoleted due to no activity on 2023/06/29 05:00
Last patch testing requests (10)
Created Duration User Patch Repo Result
2024/10/27 01:57 9m retest repro android12-5.4 report log
2024/08/18 00:32 9m retest repro android12-5.4 report log
2024/06/09 00:16 15m retest repro android12-5.4 report log
2024/03/30 23:41 28m retest repro android12-5.4 report log
2024/01/20 22:29 8m retest repro android12-5.4 report log
2023/11/11 21:59 14m retest repro android12-5.4 report log
2023/09/02 21:43 15m retest repro android12-5.4 report log
2023/06/29 10:04 19m retest repro android12-5.4 OK log
2023/06/29 05:57 14m retest repro android12-5.4 OK log
2023/06/24 21:25 12m retest repro android12-5.4 report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __hlist_del include/linux/list.h:773 [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 try_to_del_timer_sync+0x2ad/0x460 kernel/time/timer.c:1238
Write of size 8 at addr ffff8881ea7631c8 by task syz-executor394/5895

CPU: 0 PID: 5895 Comm: syz-executor394 Not tainted 5.4.197-syzkaller-00015-gf0306959ab7c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
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
 __hlist_del include/linux/list.h:773 [inline]
 detach_timer kernel/time/timer.c:824 [inline]
 detach_if_pending kernel/time/timer.c:841 [inline]
 try_to_del_timer_sync+0x2ad/0x460 kernel/time/timer.c:1238
 del_timer_sync+0x74/0xd0 kernel/time/timer.c:1379
 tun_flow_uninit drivers/net/tun.c:1387 [inline]
 tun_free_netdev+0x99/0x3b0 drivers/net/tun.c:2328
 netdev_run_todo+0xa3c/0xc80 net/core/dev.c:9445
 tun_detach drivers/net/tun.c:751 [inline]
 tun_chr_close+0xc0/0xd0 drivers/net/tun.c:3523
 __fput+0x261/0x680 fs/file_table.c:281
 task_work_run+0x186/0x1b0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xbe1/0x2b40 kernel/exit.c:812
 do_group_exit+0x136/0x300 kernel/exit.c:910
 get_signal+0xd99/0x13f0 kernel/signal.c:2735
 do_signal+0x3b/0x540 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0xdd/0x1d0 arch/x86/entry/common.c:159
 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f9e3b335a59
Code: Bad RIP value.
RSP: 002b:00007f9e3b2e7308 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: 0000000000000000 RBX: 00007f9e3b3bd3e8 RCX: 00007f9e3b335a59
RDX: 0000000020000040 RSI: 00000000400454ca RDI: 0000000000000003
RBP: 00007f9e3b3bd3e0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9e3b38b074
R13: 00007f9e3b3bd3ec R14: 74656e2f7665642f R15: 0000000000022000

The buggy address belongs to the page:
page:ffffea0007a9d8c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x8000000000000000()
raw: 8000000000000000 0000000000000000 ffffffff07a90101 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 0x46dc0(GFP_KERNEL|__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:2814
 __tun_chr_ioctl+0x6c7/0x1b70 drivers/net/tun.c:3149
 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+0x7ee/0x920 mm/page_alloc.c:1438
 free_the_page mm/page_alloc.c:4919 [inline]
 __free_pages+0x45/0x1e0 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:3523
 __fput+0x261/0x680 fs/file_table.c:281
 task_work_run+0x186/0x1b0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xbe1/0x2b40 kernel/exit.c:812
 do_group_exit+0x136/0x300 kernel/exit.c:910
 get_signal+0xd99/0x13f0 kernel/signal.c:2735
 do_signal+0x3b/0x540 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0xdd/0x1d0 arch/x86/entry/common.c:159
 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:
 ffff8881ea763080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881ea763100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8881ea763180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                              ^
 ffff8881ea763200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881ea763280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (44):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/09/03 21:31 android12-5.4 f0306959ab7c 28811d0a .config console log report syz C ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2021/07/09 16:56 android12-5.4 5d212e10cd98 281e815f .config console log report syz ci2-android-5-4-kasan KASAN: use-after-free Write in tun_free_netdev
2021/01/18 00:17 android12-5.4 dc04463953b2 fd103621 .config console log report syz ci2-android-5-4-kasan KASAN: use-after-free Write in tun_free_netdev
2020/07/19 14:40 https://android.googlesource.com/kernel/common android-5.4 0c0d417747d8 9c812472 .config console log report syz ci2-android-5-4-kasan
2020/07/05 11:34 https://android.googlesource.com/kernel/common android-5.4 45217b91eaaa 24d7f505 .config console log report syz ci2-android-5-4-kasan
2023/01/05 15:54 android12-5.4 a8aad8851131 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/11/24 13:36 android12-5.4 c80a5b2e7f63 ff68ff8f .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/11/17 18:37 android12-5.4 e9f865cb240f 4ba8ab94 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/11/15 15:22 android12-5.4 5a34019eb955 97de9cfc .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/09/12 07:44 android12-5.4 704c7d053806 356d8217 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/09/04 00:56 android12-5.4 f0306959ab7c 28811d0a .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/08/27 09:05 android12-5.4 f0306959ab7c 07177916 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/08/09 14:27 android12-5.4 c7a5efa26008 da700653 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/08/04 11:51 android12-5.4 ea07addb2369 1c9013ac .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/27 01:26 android12-5.4 397b3ca493cb ae971e66 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/24 03:10 android12-5.4 397b3ca493cb 22343af4 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/20 11:20 android12-5.4 330fa791a029 775344bc .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/19 12:23 android12-5.4 330fa791a029 72a3cc0c .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/18 21:42 android12-5.4 330fa791a029 ff988920 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/18 15:19 android12-5.4 330fa791a029 ff988920 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/16 01:15 android12-5.4 330fa791a029 95cb00d1 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/10 23:38 android12-5.4 569d38047a0f b5765a15 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/07/01 12:47 android12-5.4 fa9c78c058bd 1434eec0 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/06/04 16:40 android12-5.4 c79dfbc288c5 c8857892 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/06/03 12:45 android12-5.4 a4d27a2c85c9 eee80d3c .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/04/10 11:22 android12-5.4 b730087e9a5d e22c3da3 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/03/15 01:46 android12-5.4 865ec2523e9f 9e8eaa75 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/03/06 23:10 android12-5.4 8a3679a75730 7bdd8b2c .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/02/28 21:50 android12-5.4 961dd91cc692 45a13a73 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/02/28 04:17 android12-5.4 961dd91cc692 45a13a73 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2022/02/23 23:14 android12-5.4 cae20698ffbf 6e821dbf .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in tun_free_netdev
2021/08/06 06:24 android12-5.4 306607c78507 2f537099 .config console log report info ci2-android-5-4-kasan KASAN: use-after-free Write in tun_free_netdev
2021/06/17 15:06 android12-5.4 013507ea12a6 aba2b2fb .config console log report info ci2-android-5-4-kasan KASAN: use-after-free Write in tun_free_netdev
2021/04/25 05:01 android12-5.4 aa0556d71ff1 17f0b706 .config console log report info ci2-android-5-4-kasan KASAN: use-after-free Write in tun_free_netdev
2021/04/22 08:35 android12-5.4 a5631d493c29 2bc8999a .config console log report info ci2-android-5-4-kasan KASAN: use-after-free Write in tun_free_netdev
2020/09/15 13:04 https://android.googlesource.com/kernel/common android-5.4 48ad97696bbb 9e681632 .config console log report info ci2-android-5-4-kasan
2020/08/20 08:03 https://android.googlesource.com/kernel/common android-5.4 a2bf50800d51 ed282a3a .config console log report ci2-android-5-4-kasan
2020/08/17 20:01 https://android.googlesource.com/kernel/common android-5.4 db4c5bdbbd7a 5ce13532 .config console log report ci2-android-5-4-kasan
2020/08/06 14:50 https://android.googlesource.com/kernel/common android-5.4 8555f0d9d303 4ca1c0ea .config console log report ci2-android-5-4-kasan
2020/07/30 19:43 https://android.googlesource.com/kernel/common android-5.4 95c511558b3b b0947553 .config console log report ci2-android-5-4-kasan
2020/07/15 13:27 https://android.googlesource.com/kernel/common android-5.4 42adbe0458e6 ada108d0 .config console log report ci2-android-5-4-kasan
2020/07/14 18:16 https://android.googlesource.com/kernel/common android-5.4 22b73c7316d2 6f458026 .config console log report ci2-android-5-4-kasan
2020/07/05 07:16 https://android.googlesource.com/kernel/common android-5.4 45217b91eaaa 24d7f505 .config console log report ci2-android-5-4-kasan
2020/07/03 02:05 https://android.googlesource.com/kernel/common android-5.4 93dc81bbbde5 f30c14bf .config console log report ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.