syzbot


inconsistent lock state in free_huge_page

Status: upstream: reported C repro on 2020/12/21 08:05
Reported-by: syzbot+dbde5923a1cd4e9ccecd@syzkaller.appspotmail.com
First crash: 1461d, last: 1022d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 inconsistent lock state in free_huge_page C error 6 1179d 1448d 0/1 upstream: reported C repro on 2021/01/03 08:22
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/02/15 19:32 13m retest repro linux-4.14.y report log
2022/10/12 15:30 0m retest repro linux-4.14.y error
Fix bisection attempts (15)
Created Duration User Patch Repo Result
2022/04/04 10:21 11m bisect fix linux-4.14.y error job log
2022/03/05 09:59 22m bisect fix linux-4.14.y OK (0) job log log
2022/02/03 09:26 25m bisect fix linux-4.14.y OK (0) job log log
2022/01/04 08:57 29m bisect fix linux-4.14.y OK (0) job log log
2021/12/05 08:33 23m bisect fix linux-4.14.y OK (0) job log log
2021/11/05 08:02 30m bisect fix linux-4.14.y OK (0) job log log
2021/10/06 07:00 25m bisect fix linux-4.14.y OK (0) job log log
2021/09/06 06:21 28m bisect fix linux-4.14.y OK (0) job log log
2021/08/07 05:58 22m bisect fix linux-4.14.y OK (0) job log log
2021/07/08 05:36 22m bisect fix linux-4.14.y OK (0) job log log
2021/06/08 05:08 27m bisect fix linux-4.14.y OK (0) job log log
2021/05/09 04:42 26m bisect fix linux-4.14.y OK (0) job log log
2021/02/23 15:19 22m bisect fix linux-4.14.y OK (0) job log log
2021/02/19 09:59 18m bisect fix linux-4.14.y error job log
2021/01/20 08:05 22m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
================================
WARNING: inconsistent lock state
4.14.212-syzkaller #0 Not tainted
--------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
swapper/0/0 [HC1[1]:SC0[0]:HE0:SE1] takes:
 (hugetlb_lock){?.+.}, at: [<ffffffff817df76b>] spin_lock include/linux/spinlock.h:317 [inline]
 (hugetlb_lock){?.+.}, at: [<ffffffff817df76b>] free_huge_page+0x5ab/0x7f0 mm/hugetlb.c:1291
{HARDIRQ-ON-W} state was registered at:
  lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
  __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
  _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:152
  spin_lock include/linux/spinlock.h:317 [inline]
  hugetlb_overcommit_handler+0x283/0x400 mm/hugetlb.c:2992
  proc_sys_call_handler.isra.0+0x1ba/0x340 fs/proc/proc_sysctl.c:598
  __vfs_write+0xe4/0x630 fs/read_write.c:480
  vfs_write+0x17f/0x4d0 fs/read_write.c:544
  SYSC_write fs/read_write.c:590 [inline]
  SyS_write+0xf2/0x210 fs/read_write.c:582
  do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
  entry_SYSCALL_64_after_hwframe+0x46/0xbb
irq event stamp: 192002
hardirqs last  enabled at (191999): [<ffffffff87208635>] default_idle+0x15/0x370 arch/x86/kernel/process.c:558
hardirqs last disabled at (192000): [<ffffffff874008ce>] common_interrupt+0x8e/0x93 arch/x86/entry/entry_64.S:576
softirqs last  enabled at (192002): [<ffffffff8133021d>] irq_enter+0xbd/0xd0 kernel/softirq.c:350
softirqs last disabled at (192001): [<ffffffff81330202>] irq_enter+0xa2/0xd0 kernel/softirq.c:354

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(hugetlb_lock);
  <Interrupt>
    lock(hugetlb_lock);

 *** DEADLOCK ***

1 lock held by swapper/0/0:
 #0:  (&(&virtscsi_vq->vq_lock)->rlock){-.-.}, at: [<ffffffff83b33bd3>] virtscsi_vq_done drivers/scsi/virtio_scsi.c:219 [inline]
 #0:  (&(&virtscsi_vq->vq_lock)->rlock){-.-.}, at: [<ffffffff83b33bd3>] virtscsi_req_done+0x113/0x1d0 drivers/scsi/virtio_scsi.c:238

stack backtrace:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.212-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_usage_bug.cold+0x42e/0x570 kernel/locking/lockdep.c:2589
 valid_state kernel/locking/lockdep.c:2602 [inline]
 mark_lock_irq kernel/locking/lockdep.c:2796 [inline]
 mark_lock+0xb4d/0x1050 kernel/locking/lockdep.c:3194
 mark_irqflags kernel/locking/lockdep.c:3069 [inline]
 __lock_acquire+0xfb2/0x3f20 kernel/locking/lockdep.c:3448
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:152
 spin_lock include/linux/spinlock.h:317 [inline]
 free_huge_page+0x5ab/0x7f0 mm/hugetlb.c:1291
 __put_page+0xb9/0x2f0 mm/swap.c:111
 put_page include/linux/mm.h:875 [inline]
 bio_check_pages_dirty+0x287/0x490 block/bio.c:1794
 dio_bio_complete+0x454/0x5d0 fs/direct-io.c:553
 dio_bio_end_aio+0x43/0x450 fs/direct-io.c:358
 bio_endio+0x27a/0x680 block/bio.c:1918
 req_bio_endio block/blk-core.c:204 [inline]
 blk_update_request+0x2d0/0xa30 block/blk-core.c:2765
 scsi_end_request+0x7d/0xa10 drivers/scsi/scsi_lib.c:659
 scsi_io_completion+0xa3f/0x1530 drivers/scsi/scsi_lib.c:885
 scsi_softirq_done+0x2c8/0x360 drivers/scsi/scsi_lib.c:1671
 __blk_mq_complete_request+0x30b/0x6c0 block/blk-mq.c:571
 blk_mq_complete_request+0x52/0x60 block/blk-mq.c:591
 virtscsi_vq_done drivers/scsi/virtio_scsi.c:223 [inline]
 virtscsi_req_done+0x13b/0x1d0 drivers/scsi/virtio_scsi.c:238
 vring_interrupt+0x117/0x200 drivers/virtio/virtio_ring.c:954
 __handle_irq_event_percpu+0xee/0x7f0 kernel/irq/handle.c:147
 handle_irq_event_percpu kernel/irq/handle.c:187 [inline]
 handle_irq_event+0xf0/0x246 kernel/irq/handle.c:204
 handle_edge_irq+0x224/0xc40 kernel/irq/chip.c:770
 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
 handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87
 do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230
 common_interrupt+0x93/0x93 arch/x86/entry/entry_64.S:576
 </IRQ>
RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
RSP: 0018:ffffffff88e07e78 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff6e
RAX: 1ffffffff11e1254 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffffffff88e74cc4
RBP: ffffffff88f09290 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: fffffbfff11ce888
R13: ffffffff88e74440 R14: 0000000000000000 R15: 0000000000000000
 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline]
 default_idle+0x47/0x370 arch/x86/kernel/process.c:558
 cpuidle_idle_call kernel/sched/idle.c:156 [inline]
 do_idle+0x250/0x3c0 kernel/sched/idle.c:246
 cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:351
 start_kernel+0x750/0x770 init/main.c:708
 secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/12/21 08:04 linux-4.14.y 3f2ecb86cb90 04201c06 .config console log report syz C ci2-linux-4-14
2021/04/09 04:42 linux-4.14.y 0cc244011f40 6a81331a .config console log report info ci2-linux-4-14 inconsistent lock state in free_huge_page
2021/03/16 19:29 linux-4.14.y c7150cd2fa8c fdb2bb2c .config console log report info ci2-linux-4-14 inconsistent lock state in free_huge_page
* Struck through repros no longer work on HEAD.