syzbot


INFO: task hung in lock_extent

Status: upstream: reported C repro on 2023/05/08 17:01
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+f8217aae382555004877@syzkaller.appspotmail.com
First crash: 347d, last: 4h17m
Fix commit to backport (bisect log) :
tree: upstream
commit a1912f712188291f9d7d434fba155461f1ebef66
Author: Josef Bacik <josef@toxicpanda.com>
Date: Wed Nov 22 17:17:55 2023 +0000

  btrfs: remove code for inode_cache and recovery mount options

  
Fix bisection: the issue occurs on the latest tested release (bisect log)
Crash: INFO: task hung in lock_extent (log)
Repro: C syz .config
  
Bug presence (2)
Date Name Commit Repro Result
2024/01/17 linux-6.1.y (ToT) fec3b1451d5f C [report] INFO: task hung in lock_extent
2024/01/17 upstream (ToT) 1b1934dbbdcf C Didn't crash
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream INFO: task hung in lock_extent btrfs C error done 262 38d 447d 0/26 upstream: reported C repro on 2023/01/28 07:38
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2024/01/19 18:21 4h38m fix candidate upstream job log (1)
2024/01/17 18:00 1h47m bisect fix linux-6.1.y job log (0) log
2023/12/04 01:23 1h33m bisect fix linux-6.1.y job log (0) log
2023/11/03 10:51 2h26m bisect fix linux-6.1.y job log (0) log
2023/09/25 08:02 1h36m bisect fix linux-6.1.y job log (0) log
2023/07/16 13:54 3h06m bisect fix linux-6.1.y job log (0) log
2023/06/07 22:09 50m bisect fix linux-6.1.y job log (0) log

Sample crash report:
INFO: task syz-executor273:3562 blocked for more than 143 seconds.
      Not tainted 6.1.32-syzkaller #0
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:syz-executor273 state:D stack:23008 pid:3562  ppid:3561   flags:0x00004004
Call Trace:
 <TASK>
 context_switch kernel/sched/core.c:5241 [inline]
 __schedule+0x132c/0x4330 kernel/sched/core.c:6554
 schedule+0xbf/0x180 kernel/sched/core.c:6630
 wait_on_state fs/btrfs/extent-io-tree.c:709 [inline]
 wait_extent_bit+0x423/0x570 fs/btrfs/extent-io-tree.c:742
 lock_extent+0x17a/0x200 fs/btrfs/extent-io-tree.c:1657
 btrfs_page_mkwrite+0x550/0xc90 fs/btrfs/inode.c:8457
 do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:2973
 wp_page_shared+0x164/0x380 mm/memory.c:3319
 handle_pte_fault mm/memory.c:4982 [inline]
 __handle_mm_fault mm/memory.c:5106 [inline]
 handle_mm_fault+0x2522/0x5330 mm/memory.c:5227
 do_user_addr_fault arch/x86/mm/fault.c:1428 [inline]
 handle_page_fault arch/x86/mm/fault.c:1519 [inline]
 exc_page_fault+0x58d/0x790 arch/x86/mm/fault.c:1575
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0010:copy_user_short_string+0xd/0x40 arch/x86/lib/copy_user_64.S:233
Code: 74 0a 89 d1 f3 a4 89 c8 0f 01 ca c3 89 d0 0f 01 ca c3 01 ca eb e7 0f 1f 80 00 00 00 00 89 d1 83 e2 07 c1 e9 03 74 12 4c 8b 06 <4c> 89 07 48 8d 76 08 48 8d 7f 08 ff c9 75 ee 21 d2 74 10 89 d1 8a
RSP: 0018:ffffc90003a9f550 EFLAGS: 00050202
RAX: ffffffff84343401 RBX: 00007fffffffefc8 RCX: 0000000000000007
RDX: 0000000000000000 RSI: ffffc90003a9f600 RDI: 00000000200000e0
RBP: ffffc90003a9f6b0 R08: 0000000000000000 R09: fffff52000753ec7
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000038
R13: ffffc90003a9f600 R14: 00000000200000e0 R15: ffffc90003a9f600
 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
 raw_copy_to_user arch/x86/include/asm/uaccess_64.h:58 [inline]
 _copy_to_user+0xe9/0x130 lib/usercopy.c:41
 copy_to_user include/linux/uaccess.h:169 [inline]
 fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
 emit_last_fiemap_cache fs/btrfs/extent_io.c:3598 [inline]
 extent_fiemap+0x1b10/0x1ff0 fs/btrfs/extent_io.c:4129
 btrfs_fiemap+0x174/0x1e0 fs/btrfs/inode.c:8129
 ioctl_fiemap fs/ioctl.c:219 [inline]
 do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810
 __do_sys_ioctl fs/ioctl.c:868 [inline]
 __se_sys_ioctl+0x81/0x160 fs/ioctl.c:856
 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+0x63/0xcd
RIP: 0033:0x7feaedf00309
RSP: 002b:00007fffcc4417c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000020000080 RCX: 00007feaedf00309
RDX: 00000000200000c0 RSI: 00000000c020660b RDI: 0000000000000004
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffcc441800
R13: 0000000000000000 R14: 431bde82d7b634db R15: 0000000000000000
 </TASK>

Showing all locks held in the system:
1 lock held by rcu_tasks_kthre/12:
 #0: ffffffff8cf27470 (rcu_tasks.tasks_gp_mutex){+.+.}-{3:3}, at: rcu_tasks_one_gp+0x29/0xd20 kernel/rcu/tasks.h:510
1 lock held by rcu_tasks_trace/13:
 #0: ffffffff8cf27c70 (rcu_tasks_trace.tasks_gp_mutex){+.+.}-{3:3}, at: rcu_tasks_one_gp+0x29/0xd20 kernel/rcu/tasks.h:510
1 lock held by khungtaskd/28:
 #0: ffffffff8cf272a0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x0/0x30
2 locks held by getty/3304:
 #0: ffff888014279098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x21/0x70 drivers/tty/tty_ldisc.c:244
 #1: ffffc900031262f0 (&ldata->atomic_read_lock){+.+.}-{3:3}, at: n_tty_read+0x6a7/0x1db0 drivers/tty/n_tty.c:2177
4 locks held by syz-executor273/3562:
 #0: ffff888074788f80 (&sb->s_type->i_mutex_key#15){++++}-{3:3}, at: inode_lock_shared include/linux/fs.h:766 [inline]
 #0: ffff888074788f80 (&sb->s_type->i_mutex_key#15){++++}-{3:3}, at: btrfs_inode_lock+0x5c/0xd0 fs/btrfs/inode.c:147
 #1: ffff888015fc26d8 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline]
 #1: ffff888015fc26d8 (&mm->mmap_lock#2){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1369 [inline]
 #1: ffff888015fc26d8 (&mm->mmap_lock#2){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1519 [inline]
 #1: ffff888015fc26d8 (&mm->mmap_lock#2){++++}-{3:3}, at: exc_page_fault+0x182/0x790 arch/x86/mm/fault.c:1575
 #2: ffff88804763c558 (sb_pagefaults){.+.+}-{0:0}, at: do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:2973
 #3: ffff888074788e08 (&ei->i_mmap_lock){.+.+}-{3:3}, at: btrfs_page_mkwrite+0x421/0xc90 fs/btrfs/inode.c:8446

=============================================

NMI backtrace for cpu 1
CPU: 1 PID: 28 Comm: khungtaskd Not tainted 6.1.32-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 nmi_cpu_backtrace+0x4e1/0x560 lib/nmi_backtrace.c:111
 nmi_trigger_cpumask_backtrace+0x1b0/0x3f0 lib/nmi_backtrace.c:62
 trigger_all_cpu_backtrace include/linux/nmi.h:148 [inline]
 check_hung_uninterruptible_tasks kernel/hung_task.c:220 [inline]
 watchdog+0xf18/0xf60 kernel/hung_task.c:377
 kthread+0x26e/0x300 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
 </TASK>
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0
CPU: 0 PID: 3286 Comm: kworker/0:3 Not tainted 6.1.32-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
Workqueue: mm_percpu_wq vmstat_update
RIP: 0010:vmstat_update+0x0/0xa0 mm/vmstat.c:1930
Code: 48 03 3b e8 b2 0b 95 ff 31 c0 5b c3 48 c7 c7 40 dd fd 8c 48 89 de e8 7f 19 9b 02 eb b5 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 <55> 41 57 41 56 53 bf 01 00 00 00 e8 b0 f8 ff ff 85 c0 74 6f e8 c7
RSP: 0018:ffffc9000363fc58 EFLAGS: 00000246
RAX: 1ffff1100527be63 RBX: ffff8880b98351e8 RCX: ffff888020585940
RDX: 0000000000000000 RSI: ffffffff8b3cc980 RDI: ffff8880b98351e8
RBP: ffffc9000363fde0 R08: ffffffff815a6d47 R09: fffffbfff1ca631e
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff8880293df318 R14: 0000000000000001 R15: ffff8880b9839600
FS:  0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000561a08c1b680 CR3: 000000000cc8e000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <NMI>
 </NMI>
 <TASK>
 process_one_work+0x8aa/0x11f0 kernel/workqueue.c:2289
 worker_thread+0xa5f/0x1210 kernel/workqueue.c:2436
 kthread+0x26e/0x300 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
 </TASK>

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/09 03:27 linux-6.1.y 76ba310227d2 058b3a5a .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2023/05/08 17:00 linux-6.1.y ca48fc16c493 90c93c40 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 INFO: task hung in lock_extent
2024/04/19 18:36 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2024/04/19 18:23 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2024/04/14 02:56 linux-6.1.y cd5d98c0556c c8349e48 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2024/04/12 14:08 linux-6.1.y bf1e3b1cb1e0 27de0a5c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2024/04/12 07:58 linux-6.1.y bf1e3b1cb1e0 27de0a5c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2024/04/11 19:47 linux-6.1.y bf1e3b1cb1e0 95ed9ece .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2023/12/17 23:57 linux-6.1.y ba6f5fb46511 3222d10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2023/10/03 10:12 linux-6.1.y d23900f974e0 65faba36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan INFO: task hung in lock_extent
2024/03/10 01:06 linux-6.1.y 61adba85cc40 6ee49f2e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 INFO: task hung in lock_extent
2024/03/09 04:06 linux-6.1.y 61adba85cc40 8e75c913 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 INFO: task hung in lock_extent
2024/03/09 03:57 linux-6.1.y 61adba85cc40 8e75c913 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 INFO: task hung in lock_extent
* Struck through repros no longer work on HEAD.