ubi0: attaching mtd0 ubi0: scanning is finished ================================================================== BUG: KASAN: slab-out-of-bounds in notifier_chain_register+0x528/0x61a kernel/notifier.c:27 Read of size 4 at addr ff6000001de798e0 by task syz.1.6515/21975 CPU: 1 UID: 0 PID: 21975 Comm: syz.1.6515 Not tainted 6.13.0-rc3-syzkaller-g6f6ecce59d99 #0 Hardware name: riscv-virtio,qemu (DT) Call Trace: [] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:132 [] show_stack+0x30/0x3c arch/riscv/kernel/stacktrace.c:138 [] __dump_stack lib/dump_stack.c:94 [inline] [] dump_stack_lvl+0x12e/0x1a6 lib/dump_stack.c:120 [] print_address_description mm/kasan/report.c:378 [inline] [] print_report+0x28e/0x5aa mm/kasan/report.c:489 [] kasan_report+0xec/0x118 mm/kasan/report.c:602 [] __asan_report_load4_noabort+0x12/0x1a mm/kasan/report_generic.c:380 [] notifier_chain_register+0x528/0x61a kernel/notifier.c:27 [] __blocking_notifier_chain_register kernel/notifier.c:264 [inline] [] blocking_notifier_chain_register+0x80/0xc6 kernel/notifier.c:282 [] register_reboot_notifier+0x22/0x2c kernel/reboot.c:118 [] ubi_wl_init+0xd0a/0x15c2 drivers/mtd/ubi/wl.c:1960 [] ubi_attach+0x15da/0x4f90 drivers/mtd/ubi/attach.c:1605 [] ubi_attach_mtd_dev+0x14d8/0x3646 drivers/mtd/ubi/build.c:1004 [] ctrl_cdev_ioctl+0x496/0x764 drivers/mtd/ubi/cdev.c:1043 [] vfs_ioctl fs/ioctl.c:51 [inline] [] __do_sys_ioctl fs/ioctl.c:906 [inline] [] __se_sys_ioctl fs/ioctl.c:892 [inline] [] __riscv_sys_ioctl+0x18e/0x1e2 fs/ioctl.c:892 [] syscall_handler+0x94/0x118 arch/riscv/include/asm/syscall.h:90 [] do_trap_ecall_u+0x1aa/0x216 arch/riscv/kernel/traps.c:331 [] handle_exception+0x146/0x152 arch/riscv/kernel/entry.S:197 Allocated by task 20251: stack_trace_save+0xa0/0xd2 kernel/stacktrace.c:122 kasan_save_stack+0x3e/0x6a mm/kasan/common.c:47 kasan_save_track+0x16/0x28 mm/kasan/common.c:68 kasan_save_alloc_info+0x30/0x3e mm/kasan/generic.c:568 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xa0/0xa6 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x15e/0x3f4 mm/slub.c:4329 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] mr_table_alloc+0x5e/0x2f0 net/ipv4/ipmr_base.c:41 ip6mr_new_table net/ipv6/ip6mr.c:411 [inline] ip6mr_new_table net/ipv6/ip6mr.c:403 [inline] ip6mr_rules_init net/ipv6/ip6mr.c:254 [inline] ip6mr_net_init net/ipv6/ip6mr.c:1344 [inline] ip6mr_net_init+0x386/0x498 net/ipv6/ip6mr.c:1336 ops_init+0x1cc/0x5b6 net/core/net_namespace.c:138 setup_net+0x262/0x81a net/core/net_namespace.c:362 copy_net_ns+0x274/0x5a8 net/core/net_namespace.c:516 create_new_namespaces+0x36c/0x9f2 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xb2/0x1c6 kernel/nsproxy.c:228 ksys_unshare+0x420/0x98c kernel/fork.c:3334 __do_sys_unshare kernel/fork.c:3405 [inline] __se_sys_unshare kernel/fork.c:3403 [inline] __riscv_sys_unshare+0x34/0x48 kernel/fork.c:3403 syscall_handler+0x94/0x118 arch/riscv/include/asm/syscall.h:90 do_trap_ecall_u+0x1aa/0x216 arch/riscv/kernel/traps.c:331 handle_exception+0x146/0x152 arch/riscv/kernel/entry.S:197 The buggy address belongs to the object at ff6000001de78000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2248 bytes to the right of allocated 4120-byte region [ff6000001de78000, ff6000001de79018) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9de78 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xffe000000000040(head|node=0|zone=0|lastcpupid=0x7ff) page_type: f5(slab) raw: 0ffe000000000040 ff60000011402280 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000020002 00000001f5000000 0000000000000000 head: 0ffe000000000040 ff60000011402280 dead000000000100 dead000000000122 head: 0000000000000000 0000000000020002 00000001f5000000 0000000000000000 head: 0ffe000000000003 ff1c000000779e01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3157, tgid 3157 (sh), ts 205561628200, free_ts 205538228300 __set_page_owner+0xa2/0x70c mm/page_owner.c:320 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xf0/0x1e8 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0xdb0/0x2c0e mm/page_alloc.c:3474 __alloc_pages_noprof+0x1e8/0x1fc2 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0xf8/0x488 mm/mempolicy.c:2269 alloc_pages_noprof+0x174/0x2f0 mm/mempolicy.c:2348 alloc_slab_page mm/slub.c:2423 [inline] allocate_slab mm/slub.c:2589 [inline] new_slab+0x2b6/0x40e mm/slub.c:2642 ___slab_alloc+0x9c8/0x10e6 mm/slub.c:3830 __slab_alloc.constprop.0+0x60/0xb0 mm/slub.c:3920 __slab_alloc_node mm/slub.c:3995 [inline] slab_alloc_node mm/slub.c:4156 [inline] __kmalloc_cache_noprof+0xd4/0x3f4 mm/slub.c:4324 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] tomoyo_print_bprm security/tomoyo/audit.c:26 [inline] tomoyo_init_log+0xcaa/0x1f36 security/tomoyo/audit.c:264 tomoyo_supervisor+0x250/0x1092 security/tomoyo/common.c:2089 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x194/0x202 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0xd92/0x1dfc security/tomoyo/domain.c:881 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:102 [inline] tomoyo_bprm_check_security+0x128/0x1c4 security/tomoyo/tomoyo.c:92 security_bprm_check+0x23a/0x250 security/security.c:1296 page last free pid 3157 tgid 3157 stack trace: __reset_page_owner+0x8c/0x400 mm/page_owner.c:297 reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0x618/0x11d2 mm/page_alloc.c:2657 __free_pages+0x13a/0x1ba mm/page_alloc.c:4838 __free_slab+0xd0/0x176 mm/slub.c:2659 free_slab+0x38/0x1ae mm/slub.c:2682 discard_slab mm/slub.c:2688 [inline] __put_partials+0x174/0x1de mm/slub.c:3157 put_cpu_partial+0x17c/0x296 mm/slub.c:3232 __slab_free+0x112/0x3f6 mm/slub.c:4483 do_slab_free mm/slub.c:4565 [inline] ___cache_free+0x1a4/0x1de mm/slub.c:4671 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x76/0x168 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x158/0x1ba mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x5c/0x82 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4119 [inline] slab_alloc_node mm/slub.c:4168 [inline] __do_kmalloc_node mm/slub.c:4297 [inline] __kmalloc_noprof+0x216/0x5ba mm/slub.c:4310 kmalloc_noprof include/linux/slab.h:905 [inline] tomoyo_add_entry security/tomoyo/common.c:2023 [inline] tomoyo_supervisor+0x364/0x1092 security/tomoyo/common.c:2095 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x194/0x202 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0xd92/0x1dfc security/tomoyo/domain.c:881 Memory state around the buggy address: ff6000001de79780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ff6000001de79800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ff6000001de79880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ff6000001de79900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ff6000001de79980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================