audit: type=1400 audit(2000000015.480:54): avc: denied { setopt } for pid=8885 comm="syz-executor1" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1 ================================================================== BUG: KASAN: use-after-free in get_disk+0xb7/0xd0 block/genhd.c:1433 Read of size 8 at addr ffff8881cf6e62b0 by task blkid/8889 CPU: 1 PID: 8889 Comm: blkid Not tainted 4.14.87+ #21 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xb9/0x11b lib/dump_stack.c:53 print_address_description+0x60/0x22b mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report.cold.6+0x11b/0x2dd mm/kasan/report.c:409 get_disk+0xb7/0xd0 block/genhd.c:1433 get_gendisk+0xe4/0x230 block/genhd.c:793 __blkdev_get+0x345/0xe50 fs/block_dev.c:1446 blkdev_get+0x97/0x8c0 fs/block_dev.c:1604 blkdev_open+0x1bd/0x240 fs/block_dev.c:1762 do_dentry_open+0x426/0xda0 fs/open.c:764 vfs_open+0x11c/0x210 fs/open.c:878 do_last fs/namei.c:3455 [inline] path_openat+0x5f9/0x2930 fs/namei.c:3597 do_filp_open+0x197/0x270 fs/namei.c:3631 do_sys_open+0x2ef/0x580 fs/open.c:1071 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x7f509bd8a120 RSP: 002b:00007ffc6fa62528 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f509bd8a120 RDX: 00007ffc6fa63f1f RSI: 0000000000000000 RDI: 00007ffc6fa63f1f RBP: 0000000000000000 R08: 0000000000000078 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000025dc030 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000005 Allocated by task 1850: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.1+0x4f/0xd0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x138/0x300 mm/slub.c:2750 kmem_cache_alloc_node_trace include/linux/slab.h:378 [inline] kmalloc_node include/linux/slab.h:526 [inline] kzalloc_node include/linux/slab.h:672 [inline] alloc_disk_node+0x5f/0x3b0 block/genhd.c:1387 loop_add+0x3e9/0x840 drivers/block/loop.c:1827 loop_probe+0x14f/0x180 drivers/block/loop.c:1934 kobj_lookup+0x230/0x420 drivers/base/map.c:124 get_gendisk+0x32/0x230 block/genhd.c:785 __blkdev_get+0x345/0xe50 fs/block_dev.c:1446 blkdev_get+0x97/0x8c0 fs/block_dev.c:1604 blkdev_open+0x1bd/0x240 fs/block_dev.c:1762 do_dentry_open+0x426/0xda0 fs/open.c:764 vfs_open+0x11c/0x210 fs/open.c:878 do_last fs/namei.c:3455 [inline] path_openat+0x5f9/0x2930 fs/namei.c:3597 do_filp_open+0x197/0x270 fs/namei.c:3631 do_sys_open+0x2ef/0x580 fs/open.c:1071 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 1850: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:524 slab_free_hook mm/slub.c:1389 [inline] slab_free_freelist_hook mm/slub.c:1410 [inline] slab_free mm/slub.c:2966 [inline] kfree+0xf5/0x310 mm/slub.c:3897 device_release+0xf4/0x1a0 drivers/base/core.c:822 kobject_cleanup lib/kobject.c:646 [inline] kobject_release lib/kobject.c:675 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put+0x146/0x200 lib/kobject.c:692 put_disk+0x1f/0x30 block/genhd.c:1452 __blkdev_get+0x564/0xe50 fs/block_dev.c:1562 blkdev_get+0x97/0x8c0 fs/block_dev.c:1604 blkdev_open+0x1bd/0x240 fs/block_dev.c:1762 do_dentry_open+0x426/0xda0 fs/open.c:764 vfs_open+0x11c/0x210 fs/open.c:878 do_last fs/namei.c:3455 [inline] path_openat+0x5f9/0x2930 fs/namei.c:3597 do_filp_open+0x197/0x270 fs/namei.c:3631 do_sys_open+0x2ef/0x580 fs/open.c:1071 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 The buggy address belongs to the object at ffff8881cf6e5d80 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1328 bytes inside of 2048-byte region [ffff8881cf6e5d80, ffff8881cf6e6580) The buggy address belongs to the page: page:ffffea00073db800 count:1 mapcount:0 mapping: (null) index:0xffff8881cf6e2a80 compound_mapcount: 0 flags: 0x4000000000008100(slab|head) raw: 4000000000008100 0000000000000000 ffff8881cf6e2a80 00000001800f000e raw: ffffea000711aa00 0000000200000002 ffff8881da802800 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881cf6e6180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881cf6e6200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881cf6e6280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881cf6e6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881cf6e6380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================