syzbot


KASAN: use-after-free Read in nilfs_test_metadata_dirty

Status: closed as dup on 2022/10/04 08:41
Reported-by: syzbot+2ff4a42302a8dd97efc6@syzkaller.appspotmail.com
First crash: 59d, last: 39d

Cause bisection: failed (bisect log)
Duplicate of (1):
Title Repro Cause bisect Fix bisect Count Last Reported
KASAN: use-after-free Read in nilfs_segctor_confirm C inconclusive 19 40d 58d

Sample crash report:
loop0: detected capacity change from 0 to 2048
==================================================================
BUG: KASAN: use-after-free in nilfs_test_metadata_dirty+0x39/0x210 fs/nilfs2/segment.c:813
Read of size 8 at addr ffff8881481f7830 by task syz-executor899/3606

CPU: 0 PID: 3606 Comm: syz-executor899 Not tainted 6.0.0-syzkaller-09423-g493ffd6605b2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106
 print_address_description+0x65/0x4b0 mm/kasan/report.c:317
 print_report+0x108/0x1f0 mm/kasan/report.c:433
 kasan_report+0xc3/0xf0 mm/kasan/report.c:495
 nilfs_test_metadata_dirty+0x39/0x210 fs/nilfs2/segment.c:813
 nilfs_segctor_confirm+0x78/0x2d0 fs/nilfs2/segment.c:837
 nilfs_segctor_destroy fs/nilfs2/segment.c:2729 [inline]
 nilfs_detach_log_writer+0x4c1/0xbd0 fs/nilfs2/segment.c:2810
 nilfs_put_super+0x4b/0x150 fs/nilfs2/super.c:468
 generic_shutdown_super+0x130/0x310 fs/super.c:491
 kill_block_super+0x79/0xd0 fs/super.c:1427
 deactivate_locked_super+0xa7/0xf0 fs/super.c:331
 cleanup_mnt+0x4ce/0x560 fs/namespace.c:1186
 task_work_run+0x146/0x1c0 kernel/task_work.c:177
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x6b2/0x2280 kernel/exit.c:813
 do_group_exit+0x1fd/0x2b0 kernel/exit.c:943
 __do_sys_exit_group kernel/exit.c:954 [inline]
 __se_sys_exit_group kernel/exit.c:952 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:952
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fb697378bc9
Code: Unable to access opcode bytes at 0x7fb697378b9f.
RSP: 002b:00007ffc8e794e08 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007fb6973f0330 RCX: 00007fb697378bc9
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001
RBP: 0000000000000001 R08: ffffffffffffffc0 R09: 00007fb6973eae40
R10: 00007ffc8e794d20 R11: 0000000000000246 R12: 00007fb6973f0330
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
 </TASK>

Allocated by task 3606:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:437 [inline]
 ____kasan_kmalloc+0xcd/0x100 mm/kasan/common.c:516
 kasan_kmalloc include/linux/kasan.h:234 [inline]
 kmem_cache_alloc_trace+0x97/0x310 mm/slub.c:3289
 kmalloc include/linux/slab.h:600 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 nilfs_find_or_create_root+0x142/0x4f0 fs/nilfs2/the_nilfs.c:747
 nilfs_attach_checkpoint+0xcd/0x4a0 fs/nilfs2/super.c:519
 nilfs_fill_super+0x2e8/0x5d0 fs/nilfs2/super.c:1064
 nilfs_mount+0x613/0x9b0 fs/nilfs2/super.c:1317
 legacy_get_tree+0xea/0x180 fs/fs_context.c:610
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x289/0xad0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d3/0x3c0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 3606:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x3d/0x60 mm/kasan/common.c:45
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:367
 kasan_slab_free include/linux/kasan.h:200 [inline]
 slab_free_hook mm/slub.c:1759 [inline]
 slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1785
 slab_free mm/slub.c:3539 [inline]
 kfree+0xda/0x210 mm/slub.c:4567
 nilfs_evict_inode+0xe5/0x3d0 fs/nilfs2/inode.c:908
 evict+0x2a4/0x620 fs/inode.c:664
 dispose_list fs/inode.c:697 [inline]
 evict_inodes+0x658/0x700 fs/inode.c:747
 generic_shutdown_super+0x94/0x310 fs/super.c:479
 kill_block_super+0x79/0xd0 fs/super.c:1427
 deactivate_locked_super+0xa7/0xf0 fs/super.c:331
 cleanup_mnt+0x4ce/0x560 fs/namespace.c:1186
 task_work_run+0x146/0x1c0 kernel/task_work.c:177
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x6b2/0x2280 kernel/exit.c:813
 do_group_exit+0x1fd/0x2b0 kernel/exit.c:943
 __do_sys_exit_group kernel/exit.c:954 [inline]
 __se_sys_exit_group kernel/exit.c:952 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:952
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Last potentially related work creation:
 kasan_save_stack+0x2b/0x50 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348
 call_rcu+0x163/0x970 kernel/rcu/tree.c:2796
 fib_create_info+0x18d0/0x2410 net/ipv4/fib_semantics.c:1580
 fib_table_insert+0x1e5/0x1f50 net/ipv4/fib_trie.c:1236
 fib_magic+0x451/0x650 net/ipv4/fib_frontend.c:1098
 fib_add_ifaddr+0x143/0x5c0 net/ipv4/fib_frontend.c:1120
 fib_netdev_event+0x628/0x740 net/ipv4/fib_frontend.c:1480
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0xe7/0x170 kernel/notifier.c:455
 __dev_notify_flags+0x2ef/0x5d0
 dev_change_flags+0xe3/0x190 net/core/dev.c:8615
 devinet_ioctl+0x8cb/0x1a70 net/ipv4/devinet.c:1146
 inet_ioctl+0x314/0x3f0 net/ipv4/af_inet.c:968
 sock_do_ioctl net/socket.c:1169 [inline]
 sock_ioctl+0x53c/0x8d0 net/socket.c:1286
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff8881481f7800
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 48 bytes inside of
 256-byte region [ffff8881481f7800, ffff8881481f7900)

The buggy address belongs to the physical page:
page:ffffea0005207d80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1481f6
head:ffffea0005207d80 order:1 compound_mapcount:0 compound_pincount:0
flags: 0x57ff00000010200(slab|head|node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000010200 0000000000000000 dead000000000001 ffff888012041b40
raw: 0000000000000000 0000000000100010 00000001ffffffff 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 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 11317143355, free_ts 0
 prep_new_page mm/page_alloc.c:2532 [inline]
 get_page_from_freelist+0x742/0x7c0 mm/page_alloc.c:4283
 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2103
 alloc_slab_page+0x70/0xf0 mm/slub.c:1829
 allocate_slab+0x5e/0x520 mm/slub.c:1974
 new_slab mm/slub.c:2034 [inline]
 ___slab_alloc+0x3ee/0xc40 mm/slub.c:3036
 __slab_alloc mm/slub.c:3123 [inline]
 slab_alloc_node mm/slub.c:3214 [inline]
 slab_alloc mm/slub.c:3256 [inline]
 __kmalloc+0x2bd/0x370 mm/slub.c:4425
 kmalloc include/linux/slab.h:605 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 tomoyo_init_log+0x1a16/0x1f80 security/tomoyo/audit.c:275
 tomoyo_supervisor+0x38d/0x14f0 security/tomoyo/common.c:2088
 tomoyo_audit_mkdev_log security/tomoyo/file.c:197 [inline]
 tomoyo_mkdev_perm+0x479/0x7c0 security/tomoyo/file.c:885
 tomoyo_path_mknod+0x12c/0x1b0 security/tomoyo/tomoyo.c:229
 security_path_mknod+0xdc/0x160 security/security.c:1152
 init_mknod+0x1ed/0x318 fs/init.c:158
 initrd_load+0x22/0xc8 init/do_mounts_initrd.c:147
 prepare_namespace+0x6d/0x22d init/do_mounts.c:631
 kernel_init_freeable+0x432/0x57b init/main.c:1636
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881481f7700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881481f7780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881481f7800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff8881481f7880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881481f7900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (61):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-upstream-fs 2022/10/16 11:20 upstream 493ffd6605b2 67cb024c .config log report syz C KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/06 11:43 upstream 2bca25eaeba6 2c6543ad .config log report syz C KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/03 23:50 upstream 4fe89d07dcc2 feb56351 .config log report syz C KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/01 14:20 upstream ffb4d94b4314 feb56351 .config log report syz C KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/01 14:01 upstream ffb4d94b4314 feb56351 .config log report syz C KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/09/30 23:24 upstream 70575e77839f feb56351 .config log report syz C KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/21 05:27 upstream 493ffd6605b2 a0fd4dab .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/20 01:36 upstream 493ffd6605b2 b31320fc .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/19 18:30 upstream 493ffd6605b2 b31320fc .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/19 16:23 upstream 493ffd6605b2 b31320fc .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/19 10:22 upstream 493ffd6605b2 b31320fc .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/19 08:00 upstream 493ffd6605b2 b31320fc .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/19 04:41 upstream 493ffd6605b2 b31320fc .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/18 09:40 upstream 493ffd6605b2 94744d21 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/18 08:31 upstream 493ffd6605b2 94744d21 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/18 05:35 upstream 493ffd6605b2 94744d21 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/18 00:12 upstream 493ffd6605b2 94744d21 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/17 21:54 upstream 493ffd6605b2 94744d21 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/17 06:47 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/17 02:06 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/17 00:19 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/16 04:24 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/16 02:43 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/15 19:31 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/15 13:23 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/15 11:51 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/15 11:47 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/15 06:55 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/15 03:36 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/15 02:26 upstream 493ffd6605b2 67cb024c .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/14 19:23 upstream 493ffd6605b2 4954e4b2 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/14 12:10 upstream 493ffd6605b2 4954e4b2 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/14 04:37 upstream 493ffd6605b2 4954e4b2 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/13 19:02 upstream 493ffd6605b2 adf90437 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/12 10:31 upstream 493ffd6605b2 02b6492e .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/11 18:54 upstream 493ffd6605b2 02b6492e .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/11 18:40 upstream 493ffd6605b2 02b6492e .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/11 13:54 upstream 493ffd6605b2 5bcf0c31 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/09 20:31 upstream a6afa4199d3d aea5da89 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/09 12:44 upstream a6afa4199d3d aea5da89 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/09 08:39 upstream a6afa4199d3d aea5da89 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/08 18:05 upstream 62e6e5940c0c aea5da89 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci-upstream-kasan-gce-smack-root 2022/10/08 17:38 upstream e8bc52cb8df8 aea5da89 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/08 16:55 upstream 62e6e5940c0c aea5da89 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/08 16:08 upstream 62e6e5940c0c aea5da89 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/06 13:02 upstream 2bca25eaeba6 2c6543ad .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/06 03:03 upstream 2bca25eaeba6 2c6543ad .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/05 23:53 upstream 2bca25eaeba6 2c6543ad .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/05 07:40 upstream 0326074ff465 267e3bb1 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/05 00:55 upstream 4fe89d07dcc2 eab8f949 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/04 08:08 upstream 4fe89d07dcc2 feb56351 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/02 14:28 upstream b357fd1c2afc feb56351 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/02 12:18 upstream b357fd1c2afc feb56351 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/02 06:35 upstream ffb4d94b4314 feb56351 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/01 21:44 upstream ffb4d94b4314 feb56351 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/10/01 07:24 upstream 70575e77839f feb56351 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
ci2-upstream-fs 2022/09/30 23:06 upstream 70575e77839f feb56351 .config log report info KASAN: use-after-free Read in nilfs_test_metadata_dirty
* Struck through repros no longer work on HEAD.