================================================================== BUG: KASAN: slab-use-after-free in ucma_create_uevent+0xb1a/0xbe0 drivers/infiniband/core/ucma.c:275 Read of size 8 at addr ffff88802784c610 by task kworker/u32:0/12 CPU: 3 UID: 0 PID: 12 Comm: kworker/u32:0 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 6387: 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 6387: 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 ffff88802784c600 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 16 bytes inside of freed 192-byte region [ffff88802784c600, ffff88802784c6c0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2784c ksm flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b4423c0 ffffea0000d68c40 dead000000000003 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 6016, tgid 6016 (syz-executor), ts 68559029174, free_ts 68481540769 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 vfs_create_mount fs/namespace.c:1193 [inline] vfs_create_mount fs/namespace.c:1186 [inline] fc_mount fs/namespace.c:1211 [inline] fc_mount fs/namespace.c:1206 [inline] fc_mount_longterm+0x154/0x270 fs/namespace.c:1219 mq_create_mount ipc/mqueue.c:486 [inline] mq_init_ns+0x426/0x620 ipc/mqueue.c:1656 create_ipc_ns ipc/namespace.c:72 [inline] copy_ipcs+0x2d6/0x550 ipc/namespace.c:114 page last free pid 6005 tgid 6005 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 vfree+0x1fd/0xb50 mm/vmalloc.c:3440 kcov_put kernel/kcov.c:439 [inline] kcov_put kernel/kcov.c:435 [inline] kcov_close+0x34/0x60 kernel/kcov.c:535 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/0x240 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x86f/0x2bf0 kernel/exit.c:966 do_group_exit+0xd3/0x2a0 kernel/exit.c:1107 get_signal+0x2671/0x26d0 kernel/signal.c:3034 arch_do_signal_or_restart+0x8f/0x7c0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop+0x85/0x130 kernel/entry/common.c:40 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x426/0xfa0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88802784c500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88802784c580: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802784c600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802784c680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88802784c700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================