BUG: sleeping function called from invalid context at ./include/linux/sched/mm.h:321 in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 6016, name: syz.1.2 preempt_count: 0, expected: 0 RCU nest depth: 1, expected: 0 4 locks held by syz.1.2/6016: #0: ffff88803273b438 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x2a2/0x370 fs/file.c:1213 #1: ffff88804e118148 (&type->i_mutex_dir_key#9){.+.+}-{4:4}, at: iterate_dir+0x18b/0xb40 fs/readdir.c:101 #2: ffffffff8e3bf140 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline] #2: ffffffff8e3bf140 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline] #2: ffffffff8e3bf140 (rcu_read_lock){....}-{1:3}, at: afs_dynroot_readdir+0x619/0xf50 fs/afs/dynroot.c:351 #3: ffff888012d895e0 (&mm->mmap_lock){++++}-{4:4}, at: mmap_read_trylock include/linux/mmap_lock.h:209 [inline] #3: ffff888012d895e0 (&mm->mmap_lock){++++}-{4:4}, at: get_mmap_lock_carefully mm/memory.c:6239 [inline] #3: ffff888012d895e0 (&mm->mmap_lock){++++}-{4:4}, at: lock_mm_and_find_vma+0x35/0x6e0 mm/memory.c:6299 CPU: 2 UID: 0 PID: 6016 Comm: syz.1.2 Not tainted 6.14.0-syzkaller-10892-g4e82c87058f4 #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:120 __might_resched+0x3c0/0x5e0 kernel/sched/core.c:8818 might_alloc include/linux/sched/mm.h:321 [inline] prepare_alloc_pages+0x413/0x610 mm/page_alloc.c:4574 __alloc_frozen_pages_noprof+0x18f/0x2370 mm/page_alloc.c:4795 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2301 folio_alloc_mpol_noprof+0x36/0x2f0 mm/mempolicy.c:2320 vma_alloc_folio_noprof+0xed/0x1e0 mm/mempolicy.c:2355 folio_prealloc mm/memory.c:1060 [inline] wp_page_copy mm/memory.c:3444 [inline] do_wp_page+0x1055/0x4670 mm/memory.c:3836 handle_pte_fault mm/memory.c:5906 [inline] __handle_mm_fault+0x1ae0/0x2a50 mm/memory.c:6033 handle_mm_fault+0x404/0xae0 mm/memory.c:6202 do_user_addr_fault+0x7a9/0x1430 arch/x86/mm/fault.c:1388 handle_page_fault arch/x86/mm/fault.c:1480 [inline] exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1538 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0010:filldir64+0x2b7/0x5e0 fs/readdir.c:372 Code: e8 8e a2 84 ff 0f 01 cb 0f ae e8 48 8b 04 24 49 89 47 08 e8 7b a2 84 ff 4c 8b 7c 24 30 48 8b 74 24 10 49 89 37 e8 69 a2 84 ff <66> 45 89 6f 10 e8 5f a2 84 ff 0f b6 7c 24 1c 41 88 7f 12 e8 51 a2 RSP: 0018:ffffc900041b7c58 EFLAGS: 00050287 RAX: 0000000000000118 RBX: ffffc900041b7e80 RCX: ffffc9000c001000 RDX: 0000000000080000 RSI: ffffffff82368f37 RDI: 0000000000000006 RBP: 0000200000001008 R08: 0000000000000006 R09: 0000200000000fd0 R10: 0000200000001008 R11: 0000000000000000 R12: 0000000000000003 R13: 0000000000000018 R14: ffff8880273875a1 R15: 0000200000000ff0 dir_emit include/linux/fs.h:3861 [inline] afs_dynroot_readdir_cells fs/afs/dynroot.c:310 [inline] afs_dynroot_readdir+0x9bb/0xf50 fs/afs/dynroot.c:352 iterate_dir+0x293/0xb40 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:403 [inline] __se_sys_getdents64 fs/readdir.c:389 [inline] __x64_sys_getdents64+0x14d/0x2d0 fs/readdir.c:389 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f6fdf38d169 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6fe022f038 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007f6fdf5a5fa0 RCX: 00007f6fdf38d169 RDX: 0000000000001000 RSI: 0000200000000f80 RDI: 0000000000000004 RBP: 00007f6fdf40e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f6fdf5a5fa0 R15: 00007ffed944d638 ---------------- Code disassembly (best guess): 0: e8 8e a2 84 ff call 0xff84a293 5: 0f 01 cb stac 8: 0f ae e8 lfence b: 48 8b 04 24 mov (%rsp),%rax f: 49 89 47 08 mov %rax,0x8(%r15) 13: e8 7b a2 84 ff call 0xff84a293 18: 4c 8b 7c 24 30 mov 0x30(%rsp),%r15 1d: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 22: 49 89 37 mov %rsi,(%r15) 25: e8 69 a2 84 ff call 0xff84a293 * 2a: 66 45 89 6f 10 mov %r13w,0x10(%r15) <-- trapping instruction 2f: e8 5f a2 84 ff call 0xff84a293 34: 0f b6 7c 24 1c movzbl 0x1c(%rsp),%edi 39: 41 88 7f 12 mov %dil,0x12(%r15) 3d: e8 .byte 0xe8 3e: 51 push %rcx 3f: a2 .byte 0xa2