syzbot


BUG: sleeping function called from invalid context in shmem_undo_range

Status: upstream: reported on 2026/04/24 00:23
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+9722a25de70a85ff48a1@syzkaller.appspotmail.com
First crash: 1d15h, last: 1d15h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [mm?] BUG: sleeping function called from invalid context in shmem_undo_range 2 (3) 2026/04/24 10:42

Sample crash report:
BUG: sleeping function called from invalid context at mm/shmem.c:1150
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5904, name: rm
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
2 locks held by rm/5904:
 #0: ffff88802b0d0410 (sb_writers#5){.+.+}-{0:0}, at: filename_unlinkat+0x1ad/0x730 fs/namei.c:5545
 #1: ffffffff8e7e5260 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire.constprop.0+0x7/0x30 include/linux/rcupdate.h:300
CPU: 1 UID: 0 PID: 5904 Comm: rm Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
 __might_resched.cold+0x1ec/0x232 kernel/sched/core.c:9162
 shmem_undo_range+0x447/0x1570 mm/shmem.c:1150
 shmem_truncate_range mm/shmem.c:1277 [inline]
 shmem_evict_inode+0x3f3/0xc40 mm/shmem.c:1407
 evict+0x3c2/0xad0 fs/inode.c:841
 iput_final fs/inode.c:1960 [inline]
 iput.part.0+0x605/0xf50 fs/inode.c:2009
 iput+0x35/0x40 fs/inode.c:1975
 filename_unlinkat+0x466/0x730 fs/namei.c:5572
 __do_sys_unlink fs/namei.c:5603 [inline]
 __se_sys_unlink fs/namei.c:5600 [inline]
 __x64_sys_unlink+0x46/0x70 fs/namei.c:5600
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7eff00dbe937
Code: 00 00 e9 a9 fd ff ff 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 5f 00 00 00 0f 05 c3 0f 1f 84 00 00 00 00 00 b8 57 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 91 b4 0d 00 f7 d8 64 89 02 b8
RSP: 002b:00007ffef2c377b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000057
RAX: ffffffffffffffda RBX: 00007ffef2c37dd7 RCX: 00007eff00dbe937
RDX: 00007ffef2c377c8 RSI: 00007ffef2c37dd7 RDI: 00007ffef2c37dd7
RBP: 0000000000000008 R08: 00007ffef2c37dc0 R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000246 R12: 0000000000000000
R13: 00007eff00f4e9cc R14: 00007eff00faa000 R15: 000055fe0234bd98
 </TASK>

================================================
WARNING: lock held when returning to user space!
syzkaller #0 Tainted: G        W          
------------------------------------------------
rm/5904 is leaving the kernel with locks still held!
1 lock held by rm/5904:
 #0: ffffffff8e7e5260 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire.constprop.0+0x7/0x30 include/linux/rcupdate.h:300
------------[ cut here ]------------
Voluntary context switch within RCU read-side critical section!
WARNING: kernel/rcu/tree_plugin.h:332 at rcu_note_context_switch+0x859/0x19c0 kernel/rcu/tree_plugin.h:332, CPU#1: rm/5904
Modules linked in:
CPU: 1 UID: 0 PID: 5904 Comm: rm Tainted: G        W           syzkaller #0 PREEMPT(full) 
Tainted: [W]=WARN
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:rcu_note_context_switch+0x859/0x19c0 kernel/rcu/tree_plugin.h:332
Code: c1 ea 03 80 3c 02 00 0f 85 9b 0b 00 00 48 8b 53 28 b9 01 00 00 00 4c 89 ef e8 a3 cf fe ff e9 1d f9 ff ff 48 8d 3d b7 5e f1 0e <67> 48 0f b9 3a e9 99 f8 ff ff 48 b8 00 00 00 00 00 fc ff df 48 8d
RSP: 0000:ffffc9000407fcf0 EFLAGS: 00010002
RAX: 0000000000000001 RBX: ffff88802b33c3c0 RCX: ffffffff81ee0fc1
RDX: 0000000000000000 RSI: ffffffff8c1c1000 RDI: ffffffff90dfe2a0
RBP: ffff8880267b2500 R08: 0000000000000000 R09: fffffbfff21b89ca
R10: ffffffff90dc4e57 R11: ffffffff94142590 R12: 0000000000000000
R13: ffff8880267b29c4 R14: ffff88802b33b380 R15: ffffffff90dc81c4
FS:  00007eff00c00c80(0000) GS:ffff8880971e2000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007eff00da0850 CR3: 000000004cf7d000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 __schedule+0x276/0x6820 kernel/sched/core.c:7043
 __schedule_loop kernel/sched/core.c:7267 [inline]
 schedule+0xdd/0x390 kernel/sched/core.c:7282
 __exit_to_user_mode_loop kernel/entry/common.c:54 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:98 [inline]
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
 irqentry_exit_to_user_mode_prepare include/linux/irq-entry-common.h:252 [inline]
 irqentry_exit_to_user_mode include/linux/irq-entry-common.h:323 [inline]
 irqentry_exit+0x359/0x790 kernel/entry/common.c:162
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697
RIP: 0033:0x7eff00dbe937
Code: 00 00 e9 a9 fd ff ff 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 5f 00 00 00 0f 05 c3 0f 1f 84 00 00 00 00 00 b8 57 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 8b 15 91 b4 0d 00 f7 d8 64 89 02 b8
RSP: 002b:00007ffef2c377b8 EFLAGS: 00000246
RAX: 0000000000000000 RBX: 00007ffef2c37dd7 RCX: 00007eff00dbe937
RDX: 00007ffef2c377c8 RSI: 00007ffef2c37dd7 RDI: 00007ffef2c37dd7
RBP: 0000000000000008 R08: 00007ffef2c37dc0 R09: 0000000000000000
R10: 0000000000000100 R11: 0000000000000246 R12: 0000000000000000
R13: 00007eff00f4e9cc R14: 00007eff00faa000 R15: 000055fe0234bd98
 </TASK>
----------------
Code disassembly (best guess):
   0:	c1 ea 03             	shr    $0x3,%edx
   3:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1)
   7:	0f 85 9b 0b 00 00    	jne    0xba8
   d:	48 8b 53 28          	mov    0x28(%rbx),%rdx
  11:	b9 01 00 00 00       	mov    $0x1,%ecx
  16:	4c 89 ef             	mov    %r13,%rdi
  19:	e8 a3 cf fe ff       	call   0xfffecfc1
  1e:	e9 1d f9 ff ff       	jmp    0xfffff940
  23:	48 8d 3d b7 5e f1 0e 	lea    0xef15eb7(%rip),%rdi        # 0xef15ee1
* 2a:	67 48 0f b9 3a       	ud1    (%edx),%rdi <-- trapping instruction
  2f:	e9 99 f8 ff ff       	jmp    0xfffff8cd
  34:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  3b:	fc ff df
  3e:	48                   	rex.W
  3f:	8d                   	.byte 0x8d

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/04/23 06:49 upstream 2a4c0c11c019 b10da5ec .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 BUG: sleeping function called from invalid context in shmem_undo_range
* Struck through repros no longer work on HEAD.