================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline] BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline] BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline] BUG: KASAN: use-after-free in refcount_inc include/linux/refcount.h:267 [inline] BUG: KASAN: use-after-free in sctp_auth_shkey_hold+0x22/0xa0 net/sctp/auth.c:112 Write of size 4 at addr ffff888072aee0d8 by task syz-executor300/3728 CPU: 0 PID: 3728 Comm: syz-executor300 Not tainted 5.19.0-rc6-syzkaller-00364-g9b59ec8d50a1 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline] __refcount_add include/linux/refcount.h:193 [inline] __refcount_inc include/linux/refcount.h:250 [inline] refcount_inc include/linux/refcount.h:267 [inline] sctp_auth_shkey_hold+0x22/0xa0 net/sctp/auth.c:112 sctp_set_owner_w net/sctp/socket.c:131 [inline] sctp_sendmsg_to_asoc+0x1434/0x2380 net/sctp/socket.c:1865 sctp_sendmsg+0x1056/0x1d60 net/sctp/socket.c:2027 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 __sys_sendto+0x21a/0x320 net/socket.c:2119 __do_sys_sendto net/socket.c:2131 [inline] __se_sys_sendto net/socket.c:2127 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2127 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7ff21507cdc9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff21500d2d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007ff2151054b0 RCX: 00007ff21507cdc9 RDX: 0000000000000001 RSI: 0000000020000400 RDI: 0000000000000003 RBP: 00007ff2150d2194 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff21500d2f0 R13: 00007ff2151054b8 R14: 0100000000000000 R15: 0000000000022000 Allocated by task 3726: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] sctp_auth_shkey_create+0x85/0x1f0 net/sctp/auth.c:84 sctp_auth_asoc_copy_shkeys+0x1e8/0x350 net/sctp/auth.c:363 sctp_association_init net/sctp/associola.c:257 [inline] sctp_association_new+0x189e/0x2340 net/sctp/associola.c:298 sctp_connect_new_asoc+0x1ac/0x770 net/sctp/socket.c:1088 sctp_sendmsg_new_asoc net/sctp/socket.c:1690 [inline] sctp_sendmsg+0x13e0/0x1d60 net/sctp/socket.c:2000 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 __sys_sendto+0x21a/0x320 net/socket.c:2119 __do_sys_sendto net/socket.c:2131 [inline] __se_sys_sendto net/socket.c:2127 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2127 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 3731: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3536 [inline] kfree+0xd6/0x4d0 mm/slub.c:4584 sctp_auth_shkey_destroy net/sctp/auth.c:101 [inline] sctp_auth_shkey_release+0x100/0x160 net/sctp/auth.c:107 sctp_auth_set_key+0x443/0x960 net/sctp/auth.c:866 sctp_setsockopt_auth_key net/sctp/socket.c:3642 [inline] sctp_setsockopt+0x4c19/0xa9b0 net/sctp/socket.c:4685 __sys_setsockopt+0x2db/0x6a0 net/socket.c:2254 __do_sys_setsockopt net/socket.c:2265 [inline] __se_sys_setsockopt net/socket.c:2262 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2262 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888072aee0c0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 24 bytes inside of 32-byte region [ffff888072aee0c0, ffff888072aee0e0) The buggy address belongs to the physical page: page:ffffea0001cabb80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x72aee flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888011841500 raw: 0000000000000000 0000000080400040 00000001ffffffff 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 3726, tgid 3725 (syz-executor300), ts 53389958030, free_ts 40878895494 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x1290/0x3b70 mm/page_alloc.c:4198 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x9c4/0xe20 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] __kmalloc_node+0x2cb/0x390 mm/slub.c:4490 kmalloc_node include/linux/slab.h:623 [inline] kzalloc_node include/linux/slab.h:744 [inline] crypto_create_tfm_node+0x7f/0x330 crypto/api.c:504 crypto_create_tfm crypto/internal.h:92 [inline] crypto_spawn_tfm2+0x60/0xb0 crypto/algapi.c:803 crypto_spawn_shash include/crypto/internal/hash.h:231 [inline] hmac_init_tfm+0xbb/0x1b0 crypto/hmac.c:152 crypto_shash_init_tfm+0x185/0x2d0 crypto/shash.c:440 crypto_create_tfm_node+0x10d/0x330 crypto/api.c:512 crypto_alloc_tfm_node+0x107/0x260 crypto/api.c:588 sctp_auth_init_hmacs net/sctp/auth.c:485 [inline] sctp_auth_init_hmacs+0x1d6/0x430 net/sctp/auth.c:454 sctp_auth_init+0x8e/0x510 net/sctp/auth.c:1056 sctp_setsockopt_auth_supported net/sctp/socket.c:4368 [inline] sctp_setsockopt+0x5439/0xa9b0 net/sctp/socket.c:4754 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1421 free_unref_page_prepare mm/page_alloc.c:3343 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3438 __put_single_page mm/swap.c:106 [inline] __put_page+0x145/0x280 mm/swap.c:129 folio_put include/linux/mm.h:1200 [inline] put_page include/linux/mm.h:1233 [inline] anon_pipe_buf_release+0x362/0x4b0 fs/pipe.c:138 pipe_buf_release include/linux/pipe_fs_i.h:203 [inline] pipe_read+0x610/0x1100 fs/pipe.c:324 call_read_iter include/linux/fs.h:2052 [inline] new_sync_read+0x4f9/0x5f0 fs/read_write.c:401 vfs_read+0x492/0x5d0 fs/read_write.c:482 ksys_read+0x1e8/0x250 fs/read_write.c:620 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888072aedf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888072aee000: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc >ffff888072aee080: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff888072aee100: fa fb fb fb fc fc fc fc 00 00 00 00 fc fc fc fc ffff888072aee180: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ==================================================================