================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3db6/0x54f0 kernel/locking/lockdep.c:4702 Read of size 8 at addr ffff88802474f5a0 by task kworker/u4:0/20976 CPU: 1 PID: 20976 Comm: kworker/u4:0 Not tainted 5.11.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: kkcmd kcm_tx_work Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x107/0x163 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:230 __kasan_report mm/kasan/report.c:396 [inline] kasan_report.cold+0x79/0xd5 mm/kasan/report.c:413 __lock_acquire+0x3db6/0x54f0 kernel/locking/lockdep.c:4702 lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175 spin_lock_bh include/linux/spinlock.h:359 [inline] __lock_sock+0x145/0x260 net/core/sock.c:2519 lock_sock_nested+0xf1/0x110 net/core/sock.c:3051 lock_sock include/net/sock.h:1596 [inline] kcm_tx_work+0x21/0x160 net/kcm/kcmsock.c:725 process_one_work+0x98d/0x15f0 kernel/workqueue.c:2275 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 kthread+0x3b1/0x4a0 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296 Allocated by task 26019: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:401 [inline] ____kasan_kmalloc.constprop.0+0x82/0xa0 mm/kasan/common.c:429 kasan_slab_alloc include/linux/kasan.h:209 [inline] slab_post_alloc_hook mm/slab.h:512 [inline] slab_alloc_node mm/slub.c:2891 [inline] slab_alloc mm/slub.c:2899 [inline] kmem_cache_alloc+0x1c6/0x440 mm/slub.c:2904 sk_prot_alloc+0x5f/0x2d0 net/core/sock.c:1679 sk_alloc+0x32/0xbd0 net/core/sock.c:1739 kcm_clone net/kcm/kcmsock.c:1672 [inline] kcm_ioctl+0x5a4/0x1180 net/kcm/kcmsock.c:1717 sock_do_ioctl+0xcb/0x2d0 net/socket.c:1037 sock_ioctl+0x477/0x6a0 net/socket.c:1177 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 25987: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:356 ____kasan_slab_free+0xe1/0x110 mm/kasan/common.c:362 kasan_slab_free include/linux/kasan.h:192 [inline] slab_free_hook mm/slub.c:1547 [inline] slab_free_freelist_hook+0x5d/0x150 mm/slub.c:1580 slab_free mm/slub.c:3142 [inline] kmem_cache_free+0x82/0x350 mm/slub.c:3158 sk_prot_free net/core/sock.c:1720 [inline] __sk_destruct+0x57a/0x900 net/core/sock.c:1807 sk_destruct+0xbd/0xe0 net/core/sock.c:1822 __sk_free+0xef/0x3d0 net/core/sock.c:1833 sk_free+0x78/0xa0 net/core/sock.c:1844 sock_put include/net/sock.h:1799 [inline] kcm_done+0x5a4/0x16b0 net/kcm/kcmsock.c:1822 kcm_release+0x3f6/0x720 net/kcm/kcmsock.c:1891 __sock_release+0xcd/0x280 net/socket.c:597 sock_close+0x18/0x20 net/socket.c:1256 __fput+0x283/0x920 fs/file_table.c:280 task_work_run+0xdd/0x190 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:302 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xc5/0xf0 mm/kasan/generic.c:344 insert_work+0x48/0x370 kernel/workqueue.c:1331 __queue_work+0x5c1/0xf00 kernel/workqueue.c:1497 queue_work_on+0xc7/0xd0 kernel/workqueue.c:1524 queue_work include/linux/workqueue.h:507 [inline] kcm_unattach+0xb5b/0x1340 net/kcm/kcmsock.c:1581 kcm_unattach_ioctl net/kcm/kcmsock.c:1638 [inline] kcm_ioctl+0x9d9/0x1180 net/kcm/kcmsock.c:1705 sock_do_ioctl+0xcb/0x2d0 net/socket.c:1037 sock_ioctl+0x477/0x6a0 net/socket.c:1177 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Second to last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xc5/0xf0 mm/kasan/generic.c:344 insert_work+0x48/0x370 kernel/workqueue.c:1331 __queue_work+0x5c1/0xf00 kernel/workqueue.c:1497 queue_work_on+0xc7/0xd0 kernel/workqueue.c:1524 queue_work include/linux/workqueue.h:507 [inline] psock_now_avail+0x243/0x420 net/kcm/kcmsock.c:510 kcm_attach net/kcm/kcmsock.c:1461 [inline] kcm_attach_ioctl net/kcm/kcmsock.c:1489 [inline] kcm_ioctl+0xeca/0x1180 net/kcm/kcmsock.c:1695 sock_do_ioctl+0xcb/0x2d0 net/socket.c:1037 sock_ioctl+0x477/0x6a0 net/socket.c:1177 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88802474f500 which belongs to the cache KCM of size 1488 The buggy address is located 160 bytes inside of 1488-byte region [ffff88802474f500, ffff88802474fad0) The buggy address belongs to the page: page:0000000065a7ef61 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888024749a00 pfn:0x24748 head:0000000065a7ef61 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head) raw: 00fff00000010200 ffffea000181ac00 0000000200000002 ffff888147646780 raw: ffff888024749a00 0000000080130012 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88802474f480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802474f500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802474f580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802474f600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802474f680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================