syzbot


KASAN: use-after-free Write in xfs_trans_committed_bulk

Status: upstream: reported C repro on 2023/03/12 11:46
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+4d9a694803b65e21655b@syzkaller.appspotmail.com
First crash: 352d, last: 242d
Fix commit to backport (bisect log) :
tree: upstream
commit 575689fc0ffa6c4bb4e72fd18e31a6525a6124e0
Author: Guo Xuenan <guoxuenan@huawei.com>
Date: Wed Nov 30 17:25:46 2022 +0000

  xfs: fix super block buf log item UAF during force shutdown

  
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2023/05/10 linux-5.15.y (ToT) 8a7f2a5c5aa1 C [report] KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/05/10 upstream (ToT) 16a8829130ca C Didn't crash
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in xfs_trans_committed_bulk origin:lts-only C done 832 163d 355d 0/3 upstream: reported C repro on 2023/03/09 08:20
linux-4.19 KASAN: use-after-free Read in xfs_trans_committed_bulk xfs C 8 363d 405d 0/1 upstream: reported C repro on 2023/01/18 09:53
linux-4.14 KASAN: use-after-free Read in xfs_trans_committed_bulk xfs C 4 359d 421d 0/1 upstream: reported C repro on 2023/01/02 11:47
upstream BUG: unable to handle kernel paging request in xfs_trans_committed_bulk xfs 1 419d 415d 0/26 auto-obsoleted due to no activity on 2023/04/04 21:10
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/09/14 02:07 7h14m fix candidate upstream job log (1)
2023/09/10 18:26 0m bisect fix linux-5.15.y error job log (0)

Sample crash report:
XFS (loop0): log I/O error -5
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_write include/linux/instrumented.h:86 [inline]
BUG: KASAN: use-after-free in set_bit include/asm-generic/bitops/instrumented-atomic.h:28 [inline]
BUG: KASAN: use-after-free in xfs_trans_committed_bulk+0x158/0x7f0 fs/xfs/xfs_trans.c:757
Write of size 8 at addr ffff88801b6a2560 by task kworker/0:1H/1052

CPU: 0 PID: 1052 Comm: kworker/0:1H Not tainted 5.15.105-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Workqueue: xfs-log/loop0 xlog_ioend_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
 instrument_atomic_write include/linux/instrumented.h:86 [inline]
 set_bit include/asm-generic/bitops/instrumented-atomic.h:28 [inline]
 xfs_trans_committed_bulk+0x158/0x7f0 fs/xfs/xfs_trans.c:757
 xlog_cil_committed+0x290/0xd60 fs/xfs/xfs_log_cil.c:631
 xlog_cil_process_committed+0x155/0x1a0 fs/xfs/xfs_log_cil.c:659
 xlog_state_shutdown_callbacks+0x2b6/0x3a0 fs/xfs/xfs_log.c:516
 xlog_force_shutdown+0x1e7/0x200 fs/xfs/xfs_log.c:3896
 xfs_do_force_shutdown+0x11d/0x430 fs/xfs/xfs_fsops.c:529
 xlog_ioend_work+0xc2/0x120 fs/xfs/xfs_log.c:1364
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2306
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2453
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
 </TASK>

Allocated by task 4940:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfs_buf_item_init+0x68/0x4e0 fs/xfs/xfs_buf_item.c:807
 _xfs_trans_bjoin+0x44/0x100 fs/xfs/xfs_trans_buf.c:75
 xfs_trans_get_buf_map+0x3b1/0x7d0 fs/xfs/xfs_trans_buf.c:162
 xfs_trans_get_buf fs/xfs/xfs_trans.h:187 [inline]
 xfs_dquot_disk_alloc+0x72c/0xb80 fs/xfs/xfs_dquot.c:341
 xfs_qm_dqread_alloc fs/xfs/xfs_dquot.c:647 [inline]
 xfs_qm_dqread+0x244/0x770 fs/xfs/xfs_dquot.c:692
 xfs_qm_dqget+0x26f/0x4e0 fs/xfs/xfs_dquot.c:897
 xfs_qm_quotacheck_dqadjust+0xe6/0x560 fs/xfs/xfs_qm.c:1085
 xfs_qm_dqusage_adjust+0x44f/0x670 fs/xfs/xfs_qm.c:1190
 xfs_iwalk_ag_recs+0x4c1/0x810 fs/xfs/xfs_iwalk.c:220
 xfs_iwalk_run_callbacks+0x211/0x420 fs/xfs/xfs_iwalk.c:376
 xfs_iwalk_ag+0xad2/0xbd0 fs/xfs/xfs_iwalk.c:482
 xfs_iwalk_ag_work+0xf7/0x1a0 fs/xfs/xfs_iwalk.c:624
 xfs_pwork_work+0x78/0x180 fs/xfs/xfs_pwork.c:47
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2306
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2453
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Freed by task 6336:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 xfs_buf_ioend+0x311/0x6e0 fs/xfs/xfs_buf.c:1286
 __xfs_buf_submit+0x162/0x770 fs/xfs/xfs_buf.c:1598
 xfs_buf_delwri_submit_buffers+0x663/0x900 fs/xfs/xfs_buf.c:2136
 xfs_buf_delwri_submit+0xb6/0x260 fs/xfs/xfs_buf.c:2182
 xfs_qm_quotacheck+0x3df/0x640 fs/xfs/xfs_qm.c:1351
 xfs_qm_mount_quotas+0x328/0x610 fs/xfs/xfs_qm.c:1441
 xfs_mountfs+0x162b/0x1ca0 fs/xfs/xfs_mount.c:904
 xfs_fs_fill_super+0x100c/0x1240 fs/xfs/xfs_super.c:1658
 get_tree_bdev+0x3fe/0x620 fs/super.c:1303
 vfs_get_tree+0x88/0x270 fs/super.c:1508
 do_new_mount+0x28b/0xad0 fs/namespace.c:2994
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88801b6a2520
 which belongs to the cache xfs_buf_item of size 264
The buggy address is located 64 bytes inside of
 264-byte region [ffff88801b6a2520, ffff88801b6a2628)
The buggy address belongs to the page:
page:ffffea00006da880 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1b6a2
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00006583c0 0000000700000007 ffff8880192b9640
raw: 0000000000000000 00000000800c000c 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 5031, ts 883755184069, free_ts 883382163825
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfs_buf_item_init+0x68/0x4e0 fs/xfs/xfs_buf_item.c:807
 _xfs_trans_bjoin+0x44/0x100 fs/xfs/xfs_trans_buf.c:75
 xfs_trans_read_buf_map+0x339/0xa60 fs/xfs/xfs_trans_buf.c:310
 xfs_trans_read_buf fs/xfs/xfs_trans.h:210 [inline]
 xfs_imap_to_bp+0x154/0x1b0 fs/xfs/libxfs/xfs_inode_buf.c:136
 xfs_trans_log_inode+0x63c/0x9c0 fs/xfs/libxfs/xfs_trans_inode.c:182
 xfs_init_new_inode+0xdb2/0x1100 fs/xfs/xfs_inode.c:919
 xfs_qm_qino_alloc+0x516/0x9c0 fs/xfs/xfs_qm.c:790
 xfs_qm_init_quotainos+0x61e/0x8a0 fs/xfs/xfs_qm.c:1544
 xfs_qm_init_quotainfo+0xa6/0x970 fs/xfs/xfs_qm.c:644
 xfs_qm_mount_quotas+0x90/0x610 fs/xfs/xfs_qm.c:1428
 xfs_mountfs+0x162b/0x1ca0 fs/xfs/xfs_mount.c:904
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 __vunmap+0x8d4/0xa20 mm/vmalloc.c:2621
 free_work+0x57/0x80 mm/vmalloc.c:95
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2306
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2453
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Memory state around the buggy address:
 ffff88801b6a2400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801b6a2480: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff88801b6a2500: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88801b6a2580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801b6a2600: fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb
==================================================================

Crashes (41):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/04/01 04:39 linux-5.15.y c957cbb87315 f325deb0 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/06/17 00:06 linux-5.15.y 471e639e59d1 f3921d4d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/14 06:14 linux-5.15.y 2ddbd0f967b3 026e2200 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/14 07:25 linux-5.15.y 2ddbd0f967b3 026e2200 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/06/30 12:06 linux-5.15.y 4af60700a60c 01298212 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/06/30 07:54 linux-5.15.y 4af60700a60c 01298212 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/06/16 14:55 linux-5.15.y 471e639e59d1 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/06/10 03:16 linux-5.15.y 7349e40704a0 9018a337 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/05/29 16:06 linux-5.15.y 1fe619a7d252 cf184559 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/05/20 15:02 linux-5.15.y 9d6bde853685 4bce1a3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/05/10 11:59 linux-5.15.y 8a7f2a5c5aa1 14b12a99 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/22 09:37 linux-5.15.y 8020ae3c051d 8b4eb097 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/21 18:42 linux-5.15.y 8020ae3c051d 8b4eb097 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/13 17:58 linux-5.15.y 2ddbd0f967b3 026e2200 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/06/30 07:50 linux-5.15.y 4af60700a60c 01298212 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/06/18 07:53 linux-5.15.y 471e639e59d1 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/05/25 05:28 linux-5.15.y 1fe619a7d252 4bce1a3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/20 01:47 linux-5.15.y 4fdad925aa1a a219f34e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/19 09:46 linux-5.15.y 4fdad925aa1a 94b4184e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/17 09:47 linux-5.15.y 4fdad925aa1a c6ec7083 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/14 17:46 linux-5.15.y 4fdad925aa1a ec410564 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/12 11:45 linux-5.15.y d86dfc4d95cd 1a1596b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/11 21:47 linux-5.15.y d86dfc4d95cd 49faf98d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/08 18:03 linux-5.15.y d86dfc4d95cd 71147e29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/06 22:12 linux-5.15.y d86dfc4d95cd 00ce4c67 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/05 00:24 linux-5.15.y c957cbb87315 831373d3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/04/03 10:15 linux-5.15.y c957cbb87315 41147e3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/28 22:41 linux-5.15.y 115472395b0a fc067f05 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/25 13:51 linux-5.15.y 115472395b0a fbf0499a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/23 23:56 linux-5.15.y 115472395b0a f94b4a29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/03/12 11:46 linux-5.15.y d214f240b0f6 5205ef30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Write in xfs_trans_committed_bulk
2023/06/21 03:22 linux-5.15.y 471e639e59d1 79782afc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/06/20 01:48 linux-5.15.y 471e639e59d1 09ffe269 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/06/19 14:33 linux-5.15.y 471e639e59d1 d521bc56 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/06/15 17:11 linux-5.15.y 471e639e59d1 90d4044e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/05/18 11:42 linux-5.15.y 9d6bde853685 3bb7af1d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/05/10 12:59 linux-5.15.y 8a7f2a5c5aa1 14b12a99 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/04/06 21:09 linux-5.15.y d86dfc4d95cd 00ce4c67 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/03/22 04:29 linux-5.15.y 8020ae3c051d 8b4eb097 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/03/17 21:24 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/04/11 22:16 linux-5.15.y d86dfc4d95cd 49faf98d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in xfs_trans_committed_bulk
* Struck through repros no longer work on HEAD.