syzbot


KASAN: use-after-free Read in btrfs_mount

Status: auto-closed as invalid on 2020/02/08 08:17
Reported-by: syzbot+c823e75c46ccba66a795@syzkaller.appspotmail.com
First crash: 1825d, last: 1825d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in btrfs_mount (2) C error 13 1032d 1568d 0/1 upstream: reported C repro on 2020/06/23 11:09

Sample crash report:
ptrace attach of "/root/syz-executor.3"[12471] was attempted by "/root/syz-executor.3"[12472]
==================================================================
BUG: KASAN: use-after-free in free_fs_info fs/btrfs/ctree.h:2959 [inline]
BUG: KASAN: use-after-free in btrfs_mount+0x2a45/0x2b28 fs/btrfs/super.c:1644
Read of size 8 at addr ffff88805696ac90 by task syz-executor.0/12447

CPU: 1 PID: 12447 Comm: syz-executor.0 Not tainted 4.14.148 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x197 lib/dump_stack.c:53
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 free_fs_info fs/btrfs/ctree.h:2959 [inline]
 btrfs_mount+0x2a45/0x2b28 fs/btrfs/super.c:1644
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount+0x40/0x60 fs/namespace.c:1036
 mount_subvol fs/btrfs/super.c:1392 [inline]
 btrfs_mount+0x3ce/0x2b28 fs/btrfs/super.c:1563
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0x417/0x27d0 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xab/0x120 fs/namespace.c:3072
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45c4aa
RSP: 002b:00007f5bea504a88 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f5bea504b40 RCX: 000000000045c4aa
RDX: 00007f5bea504ae0 RSI: 0000000020000080 RDI: 00007f5bea504b00
RBP: 0000000000000001 R08: 00007f5bea504b40 R09: 00007f5bea504ae0
R10: 0000000000000009 R11: 0000000000000206 R12: 0000000000000004
R13: 00000000004c8da6 R14: 00000000004e0200 R15: 0000000000000003

Allocated by task 12447:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node+0x51/0x80 mm/slab.c:3689
 kmalloc_node include/linux/slab.h:530 [inline]
 kvmalloc_node+0x93/0xe0 mm/util.c:397
 kvmalloc include/linux/mm.h:531 [inline]
 kvzalloc include/linux/mm.h:539 [inline]
 btrfs_mount+0xf88/0x2b28 fs/btrfs/super.c:1584
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount+0x40/0x60 fs/namespace.c:1036
 mount_subvol fs/btrfs/super.c:1392 [inline]
 btrfs_mount+0x3ce/0x2b28 fs/btrfs/super.c:1563
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0x417/0x27d0 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xab/0x120 fs/namespace.c:3072
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 12447:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcc/0x270 mm/slab.c:3815
 kvfree+0x4d/0x60 mm/util.c:416
 free_fs_info fs/btrfs/ctree.h:2972 [inline]
 btrfs_kill_super+0x421/0x540 fs/btrfs/super.c:2140
 deactivate_locked_super+0x74/0xe0 fs/super.c:319
 sget_userns+0x9d9/0xc30 fs/super.c:537
 sget+0xd6/0x120 fs/super.c:572
 btrfs_mount+0x1274/0x2b28 fs/btrfs/super.c:1610
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount+0x40/0x60 fs/namespace.c:1036
 mount_subvol fs/btrfs/super.c:1392 [inline]
 btrfs_mount+0x3ce/0x2b28 fs/btrfs/super.c:1563
 mount_fs+0x97/0x2a1 fs/super.c:1237
 vfs_kern_mount.part.0+0x5e/0x3d0 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0x417/0x27d0 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xab/0x120 fs/namespace.c:3072
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8880569693c0
 which belongs to the cache kmalloc-16384 of size 16384
The buggy address is located 6352 bytes inside of
 16384-byte region [ffff8880569693c0, ffff88805696d3c0)
The buggy address belongs to the page:
page:ffffea00015a5a00 count:1 mapcount:0 mapping:ffff8880569693c0 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff8880569693c0 0000000000000000 0000000100000001
raw: ffffea00018cc020 ffffea00016bce20 ffff8880aa802200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88805696ab80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805696ac00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805696ac80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88805696ad00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805696ad80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
ptrace attach of "/root/syz-executor.3"[12484] was attempted by "/root/syz-executor.3"[12485]

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/10/11 08:16 linux-4.14.y 42327896f194 1a3bad90 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.