[syzbot] BUG: sleeping function called from invalid context in do_page_fault (3)

From: syzbot
Date: Mon Apr 25 2022 - 12:04:45 EST


Hello,

syzbot found the following issue on:

HEAD commit: 0966d385830d riscv: Fix auipc+jalr relocation range checks
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes
console output: https://syzkaller.appspot.com/x/log.txt?x=121d1d7cf00000
kernel config: https://syzkaller.appspot.com/x/.config?x=6295d67591064921
dashboard link: https://syzkaller.appspot.com/bug?extid=2845b2dfa28dec36e215
compiler: riscv64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: riscv64

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2845b2dfa28dec36e215@xxxxxxxxxxxxxxxxxxxxxxxxx

BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1460
in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 2044, name: syz-fuzzer
preempt_count: 0, expected: 0
RCU nest depth: 0, expected: 0
no locks held by syz-fuzzer/2044.
irq event stamp: 17038
hardirqs last enabled at (17037): [<ffffffff831afca0>] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline]
hardirqs last enabled at (17037): [<ffffffff831afca0>] _raw_spin_unlock_irq+0x2a/0x76 kernel/locking/spinlock.c:202
hardirqs last disabled at (17038): [<ffffffff8000e866>] __trace_hardirqs_off+0x18/0x20 arch/riscv/kernel/trace_irq.c:25
softirqs last enabled at (17032): [<ffffffff831b0bd0>] softirq_handle_end kernel/softirq.c:401 [inline]
softirqs last enabled at (17032): [<ffffffff831b0bd0>] __do_softirq+0x618/0x8fc kernel/softirq.c:587
softirqs last disabled at (17027): [<ffffffff80061288>] do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
softirqs last disabled at (17027): [<ffffffff80061288>] invoke_softirq kernel/softirq.c:439 [inline]
softirqs last disabled at (17027): [<ffffffff80061288>] __irq_exit_rcu+0x142/0x1f8 kernel/softirq.c:637
CPU: 1 PID: 2044 Comm: syz-fuzzer Not tainted 5.17.0-rc1-syzkaller-00002-g0966d385830d #0
Hardware name: riscv-virtio,qemu (DT)
Call Trace:
[<ffffffff8000a228>] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:113
[<ffffffff831668cc>] show_stack+0x34/0x40 arch/riscv/kernel/stacktrace.c:119
[<ffffffff831756ba>] __dump_stack lib/dump_stack.c:88 [inline]
[<ffffffff831756ba>] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:106
[<ffffffff83175742>] dump_stack+0x1c/0x24 lib/dump_stack.c:113
[<ffffffff800baf2a>] __might_resched+0x30a/0x342 kernel/sched/core.c:9583
[<ffffffff800bafc0>] __might_sleep+0x5e/0x8e kernel/sched/core.c:9512
[<ffffffff831ab63e>] down_read+0x24/0x54 kernel/locking/rwsem.c:1460
[<ffffffff800117d4>] mmap_read_lock include/linux/mmap_lock.h:117 [inline]
[<ffffffff800117d4>] do_page_fault+0x24e/0xa3c arch/riscv/mm/fault.c:285
[<ffffffff80005724>] ret_from_exception+0x0/0x10


---
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 syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.