TITLE: KASAN: slab-out-of-bounds Read in f2fs_get_dnode_of_data CORRUPTED: false () SUPPRESSED: false MAINTAINERS (TO): [chao@kernel.org jaegeuk@kernel.org linux-f2fs-devel@lists.sourceforge.net] MAINTAINERS (CC): [linux-kernel@vger.kernel.org] loop1: detected capacity change from 0 to 131072 F2FS-fs (loop1): Mounted with checkpoint version = 1b41e955 ================================================================== BUG: KASAN: slab-out-of-bounds in data_blkaddr fs/f2fs/f2fs.h:3053 [inline] BUG: KASAN: slab-out-of-bounds in f2fs_data_blkaddr fs/f2fs/f2fs.h:3058 [inline] BUG: KASAN: slab-out-of-bounds in f2fs_get_dnode_of_data+0x1a09/0x1c40 fs/f2fs/node.c:855 Read of size 4 at addr ffff8880464770b0 by task repro/9734 CPU: 1 UID: 0 PID: 9734 Comm: repro Not tainted 6.16.0-rc6 #1 PREEMPT(full) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x1c1/0x2a0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x17e/0x800 mm/kasan/report.c:480 kasan_report+0x147/0x180 mm/kasan/report.c:593 data_blkaddr fs/f2fs/f2fs.h:3053 [inline] f2fs_data_blkaddr fs/f2fs/f2fs.h:3058 [inline] f2fs_get_dnode_of_data+0x1a09/0x1c40 fs/f2fs/node.c:855 f2fs_reserve_block+0x53/0x310 fs/f2fs/data.c:1195 prepare_write_begin fs/f2fs/data.c:3395 [inline] f2fs_write_begin+0xf39/0x2190 fs/f2fs/data.c:3594 generic_perform_write+0x2c7/0x910 mm/filemap.c:4112 f2fs_buffered_write_iter fs/f2fs/file.c:4988 [inline] f2fs_file_write_iter+0x1ec8/0x2410 fs/f2fs/file.c:5216 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x546/0xa90 fs/read_write.c:686 ksys_write+0x149/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x3d0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x459a0d Code: c3 e8 b7 23 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 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:00007ffeb41adbd8 EFLAGS: 00000287 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ffeb41ade38 RCX: 0000000000459a0d RDX: 00000000fffffd6e RSI: 0000000020000180 RDI: 0000000000000005 RBP: 00007ffeb41adbf0 R08: 00007ffeb41adbf0 R09: 00007ffeb41adbf0 R10: 0000000000000000 R11: 0000000000000287 R12: 0000000000000001 R13: 00007ffeb41ade28 R14: 00000000004de790 R15: 0000000000000001 Allocated by task 1: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:319 [inline] __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:345 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4148 [inline] slab_alloc_node mm/slub.c:4197 [inline] kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4204 __kernfs_new_node+0xd7/0x7e0 fs/kernfs/dir.c:637 kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:713 kernfs_create_dir_ns+0x44/0x130 fs/kernfs/dir.c:1083 sysfs_create_dir_ns+0x123/0x280 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x40c/0x940 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_init_and_add+0x125/0x190 lib/kobject.c:457 netdev_queue_add_kobject net/core/net-sysfs.c:1976 [inline] netdev_queue_update_kobjects+0x249/0x6c0 net/core/net-sysfs.c:2035 register_queue_kobjects net/core/net-sysfs.c:2098 [inline] netdev_register_kobject+0x236/0x2f0 net/core/net-sysfs.c:2340 register_netdevice+0x126c/0x1ae0 net/core/dev.c:11105 register_netdev+0x40/0x60 net/core/dev.c:11221 ip6gre_init_net+0x271/0x3a0 net/ipv6/ip6_gre.c:1629 ops_init+0x359/0x5c0 net/core/net_namespace.c:138 __register_pernet_operations net/core/net_namespace.c:1284 [inline] register_pernet_operations+0x336/0x800 net/core/net_namespace.c:1361 register_pernet_device+0x2a/0x80 net/core/net_namespace.c:1448 ip6gre_init+0x22/0x120 net/ipv6/ip6_gre.c:2355 do_one_initcall+0x233/0x860 init/main.c:1274 do_initcall_level+0x137/0x1f0 init/main.c:1336 do_initcalls+0x69/0xd0 init/main.c:1352 kernel_init_freeable+0x3d9/0x570 init/main.c:1584 kernel_init+0x1d/0x2a0 init/main.c:1474 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff888046477000 which belongs to the cache kernfs_node_cache of size 176 The buggy address is located 0 bytes to the right of allocated 176-byte region [ffff888046477000, ffff8880464770b0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x46477 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000000 ffff8880404188c0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000110011 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 7313974045, free_ts 6400501225 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704 prep_new_page mm/page_alloc.c:1712 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3669 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419 alloc_slab_page mm/slub.c:2451 [inline] allocate_slab+0x8a/0x3b0 mm/slub.c:2619 new_slab mm/slub.c:2673 [inline] ___slab_alloc+0xbfc/0x1480 mm/slub.c:3859 __slab_alloc mm/slub.c:3949 [inline] __slab_alloc_node mm/slub.c:4024 [inline] slab_alloc_node mm/slub.c:4185 [inline] kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4204 __kernfs_new_node+0xd7/0x7e0 fs/kernfs/dir.c:637 kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:713 kernfs_create_dir_ns+0x44/0x130 fs/kernfs/dir.c:1083 sysfs_create_dir_ns+0x123/0x280 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x40c/0x940 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_init_and_add+0x125/0x190 lib/kobject.c:457 netdev_queue_add_kobject net/core/net-sysfs.c:1976 [inline] netdev_queue_update_kobjects+0x249/0x6c0 net/core/net-sysfs.c:2035 register_queue_kobjects net/core/net-sysfs.c:2098 [inline] netdev_register_kobject+0x236/0x2f0 net/core/net-sysfs.c:2340 register_netdevice+0x126c/0x1ae0 net/core/dev.c:11105 page last free pid 1235 tgid 1235 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1248 [inline] __free_frozen_pages+0xc8e/0xe90 mm/page_alloc.c:2706 kasan_depopulate_vmalloc_pte+0x74/0xa0 mm/kasan/shadow.c:472 apply_to_pte_range mm/memory.c:3032 [inline] apply_to_pmd_range mm/memory.c:3076 [inline] apply_to_pud_range mm/memory.c:3112 [inline] apply_to_p4d_range mm/memory.c:3148 [inline] __apply_to_page_range+0xb8a/0x1360 mm/memory.c:3184 kasan_release_vmalloc+0xa5/0xd0 mm/kasan/shadow.c:593 kasan_release_vmalloc_node mm/vmalloc.c:2249 [inline] purge_vmap_node+0x20f/0x8f0 mm/vmalloc.c:2266 __purge_vmap_area_lazy+0x7a4/0xb40 mm/vmalloc.c:2356 drain_vmap_area_work+0x27/0x40 mm/vmalloc.c:2390 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888046476f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888046477000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888046477080: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 ^ ffff888046477100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888046477180: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 ================================================================== TITLE: kernel panic: KASAN: panic_on_warn set ... CORRUPTED: false () SUPPRESSED: false MAINTAINERS (TO): [chao@kernel.org jaegeuk@kernel.org linux-f2fs-devel@lists.sourceforge.net] MAINTAINERS (CC): [linux-kernel@vger.kernel.org] The buggy address is located 0 bytes to the right of allocated 176-byte region [ffff888046477000, ffff8880464770b0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x46477 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000000 ffff8880404188c0 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000110011 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 7313974045, free_ts 6400501225 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704 prep_new_page mm/page_alloc.c:1712 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3669 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419 alloc_slab_page mm/slub.c:2451 [inline] allocate_slab+0x8a/0x3b0 mm/slub.c:2619 new_slab mm/slub.c:2673 [inline] ___slab_alloc+0xbfc/0x1480 mm/slub.c:3859 __slab_alloc mm/slub.c:3949 [inline] __slab_alloc_node mm/slub.c:4024 [inline] slab_alloc_node mm/slub.c:4185 [inline] kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4204 __kernfs_new_node+0xd7/0x7e0 fs/kernfs/dir.c:637 kernfs_new_node+0x102/0x210 fs/kernfs/dir.c:713 kernfs_create_dir_ns+0x44/0x130 fs/kernfs/dir.c:1083 sysfs_create_dir_ns+0x123/0x280 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x40c/0x940 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_init_and_add+0x125/0x190 lib/kobject.c:457 netdev_queue_add_kobject net/core/net-sysfs.c:1976 [inline] netdev_queue_update_kobjects+0x249/0x6c0 net/core/net-sysfs.c:2035 register_queue_kobjects net/core/net-sysfs.c:2098 [inline] netdev_register_kobject+0x236/0x2f0 net/core/net-sysfs.c:2340 register_netdevice+0x126c/0x1ae0 net/core/dev.c:11105 page last free pid 1235 tgid 1235 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1248 [inline] __free_frozen_pages+0xc8e/0xe90 mm/page_alloc.c:2706 kasan_depopulate_vmalloc_pte+0x74/0xa0 mm/kasan/shadow.c:472 apply_to_pte_range mm/memory.c:3032 [inline] apply_to_pmd_range mm/memory.c:3076 [inline] apply_to_pud_range mm/memory.c:3112 [inline] apply_to_p4d_range mm/memory.c:3148 [inline] __apply_to_page_range+0xb8a/0x1360 mm/memory.c:3184 kasan_release_vmalloc+0xa5/0xd0 mm/kasan/shadow.c:593 kasan_release_vmalloc_node mm/vmalloc.c:2249 [inline] purge_vmap_node+0x20f/0x8f0 mm/vmalloc.c:2266 __purge_vmap_area_lazy+0x7a4/0xb40 mm/vmalloc.c:2356 drain_vmap_area_work+0x27/0x40 mm/vmalloc.c:2390 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888046476f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888046477000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888046477080: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 ^ ffff888046477100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888046477180: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00 ================================================================== Kernel panic - not syncing: KASAN: panic_on_warn set ... CPU: 1 UID: 0 PID: 9734 Comm: repro Not tainted 6.16.0-rc6 #1 PREEMPT(full) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x1c1/0x2a0 lib/dump_stack.c:120 panic+0x2db/0x790 kernel/panic.c:382 check_panic_on_warn+0x89/0xb0 kernel/panic.c:273 end_report+0x78/0x160 mm/kasan/report.c:227 kasan_report+0x158/0x180 mm/kasan/report.c:595 data_blkaddr fs/f2fs/f2fs.h:3053 [inline] f2fs_data_blkaddr fs/f2fs/f2fs.h:3058 [inline] f2fs_get_dnode_of_data+0x1a09/0x1c40 fs/f2fs/node.c:855 f2fs_reserve_block+0x53/0x310 fs/f2fs/data.c:1195 prepare_write_begin fs/f2fs/data.c:3395 [inline] f2fs_write_begin+0xf39/0x2190 fs/f2fs/data.c:3594 generic_perform_write+0x2c7/0x910 mm/filemap.c:4112 f2fs_buffered_write_iter fs/f2fs/file.c:4988 [inline] f2fs_file_write_iter+0x1ec8/0x2410 fs/f2fs/file.c:5216 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x546/0xa90 fs/read_write.c:686 ksys_write+0x149/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x3d0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x459a0d Code: c3 e8 b7 23 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 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:00007ffeb41adbd8 EFLAGS: 00000287 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ffeb41ade38 RCX: 0000000000459a0d RDX: 00000000fffffd6e RSI: 0000000020000180 RDI: 0000000000000005 RBP: 00007ffeb41adbf0 R08: 00007ffeb41adbf0 R09: 00007ffeb41adbf0 R10: 0000000000000000 R11: 0000000000000287 R12: 0000000000000001 R13: 00007ffeb41ade28 R14: 00000000004de790 R15: 0000000000000001 Kernel Offset: disabled Rebooting in 86400 seconds..