syzbot


KASAN: use-after-free Read in gfs2_end_log_write

Status: auto-obsoleted due to no activity on 2023/09/03 05:45
Reported-by: syzbot+27affe85c99db111b345@syzkaller.appspotmail.com
First crash: 470d, last: 470d

Sample crash report:
BUG: MAX_LOCKDEP_CHAINS too low!
turning off the locking correctness validator.
CPU: 0 PID: 14 Comm: ksoftirqd/0 Not tainted 5.15.113-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 dump_stack+0x1c/0x58 lib/dump_stack.c:113
 lookup_chain_cache_add kernel/locking/lockdep.c:3734 [inline]
 validate_chain kernel/locking/lockdep.c:3755 [inline]
 __lock_acquire+0x1b68/0x7620 kernel/locking/lockdep.c:5011
 lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xc4/0x14c kernel/locking/spinlock.c:162
 __wake_up_common_lock kernel/sched/wait.c:137 [inline]
 __wake_up+0xe8/0x1a0 kernel/sched/wait.c:157
 gfs2_end_log_write+0x590/0x798 fs/gfs2/lops.c:229
 bio_endio+0x780/0x7c4 block/bio.c:1476
 req_bio_endio block/blk-core.c:261 [inline]
 blk_update_request+0x79c/0x1304 block/blk-core.c:1447
 blk_mq_end_request+0x54/0x88 block/blk-mq.c:575
 blk_flush_complete_seq+0x4f4/0xabc block/blk-flush.c:204
 flush_end_io+0x5ec/0x7c0 block/blk-flush.c:261
 __blk_mq_end_request+0x308/0x350 block/blk-mq.c:566
 blk_mq_end_request+0x68/0x88 block/blk-mq.c:577
 lo_complete_rq+0x140/0x258 drivers/block/loop.c:529
 blk_complete_reqs block/blk-mq.c:587 [inline]
 blk_done_softirq+0x11c/0x168 block/blk-mq.c:592
 __do_softirq+0x344/0xe20 kernel/softirq.c:558
 run_ksoftirqd+0x68/0x258 kernel/softirq.c:920
 smpboot_thread_fn+0x4b0/0x920 kernel/smpboot.c:164
 kthread+0x37c/0x45c kernel/kthread.c:319
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870
==================================================================
BUG: KASAN: use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline]
BUG: KASAN: use-after-free in do_raw_spin_lock+0x244/0x35c kernel/locking/spinlock_debug.c:114
Read of size 4 at addr ffff0000d92290dc by task ksoftirqd/0/14

CPU: 0 PID: 14 Comm: ksoftirqd/0 Not tainted 5.15.113-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 __asan_report_load4_noabort+0x44/0x50 mm/kasan/report_generic.c:308
 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline]
 do_raw_spin_lock+0x244/0x35c kernel/locking/spinlock_debug.c:114
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:117 [inline]
 _raw_spin_lock_irqsave+0xcc/0x14c kernel/locking/spinlock.c:162
 __wake_up_common_lock kernel/sched/wait.c:137 [inline]
 __wake_up+0xe8/0x1a0 kernel/sched/wait.c:157
 gfs2_end_log_write+0x590/0x798 fs/gfs2/lops.c:229
 bio_endio+0x780/0x7c4 block/bio.c:1476
 req_bio_endio block/blk-core.c:261 [inline]
 blk_update_request+0x79c/0x1304 block/blk-core.c:1447
 blk_mq_end_request+0x54/0x88 block/blk-mq.c:575
 blk_flush_complete_seq+0x4f4/0xabc block/blk-flush.c:204
 flush_end_io+0x5ec/0x7c0 block/blk-flush.c:261
 __blk_mq_end_request+0x308/0x350 block/blk-mq.c:566
 blk_mq_end_request+0x68/0x88 block/blk-mq.c:577
 lo_complete_rq+0x140/0x258 drivers/block/loop.c:529
 blk_complete_reqs block/blk-mq.c:587 [inline]
 blk_done_softirq+0x11c/0x168 block/blk-mq.c:592
 __do_softirq+0x344/0xe20 kernel/softirq.c:558
 run_ksoftirqd+0x68/0x258 kernel/softirq.c:920
 smpboot_thread_fn+0x4b0/0x920 kernel/smpboot.c:164
 kthread+0x37c/0x45c kernel/kthread.c:319
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Allocated by task 13935:
 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_kmalloc+0xbc/0xfc mm/kasan/common.c:513
 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 init_sbd fs/gfs2/ops_fstype.c:77 [inline]
 gfs2_fill_super+0x140/0x2010 fs/gfs2/ops_fstype.c:1151
 get_tree_bdev+0x360/0x54c fs/super.c:1303
 gfs2_get_tree+0x54/0x1b4 fs/gfs2/ops_fstype.c:1332
 vfs_get_tree+0x90/0x274 fs/super.c:1508
 do_new_mount+0x25c/0x8c8 fs/namespace.c:2994
 path_mount+0x590/0x104c fs/namespace.c:3324
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount fs/namespace.c:3522 [inline]
 __arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3522
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 3991:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0x178/0x410 mm/slub.c:4559
 free_sbd+0x5c/0x6c fs/gfs2/ops_fstype.c:69
 gfs2_put_super+0x60c/0x684 fs/gfs2/super.c:632
 generic_shutdown_super+0x130/0x29c fs/super.c:475
 kill_block_super+0x70/0xdc fs/super.c:1405
 gfs2_kill_sb+0xc0/0xd4
 deactivate_locked_super+0xb8/0x13c fs/super.c:335
 deactivate_super+0x108/0x128 fs/super.c:366
 cleanup_mnt+0x3c0/0x474 fs/namespace.c:1143
 __cleanup_mnt+0x20/0x30 fs/namespace.c:1150
 task_work_run+0x130/0x1e4 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Last potentially related work creation:
 kasan_save_stack+0x38/0x68 mm/kasan/common.c:38
 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2994 [inline]
 call_rcu+0x118/0xb40 kernel/rcu/tree.c:3074
 fat_put_super+0x98/0xac fs/fat/inode.c:740
 generic_shutdown_super+0x130/0x29c fs/super.c:475
 kill_block_super+0x70/0xdc fs/super.c:1405
 deactivate_locked_super+0xb8/0x13c fs/super.c:335
 deactivate_super+0x108/0x128 fs/super.c:366
 cleanup_mnt+0x3c0/0x474 fs/namespace.c:1143
 __cleanup_mnt+0x20/0x30 fs/namespace.c:1150
 task_work_run+0x130/0x1e4 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000d9228000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 4316 bytes inside of
 8192-byte region [ffff0000d9228000, ffff0000d922a000)
The buggy address belongs to the page:
page:00000000c5c97784 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x119228
head:00000000c5c97784 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 0000000100000001 ffff0000c0002c00
raw: 0000000000000000 0000000080020002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d9228f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d9229000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000d9229080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff0000d9229100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d9229180: 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
2023/05/26 05:45 linux-5.15.y 1fe619a7d252 b40ef614 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in gfs2_end_log_write
* Struck through repros no longer work on HEAD.