[syzbot] BUG: sleeping function called from invalid context in __munlock_pagevec

26 views
Skip to first unread message

syzbot

unread,
Jul 10, 2021, 6:12:19 PM7/10/21
to ak...@linux-foundation.org, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ee268dee Add linux-next specific files for 20210707
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13ed30d2300000
kernel config: https://syzkaller.appspot.com/x/.config?x=59e1e3bbc3afca75
dashboard link: https://syzkaller.appspot.com/bug?extid=cf9c548279bff83b0c97
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17a25ee4300000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14f81928300000

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

BUG: sleeping function called from invalid context at include/linux/pagemap.h:674
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 8467, name: syz-executor631
1 lock held by syz-executor631/8467:
#0: ffff8880343e0978 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:359 [inline]
#0: ffff8880343e0978 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: map_pte mm/page_vma_mapped.c:52 [inline]
#0: ffff8880343e0978 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: page_vma_mapped_walk+0xd87/0x24f0 mm/page_vma_mapped.c:261
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 0 PID: 8467 Comm: syz-executor631 Not tainted 5.13.0-next-20210707-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
___might_sleep.cold+0x1f1/0x237 kernel/sched/core.c:9171
lock_page include/linux/pagemap.h:674 [inline]
__munlock_pagevec+0xa22/0x2340 mm/mlock.c:314
munlock_vma_pages_range+0x9d7/0xf00 mm/mlock.c:475
munlock_vma_pages_all mm/internal.h:354 [inline]
unlock_range mm/mmap.c:2811 [inline]
exit_mmap+0x47a/0x620 mm/mmap.c:3188
__mmput+0x122/0x470 kernel/fork.c:1152
mmput+0x58/0x60 kernel/fork.c:1173
exit_mm kernel/exit.c:501 [inline]
do_exit+0xae2/0x2a60 kernel/exit.c:812
do_group_exit+0x125/0x310 kernel/exit.c:922
__do_sys_exit_group kernel/exit.c:933 [inline]
__se_sys_exit_group kernel/exit.c:931 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:931
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x43e969
Code: Unable to access opcode bytes at RIP 0x43e93f.
RSP: 002b:00007ffce2d3a7a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00000000004b02f0 RCX: 000000000043e969
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004b02f0
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001

=============================
[ BUG: Invalid wait context ]
5.13.0-next-20210707-syzkaller #0 Tainted: G W
-----------------------------
syz-executor631/8467 is trying to lock:
ffff888035ea6000 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: i_mmap_lock_read include/linux/fs.h:514 [inline]
ffff888035ea6000 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: rmap_walk_file+0x52f/0x710 mm/rmap.c:2337
other info that might help us debug this:
context-{4:4}
1 lock held by syz-executor631/8467:
#0: ffff8880343e0978 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:359 [inline]
#0: ffff8880343e0978 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: map_pte mm/page_vma_mapped.c:52 [inline]
#0: ffff8880343e0978 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: page_vma_mapped_walk+0xd87/0x24f0 mm/page_vma_mapped.c:261
stack backtrace:
CPU: 0 PID: 8467 Comm: syz-executor631 Tainted: G W 5.13.0-next-20210707-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
print_lock_invalid_wait_context kernel/locking/lockdep.c:4666 [inline]
check_wait_context kernel/locking/lockdep.c:4727 [inline]
__lock_acquire.cold+0x213/0x3ab kernel/locking/lockdep.c:4965
lock_acquire kernel/locking/lockdep.c:5625 [inline]
lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590
down_read+0x9a/0x440 kernel/locking/rwsem.c:1353
i_mmap_lock_read include/linux/fs.h:514 [inline]
rmap_walk_file+0x52f/0x710 mm/rmap.c:2337
rmap_walk+0x10d/0x190 mm/rmap.c:2366
page_mlock+0x448/0x650 mm/rmap.c:2029
__munlock_isolated_page+0x88/0x410 mm/mlock.c:122
__munlock_pagevec+0xd7f/0x2340 mm/mlock.c:322
munlock_vma_pages_range+0x9d7/0xf00 mm/mlock.c:475
munlock_vma_pages_all mm/internal.h:354 [inline]
unlock_range mm/mmap.c:2811 [inline]
exit_mmap+0x47a/0x620 mm/mmap.c:3188
__mmput+0x122/0x470 kernel/fork.c:1152
mmput+0x58/0x60 kernel/fork.c:1173
exit_mm kernel/exit.c:501 [inline]
do_exit+0xae2/0x2a60 kernel/exit.c:812
do_group_exit+0x125/0x310 kernel/exit.c:922
__do_sys_exit_group kernel/exit.c:933 [inline]
__se_sys_exit_group kernel/exit.c:931 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:931
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x43e969
Code: Unable to access opcode bytes at RIP 0x43e93f.
RSP: 002b:00007ffce2d3a7a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00000000004b02f0 RCX: 000000000043e969
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004b02f0
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001


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

Hugh Dickins

unread,
Jul 10, 2021, 11:11:48 PM7/10/21
to Andrew Morton, linux-...@vger.kernel.org, linu...@kvack.org, syzkall...@googlegroups.com
On Sat, 10 Jul 2021, syzbot wrote:

> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: ee268dee Add linux-next specific files for 20210707
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=13ed30d2300000
> kernel config: https://syzkaller.appspot.com/x/.config?x=59e1e3bbc3afca75
> dashboard link: https://syzkaller.appspot.com/bug?extid=cf9c548279bff83b0c97
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17a25ee4300000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14f81928300000

I have checked with that C reproducer: this issue is in Linus's
current tree; but as expected, it is already fixed by
mm-rmap-fix-new-bug-premature-return-from-page_mlock_one.patch
in mmotm.

Hugh

syzbot

unread,
Jul 11, 2021, 5:37:07 AM7/11/21
to chouhan.sh...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: sleeping function called from invalid context in __munlock_pagevec

BUG: sleeping function called from invalid context at include/linux/pagemap.h:674
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 10933, name: syz-executor.3
INFO: lockdep is turned off.
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 PID: 10933 Comm: syz-executor.3 Not tainted 5.13.0-next-20210709-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
___might_sleep.cold+0x1f1/0x237 kernel/sched/core.c:9171
lock_page include/linux/pagemap.h:674 [inline]
__munlock_pagevec+0xa22/0x2340 mm/mlock.c:314
munlock_vma_pages_range+0x9d7/0xf00 mm/mlock.c:475
munlock_vma_pages_all mm/internal.h:354 [inline]
unlock_range mm/mmap.c:2811 [inline]
exit_mmap+0x47a/0x620 mm/mmap.c:3188
__mmput+0x122/0x470 kernel/fork.c:1152
mmput+0x58/0x60 kernel/fork.c:1173
exit_mm kernel/exit.c:501 [inline]
do_exit+0xae2/0x2a60 kernel/exit.c:812
do_group_exit+0x125/0x310 kernel/exit.c:922
get_signal+0x47f/0x2160 kernel/signal.c:2808
arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:865
handle_signal_work kernel/entry/common.c:148 [inline]
exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:209
__syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302
do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665d9
Code: Unable to access opcode bytes at RIP 0x4665af.
RSP: 002b:00007fd2a255e218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: 0000000000000001 RBX: 000000000056c0f8 RCX: 00000000004665d9
RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 000000000056c0fc
RBP: 000000000056c0f0 R08: 0000000000000016 R09: 0000000000000000
R10: ffffffffffffffff R11: 0000000000000246 R12: 000000000056c0fc
R13: 00007ffd9aa9aa0f R14: 00007fd2a255e300 R15: 0000000000022000
BUG: scheduling while atomic: syz-executor.3/10933/0x00000002
INFO: lockdep is turned off.
Modules linked in:
Preemption disabled at:
[<0000000000000000>] 0x0


Tested on:

commit: 92510a7f Add linux-next specific files for 20210709
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13c142d2300000
kernel config: https://syzkaller.appspot.com/x/.config?x=505de2716f052686
dashboard link: https://syzkaller.appspot.com/bug?extid=cf9c548279bff83b0c97
compiler:

syzbot

unread,
Apr 14, 2023, 10:09:29 PM4/14/23
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages