syzbot


BUG: sleeping function called from invalid context in break_ksm

Status: upstream: reported C repro on 2022/10/20 12:59
Reported-by: syzbot+78a0878b3076f71313b3@syzkaller.appspotmail.com
Fix commit: d7c0e68dab98 mm/ksm: convert break_ksm() to use walk_page_range_vma()
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 110d, last: 109d

Sample crash report:
BUG: sleeping function called from invalid context at mm/ksm.c:500
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3610, name: syz-executor212
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
INFO: lockdep is turned off.
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 0 PID: 3610 Comm: syz-executor212 Not tainted 6.1.0-rc1-next-20221020-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 __might_resched.cold+0x222/0x26b kernel/sched/core.c:9890
 break_ksm.part.0+0xbe/0x160 mm/ksm.c:500
 break_ksm mm/ksm.c:875 [inline]
 unmerge_ksm_pages+0x1a0/0x240 mm/ksm.c:881
 unmerge_and_remove_all_rmap_items mm/ksm.c:1021 [inline]
 run_store+0x3cf/0xa30 mm/ksm.c:2983
 kobj_attr_store+0x50/0x80 lib/kobject.c:824
 sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:136
 kernfs_fop_write_iter+0x3f8/0x610 fs/kernfs/file.c:330
 call_write_iter include/linux/fs.h:2191 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x9e9/0xdd0 fs/read_write.c:584
 ksys_write+0x127/0x250 fs/read_write.c:637
 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+0x63/0xcd
RIP: 0033:0x7fc23ce26b39
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff3f50c3a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc23ce26b39
RDX: 0000000000000002 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 00007fc23cdeace0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc23cdead70
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Crashes (9):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-linux-next-kasan-gce-root 2022/10/20 12:40 linux-next acee3e83b493 b31320fc .config strace log report syz C [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
ci-upstream-linux-next-kasan-gce-root 2022/10/20 11:59 linux-next acee3e83b493 b31320fc .config console log report info [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
ci-upstream-linux-next-kasan-gce-root 2022/10/20 11:57 linux-next acee3e83b493 b31320fc .config console log report info [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
ci-upstream-linux-next-kasan-gce-root 2022/10/20 11:54 linux-next acee3e83b493 b31320fc .config console log report info [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
ci-upstream-linux-next-kasan-gce-root 2022/10/20 11:51 linux-next acee3e83b493 b31320fc .config console log report info [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
ci-upstream-linux-next-kasan-gce-root 2022/10/19 09:25 linux-next a72b55bc981b b31320fc .config console log report info [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
ci-upstream-linux-next-kasan-gce-root 2022/10/19 08:23 linux-next a72b55bc981b b31320fc .config console log report info [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
ci-upstream-linux-next-kasan-gce-root 2022/10/19 06:48 linux-next a72b55bc981b b31320fc .config console log report info [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
ci-upstream-linux-next-kasan-gce-root 2022/10/19 06:28 linux-next a72b55bc981b b31320fc .config console log report info [disk image] [vmlinux] BUG: sleeping function called from invalid context in break_ksm
* Struck through repros no longer work on HEAD.