Subject: WARNING: suspicious RCU usage in rds_loop_conn_alloc

From: syzbot <[email-masked]>
Date: Mon, 12 Feb 2018 07:59:01 -0800

Hello,

syzbot hit the following crash on net-next commit
9a61df9e5f7471fe5be3e02bd0bed726b2761a54 (Sat Feb 10 03:32:41 2018 +0000)
Merge tag 'kbuild-v4.16-2' of  
git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

So far this crash happened 5095 times on net-next, upstream.
C reproducer is attached.
syzkaller reproducer is attached.
Raw console output is attached.
compiler: gcc (GCC) 7.1.1 20170620
.config is attached.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: [email-masked]
It will help syzbot understand when the bug is fixed. See footer for  
details.
If you forward the report, please keep this part and the footer.

audit: type=1400 audit(1518375397.081:7): avc:  denied  { map } for   
pid=4086 comm="syzkaller563791" path="/root/syzkaller563791236" dev="sda1"  
ino=16481 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.15.0+ #222 Not tainted
-----------------------------
./include/linux/rcupdate.h:302 Illegal context switch in RCU read-side  
critical section!

other info that might help us debug this:

rcu_scheduler_active = 2, debug_locks = 1
1 lock held by syzkaller563791/4086:
  #0:  (rcu_read_lock){....}, at: [<00000000bf5db0e6>]  
__rds_conn_create+0xe46/0x1b50 net/rds/connection.c:218

stack backtrace:
CPU: 0 PID: 4086 Comm: syzkaller563791 Not tainted 4.15.0+ #222
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x194/0x257 lib/dump_stack.c:53
  lockdep_rcu_suspicious+0x123/0x170 kernel/locking/lockdep.c:4592
  rcu_preempt_sleep_check include/linux/rcupdate.h:301 [inline]
  ___might_sleep+0x385/0x470 kernel/sched/core.c:6093
  __might_sleep+0x95/0x190 kernel/sched/core.c:6081
  slab_pre_alloc_hook mm/slab.h:420 [inline]
  slab_alloc mm/slab.c:3365 [inline]
  kmem_cache_alloc_trace+0x299/0x740 mm/slab.c:3605
  kmalloc include/linux/slab.h:512 [inline]
  kzalloc include/linux/slab.h:701 [inline]
  rds_loop_conn_alloc+0xc8/0x380 net/rds/loop.c:126
  __rds_conn_create+0x112f/0x1b50 net/rds/connection.c:227
  rds_conn_create_outgoing+0x3f/0x50 net/rds/connection.c:309
  rds_sendmsg+0xda3/0x2390 net/rds/send.c:1126
  sock_sendmsg_nosec net/socket.c:630 [inline]
  sock_sendmsg+0xca/0x110 net/socket.c:640
  SYSC_sendto+0x361/0x5c0 net/socket.c:1747
  SyS_sendto+0x40/0x50 net/socket.c:1715
  do_syscall_64+0x282/0x940 arch/x86/entry/common.c:287
  entry_SYSCALL_64_after_hwframe+0x26/0x9b
RIP: 0033:0x43fd99
RSP: 002b:00007ffc09659fa8 EFLAGS: 00000217 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 000000000043fd99
RDX: 0000000000000000 RSI: 0000000020218000 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000020af3ff0 R09: 0000000000000010
R10: 0000000000000000 R11: 0000000000000217 R12: 00000000004016c0
R13: 0000000000401750 R14: 0000000000000000 R15: 0000000000000000
BUG: sleeping function called from invalid context at mm/slab.h:420
in_atomic(): 1, irqs_disabled(): 0, pid: 4086, name: syzkaller563791
1 lock held by syzkaller563791/4086:
  #0:  (rcu_read_lock){....}, at: [<00000000bf5db0e6>]  
__rds_conn_create+0xe46/0x1b50 net/rds/connection.c:218
CPU: 0 PID: 4086 Comm: syzkaller563791 Not tainted 4.15.0+ #222
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x194/0x257 lib/dump_stack.c:53
  ___might_sleep+0x2b2/0x470 kernel/sched/core.c:6128
  __might_sleep+0x95/0x190 kernel/sched/core.c:6081
  slab_pre_alloc_hook mm/slab.h:420 [inline]
  slab_alloc mm/slab.c:3365 [inline]
  kmem_cache_alloc_trace+0x299/0x740 mm/slab.c:3605
  kmalloc include/linux/slab.h:512 [inline]
  kzalloc include/linux/slab.h:701 [inline]
  rds_loop_conn_alloc+0xc8/0x380 net/rds/loop.c:126
  __rds_conn_create+0x112f/0x1b50 net/rds/connection.c:227
  rds_conn_create_outgoing+0x3f/0x50 net/rds/connection.c:309
  rds_sendmsg+0xda3/0x2390 net/rds/send.c:1126
  sock_sendmsg_nosec net/socket.c:630 [inline]
  sock_sendmsg+0xca/0x110 net/socket.c:640
  SYSC_sendto+0x361/0x5c0 net/socket.c:1747
  SyS_sendto+0x40/0x50 net/socket.c:1715
  do_syscall_64+0x282/0x940 arch/x86/entry/common.c:287
  entry_SYSCALL_64_after_hwframe+0x26/0x9b
RIP: 0033:0x43fd99
RSP: 002b:00007ffc09659fa8 EFLAGS: 00000217 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 000000000043fd99
RDX: 0000000000000000 RSI: 0000000020218000 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000020af3ff0 R09: 0000000000000010
R10: 000000

---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to [email-masked].

syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is  
merged
into any tree, please reply to this email with:
#syz fix: exact-commit-title
If you want to test a patch for this bug, please reply with:
#syz test: git://repo/address.git branch
and provide the patch inline or as an attachment.
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug  
report.
Note: all commands must start from beginning of the line in the email body.