================================================================== BUG: KASAN: slab-use-after-free in hlist_add_head_rcu include/linux/rculist.h:652 [inline] BUG: KASAN: slab-use-after-free in ipv6_add_acaddr_hash net/ipv6/anycast.c:247 [inline] BUG: KASAN: slab-use-after-free in __ipv6_dev_ac_inc+0xd35/0xdc0 net/ipv6/anycast.c:376 Write of size 8 at addr ffff8880298a3ca8 by task syz.2.276/6887 CPU: 0 UID: 0 PID: 6887 Comm: syz.2.276 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 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/0x1d0 mm/kasan/report.c:595 hlist_add_head_rcu include/linux/rculist.h:652 [inline] ipv6_add_acaddr_hash net/ipv6/anycast.c:247 [inline] __ipv6_dev_ac_inc+0xd35/0xdc0 net/ipv6/anycast.c:376 ipv6_sock_ac_join+0x929/0x10d0 net/ipv6/anycast.c:153 do_ipv6_setsockopt+0x3884/0x44b0 net/ipv6/ipv6_sockglue.c:893 ipv6_setsockopt+0xcb/0x170 net/ipv6/ipv6_sockglue.c:965 udpv6_setsockopt+0x64/0xb0 net/ipv6/udp.c:1823 do_sock_setsockopt+0xf3/0x1d0 net/socket.c:2381 __sys_setsockopt+0x195/0x220 net/socket.c:2406 __do_sys_setsockopt net/socket.c:2412 [inline] __se_sys_setsockopt net/socket.c:2409 [inline] __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2409 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f1bcc79cdd9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f1bcd6f8028 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 00007f1bcca16090 RCX: 00007f1bcc79cdd9 RDX: 000000000000001b RSI: 0000000000000029 RDI: 0000000000000004 RBP: 00007f1bcc832d69 R08: 0000000000000014 R09: 0000000000000000 R10: 0000200000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f1bcca16128 R14: 00007f1bcca16090 R15: 00007ffc41cfd398 Allocated by task 6727: 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 kmalloc_noprof include/linux/slab.h:950 [inline] kzalloc_noprof include/linux/slab.h:1188 [inline] aca_alloc net/ipv6/anycast.c:282 [inline] __ipv6_dev_ac_inc+0x351/0xdc0 net/ipv6/anycast.c:360 ipv6_sock_ac_join+0x929/0x10d0 net/ipv6/anycast.c:153 do_ipv6_setsockopt+0x3884/0x44b0 net/ipv6/ipv6_sockglue.c:893 ipv6_setsockopt+0xcb/0x170 net/ipv6/ipv6_sockglue.c:965 udpv6_setsockopt+0x64/0xb0 net/ipv6/udp.c:1823 do_sock_setsockopt+0xf3/0x1d0 net/socket.c:2381 __sys_setsockopt+0x195/0x220 net/socket.c:2406 __do_sys_setsockopt net/socket.c:2412 [inline] __se_sys_setsockopt net/socket.c:2409 [inline] __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2409 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 0: 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:2689 [inline] slab_free mm/slub.c:6246 [inline] kfree+0x223/0x6c0 mm/slub.c:6561 rcu_do_batch kernel/rcu/tree.c:2617 [inline] rcu_core+0x5a2/0x10d0 kernel/rcu/tree.c:2869 handle_softirqs+0x1ea/0xa00 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1061 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1061 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 Last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 __call_rcu_common.constprop.0+0xa5/0x9b0 kernel/rcu/tree.c:3131 call_rcu_hurry include/linux/rcupdate.h:125 [inline] aca_put net/ipv6/anycast.c:274 [inline] aca_put+0x5f/0x90 net/ipv6/anycast.c:271 __ipv6_dev_ac_inc+0x96b/0xdc0 net/ipv6/anycast.c:384 ipv6_sock_ac_join+0x929/0x10d0 net/ipv6/anycast.c:153 do_ipv6_setsockopt+0x3884/0x44b0 net/ipv6/ipv6_sockglue.c:893 ipv6_setsockopt+0xcb/0x170 net/ipv6/ipv6_sockglue.c:965 udpv6_setsockopt+0x64/0xb0 net/ipv6/udp.c:1823 do_sock_setsockopt+0xf3/0x1d0 net/socket.c:2381 __sys_setsockopt+0x195/0x220 net/socket.c:2406 __do_sys_setsockopt net/socket.c:2412 [inline] __se_sys_setsockopt net/socket.c:2409 [inline] __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2409 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff8880298a3c80 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 40 bytes inside of freed 96-byte region [ffff8880298a3c80, ffff8880298a3ce0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880298a3900 pfn:0x298a3 flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000200 ffff88801b842280 ffffea0000881f50 ffffea000089bf10 raw: ffff8880298a3900 000000080020001b 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 1, tgid 1 (swapper/0), ts 11256415309, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x153/0x170 mm/page_alloc.c:1858 prep_new_page mm/page_alloc.c:1866 [inline] get_page_from_freelist+0x11a6/0x33b0 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x27c/0x2bc0 mm/page_alloc.c:5226 alloc_slab_page mm/slub.c:3278 [inline] allocate_slab mm/slub.c:3467 [inline] new_slab+0xa6/0x6c0 mm/slub.c:3525 refill_objects+0x277/0x420 mm/slub.c:7251 refill_sheaf mm/slub.c:2816 [inline] __pcs_replace_empty_main+0x375/0x650 mm/slub.c:4651 alloc_from_pcs mm/slub.c:4749 [inline] slab_alloc_node mm/slub.c:4883 [inline] __kmalloc_cache_noprof+0x493/0x6f0 mm/slub.c:5410 kmalloc_noprof include/linux/slab.h:950 [inline] kzalloc_noprof include/linux/slab.h:1188 [inline] blk_mq_alloc_ctxs block/blk-mq.c:4386 [inline] blk_mq_init_allocated_queue+0xcf/0x1440 block/blk-mq.c:4663 blk_mq_alloc_queue+0x1bd/0x290 block/blk-mq.c:4454 __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4497 loop_add+0x498/0xb60 drivers/block/loop.c:2049 loop_init+0x1d3/0x200 drivers/block/loop.c:2288 do_one_initcall+0x121/0x750 init/main.c:1392 do_initcall_level init/main.c:1454 [inline] do_initcalls init/main.c:1470 [inline] do_basic_setup init/main.c:1490 [inline] kernel_init_freeable+0x6ea/0x7b0 init/main.c:1703 kernel_init+0x1f/0x1e0 init/main.c:1593 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 page_owner free stack trace missing Memory state around the buggy address: ffff8880298a3b80: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc ffff8880298a3c00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc >ffff8880298a3c80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff8880298a3d00: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ffff8880298a3d80: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ==================================================================