syzbot


KASAN: use-after-free Read in nilfs_segctor_sync

Status: upstream: reported C repro on 2022/11/02 14:31
Reported-by: syzbot+c267f64d1e972c68f8fa@syzkaller.appspotmail.com
First crash: 540d, last: 429d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in nilfs_segctor_sync nilfs C error 3 532d 542d 22/26 fixed on 2023/02/24 13:50
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/02/21 10:35 33m bisect fix linux-4.14.y job log (0) log
2023/01/21 07:54 24m bisect fix linux-4.14.y job log (0) log

Sample crash report:
Remounting filesystem read-only
NILFS (loop3): segctord starting. Construction interval = 5 seconds, CP frequency < 30 seconds
NILFS (loop3): mounting fs with errors
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x2c57/0x3f20 kernel/locking/lockdep.c:3369
Read of size 8 at addr ffff88809a05d3a8 by task syz-executor178/8003
NILFS (loop2): mounting fs with errors

NILFS (loop2): segctord starting. Construction interval = 5 seconds, CP frequency < 30 seconds
CPU: 1 PID: 8003 Comm: syz-executor178 Not tainted 4.14.297-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
 __lock_acquire+0x2c57/0x3f20 kernel/locking/lockdep.c:3369
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160
 finish_wait+0xb2/0x260 kernel/sched/wait.c:376
 nilfs_segctor_sync+0x1e6/0x250 fs/nilfs2/segment.c:2210
 nilfs_construct_segment+0xab/0x120 fs/nilfs2/segment.c:2265
 nilfs_transaction_commit+0x7bb/0xae0 fs/nilfs2/segment.c:299
 nilfs_evict_inode+0x2be/0x3a0 fs/nilfs2/inode.c:967
 evict+0x2c8/0x700 fs/inode.c:554
 iput_final fs/inode.c:1523 [inline]
 iput+0x458/0x7e0 fs/inode.c:1550
 dentry_unlink_inode+0x25c/0x310 fs/dcache.c:387
 d_delete+0x1c5/0x280 fs/dcache.c:2417
 vfs_rmdir.part.0+0x260/0x390 fs/namei.c:3922
 vfs_rmdir fs/namei.c:3895 [inline]
 do_rmdir+0x334/0x3c0 fs/namei.c:3970
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Allocated by task 8003:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 nilfs_segctor_new fs/nilfs2/segment.c:2673 [inline]
 nilfs_attach_log_writer+0x127/0x970 fs/nilfs2/segment.c:2802
 nilfs_fill_super fs/nilfs2/super.c:1088 [inline]
 nilfs_mount+0x95b/0xd00 fs/nilfs2/super.c:1332
 mount_fs+0x92/0x2a0 fs/super.c:1237
 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2572 [inline]
 do_mount+0xe65/0x2a30 fs/namespace.c:2905
 SYSC_mount fs/namespace.c:3121 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3098
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 8032:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 nilfs_segctor_destroy fs/nilfs2/segment.c:2772 [inline]
 nilfs_detach_log_writer+0x56f/0x980 fs/nilfs2/segment.c:2829
 nilfs_attach_log_writer+0xcb/0x970 fs/nilfs2/segment.c:2799
 nilfs_remount+0x326/0x470 fs/nilfs2/super.c:1186
 do_remount_sb+0x150/0x530 fs/super.c:868
 do_remount fs/namespace.c:2393 [inline]
 do_mount+0x15f3/0x2a30 fs/namespace.c:2896
 SYSC_mount fs/namespace.c:3121 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3098
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

The buggy address belongs to the object at ffff88809a05d200
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 424 bytes inside of
 1024-byte region [ffff88809a05d200, ffff88809a05d600)
The buggy address belongs to the page:
page:ffffea0002681700 count:1 mapcount:0 mapping:ffff88809a05c000 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff88809a05c000 0000000000000000 0000000100000007
raw: ffffea000277b520 ffffea000268f920 ffff88813fe74ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809a05d280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809a05d300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809a05d380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff88809a05d400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809a05d480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/11/02 14:30 linux-4.14.y a85772d7ba90 08977f5d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: use-after-free Read in nilfs_segctor_sync
* Struck through repros no longer work on HEAD.