syzbot


KASAN: slab-use-after-free Read in btrfs_open_devices

Status: auto-obsoleted due to no activity on 2023/09/24 10:48
Subsystems: btrfs
[Documentation on labels]
Reported-by: syzbot+26860029a4d562566231@syzkaller.appspotmail.com
First crash: 321d, last: 313d
Cause bisection: introduced by (bisect log) :
commit 066d64b26a21a5b5c500a30f27f3e4b1959aac9e
Author: Christoph Hellwig <hch@lst.de>
Date: Wed Aug 2 15:41:23 2023 +0000

  btrfs: open block devices after superblock creation

Crash: KASAN: slab-use-after-free Read in btrfs_open_devices (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] [btrfs?] KASAN: slab-use-after-free Read in btrfs_open_devices 4 (6) 2023/08/08 17:38
Re: [syzbot] [btrfs?] KASAN: slab-use-after-free Read in btrfs_open_devices 1 (1) 2023/08/08 17:22
Last patch testing requests (8)
Created Duration User Patch Repo Result
2023/09/01 21:00 1h34m retest repro linux-next OK log
2023/09/01 21:00 40m retest repro linux-next OK log
2023/08/10 14:12 30m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git f7dc24b34138 OK log
2023/08/10 12:46 13m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git f7dc24b34138 report log
2023/08/10 10:46 14m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git f7dc24b34138 report log
2023/08/09 11:03 21m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git f7dc24b34138 report log
2023/08/08 23:23 13m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git f7dc24b34138 report log
2023/08/08 14:08 16m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git f7dc24b34138 report log

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in btrfs_open_devices+0xb8/0xc0 fs/btrfs/volumes.c:1281
Read of size 4 at addr ffff888021788130 by task syz-executor375/5071

CPU: 1 PID: 5071 Comm: syz-executor375 Not tainted 6.5.0-rc5-next-20230809-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xc4/0x620 mm/kasan/report.c:475
 kasan_report+0xda/0x110 mm/kasan/report.c:588
 btrfs_open_devices+0xb8/0xc0 fs/btrfs/volumes.c:1281
 btrfs_mount_root+0x681/0xda0 fs/btrfs/super.c:1505
 legacy_get_tree+0x109/0x220 fs/fs_context.c:611
 vfs_get_tree+0x88/0x350 fs/super.c:1544
 fc_mount fs/namespace.c:1112 [inline]
 vfs_kern_mount.part.0+0xcb/0x170 fs/namespace.c:1142
 vfs_kern_mount+0x3f/0x60 fs/namespace.c:1129
 btrfs_mount+0x292/0xb10 fs/btrfs/super.c:1578
 legacy_get_tree+0x109/0x220 fs/fs_context.c:611
 vfs_get_tree+0x88/0x350 fs/super.c:1544
 do_new_mount fs/namespace.c:3335 [inline]
 path_mount+0x1492/0x1ed0 fs/namespace.c:3662
 do_mount fs/namespace.c:3675 [inline]
 __do_sys_mount fs/namespace.c:3884 [inline]
 __se_sys_mount fs/namespace.c:3861 [inline]
 __x64_sys_mount+0x293/0x310 fs/namespace.c:3861
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fdff6d3cf9a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007ffc9bed0318 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc9bed0330 RCX: 00007fdff6d3cf9a
RDX: 0000000020005100 RSI: 0000000020005140 RDI: 00007ffc9bed0330
RBP: 0000000000000004 R08: 00007ffc9bed0370 R09: 0000000000005103
R10: 0000000000000016 R11: 0000000000000282 R12: 0000000000000016
R13: 00007ffc9bed0370 R14: 0000000000000003 R15: 0000000001000000
 </TASK>

Allocated by task 5071:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:599 [inline]
 kzalloc include/linux/slab.h:720 [inline]
 alloc_fs_devices+0x54/0x2b0 fs/btrfs/volumes.c:375
 device_list_add.constprop.0+0x3eb/0x1db0 fs/btrfs/volumes.c:807
 btrfs_scan_one_device+0x1b7/0x2a0 fs/btrfs/volumes.c:1405
 btrfs_mount_root+0x4a8/0xda0 fs/btrfs/super.c:1482
 legacy_get_tree+0x109/0x220 fs/fs_context.c:611
 vfs_get_tree+0x88/0x350 fs/super.c:1544
 fc_mount fs/namespace.c:1112 [inline]
 vfs_kern_mount.part.0+0xcb/0x170 fs/namespace.c:1142
 vfs_kern_mount+0x3f/0x60 fs/namespace.c:1129
 btrfs_mount+0x292/0xb10 fs/btrfs/super.c:1578
 legacy_get_tree+0x109/0x220 fs/fs_context.c:611
 vfs_get_tree+0x88/0x350 fs/super.c:1544
 do_new_mount fs/namespace.c:3335 [inline]
 path_mount+0x1492/0x1ed0 fs/namespace.c:3662
 do_mount fs/namespace.c:3675 [inline]
 __do_sys_mount fs/namespace.c:3884 [inline]
 __se_sys_mount fs/namespace.c:3861 [inline]
 __x64_sys_mount+0x293/0x310 fs/namespace.c:3861
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 5070:
 kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x15e/0x1b0 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1800 [inline]
 slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826
 slab_free mm/slub.c:3809 [inline]
 __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822
 btrfs_close_devices+0x4cd/0x610 fs/btrfs/volumes.c:1207
 open_ctree+0x1c1/0x5710 fs/btrfs/disk-io.c:3612
 btrfs_fill_super fs/btrfs/super.c:1158 [inline]
 btrfs_mount_root+0x976/0xda0 fs/btrfs/super.c:1520
 legacy_get_tree+0x109/0x220 fs/fs_context.c:611
 vfs_get_tree+0x88/0x350 fs/super.c:1544
 fc_mount fs/namespace.c:1112 [inline]
 vfs_kern_mount.part.0+0xcb/0x170 fs/namespace.c:1142
 vfs_kern_mount+0x3f/0x60 fs/namespace.c:1129
 btrfs_mount+0x292/0xb10 fs/btrfs/super.c:1578
 legacy_get_tree+0x109/0x220 fs/fs_context.c:611
 vfs_get_tree+0x88/0x350 fs/super.c:1544
 do_new_mount fs/namespace.c:3335 [inline]
 path_mount+0x1492/0x1ed0 fs/namespace.c:3662
 do_mount fs/namespace.c:3675 [inline]
 __do_sys_mount fs/namespace.c:3884 [inline]
 __se_sys_mount fs/namespace.c:3861 [inline]
 __x64_sys_mount+0x293/0x310 fs/namespace.c:3861
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888021788000
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 304 bytes inside of
 freed 512-byte region [ffff888021788000, ffff888021788200)

The buggy address belongs to the physical page:
page:ffffea000085e200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21788
head:ffffea000085e200 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff888012841c80 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2005, tgid 2005 (kworker/u4:3), ts 14978345817, free_ts 0
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1567
 prep_new_page mm/page_alloc.c:1574 [inline]
 get_page_from_freelist+0x10d7/0x31b0 mm/page_alloc.c:3253
 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4509
 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2298
 alloc_slab_page mm/slub.c:1870 [inline]
 allocate_slab+0x24e/0x380 mm/slub.c:2017
 new_slab mm/slub.c:2070 [inline]
 ___slab_alloc+0x8bc/0x1570 mm/slub.c:3223
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322
 __slab_alloc_node mm/slub.c:3375 [inline]
 slab_alloc_node mm/slub.c:3468 [inline]
 __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3517
 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114
 kmalloc include/linux/slab.h:599 [inline]
 kzalloc include/linux/slab.h:720 [inline]
 alloc_bprm+0x51/0xaf0 fs/exec.c:1514
 kernel_execve+0xaf/0x4e0 fs/exec.c:1989
 call_usermodehelper_exec_async+0x256/0x4c0 kernel/umh.c:110
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:145
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888021788000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888021788080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888021788100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff888021788180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888021788200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (123):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/08/11 09:36 linux-next 21ef7b1e17d0 da3c3ef8 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/07 20:50 linux-next f7dc24b34138 0ef3dfda .config strace log report syz C [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/15 10:47 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/15 08:59 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/15 07:50 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/15 04:33 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/14 18:55 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/14 17:14 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/14 14:21 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/14 12:13 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/14 05:42 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/14 03:42 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/13 18:46 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/13 17:39 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/13 15:19 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/13 12:40 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/13 09:58 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/13 06:31 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/13 04:02 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/13 01:58 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/12 23:53 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/12 22:47 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/12 16:50 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/12 16:14 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/12 13:13 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/12 03:36 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/12 01:02 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/11 22:51 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/11 21:06 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/11 19:53 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/11 18:40 linux-next 21ef7b1e17d0 39990d51 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/11 11:52 linux-next 21ef7b1e17d0 da3c3ef8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/11 09:19 linux-next 21ef7b1e17d0 da3c3ef8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/11 06:12 linux-next 21ef7b1e17d0 da3c3ef8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/11 05:45 linux-next 21ef7b1e17d0 da3c3ef8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 21:30 linux-next 21ef7b1e17d0 4df3089c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 19:28 linux-next 21ef7b1e17d0 4df3089c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 16:30 linux-next 21ef7b1e17d0 4df3089c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 15:05 linux-next 21ef7b1e17d0 4df3089c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 14:00 linux-next 21ef7b1e17d0 4df3089c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 12:53 linux-next 21ef7b1e17d0 4df3089c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 07:36 linux-next 21ef7b1e17d0 13ca4cd6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 05:28 linux-next 21ef7b1e17d0 13ca4cd6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 04:28 linux-next 21ef7b1e17d0 13ca4cd6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/10 04:19 linux-next 21ef7b1e17d0 13ca4cd6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
2023/08/07 07:54 linux-next f7dc24b34138 4ffcc9ef .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Read in btrfs_open_devices
* Struck through repros no longer work on HEAD.