BUG: KASAN: use-after-free in do_blk_trace_setup+0xab4/0xcf0 kernel/trace/blktrace.c:546 Read of size 8 at addr ffff8801d46ad4c0 by task syzkaller145114/2988 CPU: 1 PID: 2988 Comm: syzkaller145114 Not tainted 4.14.0-rc5-mm1+ #20 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:16 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:52 print_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x25b/0x340 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 do_blk_trace_setup+0xab4/0xcf0 kernel/trace/blktrace.c:546 blk_trace_setup+0xbd/0x180 kernel/trace/blktrace.c:564 sg_ioctl+0xc71/0x2d90 drivers/scsi/sg.c:1089 vfs_ioctl fs/ioctl.c:45 [inline] do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:685 SYSC_ioctl fs/ioctl.c:700 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691 entry_SYSCALL_64_fastpath+0x1f/0xbe RIP: 0033:0x444339 RSP: 002b:00007fff01b5c848 EFLAGS: 00000206 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00000000006d66c0 RCX: 0000000000444339 RDX: 000000002084cf90 RSI: 00000000c0481273 RDI: 0000000000000004 RBP: 0000000000000082 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: ffffffffffffffff R13: 6000020000001276 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 2988: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3614 kmalloc include/linux/slab.h:499 [inline] kzalloc include/linux/slab.h:688 [inline] do_blk_trace_setup+0x182/0xcf0 kernel/trace/blktrace.c:479 blk_trace_setup+0xbd/0x180 kernel/trace/blktrace.c:564 sg_ioctl+0xc71/0x2d90 drivers/scsi/sg.c:1089 vfs_ioctl fs/ioctl.c:45 [inline] do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:685 SYSC_ioctl fs/ioctl.c:700 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691 entry_SYSCALL_64_fastpath+0x1f/0xbe Freed by task 2993: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3492 [inline] kfree+0xca/0x250 mm/slab.c:3807 blk_trace_free+0xf9/0x130 kernel/trace/blktrace.c:329 blk_trace_cleanup+0x15/0x30 kernel/trace/blktrace.c:334 blk_trace_remove+0x55/0x80 kernel/trace/blktrace.c:348 sg_ioctl+0x5eb/0x2d90 drivers/scsi/sg.c:1098 vfs_ioctl fs/ioctl.c:45 [inline] do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:685 SYSC_ioctl fs/ioctl.c:700 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691 entry_SYSCALL_64_fastpath+0x1f/0xbe The buggy address belongs to the object at ffff8801d46ad480 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 64 bytes inside of 128-byte region [ffff8801d46ad480, ffff8801d46ad500) The buggy address belongs to the page: page:ffffea000751ab40 count:1 mapcount:0 mapping:ffff8801d46ad000 index:0x0 flags: 0x200000000000100(slab) raw: 0200000000000100 ffff8801d46ad000 0000000000000000 0000000100000015 raw: ffffea00075156e0 ffffea000751d8a0 ffff8801dac00640 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801d46ad380: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 ffff8801d46ad400: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff8801d46ad480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801d46ad500: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ffff8801d46ad580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================