syzbot


KASAN: invalid-free in security_tun_dev_free_security

Status: fixed on 2022/03/08 16:11
Reported-by: syzbot+@syzkaller.appspotmail.com
Fix commit: 158b515f703e tun: avoid double free in tun_free_netdev
First crash: 744d, last: 402d

Cause bisection: failed (bisect log)

Fix bisection: failed (bisect log)

Sample crash report:
==================================================================
BUG: KASAN: double-free or invalid-free in security_tun_dev_free_security+0x3e/0x70 security/security.c:2341

CPU: 0 PID: 32161 Comm: syz-executor.3 Not tainted 5.15.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0x6c/0x2d6 mm/kasan/report.c:256
 kasan_report_invalid_free+0x51/0x80 mm/kasan/report.c:381
 ____kasan_slab_free mm/kasan/common.c:346 [inline]
 __kasan_slab_free+0xf6/0x110 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 __cache_free mm/slab.c:3445 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3803
 security_tun_dev_free_security+0x3e/0x70 security/security.c:2341
 tun_free_netdev+0xdc/0x140 drivers/net/tun.c:2210
 netdev_run_todo+0x6b4/0xa80 net/core/dev.c:10593
 __tun_chr_ioctl.isra.0+0x993/0x4230 drivers/net/tun.c:3297
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f7dbe03d8d9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7dbd7b4188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f7dbe141f60 RCX: 00007f7dbe03d8d9
RDX: 0000000020000000 RSI: 00000000400454ca RDI: 0000000000000004
RBP: 00007f7dbe097cb4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc29f277cf R14: 00007f7dbd7b4300 R15: 0000000000022000

Allocated by task 32161:
 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:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 ____kasan_kmalloc mm/kasan/common.c:472 [inline]
 __kasan_kmalloc+0xa1/0xd0 mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x1e4/0x480 mm/slab.c:3575
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 selinux_tun_dev_alloc_security+0x43/0x180 security/selinux/hooks.c:5611
 security_tun_dev_alloc_security+0x40/0x90 security/security.c:2335
 __tun_chr_ioctl.isra.0+0x27d8/0x4230 drivers/net/tun.c:2722
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 32161:
 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:360
 ____kasan_slab_free mm/kasan/common.c:366 [inline]
 ____kasan_slab_free mm/kasan/common.c:328 [inline]
 __kasan_slab_free+0xd1/0x110 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 __cache_free mm/slab.c:3445 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3803
 security_tun_dev_free_security+0x3e/0x70 security/security.c:2341
 __tun_chr_ioctl.isra.0+0x2cdf/0x4230 drivers/net/tun.c:2777
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88801656b840
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff88801656b840, ffff88801656b860)
The buggy address belongs to the page:
page:ffffea0000595ac0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801656bfc1 pfn:0x1656b
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0001b22d08 ffffea0000547908 ffff888010c40100
raw: ffff88801656bfc1 ffff88801656b000 000000010000003e 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 1, ts 2421751794, free_ts 0
 prep_new_page mm/page_alloc.c:2424 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4153
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5375
 __alloc_pages_node include/linux/gfp.h:570 [inline]
 kmem_getpages mm/slab.c:1377 [inline]
 cache_grow_begin+0x75/0x460 mm/slab.c:2593
 cache_alloc_refill+0x27f/0x380 mm/slab.c:2965
 ____cache_alloc mm/slab.c:3048 [inline]
 ____cache_alloc mm/slab.c:3031 [inline]
 __do_cache_alloc mm/slab.c:3275 [inline]
 slab_alloc mm/slab.c:3316 [inline]
 __do_kmalloc mm/slab.c:3700 [inline]
 __kmalloc+0x3d5/0x4d0 mm/slab.c:3711
 acpi_ns_internalize_name drivers/acpi/acpica/nsutils.c:331 [inline]
 acpi_ns_internalize_name+0xf2/0x1a1 drivers/acpi/acpica/nsutils.c:312
 acpi_ns_get_node_unlocked drivers/acpi/acpica/nsutils.c:666 [inline]
 acpi_ns_get_node_unlocked+0x1d8/0x278 drivers/acpi/acpica/nsutils.c:635
 acpi_ns_get_node+0x4b/0x6a drivers/acpi/acpica/nsutils.c:726
 acpi_get_handle+0x129/0x211 drivers/acpi/acpica/nsxfname.c:98
 acpi_has_method+0x6e/0xb0 drivers/acpi/utils.c:553
 acpi_dock_match drivers/acpi/scan.c:1189 [inline]
 acpi_set_pnp_ids drivers/acpi/scan.c:1364 [inline]
 acpi_init_device_object+0x14bd/0x1c20 drivers/acpi/scan.c:1742
 acpi_add_single_object+0xdd/0x1a10 drivers/acpi/scan.c:1788
 acpi_bus_check_add+0x1ad/0x5d0 drivers/acpi/scan.c:2047
 acpi_ns_walk_namespace+0x23d/0x41f drivers/acpi/acpica/nswalk.c:237
 acpi_walk_namespace drivers/acpi/acpica/nsxfeval.c:606 [inline]
 acpi_walk_namespace+0xee/0x127 drivers/acpi/acpica/nsxfeval.c:554
 acpi_bus_scan+0x171/0x1c0 drivers/acpi/scan.c:2360
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88801656b700: 00 00 01 fc fc fc fc fc fa fb fb fb fc fc fc fc
 ffff88801656b780: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
>ffff88801656b800: 00 01 fc fc fc fc fc fc fa fb fb fb fc fc fc fc
                                           ^
 ffff88801656b880: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
 ffff88801656b900: 00 00 01 fc fc fc fc fc fa fb fb fb fc fc fc fc
==================================================================

Crashes (346):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-selinux-root 2021/10/12 14:39 upstream fa5878760579 838e7e2c .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/10/04 03:09 upstream 9e1ff307c779 db0f5787 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/10/01 03:36 upstream 02d5e016800d 1d849ab4 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/09/07 21:18 upstream 4b93c544e90e 6ca60148 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/09/05 18:17 upstream 49624efa65ac d236a457 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/09/04 05:36 upstream 7cca308cfdc0 d236a457 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/09/03 20:00 upstream a9c9a6f741cd f62a5829 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/09/01 12:45 upstream 9c849ce86e0f 7eb7e152 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/08/25 14:52 upstream 6e764bcd1cf7 b599f2fc .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/05/07 02:34 upstream d2b6f8a17919 06585184 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/02/02 00:17 upstream 1048ba83fb1c e6b95f32 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/02/01 22:58 upstream 1048ba83fb1c e6b95f32 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-qemu-upstream 2021/01/30 22:40 upstream 0e9bcda5d286 fc9fd31e .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/01/25 03:43 upstream e68061375f79 52e37319 .config console log report syz KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/23 05:51 upstream 3f066e882bf1 6caa12e4 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/22 20:01 upstream 3f066e882bf1 6caa12e4 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/22 02:45 upstream 2f47a9a4dfa3 6caa12e4 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/21 03:58 upstream 86085fe79e3c 62bd192b .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/20 01:11 upstream a76c3d035872 44068e19 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/16 09:42 upstream 2b14864acbaa 572bcb40 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/15 19:00 upstream 5472f14a3742 572bcb40 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/13 21:38 upstream 2585cf9dfaad 49ca1f59 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/13 16:19 upstream 2585cf9dfaad 49ca1f59 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/13 00:22 upstream 90d9fbc16b69 49ca1f59 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/12 22:11 upstream a763d5a5abd6 49ca1f59 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/12 06:42 upstream 6f513529296f 49ca1f59 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/09 15:23 upstream 2a987e65025e b54aa474 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/09 06:07 upstream 2a987e65025e a4a2a501 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/08 13:00 upstream 2a987e65025e a4a2a501 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/08 06:52 upstream 2a987e65025e 0230ba3e .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/06 10:25 upstream 944207047ca4 a617004c .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/06 09:15 upstream 944207047ca4 a617004c .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/06 04:47 upstream 944207047ca4 a617004c .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/05 22:10 upstream 944207047ca4 a617004c .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/05 21:07 upstream 944207047ca4 a617004c .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/05 09:26 upstream 79a72162048e a617004c .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/05 05:16 upstream bbef3c7a63d2 a617004c .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/04 03:10 upstream 12119cfa1052 a617004c .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/03 10:12 upstream 5f58da2befa5 61f86278 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-qemu-upstream 2021/12/02 22:46 upstream a51e3ac43ddb 61f86278 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/02 14:02 upstream 58e1100fdc59 61f86278 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/12/02 06:32 upstream 58e1100fdc59 61f86278 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-qemu-upstream 2021/11/30 22:40 upstream 58e1100fdc59 80270552 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/30 06:58 upstream d58071a8a76d d0830353 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/30 04:01 upstream d58071a8a76d d0830353 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/28 12:31 upstream 3498e7f2bb41 63eeac02 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/28 10:27 upstream 3498e7f2bb41 63eeac02 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/28 00:52 upstream 741392771338 63eeac02 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/26 22:56 upstream c5c17547b778 63eeac02 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-qemu-upstream 2021/11/26 11:02 upstream a4849f6000e2 63eeac02 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/24 18:13 upstream 5d9f4cf36721 545ab074 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/24 08:51 upstream 5d9f4cf36721 545ab074 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/23 08:02 upstream 136057256686 545ab074 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/23 06:35 upstream 136057256686 545ab074 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/22 22:58 upstream 136057256686 545ab074 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-qemu-upstream 2021/11/22 15:43 upstream 136057256686 545ab074 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/22 14:17 upstream 136057256686 545ab074 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/21 21:22 upstream 40c93d7fff6f 4eb20a4e .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/21 18:41 upstream 923dcc5eb0c1 4eb20a4e .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/21 05:19 upstream 923dcc5eb0c1 4eb20a4e .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/20 00:26 upstream 4c388a8e740d 3a9d0024 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/11/18 23:58 upstream 6fdf886424cf 31a30fc0 .config console log report info KASAN: invalid-free in security_tun_dev_free_security
ci-upstream-kasan-gce-selinux-root 2021/01/15 04:26 upstream 146620506274 65a7a854 .config console log report info
* Struck through repros no longer work on HEAD.