================================================================== BUG: KASAN: slab-use-after-free in ucma_create_uevent+0xb1a/0xbe0 drivers/infiniband/core/ucma.c:275 Read of size 8 at addr ffff88804e73da10 by task kworker/u32:8/1153 CPU: 2 UID: 0 PID: 1153 Comm: kworker/u32:8 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: rdma_cm cma_iboe_join_work_handler Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 ucma_create_uevent+0xb1a/0xbe0 drivers/infiniband/core/ucma.c:275 ucma_event_handler+0x102/0x940 drivers/infiniband/core/ucma.c:356 cma_cm_event_handler+0x97/0x300 drivers/infiniband/core/cma.c:2174 cma_iboe_join_work_handler+0xca/0x170 drivers/infiniband/core/cma.c:3009 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x675/0x7d0 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 6486: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:400 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:417 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] ucma_process_join+0x237/0xa30 drivers/infiniband/core/ucma.c:1532 ucma_join_multicast+0xe8/0x160 drivers/infiniband/core/ucma.c:1624 ucma_write+0x1fb/0x330 drivers/infiniband/core/ucma.c:1856 vfs_write+0x2a0/0x11d0 fs/read_write.c:684 ksys_write+0x1f8/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 6486: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 __kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:587 kasan_save_free_info mm/kasan/kasan.h:406 [inline] poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2523 [inline] slab_free mm/slub.c:6611 [inline] kfree+0x2b8/0x6d0 mm/slub.c:6818 ucma_process_join+0x3b9/0xa30 drivers/infiniband/core/ucma.c:1583 ucma_join_multicast+0xe8/0x160 drivers/infiniband/core/ucma.c:1624 ucma_write+0x1fb/0x330 drivers/infiniband/core/ucma.c:1856 vfs_write+0x2a0/0x11d0 fs/read_write.c:684 ksys_write+0x1f8/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88804e73da00 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 16 bytes inside of freed 192-byte region [ffff88804e73da00, ffff88804e73dac0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4e73d flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b4423c0 ffffea0000c3b500 dead000000000002 raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 6014, tgid 6014 (syz-executor), ts 61499392711, free_ts 61498598414 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1850 prep_new_page mm/page_alloc.c:1858 [inline] get_page_from_freelist+0x10a3/0x3a30 mm/page_alloc.c:3884 __alloc_frozen_pages_noprof+0x25f/0x2470 mm/page_alloc.c:5183 alloc_slab_page mm/slub.c:3041 [inline] allocate_slab mm/slub.c:3212 [inline] new_slab+0xa5/0x360 mm/slub.c:3266 ___slab_alloc+0xdc4/0x1ae0 mm/slub.c:4636 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4755 __slab_alloc_node mm/slub.c:4831 [inline] slab_alloc_node mm/slub.c:5253 [inline] __do_kmalloc_node mm/slub.c:5626 [inline] __kmalloc_node_noprof+0x4dd/0x8a0 mm/slub.c:5633 kmalloc_array_node_noprof include/linux/slab.h:1075 [inline] alloc_slab_obj_exts+0x3a/0xd0 mm/slub.c:2123 account_slab mm/slub.c:3166 [inline] allocate_slab mm/slub.c:3231 [inline] new_slab+0x283/0x360 mm/slub.c:3266 ___slab_alloc+0xdc4/0x1ae0 mm/slub.c:4636 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4755 __slab_alloc_node mm/slub.c:4831 [inline] slab_alloc_node mm/slub.c:5253 [inline] kmem_cache_alloc_noprof+0x43f/0x6e0 mm/slub.c:5272 alloc_vfsmnt+0x23/0x6b0 fs/namespace.c:302 clone_mnt+0x4b/0x930 fs/namespace.c:1261 copy_tree+0x31d/0xbd0 fs/namespace.c:2203 __do_loopback+0x44e/0x550 fs/namespace.c:2967 page last free pid 6014 tgid 6014 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] __free_frozen_pages+0x7df/0x1160 mm/page_alloc.c:2906 selinux_genfs_get_sid security/selinux/hooks.c:1357 [inline] inode_doinit_with_dentry+0xacb/0x12e0 security/selinux/hooks.c:1555 sb_finish_set_opts+0x221/0xb80 security/selinux/hooks.c:587 selinux_set_mnt_opts+0xc55/0x18c0 security/selinux/hooks.c:875 security_sb_set_mnt_opts+0xc0/0x140 security/security.c:1661 vfs_get_tree+0x17a/0x340 fs/super.c:1776 fc_mount fs/namespace.c:1208 [inline] do_new_mount_fc fs/namespace.c:3651 [inline] do_new_mount fs/namespace.c:3727 [inline] path_mount+0x7b9/0x23a0 fs/namespace.c:4037 do_mount fs/namespace.c:4050 [inline] __do_sys_mount fs/namespace.c:4238 [inline] __se_sys_mount fs/namespace.c:4215 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4215 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88804e73d900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88804e73d980: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88804e73da00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804e73da80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88804e73db00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================