syzbot


KASAN: use-after-free Read in xfs_buf_rele

Status: upstream: reported C repro on 2022/12/24 01:04
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+6d3a2fae3f160689c744@syzkaller.appspotmail.com
First crash: 728d, last: 658d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in xfs_buf_rele syz error 3 656d 737d 0/1 upstream: reported syz repro on 2022/12/14 21:15
upstream KASAN: slab-use-after-free Read in xfs_buf_rele xfs 2 190d 217d 0/28 auto-obsoleted due to no activity on 2024/09/11 19:16
upstream KASAN: slab-use-after-free Read in xfs_buf_rele (2) xfs 1 22d 12d 0/28 upstream: reported on 2024/12/09 11:23
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/03/03 18:58 22m bisect fix linux-4.14.y OK (0) job log log
2023/02/01 14:29 32m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
syz-executor202 (19441): drop_caches: 2
syz-executor202 (19441): drop_caches: 2
XFS (loop5): Ending clean mount
XFS (loop5): Unmounting Filesystem
==================================================================
BUG: KASAN: use-after-free in rht_key_hashfn include/linux/rhashtable.h:259 [inline]
BUG: KASAN: use-after-free in rht_head_hashfn include/linux/rhashtable.h:283 [inline]
BUG: KASAN: use-after-free in __rhashtable_remove_fast_one include/linux/rhashtable.h:1021 [inline]
BUG: KASAN: use-after-free in __rhashtable_remove_fast include/linux/rhashtable.h:1101 [inline]
BUG: KASAN: use-after-free in rhashtable_remove_fast include/linux/rhashtable.h:1130 [inline]
BUG: KASAN: use-after-free in xfs_buf_rele+0x123c/0x12a0 fs/xfs/xfs_buf.c:1063
Read of size 4 at addr ffff8880a24fc58c by task syz-executor202/19445

CPU: 1 PID: 19445 Comm: syz-executor202 Not tainted 4.14.302-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/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_load4_noabort+0x68/0x70 mm/kasan/report.c:429
 rht_key_hashfn include/linux/rhashtable.h:259 [inline]
 rht_head_hashfn include/linux/rhashtable.h:283 [inline]
 __rhashtable_remove_fast_one include/linux/rhashtable.h:1021 [inline]
 __rhashtable_remove_fast include/linux/rhashtable.h:1101 [inline]
 rhashtable_remove_fast include/linux/rhashtable.h:1130 [inline]
 xfs_buf_rele+0x123c/0x12a0 fs/xfs/xfs_buf.c:1063
 xfs_buftarg_shrink_scan+0x18a/0x270 fs/xfs/xfs_buf.c:1769
 do_shrink_slab mm/vmscan.c:401 [inline]
 shrink_slab+0x535/0xb60 mm/vmscan.c:504
 drop_slab_node+0x2b/0x60 mm/vmscan.c:531
 drop_slab+0x39/0x70 mm/vmscan.c:542
 drop_caches_sysctl_handler+0xc9/0xe0 fs/drop_caches.c:65
 proc_sys_call_handler.isra.0+0x1ba/0x340 fs/proc/proc_sysctl.c:598
 __vfs_write+0xe4/0x630 fs/read_write.c:480
 __kernel_write+0xf5/0x330 fs/read_write.c:501
 write_pipe_buf+0x143/0x1c0 fs/splice.c:797
 splice_from_pipe_feed fs/splice.c:502 [inline]
 __splice_from_pipe+0x326/0x7a0 fs/splice.c:626
 splice_from_pipe fs/splice.c:661 [inline]
 default_file_splice_write+0xc5/0x150 fs/splice.c:809
 do_splice_from fs/splice.c:851 [inline]
 direct_splice_actor+0x115/0x160 fs/splice.c:1018
 splice_direct_to_actor+0x27c/0x730 fs/splice.c:973
 do_splice_direct+0x164/0x210 fs/splice.c:1061
 do_sendfile+0x47f/0xb30 fs/read_write.c:1441
 SYSC_sendfile64 fs/read_write.c:1496 [inline]
 SyS_sendfile64+0x9b/0x110 fs/read_write.c:1488
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3
RIP: 0033:0x7f452f165be9
RSP: 002b:00007f452f10e2f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f452f1f67a0 RCX: 00007f452f165be9
RDX: 0000000020002080 RSI: 0000000000000003 RDI: 0000000000000004
RBP: 00007f452f1f67ac R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000870 R11: 0000000000000246 R12: 00007f452f1c2ff0
R13: 0031656c69662f2e R14: 7365686361635f70 R15: 00007f452f1f67a8

Allocated by task 19353:
 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
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node+0x4c/0x70 mm/slab.c:3689
 kmalloc_node include/linux/slab.h:530 [inline]
 kvmalloc_node+0x46/0xd0 mm/util.c:430
 kvmalloc include/linux/mm.h:531 [inline]
 kvzalloc include/linux/mm.h:539 [inline]
 bucket_table_alloc+0x3a5/0x5d0 lib/rhashtable.c:217
 rhashtable_init+0x3e2/0x7a0 lib/rhashtable.c:995
 xfs_initialize_perag+0x174/0x3d0 fs/xfs/xfs_mount.c:218
 xfs_mountfs+0xaf4/0x1f40 fs/xfs/xfs_mount.c:821
 xfs_fs_fill_super+0xb7a/0x1380 fs/xfs/xfs_super.c:1688
 mount_bdev+0x2b3/0x360 fs/super.c:1134
 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 7983:
 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
 kvfree+0x45/0x50 mm/util.c:449
 rhashtable_free_and_destroy+0x20a/0x710 lib/rhashtable.c:1093
 xfs_free_perag+0x9e/0xf0 fs/xfs/xfs_mount.c:164
 xfs_unmountfs+0x216/0x5e0 fs/xfs/xfs_mount.c:1149
 xfs_fs_put_super+0x62/0x130 fs/xfs/xfs_super.c:1742
 generic_shutdown_super+0x144/0x370 fs/super.c:446
 kill_block_super+0x95/0xe0 fs/super.c:1161
 deactivate_locked_super+0x6c/0xd0 fs/super.c:319
 deactivate_super+0x7f/0xa0 fs/super.c:350
 cleanup_mnt+0x186/0x2c0 fs/namespace.c:1183
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

The buggy address belongs to the object at ffff8880a24fc580
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 12 bytes inside of
 512-byte region [ffff8880a24fc580, ffff8880a24fc780)
The buggy address belongs to the page:
page:ffffea0002893f00 count:1 mapcount:0 mapping:ffff8880a24fc080 index:0xffff8880a24fc800
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880a24fc080 ffff8880a24fc800 0000000100000004
raw: ffffea000263df20 ffffea0002887660 ffff88813fe74940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a24fc480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a24fc500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a24fc580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff8880a24fc600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a24fc680: 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/12/24 01:03 linux-4.14.y c4215ee4771b 9da18ae8 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-4-14 KASAN: use-after-free Read in xfs_buf_rele
* Struck through repros no longer work on HEAD.