syzbot


KASAN: slab-out-of-bounds Read in xfs_btree_del_cursor

Status: auto-obsoleted due to no activity on 2023/06/13 01:48
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+fdd050b6b63ef0e6e29f@syzkaller.appspotmail.com
First crash: 424d, last: 400d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [xfs?] KASAN: slab-out-of-bounds Read in xfs_btree_del_cursor 0 (1) 2023/01/24 09:28

Sample crash report:
XFS (loop5): Metadata corruption detected at xfs_btree_lookup_get_block+0x5ab/0x720 fs/xfs/libxfs/xfs_btree.c:1846, xfs_refcountbt block 0x18
XFS (loop5): Unmount and run xfs_repair
==================================================================
BUG: KASAN: slab-out-of-bounds in xfs_btree_del_cursor+0x99/0x2b0 fs/xfs/libxfs/xfs_btree.c:439
Read of size 8 at addr ffff88801d95cf38 by task syz-executor.5/4471

CPU: 0 PID: 4471 Comm: syz-executor.5 Not tainted 6.2.0-rc7-syzkaller-00231-g711e9a4d52bf #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:306 [inline]
 print_report+0x163/0x4f0 mm/kasan/report.c:417
 kasan_report+0x13a/0x170 mm/kasan/report.c:517
 xfs_btree_del_cursor+0x99/0x2b0 fs/xfs/libxfs/xfs_btree.c:439
 xfs_refcount_recover_cow_leftovers+0x37f/0xe60 fs/xfs/libxfs/xfs_refcount.c:1948
 xfs_reflink_recover_cow+0xa2/0x1a0 fs/xfs/xfs_reflink.c:928
 xlog_recover_finish+0x855/0x940 fs/xfs/xfs_log_recover.c:3493
 xfs_log_mount_finish+0x1fd/0x3e0 fs/xfs/xfs_log.c:829
 xfs_mountfs+0x1639/0x1f10 fs/xfs/xfs_mount.c:933
 xfs_fs_fill_super+0xf94/0x11e0 fs/xfs/xfs_super.c:1666
 get_tree_bdev+0x402/0x620 fs/super.c:1282
 vfs_get_tree+0x8c/0x270 fs/super.c:1489
 do_new_mount+0x28f/0xae0 fs/namespace.c:3145
 do_mount fs/namespace.c:3488 [inline]
 __do_sys_mount fs/namespace.c:3697 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3674
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f245408d62a
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 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:00007f2454d8ff88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000009712 RCX: 00007f245408d62a
RDX: 0000000020000100 RSI: 0000000020009640 RDI: 00007f2454d8ffe0
RBP: 00007f2454d90020 R08: 00007f2454d90020 R09: 0000000000200800
R10: 0000000000200800 R11: 0000000000000202 R12: 0000000020000100
R13: 0000000020009640 R14: 00007f2454d8ffe0 R15: 0000000020000240
 </TASK>

Allocated by task 4471:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4f/0x80 mm/kasan/common.c:52
 __kasan_slab_alloc+0x69/0x80 mm/kasan/common.c:325
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x68/0x390 mm/slab.h:761
 slab_alloc_node mm/slub.c:3452 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc+0x12c/0x280 mm/slub.c:3476
 kmem_cache_zalloc include/linux/slab.h:710 [inline]
 xfs_btree_alloc_cursor fs/xfs/libxfs/xfs_btree.h:592 [inline]
 xfs_refcountbt_init_common fs/xfs/libxfs/xfs_refcount_btree.c:336 [inline]
 xfs_refcountbt_init_cursor+0x8a/0x340 fs/xfs/libxfs/xfs_refcount_btree.c:363
 xfs_refcount_recover_cow_leftovers+0x2b2/0xe60 fs/xfs/libxfs/xfs_refcount.c:1939
 xfs_reflink_recover_cow+0xa2/0x1a0 fs/xfs/xfs_reflink.c:928
 xlog_recover_finish+0x855/0x940 fs/xfs/xfs_log_recover.c:3493
 xfs_log_mount_finish+0x1fd/0x3e0 fs/xfs/xfs_log.c:829
 xfs_mountfs+0x1639/0x1f10 fs/xfs/xfs_mount.c:933
 xfs_fs_fill_super+0xf94/0x11e0 fs/xfs/xfs_super.c:1666
 get_tree_bdev+0x402/0x620 fs/super.c:1282
 vfs_get_tree+0x8c/0x270 fs/super.c:1489
 do_new_mount+0x28f/0xae0 fs/namespace.c:3145
 do_mount fs/namespace.c:3488 [inline]
 __do_sys_mount fs/namespace.c:3697 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3674
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88801d95ce70
 which belongs to the cache xfs_refcbt_cur of size 200
The buggy address is located 0 bytes to the right of
 200-byte region [ffff88801d95ce70, ffff88801d95cf38)

The buggy address belongs to the physical page:
page:ffffea0000765700 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801d95cc60 pfn:0x1d95c
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffff888145c51dc0 dead000000000122 0000000000000000
raw: ffff88801d95cc60 00000000800f000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 12951, tgid 12950 (syz-executor.2), ts 338815586322, free_ts 325915580051
 prep_new_page mm/page_alloc.c:2531 [inline]
 get_page_from_freelist+0x3449/0x35c0 mm/page_alloc.c:4283
 __alloc_pages+0x291/0x7e0 mm/page_alloc.c:5549
 alloc_slab_page+0x6a/0x160 mm/slub.c:1851
 allocate_slab mm/slub.c:1998 [inline]
 new_slab+0x84/0x2f0 mm/slub.c:2051
 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3193
 __slab_alloc mm/slub.c:3292 [inline]
 __slab_alloc_node mm/slub.c:3345 [inline]
 slab_alloc_node mm/slub.c:3442 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc+0x1b0/0x280 mm/slub.c:3476
 kmem_cache_zalloc include/linux/slab.h:710 [inline]
 xfs_btree_alloc_cursor fs/xfs/libxfs/xfs_btree.h:592 [inline]
 xfs_refcountbt_init_common fs/xfs/libxfs/xfs_refcount_btree.c:336 [inline]
 xfs_refcountbt_init_cursor+0x8a/0x340 fs/xfs/libxfs/xfs_refcount_btree.c:363
 xfs_reflink_find_shared fs/xfs/xfs_reflink.c:146 [inline]
 xfs_reflink_trim_around_shared+0x5d7/0xb20 fs/xfs/xfs_reflink.c:193
 xfs_buffered_write_iomap_begin+0xd5c/0x1c20 fs/xfs/xfs_iomap.c:1052
 iomap_iter+0x752/0x12f0 fs/iomap/iter.c:91
 iomap_file_buffered_write+0x2ad/0xc90 fs/iomap/buffered-io.c:850
 xfs_file_buffered_write+0x38b/0xcc0 fs/xfs/xfs_file.c:724
 do_iter_write+0x6ea/0xc50 fs/read_write.c:861
 iter_file_splice_write+0x80a/0xfa0 fs/splice.c:686
 do_splice_from fs/splice.c:764 [inline]
 direct_splice_actor+0xe7/0x1c0 fs/splice.c:931
 splice_direct_to_actor+0x4c4/0xbd0 fs/splice.c:886
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1446 [inline]
 free_pcp_prepare mm/page_alloc.c:1496 [inline]
 free_unref_page_prepare+0xf3a/0x1040 mm/page_alloc.c:3369
 free_unref_page+0x37/0x3f0 mm/page_alloc.c:3464
 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:302
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x68/0x390 mm/slab.h:761
 slab_alloc_node mm/slub.c:3452 [inline]
 kmem_cache_alloc_node+0x158/0x2c0 mm/slub.c:3497
 __alloc_skb+0xd6/0x2d0 net/core/skbuff.c:552
 alloc_skb include/linux/skbuff.h:1270 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1211 [inline]
 netlink_sendmsg+0x799/0xd10 net/netlink/af_netlink.c:1917
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg net/socket.c:734 [inline]
 ____sys_sendmsg+0x5a2/0x8f0 net/socket.c:2476
 ___sys_sendmsg net/socket.c:2530 [inline]
 __sys_sendmsg+0x2ad/0x390 net/socket.c:2559
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88801d95ce00: fb fb fb fb fb fb fc fc fc fc fc fc fc fc 00 00
 ffff88801d95ce80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88801d95cf00: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
                                        ^
 ffff88801d95cf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88801d95d000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/13 01:48 upstream 711e9a4d52bf 93e26d60 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in xfs_btree_del_cursor
2023/01/19 23:51 upstream 081edded9b38 71197f3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in xfs_btree_del_cursor
* Struck through repros no longer work on HEAD.