ubi0: attaching mtd0 ubi0: scanning is finished ================================================================== BUG: KASAN: slab-use-after-free in notifier_chain_register+0x3ac/0x420 kernel/notifier.c:27 Read of size 4 at addr ffff88806befd8d8 by task syz.0.578/7866 CPU: 2 UID: 0 PID: 7866 Comm: syz.0.578 Not tainted 6.13.0-syzkaller-09485-g72deda0abee6 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 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+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 notifier_chain_register+0x3ac/0x420 kernel/notifier.c:27 __blocking_notifier_chain_register kernel/notifier.c:264 [inline] blocking_notifier_chain_register+0x76/0xd0 kernel/notifier.c:282 ubi_wl_init+0x1018/0x17b0 drivers/mtd/ubi/wl.c:1960 ubi_attach+0x1cdd/0x4dc0 drivers/mtd/ubi/attach.c:1605 ubi_attach_mtd_dev+0x158f/0x3590 drivers/mtd/ubi/build.c:1004 ctrl_cdev_ioctl+0x339/0x3d0 drivers/mtd/ubi/cdev.c:1043 compat_ptr_ioctl+0x6b/0xa0 fs/ioctl.c:943 __do_compat_sys_ioctl+0x1cb/0x2c0 fs/ioctl.c:1004 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7f01579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f502655c EFLAGS: 00000296 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000008 RCX: 0000000040186f40 RDX: 0000000020000502 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 7528: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:319 [inline] __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:345 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4115 [inline] slab_alloc_node mm/slub.c:4164 [inline] kmem_cache_alloc_noprof+0x1c8/0x3b0 mm/slub.c:4171 alloc_vfsmnt+0x23/0x6f0 fs/namespace.c:341 vfs_create_mount+0x93/0x500 fs/namespace.c:1249 do_new_mount_fc fs/namespace.c:3491 [inline] do_new_mount fs/namespace.c:3562 [inline] path_mount+0x19d0/0x1f00 fs/namespace.c:3887 do_mount fs/namespace.c:3900 [inline] __do_sys_mount fs/namespace.c:4111 [inline] __se_sys_mount fs/namespace.c:4088 [inline] __ia32_sys_mount+0x28d/0x310 fs/namespace.c:4088 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 24: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4609 [inline] kmem_cache_free+0x2e2/0x4d0 mm/slub.c:4711 rcu_do_batch kernel/rcu/tree.c:2546 [inline] rcu_core+0x79d/0x14d0 kernel/rcu/tree.c:2802 handle_softirqs+0x213/0x8f0 kernel/softirq.c:561 run_ksoftirqd kernel/softirq.c:950 [inline] run_ksoftirqd+0x3a/0x60 kernel/softirq.c:942 smpboot_thread_fn+0x661/0xa30 kernel/smpboot.c:164 kthread+0x3af/0x750 kernel/kthread.c:464 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Last potentially related work creation: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_record_aux_stack+0xb8/0xd0 mm/kasan/generic.c:548 __call_rcu_common.constprop.0+0x9a/0x870 kernel/rcu/tree.c:3065 task_work_run+0x14e/0x250 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218 __do_fast_syscall_32+0x80/0x120 arch/x86/entry/common.c:389 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Second to last potentially related work creation: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_record_aux_stack+0xb8/0xd0 mm/kasan/generic.c:548 task_work_add+0x25a/0x370 kernel/task_work.c:65 mntput_no_expire+0x61e/0xb00 fs/namespace.c:1492 path_umount+0x6c2/0x1100 fs/namespace.c:2055 ksys_umount fs/namespace.c:2074 [inline] __do_sys_umount fs/namespace.c:2079 [inline] __se_sys_umount fs/namespace.c:2077 [inline] __ia32_sys_umount+0x16b/0x1a0 fs/namespace.c:2077 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff88806befd880 which belongs to the cache mnt_cache of size 336 The buggy address is located 88 bytes inside of freed 336-byte region [ffff88806befd880, ffff88806befd9d0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88806befd6c0 pfn:0x6befc head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff88804a027301 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801c2b1900 ffffea0001a45700 0000000000000004 raw: ffff88806befd6c0 000000008012000c 00000000f5000000 ffff88804a027301 head: 04fff00000000040 ffff88801c2b1900 ffffea0001a45700 0000000000000004 head: ffff88806befd6c0 000000008012000c 00000000f5000000 ffff88804a027301 head: 04fff00000000001 ffffea0001afbf01 ffffffffffffffff 0000000000000000 head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6911, tgid 6910 (syz.1.280), ts 89663788655, free_ts 78836142213 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x181/0x1b0 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x221/0x2470 mm/page_alloc.c:4739 alloc_pages_mpol+0x1fc/0x540 mm/mempolicy.c:2270 alloc_slab_page mm/slub.c:2423 [inline] allocate_slab mm/slub.c:2587 [inline] new_slab+0x23d/0x330 mm/slub.c:2640 ___slab_alloc+0xbfa/0x1600 mm/slub.c:3826 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3916 __slab_alloc_node mm/slub.c:3991 [inline] slab_alloc_node mm/slub.c:4152 [inline] kmem_cache_alloc_noprof+0xeb/0x3b0 mm/slub.c:4171 alloc_vfsmnt+0x23/0x6f0 fs/namespace.c:341 clone_mnt+0x6d/0xf90 fs/namespace.c:1332 copy_tree+0x39e/0x9c0 fs/namespace.c:2209 copy_mnt_ns+0x1b5/0xa70 fs/namespace.c:3998 create_new_namespaces+0xd3/0xad0 kernel/nsproxy.c:78 unshare_nsproxy_namespaces+0xc0/0x1f0 kernel/nsproxy.c:228 ksys_unshare+0x45d/0xa40 kernel/fork.c:3331 __do_sys_unshare kernel/fork.c:3402 [inline] __se_sys_unshare kernel/fork.c:3400 [inline] __ia32_sys_unshare+0x30/0x40 kernel/fork.c:3400 page last free pid 0 tgid 0 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] __free_pages_ok+0x62b/0xe50 mm/page_alloc.c:1271 __folio_put+0x32a/0x450 mm/swap.c:112 skb_kfree_head net/core/skbuff.c:1086 [inline] skb_free_head+0x108/0x1d0 net/core/skbuff.c:1098 skb_release_data+0x560/0x730 net/core/skbuff.c:1125 skb_release_all net/core/skbuff.c:1190 [inline] __kfree_skb net/core/skbuff.c:1204 [inline] consume_skb net/core/skbuff.c:1436 [inline] consume_skb+0xbf/0x100 net/core/skbuff.c:1430 sctp_chunk_destroy net/sctp/sm_make_chunk.c:1503 [inline] sctp_chunk_put+0x1ad/0x2c0 net/sctp/sm_make_chunk.c:1530 sctp_inq_chunk_free net/sctp/inqueue.c:46 [inline] sctp_inq_pop+0x5d4/0xfa0 net/sctp/inqueue.c:141 sctp_assoc_bh_rcv+0x117/0x6f0 net/sctp/associola.c:998 sctp_inq_push+0x1d8/0x270 net/sctp/inqueue.c:88 sctp_rcv+0x14f8/0x3c60 net/sctp/input.c:243 ip_protocol_deliver_rcu+0x441/0x4c0 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x316/0x570 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip_local_deliver+0x18e/0x1f0 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:469 [inline] ip_rcv_finish net/ipv4/ip_input.c:447 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip_rcv+0x2c3/0x5d0 net/ipv4/ip_input.c:567 __netif_receive_skb_one_core+0x199/0x1e0 net/core/dev.c:5828 __netif_receive_skb+0x1d/0x160 net/core/dev.c:5941 Memory state around the buggy address: ffff88806befd780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806befd800: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88806befd880: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806befd900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806befd980: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi