syzbot


WARNING: suspicious RCU usage in memfd_fcntl

Status: fixed on 2019/12/21 01:54
Reported-by: syzbot+b5b42e3bd0551159cf1b@syzkaller.appspotmail.com
Fix commit: e4cc9c81e230 memfd: Use radix_tree_deref_slot_protected to avoid the warning.
First crash: 1850d, last: 1827d
Cause bisection: introduced by (bisect log) :
commit 99b45e7a1ba17548fd95420dce36346956d04564
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date: Fri Oct 25 16:58:34 2019 +0000

  memfd: Fix locking when tagging pins

Crash: WARNING: suspicious RCU usage in memfd_fcntl (log)
Repro: C syz .config
  
Fix bisection: fixed by (bisect log) :
commit e4cc9c81e2305aabfa9a0e46e17d3895a10ba3d8
Author: zhong jiang <zhongjiang@huawei.com>
Date: Mon Nov 18 03:26:08 2019 +0000

  memfd: Use radix_tree_deref_slot_protected to avoid the warning.

  

Sample crash report:
kauditd_printk_skb: 2 callbacks suppressed
audit: type=1400 audit(1572784890.737:36): avc:  denied  { map } for  pid=7552 comm="syz-executor659" path="/root/syz-executor659710954" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
=============================
WARNING: suspicious RCU usage
4.19.81 #0 Not tainted
-----------------------------
include/linux/radix-tree.h:241 suspicious rcu_dereference_check() usage!

other info that might help us debug this:


rcu_scheduler_active = 2, debug_locks = 1
2 locks held by syz-executor659/7552:
 #0: 00000000c07c9d7f (&sb->s_type->i_mutex_key#12){+.+.}, at: inode_lock include/linux/fs.h:747 [inline]
 #0: 00000000c07c9d7f (&sb->s_type->i_mutex_key#12){+.+.}, at: memfd_add_seals mm/memfd.c:199 [inline]
 #0: 00000000c07c9d7f (&sb->s_type->i_mutex_key#12){+.+.}, at: memfd_fcntl+0x235/0x1750 mm/memfd.c:249
 #1: 0000000020c6b994 (&(&(&mapping->i_pages)->xa_lock)->rlock){-...}, at: spin_lock_irq include/linux/spinlock.h:354 [inline]
 #1: 0000000020c6b994 (&(&(&mapping->i_pages)->xa_lock)->rlock){-...}, at: memfd_tag_pins mm/memfd.c:42 [inline]
 #1: 0000000020c6b994 (&(&(&mapping->i_pages)->xa_lock)->rlock){-...}, at: memfd_wait_for_pins mm/memfd.c:83 [inline]
 #1: 0000000020c6b994 (&(&(&mapping->i_pages)->xa_lock)->rlock){-...}, at: memfd_add_seals mm/memfd.c:217 [inline]
 #1: 0000000020c6b994 (&(&(&mapping->i_pages)->xa_lock)->rlock){-...}, at: memfd_fcntl+0x4bc/0x1750 mm/memfd.c:249

stack backtrace:
CPU: 1 PID: 7552 Comm: syz-executor659 Not tainted 4.19.81 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x172/0x1f0 lib/dump_stack.c:113
 lockdep_rcu_suspicious+0x153/0x15d kernel/locking/lockdep.c:4539
 radix_tree_deref_slot include/linux/radix-tree.h:241 [inline]
 radix_tree_deref_slot include/linux/radix-tree.h:239 [inline]
 memfd_tag_pins mm/memfd.c:44 [inline]
 memfd_wait_for_pins mm/memfd.c:83 [inline]
 memfd_add_seals mm/memfd.c:217 [inline]
 memfd_fcntl+0xfdf/0x1750 mm/memfd.c:249
 do_fcntl+0x200/0x1020 fs/fcntl.c:421
 __do_sys_fcntl fs/fcntl.c:463 [inline]
 __se_sys_fcntl fs/fcntl.c:448 [inline]
 __x64_sys_fcntl+0x16d/0x1e0 fs/fcntl.c:448
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4401b9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffd1713beb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000048
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004401b9
RDX: 0000000000000009 RSI: 0000000000000409 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 0

Crashes (1879):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/03 12:44 linux-4.19.y ef244c308885 c9610487 .config console log report syz C ci2-linux-4-19
2019/11/02 11:19 linux-4.19.y ef244c308885 997ccc67 .config console log report syz C ci2-linux-4-19
2019/11/02 11:02 linux-4.19.y ef244c308885 997ccc67 .config console log report syz C ci2-linux-4-19
2019/11/02 10:33 linux-4.19.y ef244c308885 997ccc67 .config console log report syz C ci2-linux-4-19
2019/11/02 09:14 linux-4.19.y ef244c308885 997ccc67 .config console log report syz C ci2-linux-4-19
2019/11/02 08:53 linux-4.19.y ef244c308885 997ccc67 .config console log report syz C ci2-linux-4-19
2019/11/02 08:23 linux-4.19.y ef244c308885 997ccc67 .config console log report syz C ci2-linux-4-19
2019/11/01 11:45 linux-4.19.y ef244c308885 a41ca8fa .config console log report syz C ci2-linux-4-19
2019/10/30 14:04 linux-4.19.y ef244c308885 5ea87a66 .config console log report syz C ci2-linux-4-19
2019/10/30 06:01 linux-4.19.y ef244c308885 5ea87a66 .config console log report syz C ci2-linux-4-19
2019/10/30 05:07 linux-4.19.y ef244c308885 5ea87a66 .config console log report syz C ci2-linux-4-19
2019/10/29 11:08 linux-4.19.y ef244c308885 5ea87a66 .config console log report syz C ci2-linux-4-19
2019/10/29 10:42 linux-4.19.y ef244c308885 5ea87a66 .config console log report syz C ci2-linux-4-19
2019/11/20 19:28 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 16:30 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 15:26 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 13:17 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 12:12 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 10:49 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 09:45 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 07:14 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 05:41 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 05:34 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 04:33 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 02:30 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/20 01:22 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/19 22:23 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/19 18:03 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/19 15:52 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/19 14:27 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/19 12:26 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/19 10:28 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/19 10:19 linux-4.19.y c555efaf1402 432c7650 .config console log report ci2-linux-4-19
2019/11/19 06:55 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/19 05:38 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/19 03:25 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/19 02:24 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/19 00:04 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 23:23 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 22:14 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 19:28 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 18:17 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 17:16 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 15:08 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 10:32 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 09:14 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/18 02:52 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/17 23:50 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/17 23:37 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/17 22:31 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/17 16:45 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/17 14:12 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/17 13:05 linux-4.19.y c555efaf1402 d5696d51 .config console log report ci2-linux-4-19
2019/11/17 08:30 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/11/17 06:19 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/11/17 04:57 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/11/17 02:06 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/11/16 22:04 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/11/16 20:41 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/11/16 19:06 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/11/16 16:55 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/11/16 15:29 linux-4.19.y c555efaf1402 cdac920b .config console log report ci2-linux-4-19
2019/10/29 10:01 linux-4.19.y ef244c308885 5ea87a66 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.