[syzbot] [mm?] [fs?] BUG: sleeping function called from invalid context in folio_mc_copy

From: syzbot
Date: Thu Mar 27 2025 - 12:26:51 EST


Hello,

syzbot found the following issue on:

HEAD commit: 3ba7dfb8da62 Merge tag 'rcu-next-v6.15' of git://git.kerne..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=112d4de4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=81ce17d4cab5b5b4
dashboard link: https://syzkaller.appspot.com/bug?extid=f3c6fda1297c748a7076
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1597d24c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=152d4de4580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/61886896d33d/disk-3ba7dfb8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e41306171182/vmlinux-3ba7dfb8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e056187afb19/bzImage-3ba7dfb8.xz

The issue was bisected to:

commit 3c20917120ce61f2a123ca0810293872f4c6b5a4
Author: Hannes Reinecke <hare@xxxxxxx>
Date: Fri Feb 21 22:38:21 2025 +0000

block/bdev: enable large folio support for large logical block sizes

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1393643f980000
final oops: https://syzkaller.appspot.com/x/report.txt?x=1053643f980000
console output: https://syzkaller.appspot.com/x/log.txt?x=1793643f980000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+f3c6fda1297c748a7076@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 3c20917120ce ("block/bdev: enable large folio support for large logical block sizes")

BUG: sleeping function called from invalid context at mm/util.c:742
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 7101, name: syz-executor140
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
2 locks held by syz-executor140/7101:
#0: ffff888032c2e420 (sb_writers#3){.+.+}-{0:0}, at: direct_splice_actor+0x49/0x220 fs/splice.c:1157
#1: ffff888148ca65c8 (&mapping->i_private_lock){+.+.}-{3:3}, at: spin_lock include/linux/spinlock.h:351 [inline]
#1: ffff888148ca65c8 (&mapping->i_private_lock){+.+.}-{3:3}, at: __buffer_migrate_folio+0x241/0x5d0 mm/migrate.c:853
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 1 UID: 0 PID: 7101 Comm: syz-executor140 Not tainted 6.14.0-syzkaller-00685-g3ba7dfb8da62 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
__might_resched+0x5d4/0x780 kernel/sched/core.c:8764
folio_mc_copy+0x13c/0x1d0 mm/util.c:742
__migrate_folio mm/migrate.c:758 [inline]
filemap_migrate_folio+0xb4/0x4c0 mm/migrate.c:943
__buffer_migrate_folio+0x3ec/0x5d0 mm/migrate.c:874
move_to_new_folio+0x2ac/0xc20 mm/migrate.c:1050
migrate_folio_move mm/migrate.c:1358 [inline]
migrate_folios_move mm/migrate.c:1710 [inline]
migrate_pages_batch+0x1e84/0x30b0 mm/migrate.c:1957
migrate_pages_sync mm/migrate.c:1987 [inline]
migrate_pages+0x2007/0x3680 mm/migrate.c:2096
compact_zone+0x33d5/0x4ae0 mm/compaction.c:2663
compact_node mm/compaction.c:2932 [inline]
compact_nodes mm/compaction.c:2954 [inline]
sysctl_compaction_handler+0x496/0x990 mm/compaction.c:3005
proc_sys_call_handler+0x5f3/0x950 fs/proc/proc_sysctl.c:601
iter_file_splice_write+0xbce/0x1510 fs/splice.c:738
do_splice_from fs/splice.c:935 [inline]
direct_splice_actor+0x11b/0x220 fs/splice.c:1158
splice_direct_to_actor+0x586/0xc80 fs/splice.c:1102
do_splice_direct_actor fs/splice.c:1201 [inline]
do_splice_direct+0x289/0x3e0 fs/splice.c:1227
do_sendfile+0x564/0x8a0 fs/read_write.c:1368
__do_sys_sendfile64 fs/read_write.c:1423 [inline]
__se_sys_sendfile64+0x100/0x1e0 fs/read_write.c:1415
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f615c6e5599
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 18 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f615c67f218 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f615c76f358 RCX: 00007f615c6e5599
RDX: 00002000000000c0 RSI: 0000000000000006 RDI: 0000000000000007
RBP: 00007f615c76f350 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000009 R11: 0000000000000246 R12: 00007f615c73c074
R13: 0000200000000080 R14: 0000200000000040 R15: 00002000000000c0
</TASK>


---
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.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup