syzbot


KASAN: use-after-free Read in getname_kernel

Status: auto-closed as invalid on 2019/02/22 10:34
Subsystems: btrfs
[Documentation on labels]
Reported-by: syzbot+abf707d7ccbb3244f34e@syzkaller.appspotmail.com
First crash: 2423d, last: 2423d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in getname_kernel 1 (2) 2018/06/11 17:38

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:345 [inline]
BUG: KASAN: use-after-free in getname_kernel+0x123/0x370 fs/namei.c:241
Read of size 11 at addr ffff8801d8053310 by task syz-executor5/15925

CPU: 0 PID: 15925 Comm: syz-executor5 Not tainted 4.17.0+ #94
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 memcpy+0x23/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:345 [inline]
 getname_kernel+0x123/0x370 fs/namei.c:241
 kern_path+0x1e/0x40 fs/namei.c:2410
 lookup_bdev+0xfa/0x240 fs/block_dev.c:2084
 blkdev_get_by_path+0x1f/0xe0 fs/block_dev.c:1687
 btrfs_get_bdev_and_sb+0x38/0x300 fs/btrfs/volumes.c:392
 btrfs_open_one_device fs/btrfs/volumes.c:695 [inline]
 open_fs_devices+0x6a5/0xc60 fs/btrfs/volumes.c:1112
 btrfs_open_devices+0xc0/0xd0 fs/btrfs/volumes.c:1155
 btrfs_mount_root+0x91f/0x1e70 fs/btrfs/super.c:1568
 mount_fs+0xae/0x328 fs/super.c:1277
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount+0x40/0x60 fs/namespace.c:1027
 btrfs_mount+0x4a1/0x213e fs/btrfs/super.c:1661
 mount_fs+0xae/0x328 fs/super.c:1277
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2518 [inline]
 do_mount+0x564/0x30b0 fs/namespace.c:2848
 ksys_mount+0x12d/0x140 fs/namespace.c:3064
 __do_sys_mount fs/namespace.c:3078 [inline]
 __se_sys_mount fs/namespace.c:3075 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45842a
Code: b8 a6 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 dd 8f fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 ba 8f fb ff c3 66 0f 1f 84 00 00 00 00 00 
RSP: 002b:00007fe10e408ba8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000080 RCX: 000000000045842a
RDX: 0000000020000080 RSI: 0000000020000100 RDI: 00007fe10e408bf0
RBP: 0000000000000001 R08: 0000000020000240 R09: 0000000020000080
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000014
R13: 0000000000000001 R14: 00000000004d2bc0 R15: 0000000000000000

Allocated by task 15908:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc mm/slab.c:3718 [inline]
 __kmalloc+0x14e/0x760 mm/slab.c:3727
 kmalloc include/linux/slab.h:518 [inline]
 kzalloc include/linux/slab.h:706 [inline]
 rcu_string_strdup fs/btrfs/rcu-string.h:17 [inline]
 btrfs_prepare_close_one_device fs/btrfs/volumes.c:1031 [inline]
 close_fs_devices+0x497/0xfa0 fs/btrfs/volumes.c:1052
 btrfs_close_devices+0x29/0x150 fs/btrfs/volumes.c:1085
 open_ctree+0x589/0x7898 fs/btrfs/disk-io.c:3358
 btrfs_fill_super fs/btrfs/super.c:1202 [inline]
 btrfs_mount_root+0x16df/0x1e70 fs/btrfs/super.c:1593
 mount_fs+0xae/0x328 fs/super.c:1277
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount+0x40/0x60 fs/namespace.c:1027
 btrfs_mount+0x4a1/0x213e fs/btrfs/super.c:1661
 mount_fs+0xae/0x328 fs/super.c:1277
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2518 [inline]
 do_mount+0x564/0x30b0 fs/namespace.c:2848
 ksys_mount+0x12d/0x140 fs/namespace.c:3064
 __do_sys_mount fs/namespace.c:3078 [inline]
 __se_sys_mount fs/namespace.c:3075 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 15922:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 __rcu_reclaim kernel/rcu/rcu.h:173 [inline]
 rcu_do_batch kernel/rcu/tree.c:2558 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2818 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2785 [inline]
 rcu_process_callbacks+0xfc5/0x1760 kernel/rcu/tree.c:2802
 __do_softirq+0x2e0/0xaf5 kernel/softirq.c:284

The buggy address belongs to the object at ffff8801d8053300
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 16 bytes inside of
 32-byte region [ffff8801d8053300, ffff8801d8053320)
The buggy address belongs to the page:
page:ffffea00076014c0 count:1 mapcount:0 mapping:ffff8801da8001c0 index:0xffff8801d8053fc1
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00075f2f08 ffffea00075a9a08 ffff8801da8001c0
raw: ffff8801d8053fc1 ffff8801d8053000 0000000100000011 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d8053200: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d8053280: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8801d8053300: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                         ^
 ffff8801d8053380: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d8053400: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/06/10 14:00 upstream 3ca24ce9ff76 866118af .config console log report ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.