================================================================== BUG: KASAN: use-after-free in get_disk_and_module block/genhd.c:1787 [inline] BUG: KASAN: use-after-free in exact_lock+0x38/0xc0 block/genhd.c:677 Read of size 8 at addr ffff888109532460 by task syz-executor/15034 CPU: 1 PID: 15034 Comm: syz-executor Tainted: G W 5.10.237-syzkaller-00309-g7e2543346ff7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:77 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0xe2/0x130 mm/kasan/report.c:452 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 get_disk_and_module block/genhd.c:1787 [inline] exact_lock+0x38/0xc0 block/genhd.c:677 kobj_lookup+0x298/0x430 drivers/base/map.c:119 get_gendisk+0xe9/0x340 block/genhd.c:1001 bdev_get_gendisk fs/block_dev.c:1110 [inline] __blkdev_get+0x1b0/0x12f0 fs/block_dev.c:1474 blkdev_get fs/block_dev.c:1653 [inline] blkdev_open+0x208/0x430 fs/block_dev.c:1770 do_dentry_open+0x793/0x1090 fs/open.c:819 vfs_open+0x73/0x80 fs/open.c:942 do_open fs/namei.c:3391 [inline] path_openat+0x27ad/0x3160 fs/namei.c:3509 do_filp_open+0x1b3/0x3e0 fs/namei.c:3536 do_sys_openat2+0x14c/0x6d0 fs/open.c:1217 do_sys_open fs/open.c:1233 [inline] __do_sys_openat fs/open.c:1249 [inline] __se_sys_openat fs/open.c:1244 [inline] __x64_sys_openat+0x136/0x160 fs/open.c:1244 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7faf10982251 Code: 75 57 89 f0 25 00 00 41 00 3d 00 00 41 00 74 49 80 3d fa 72 1f 00 00 74 6d 89 da 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 93 00 00 00 48 8b 54 24 28 64 48 2b 14 25 RSP: 002b:00007fff0d885b00 EFLAGS: 00000202 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007faf10982251 RDX: 0000000000000002 RSI: 00007fff0d885c10 RDI: 00000000ffffff9c RBP: 00007fff0d885c10 R08: 000000000000000a R09: 00007fff0d8858c7 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 R13: 00007faf10b72260 R14: 0000000000000003 R15: 00007fff0d885c10 Allocated by task 15027: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:430 [inline] ____kasan_kmalloc mm/kasan/common.c:509 [inline] __kasan_kmalloc+0xda/0x110 mm/kasan/common.c:518 kasan_kmalloc include/linux/kasan.h:254 [inline] __kmalloc+0x1a7/0x330 mm/slub.c:4033 kmalloc include/linux/slab.h:557 [inline] sk_prot_alloc+0xb2/0x340 net/core/sock.c:1716 sk_alloc+0x38/0x4e0 net/core/sock.c:1774 packet_create+0x109/0x860 net/packet/af_packet.c:3367 __sock_create+0x38d/0x770 net/socket.c:1436 sock_create net/socket.c:1487 [inline] __sys_socket+0xec/0x190 net/socket.c:1529 __do_sys_socket net/socket.c:1538 [inline] __se_sys_socket net/socket.c:1536 [inline] __x64_sys_socket+0x7a/0x90 net/socket.c:1536 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 15026: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4a/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370 kasan_slab_free include/linux/kasan.h:220 [inline] slab_free_hook mm/slub.c:1595 [inline] slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1621 slab_free mm/slub.c:3203 [inline] kfree+0xc0/0x270 mm/slub.c:4191 sk_prot_free net/core/sock.c:1757 [inline] __sk_destruct+0x4bc/0x600 net/core/sock.c:1843 sk_destruct net/core/sock.c:1858 [inline] __sk_free+0x313/0x410 net/core/sock.c:1869 sk_free+0x54/0x90 net/core/sock.c:1880 sock_put include/net/sock.h:1858 [inline] packet_release+0xb68/0xc60 net/packet/af_packet.c:3194 __sock_release net/socket.c:597 [inline] sock_close+0xe0/0x270 net/socket.c:1286 __fput+0x2fb/0x770 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x127/0x190 kernel/task_work.c:189 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:172 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] syscall_exit_to_user_mode+0x68/0x90 kernel/entry/common.c:274 do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x61/0xcb The buggy address belongs to the object at ffff888109532000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1120 bytes inside of 2048-byte region [ffff888109532000, ffff888109532800) The buggy address belongs to the page: page:ffffea0004254c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109530 head:ffffea0004254c00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100042d80 raw: 0000000000000000 0000000000080008 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 1, ts 3113392282, free_ts 0 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x179/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5349 alloc_slab_page mm/slub.c:-1 [inline] allocate_slab mm/slub.c:1808 [inline] new_slab+0x84/0x3f0 mm/slub.c:1869 new_slab_objects mm/slub.c:2627 [inline] ___slab_alloc+0x2a6/0x450 mm/slub.c:2791 __slab_alloc+0x63/0xa0 mm/slub.c:2831 slab_alloc_node mm/slub.c:2913 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc_trace+0x1b3/0x2e0 mm/slub.c:2972 kmem_cache_alloc_node_trace include/linux/slab.h:440 [inline] kmalloc_node include/linux/slab.h:570 [inline] kzalloc_node include/linux/slab.h:675 [inline] __alloc_disk_node+0x79/0x580 block/genhd.c:1727 brd_alloc+0x144/0x3e0 drivers/block/brd.c:394 brd_init+0x125/0x468 drivers/block/brd.c:517 do_one_initcall+0x187/0x510 init/main.c:1197 do_initcall_level+0x16f/0x2cf init/main.c:1270 do_initcalls+0x50/0x92 init/main.c:1286 do_basic_setup+0x88/0x8f init/main.c:1306 kernel_init_freeable+0x287/0x3be init/main.c:1510 kernel_init+0x11/0x1a0 init/main.c:1397 page_owner free stack trace missing Memory state around the buggy address: ffff888109532300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888109532380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888109532400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888109532480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888109532500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== general protection fault, probably for non-canonical address 0xe000080fc1181f24: 0000 [#1] PREEMPT SMP KASAN KASAN: probably user-memory-access in range [0x0000607e08c0f920-0x0000607e08c0f927] CPU: 0 PID: 15034 Comm: syz-executor Tainted: G B W 5.10.237-syzkaller-00309-g7e2543346ff7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 RIP: 0010:get_disk_and_module block/genhd.c:1789 [inline] RIP: 0010:exact_lock+0x4b/0xc0 block/genhd.c:677 Code: 00 4c 89 f0 48 c1 e8 03 42 80 3c 38 00 74 08 4c 89 f7 e8 38 f8 6d ff 4d 8b 36 4d 85 f6 74 35 49 83 c6 68 4c 89 f0 48 c1 e8 03 <42> 80 3c 38 00 74 08 4c 89 f7 e8 16 f8 6d ff 4d 8b 36 4d 85 f6 74 RSP: 0018:ffffc90000bc7630 EFLAGS: 00010207 RAX: 00000c0fc1181f24 RBX: ffff888109532000 RCX: 0000000000000282 RDX: 0000000000000000 RSI: 000000000000002f RDI: 00000000ffffffff RBP: ffffc90000bc7648 R08: 0000000000000004 R09: 0000000000000003 R10: fffffbfff0d8e248 R11: 1ffffffff0d8e248 R12: ffff888109532000 R13: 0000000000700002 R14: 0000607e08c0f924 R15: dffffc0000000000 FS: 000055557da66500(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fad08470d58 CR3: 0000000135846000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: kobj_lookup+0x298/0x430 drivers/base/map.c:119 get_gendisk+0xe9/0x340 block/genhd.c:1001 bdev_get_gendisk fs/block_dev.c:1110 [inline] __blkdev_get+0x1b0/0x12f0 fs/block_dev.c:1474 blkdev_get fs/block_dev.c:1653 [inline] blkdev_open+0x208/0x430 fs/block_dev.c:1770 do_dentry_open+0x793/0x1090 fs/open.c:819 vfs_open+0x73/0x80 fs/open.c:942 do_open fs/namei.c:3391 [inline] path_openat+0x27ad/0x3160 fs/namei.c:3509 do_filp_open+0x1b3/0x3e0 fs/namei.c:3536 do_sys_openat2+0x14c/0x6d0 fs/open.c:1217 do_sys_open fs/open.c:1233 [inline] __do_sys_openat fs/open.c:1249 [inline] __se_sys_openat fs/open.c:1244 [inline] __x64_sys_openat+0x136/0x160 fs/open.c:1244 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7faf10982251 Code: 75 57 89 f0 25 00 00 41 00 3d 00 00 41 00 74 49 80 3d fa 72 1f 00 00 74 6d 89 da 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 93 00 00 00 48 8b 54 24 28 64 48 2b 14 25 RSP: 002b:00007fff0d885b00 EFLAGS: 00000202 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007faf10982251 RDX: 0000000000000002 RSI: 00007fff0d885c10 RDI: 00000000ffffff9c RBP: 00007fff0d885c10 R08: 000000000000000a R09: 00007fff0d8858c7 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000 R13: 00007faf10b72260 R14: 0000000000000003 R15: 00007fff0d885c10 Modules linked in: ---[ end trace fdd1cc6a33d1aa07 ]--- RIP: 0010:get_disk_and_module block/genhd.c:1789 [inline] RIP: 0010:exact_lock+0x4b/0xc0 block/genhd.c:677 Code: 00 4c 89 f0 48 c1 e8 03 42 80 3c 38 00 74 08 4c 89 f7 e8 38 f8 6d ff 4d 8b 36 4d 85 f6 74 35 49 83 c6 68 4c 89 f0 48 c1 e8 03 <42> 80 3c 38 00 74 08 4c 89 f7 e8 16 f8 6d ff 4d 8b 36 4d 85 f6 74 RSP: 0018:ffffc90000bc7630 EFLAGS: 00010207 RAX: 00000c0fc1181f24 RBX: ffff888109532000 RCX: 0000000000000282 RDX: 0000000000000000 RSI: 000000000000002f RDI: 00000000ffffffff RBP: ffffc90000bc7648 R08: 0000000000000004 R09: 0000000000000003 R10: fffffbfff0d8e248 R11: 1ffffffff0d8e248 R12: ffff888109532000 R13: 0000000000700002 R14: 0000607e08c0f924 R15: dffffc0000000000 FS: 000055557da66500(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 0000000135846000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 00 4c 89 f0 add %cl,-0x10(%rcx,%rcx,4) 4: 48 c1 e8 03 shr $0x3,%rax 8: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1) d: 74 08 je 0x17 f: 4c 89 f7 mov %r14,%rdi 12: e8 38 f8 6d ff call 0xff6df84f 17: 4d 8b 36 mov (%r14),%r14 1a: 4d 85 f6 test %r14,%r14 1d: 74 35 je 0x54 1f: 49 83 c6 68 add $0x68,%r14 23: 4c 89 f0 mov %r14,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1) <-- trapping instruction 2f: 74 08 je 0x39 31: 4c 89 f7 mov %r14,%rdi 34: e8 16 f8 6d ff call 0xff6df84f 39: 4d 8b 36 mov (%r14),%r14 3c: 4d 85 f6 test %r14,%r14 3f: 74 .byte 0x74