inconsistent lock state in free_huge_page

6 views
Skip to first unread message

syzbot

unread,
Dec 21, 2020, 3:05:11 AM12/21/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f2ecb86 Linux 4.14.212
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=127ca7cb500000
kernel config: https://syzkaller.appspot.com/x/.config?x=80549830ca6ffbb2
dashboard link: https://syzkaller.appspot.com/bug?extid=dbde5923a1cd4e9ccecd
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15b32287500000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1623eadf500000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+dbde59...@syzkaller.appspotmail.com

================================
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


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages