================================================================== BUG: KASAN: slab-use-after-free in ucma_create_uevent+0xb60/0xbe0 drivers/infiniband/core/ucma.c:275 Read of size 8 at addr ffff888053083c10 by task kworker/u32:3/5761 CPU: 2 UID: 0 PID: 5761 Comm: kworker/u32:3 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Workqueue: rdma_cm cma_iboe_join_work_handler Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 ucma_create_uevent+0xb60/0xbe0 drivers/infiniband/core/ucma.c:275 ucma_event_handler+0x102/0x940 drivers/infiniband/core/ucma.c:356 cma_cm_event_handler+0x99/0x300 drivers/infiniband/core/cma.c:2181 cma_iboe_join_work_handler+0xca/0x180 drivers/infiniband/core/cma.c:3017 process_one_work+0xa23/0x1940 kernel/workqueue.c:3322 process_scheduled_works kernel/workqueue.c:3405 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 6252: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2e5/0x6c0 mm/slub.c:5515 _kmalloc_noprof include/linux/slab.h:969 [inline] _kzalloc_noprof include/linux/slab.h:1290 [inline] ucma_process_join+0x232/0xa20 drivers/infiniband/core/ucma.c:1532 ucma_join_multicast+0xe9/0x160 drivers/infiniband/core/ucma.c:1624 ucma_write+0x1fb/0x330 drivers/infiniband/core/ucma.c:1856 vfs_write+0x2aa/0x1050 fs/read_write.c:685 ksys_write+0x1f8/0x250 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 6252: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2705 [inline] slab_free mm/slub.c:6405 [inline] kfree+0x22b/0x6c0 mm/slub.c:6720 ucma_process_join+0x39a/0xa20 drivers/infiniband/core/ucma.c:1583 ucma_join_multicast+0xe9/0x160 drivers/infiniband/core/ucma.c:1624 ucma_write+0x1fb/0x330 drivers/infiniband/core/ucma.c:1856 vfs_write+0x2aa/0x1050 fs/read_write.c:685 ksys_write+0x1f8/0x250 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888053083c00 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 16 bytes inside of freed 192-byte region [ffff888053083c00, ffff888053083cc0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x53083 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801bc423c0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000800100010 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 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6191, tgid 6191 (syz-executor), ts 97952770545, free_ts 97952313814 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_slab_page mm/slub.c:3294 [inline] allocate_slab mm/slub.c:3408 [inline] new_slab+0xa2/0x650 mm/slub.c:3454 refill_objects+0xe3/0x410 mm/slub.c:7338 refill_sheaf mm/slub.c:2832 [inline] __pcs_replace_empty_main+0x376/0x680 mm/slub.c:4703 alloc_from_pcs mm/slub.c:4801 [inline] slab_alloc_node mm/slub.c:4933 [inline] __do_kmalloc_node mm/slub.c:5361 [inline] __kmalloc_noprof+0x66d/0x820 mm/slub.c:5387 _kmalloc_noprof include/linux/slab.h:973 [inline] memcg_init_list_lru_one mm/list_lru.c:468 [inline] __memcg_list_lru_alloc+0x418/0x680 mm/list_lru.c:601 memcg_list_lru_alloc+0xd3/0x100 mm/list_lru.c:628 __memcg_slab_post_alloc_hook+0x28b/0x1160 mm/memcontrol.c:3572 memcg_slab_post_alloc_hook mm/slub.c:2475 [inline] slab_post_alloc_hook mm/slub.c:4631 [inline] slab_alloc_node mm/slub.c:4945 [inline] kmem_cache_alloc_lru_noprof+0x583/0x6a0 mm/slub.c:4978 shmem_alloc_inode+0x25/0x50 mm/shmem.c:5080 alloc_inode+0x68/0x250 fs/inode.c:338 new_inode+0x22/0x1c0 fs/inode.c:1174 __shmem_get_inode mm/shmem.c:3014 [inline] shmem_get_inode+0x1e3/0xf70 mm/shmem.c:3086 shmem_mknod+0x217/0x480 mm/shmem.c:3796 page last free pid 6191 tgid 6191 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1406 [inline] __free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950 ___free_pages_bulk mm/kasan/shadow.c:333 [inline] __kasan_populate_vmalloc_do mm/kasan/shadow.c:385 [inline] __kasan_populate_vmalloc+0x164/0x210 mm/kasan/shadow.c:424 kasan_populate_vmalloc include/linux/kasan.h:580 [inline] alloc_vmap_area+0x95d/0x2bb0 mm/vmalloc.c:2123 __get_vm_area_node+0x1ca/0x330 mm/vmalloc.c:3226 __vmalloc_node_range_noprof+0x228/0x1630 mm/vmalloc.c:4042 __vmalloc_node_noprof+0xad/0xf0 mm/vmalloc.c:4143 alloc_counters net/ipv6/netfilter/ip6_tables.c:815 [inline] copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:837 [inline] get_entries net/ipv6/netfilter/ip6_tables.c:1037 [inline] do_ip6t_get_ctl+0x7e0/0xc30 net/ipv6/netfilter/ip6_tables.c:1678 nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x207/0x2a0 net/ipv6/ipv6_sockglue.c:1464 tcp_getsockopt+0xa1/0x110 net/ipv4/tcp.c:4864 do_sock_getsockopt+0x50a/0x6e0 net/socket.c:2474 __sys_getsockopt+0x148/0x260 net/socket.c:2505 __do_sys_getsockopt net/socket.c:2512 [inline] __se_sys_getsockopt net/socket.c:2509 [inline] __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2509 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888053083b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888053083b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888053083c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888053083c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888053083d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================