================================================================== BUG: KASAN: use-after-free in ex_handler_refcount+0x164/0x1a0 arch/x86/mm/extable.c:49 Write of size 4 at addr ffff8880af0ac898 by task systemd-udevd/8300 CPU: 1 PID: 8300 Comm: systemd-udevd Not tainted 4.14.237-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351 kasan_report mm/kasan/report.c:409 [inline] __asan_report_store4_noabort+0x68/0x70 mm/kasan/report.c:434 ex_handler_refcount+0x164/0x1a0 arch/x86/mm/extable.c:49 fixup_exception+0x8a/0xd0 arch/x86/mm/extable.c:197 do_trap_no_signal arch/x86/kernel/traps.c:208 [inline] do_trap+0x61/0x250 arch/x86/kernel/traps.c:257 do_error_trap+0x132/0x2d0 arch/x86/kernel/traps.c:301 invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:964 RIP: 0010:flags_string.cold+0x1b15/0x6a9f RSP: 0018:ffff88809a2a7cd0 EFLAGS: 00010296 RAX: 0000000000000000 RBX: ffff8880af0ac898 RCX: ffff8880af0ac898 RDX: 0000000000000004 RSI: 0000000000000003 RDI: 0000000000000001 RBP: ffffffff89512ae0 R08: 0000000000000000 R09: 0000000000000002 R10: 0000000000000000 R11: ffff8880abccc000 R12: 0000000000000000 R13: ffff88808ace8984 R14: ffffed101159d17e R15: dffffc0000000000 nbd_put drivers/block/nbd.c:228 [inline] nbd_release+0xf3/0x150 drivers/block/nbd.c:1446 __blkdev_put+0x5aa/0x800 fs/block_dev.c:1803 blkdev_close+0x86/0xb0 fs/block_dev.c:1875 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x7f5d4ff91270 RSP: 002b:00007ffc7fc995b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007f5d4ff91270 RDX: 000000000aba9500 RSI: 0000000000000000 RDI: 0000000000000007 RBP: 00007f5d50e4b710 R08: 000055be6e51fe50 R09: 0000000000000008 R10: 000055be6e5201b8 R11: 0000000000000246 R12: 0000000000000000 R13: 000055be6e51e720 R14: 0000000000000003 R15: 000000000000000e Allocated by task 8275: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] nbd_dev_add+0x7c/0x800 drivers/block/nbd.c:1611 nbd_genl_connect+0x3a4/0x1400 drivers/block/nbd.c:1756 genl_family_rcv_msg+0x572/0xb20 net/netlink/genetlink.c:600 genl_rcv_msg+0xaf/0x140 net/netlink/genetlink.c:625 netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2435 genl_rcv+0x24/0x40 net/netlink/genetlink.c:636 netlink_unicast_kernel net/netlink/af_netlink.c:1289 [inline] netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1315 netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1880 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xb5/0x100 net/socket.c:656 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062 __sys_sendmsg+0xa3/0x120 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x27/0x40 net/socket.c:2103 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb Freed by task 8292: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xc9/0x250 mm/slab.c:3815 nbd_dev_remove drivers/block/nbd.c:223 [inline] nbd_put.part.0+0x100/0x140 drivers/block/nbd.c:231 nbd_put drivers/block/nbd.c:228 [inline] nbd_genl_connect+0xfa9/0x1400 drivers/block/nbd.c:1896 genl_family_rcv_msg+0x572/0xb20 net/netlink/genetlink.c:600 genl_rcv_msg+0xaf/0x140 net/netlink/genetlink.c:625 netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2435 genl_rcv+0x24/0x40 net/netlink/genetlink.c:636 netlink_unicast_kernel net/netlink/af_netlink.c:1289 [inline] netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1315 netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1880 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xb5/0x100 net/socket.c:656 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062 __sys_sendmsg+0xa3/0x120 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x27/0x40 net/socket.c:2103 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb The buggy address belongs to the object at ffff8880af0ac7c0 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 216 bytes inside of 512-byte region [ffff8880af0ac7c0, ffff8880af0ac9c0) The buggy address belongs to the page: page:ffffea0002bc2b00 count:1 mapcount:0 mapping:ffff8880af0ac040 index:0x0 flags: 0xfff00000000100(slab) raw: 00fff00000000100 ffff8880af0ac040 0000000000000000 0000000100000006 raw: ffffea0002c64660 ffffea0002a7cb60 ffff88813fe80940 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880af0ac780: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ffff8880af0ac800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880af0ac880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880af0ac900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880af0ac980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================