================================================================== BUG: KASAN: slab-out-of-bounds in MON_OFF2HDR drivers/usb/mon/mon_bin.c:207 [inline] BUG: KASAN: slab-out-of-bounds in mon_bin_flush+0x121/0x260 drivers/usb/mon/mon_bin.c:884 Read of size 8 at addr ffff88810c7d7b68 by task syz-executor353/421 CPU: 1 PID: 421 Comm: syz-executor353 Not tainted 5.10.140-syzkaller-00825-g59390358870a #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_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3c0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 MON_OFF2HDR drivers/usb/mon/mon_bin.c:207 [inline] mon_bin_flush+0x121/0x260 drivers/usb/mon/mon_bin.c:884 mon_bin_ioctl+0x77c/0xed0 drivers/usb/mon/mon_bin.c:1091 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl+0x115/0x190 fs/ioctl.c:739 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7f418dfad639 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 00 00 90 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffffc96ebe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f418dfad639 RDX: 00000000200005c0 RSI: 00000000c0109207 RDI: 0000000000000005 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000470 R11: 0000000000000246 R12: 000000000000579b R13: 00007ffffc96ec0c R14: 00007ffffc96ec20 R15: 00007ffffc96ec10 Allocated by task 386: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] kmem_cache_alloc_trace+0x1dd/0x330 mm/slub.c:2983 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] kobject_uevent_env+0x26c/0x730 lib/kobject_uevent.c:524 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:642 driver_bound+0x490/0x4e0 drivers/base/dd.c:387 really_probe+0x8c8/0xfc0 drivers/base/dd.c:611 driver_probe_device+0x118/0x1c0 drivers/base/dd.c:747 __device_attach_driver+0x334/0x3f0 drivers/base/dd.c:853 bus_for_each_drv+0x18a/0x210 drivers/base/bus.c:431 __device_attach+0x323/0x530 drivers/base/dd.c:922 device_initial_probe+0x1a/0x20 drivers/base/dd.c:971 bus_probe_device+0xbc/0x1f0 drivers/base/bus.c:491 device_add+0x893/0xbd0 drivers/base/core.c:3248 usb_new_device+0xb91/0x16e0 drivers/usb/core/hub.c:2563 hub_port_connect drivers/usb/core/hub.c:5280 [inline] hub_port_connect_change drivers/usb/core/hub.c:5424 [inline] port_event drivers/usb/core/hub.c:5570 [inline] hub_event+0x2c65/0x5140 drivers/usb/core/hub.c:5652 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 Freed by task 386: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 kobject_uevent_env+0x348/0x730 lib/kobject_uevent.c:626 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:642 driver_bound+0x490/0x4e0 drivers/base/dd.c:387 really_probe+0x8c8/0xfc0 drivers/base/dd.c:611 driver_probe_device+0x118/0x1c0 drivers/base/dd.c:747 __device_attach_driver+0x334/0x3f0 drivers/base/dd.c:853 bus_for_each_drv+0x18a/0x210 drivers/base/bus.c:431 __device_attach+0x323/0x530 drivers/base/dd.c:922 device_initial_probe+0x1a/0x20 drivers/base/dd.c:971 bus_probe_device+0xbc/0x1f0 drivers/base/bus.c:491 device_add+0x893/0xbd0 drivers/base/core.c:3248 usb_new_device+0xb91/0x16e0 drivers/usb/core/hub.c:2563 hub_port_connect drivers/usb/core/hub.c:5280 [inline] hub_port_connect_change drivers/usb/core/hub.c:5424 [inline] port_event drivers/usb/core/hub.c:5570 [inline] hub_event+0x2c65/0x5140 drivers/usb/core/hub.c:5652 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 The buggy address belongs to the object at ffff88810c7d6000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 2920 bytes to the right of 4096-byte region [ffff88810c7d6000, ffff88810c7d7000) The buggy address belongs to the page: page:ffffea000431f400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10c7d0 head:ffffea000431f400 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff888100042c00 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 386, ts 22258484565, free_ts 22250139650 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0x745/0x760 mm/page_alloc.c:4071 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5124 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x78/0x540 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2636 [inline] ___slab_alloc+0x131/0x2e0 mm/slub.c:2800 __slab_alloc+0x63/0xa0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc_trace+0x20e/0x330 mm/slub.c:2981 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] kobject_uevent_env+0x26c/0x730 lib/kobject_uevent.c:524 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:642 device_add+0x79c/0xbd0 drivers/base/core.c:3229 usb_set_configuration+0x1ab1/0x2020 drivers/usb/core/message.c:2165 usb_generic_driver_probe+0x89/0x150 drivers/usb/core/generic.c:238 usb_probe_device+0x140/0x240 drivers/usb/core/driver.c:294 really_probe+0x63f/0xfc0 drivers/base/dd.c:562 driver_probe_device+0x118/0x1c0 drivers/base/dd.c:747 __device_attach_driver+0x334/0x3f0 drivers/base/dd.c:853 bus_for_each_drv+0x18a/0x210 drivers/base/bus.c:431 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1331 [inline] __free_pages_ok+0x7f8/0x830 mm/page_alloc.c:1611 free_the_page mm/page_alloc.c:5185 [inline] __free_pages+0x383/0x570 mm/page_alloc.c:5192 __free_slab+0xd3/0x190 mm/slub.c:1903 free_slab mm/slub.c:1918 [inline] discard_slab mm/slub.c:1924 [inline] unfreeze_partials+0x17d/0x1b0 mm/slub.c:2419 put_cpu_partial+0xc8/0x190 mm/slub.c:2455 __slab_free+0x2d8/0x3a0 mm/slub.c:3104 do_slab_free mm/slub.c:3200 [inline] ___cache_free+0x11f/0x140 mm/slub.c:3219 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146 qlist_free_all+0x4c/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:438 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook include/../mm/slab.h:583 [inline] slab_alloc_node mm/slub.c:2956 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc+0x16c/0x300 mm/slub.c:2969 getname_flags+0xba/0x510 fs/namei.c:141 user_path_at_empty+0x2d/0x50 fs/namei.c:2728 do_readlinkat+0x11b/0x3b0 fs/stat.c:414 __do_sys_readlink fs/stat.c:447 [inline] __se_sys_readlink fs/stat.c:444 [inline] __x64_sys_readlink+0x7f/0x90 fs/stat.c:444 Memory state around the buggy address: ffff88810c7d7a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88810c7d7a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88810c7d7b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88810c7d7b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88810c7d7c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== general protection fault, probably for non-canonical address 0xdffffc00000001fc: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000fe0-0x0000000000000fe7] CPU: 1 PID: 421 Comm: syz-executor353 Tainted: G B 5.10.140-syzkaller-00825-g59390358870a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 RIP: 0010:mon_bin_flush+0x141/0x260 drivers/usb/mon/mon_bin.c:885 Code: 74 08 48 89 df e8 8f 3a 94 fe 48 8b 03 41 81 e7 ff 0f 00 00 4d 8d 7c 07 24 4c 89 f8 48 c1 e8 03 48 bb 00 00 00 00 00 fc ff df <0f> b6 04 18 84 c0 75 6b 41 8b 37 83 c6 40 4c 89 f7 e8 a9 fd ff ff RSP: 0018:ffffc90000d77d08 EFLAGS: 00010007 RAX: 00000000000001fc RBX: dffffc0000000000 RCX: 0000000000000002 RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000001 RBP: ffffc90000d77d70 R08: ffffffff813efe13 R09: fffffbfff0d864f9 R10: fffffbfff0d864f9 R11: 1ffffffff0d864f8 R12: 00000000fffffffd R13: ffff88810e1c3118 R14: ffff88810e1c3100 R15: 0000000000000fe4 FS: 00005555555a0300(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f418df69910 CR3: 000000010c753000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: mon_bin_ioctl+0x77c/0xed0 drivers/usb/mon/mon_bin.c:1091 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl+0x115/0x190 fs/ioctl.c:739 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7f418dfad639 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 00 00 90 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffffc96ebe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f418dfad639 RDX: 00000000200005c0 RSI: 00000000c0109207 RDI: 0000000000000005 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000470 R11: 0000000000000246 R12: 000000000000579b R13: 00007ffffc96ec0c R14: 00007ffffc96ec20 R15: 00007ffffc96ec10 Modules linked in: ---[ end trace a560a08682ca22f5 ]--- RIP: 0010:mon_bin_flush+0x141/0x260 drivers/usb/mon/mon_bin.c:885 Code: 74 08 48 89 df e8 8f 3a 94 fe 48 8b 03 41 81 e7 ff 0f 00 00 4d 8d 7c 07 24 4c 89 f8 48 c1 e8 03 48 bb 00 00 00 00 00 fc ff df <0f> b6 04 18 84 c0 75 6b 41 8b 37 83 c6 40 4c 89 f7 e8 a9 fd ff ff RSP: 0018:ffffc90000d77d08 EFLAGS: 00010007 RAX: 00000000000001fc RBX: dffffc0000000000 RCX: 0000000000000002 RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000001 RBP: ffffc90000d77d70 R08: ffffffff813efe13 R09: fffffbfff0d864f9 R10: fffffbfff0d864f9 R11: 1ffffffff0d864f8 R12: 00000000fffffffd R13: ffff88810e1c3118 R14: ffff88810e1c3100 R15: 0000000000000fe4 FS: 00005555555a0300(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f418df69910 CR3: 000000010c753000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 74 08 je 0xa 2: 48 89 df mov %rbx,%rdi 5: e8 8f 3a 94 fe callq 0xfe943a99 a: 48 8b 03 mov (%rbx),%rax d: 41 81 e7 ff 0f 00 00 and $0xfff,%r15d 14: 4d 8d 7c 07 24 lea 0x24(%r15,%rax,1),%r15 19: 4c 89 f8 mov %r15,%rax 1c: 48 c1 e8 03 shr $0x3,%rax 20: 48 bb 00 00 00 00 00 movabs $0xdffffc0000000000,%rbx 27: fc ff df * 2a: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax <-- trapping instruction 2e: 84 c0 test %al,%al 30: 75 6b jne 0x9d 32: 41 8b 37 mov (%r15),%esi 35: 83 c6 40 add $0x40,%esi 38: 4c 89 f7 mov %r14,%rdi 3b: e8 a9 fd ff ff callq 0xfffffde9