syzbot


inconsistent lock state in xfrm_user_rcv_msg

Status: closed as dup on 2020/09/24 04:15
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+00c3b7dbdf97d1d36a9e@syzkaller.appspotmail.com
First crash: 1280d, last: 1278d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
inconsistent lock state in xfrm_policy_lookup_inexact_addr net 11 1278d 1279d
Discussions (1)
Title Replies (including bot) Last reply
inconsistent lock state in xfrm_user_rcv_msg 1 (2) 2020/09/24 04:15

Sample crash report:
================================
WARNING: inconsistent lock state
5.9.0-rc5-next-20200916-syzkaller #0 Not tainted
--------------------------------
inconsistent {IN-SOFTIRQ-R} -> {SOFTIRQ-ON-W} usage.
syz-executor.3/26325 [HC0[0]:SC0[0]:HE1:SE1] takes:
ffff88808b5077d0 (&s->seqcount#12){+.+-}-{0:0}, at: xfrm_user_rcv_msg+0x41e/0x720 net/xfrm/xfrm_user.c:2684
{IN-SOFTIRQ-R} state was registered at:
  lock_acquire+0x1f2/0xaa0 kernel/locking/lockdep.c:5398
  seqcount_lockdep_reader_access+0x139/0x1a0 include/linux/seqlock.h:103
  xfrm_policy_lookup_inexact_addr+0x57/0x200 net/xfrm/xfrm_policy.c:1909
  xfrm_policy_find_inexact_candidates+0xac/0x1d0 net/xfrm/xfrm_policy.c:1953
  xfrm_policy_lookup_bytype+0x4b8/0xa40 net/xfrm/xfrm_policy.c:2108
  xfrm_policy_lookup net/xfrm/xfrm_policy.c:2144 [inline]
  xfrm_bundle_lookup net/xfrm/xfrm_policy.c:2944 [inline]
  xfrm_lookup_with_ifid+0xab3/0x2130 net/xfrm/xfrm_policy.c:3085
  icmp6_dst_alloc+0x489/0x6c0 net/ipv6/route.c:3187
  ndisc_send_skb+0x1207/0x1720 net/ipv6/ndisc.c:486
  ndisc_send_rs+0x12e/0x700 net/ipv6/ndisc.c:700
  addrconf_rs_timer+0x2ec/0x7c0 net/ipv6/addrconf.c:3873
  call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1413
  expire_timers kernel/time/timer.c:1458 [inline]
  __run_timers.part.0+0x67c/0xa50 kernel/time/timer.c:1755
  __run_timers kernel/time/timer.c:1736 [inline]
  run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1768
  __do_softirq+0x203/0xab6 kernel/softirq.c:298
  asm_call_on_stack+0xf/0x20 arch/x86/entry/entry_64.S:786
  __run_on_irqstack arch/x86/include/asm/irq_stack.h:22 [inline]
  run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:48 [inline]
  do_softirq_own_stack+0x9d/0xd0 arch/x86/kernel/irq_64.c:77
  invoke_softirq kernel/softirq.c:393 [inline]
  __irq_exit_rcu kernel/softirq.c:423 [inline]
  irq_exit_rcu+0x235/0x280 kernel/softirq.c:435
  sysvec_apic_timer_interrupt+0x51/0xf0 arch/x86/kernel/apic/apic.c:1091
  asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:631
  arch_local_irq_restore arch/x86/include/asm/paravirt.h:653 [inline]
  console_unlock+0xa40/0xd70 kernel/printk/printk.c:2496
  vprintk_emit+0x2b5/0x6f0 kernel/printk/printk.c:2015
  vprintk_func+0x8d/0x1e0 kernel/printk/printk_safe.c:393
  printk+0xba/0xed kernel/printk/printk.c:2063
  __nla_validate_parse.cold+0x6d/0xaa lib/nlattr.c:563
  __nla_parse+0x3d/0x50 lib/nlattr.c:648
  __nlmsg_parse include/net/netlink.h:722 [inline]
  nlmsg_parse_deprecated include/net/netlink.h:761 [inline]
  rtnl_dellink+0x13e/0xa60 net/core/rtnetlink.c:3072
  rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5563
  netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470
  netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
  netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
  netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
  sock_sendmsg_nosec net/socket.c:651 [inline]
  sock_sendmsg+0xcf/0x120 net/socket.c:671
  ____sys_sendmsg+0x6e8/0x810 net/socket.c:2362
  ___sys_sendmsg+0xf3/0x170 net/socket.c:2416
  __sys_sendmsg+0xe5/0x1b0 net/socket.c:2449
  do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
  entry_SYSCALL_64_after_hwframe+0x44/0xa9
irq event stamp: 1377
hardirqs last  enabled at (1377): [<ffffffff81b5ef71>] slab_alloc_node mm/slab.c:3246 [inline]
hardirqs last  enabled at (1377): [<ffffffff81b5ef71>] kmem_cache_alloc_node_trace+0x271/0x5b0 mm/slab.c:3590
hardirqs last disabled at (1376): [<ffffffff81b5ef7b>] slab_alloc_node mm/slab.c:3221 [inline]
hardirqs last disabled at (1376): [<ffffffff81b5ef7b>] kmem_cache_alloc_node_trace+0x27b/0x5b0 mm/slab.c:3590
softirqs last  enabled at (1372): [<ffffffff8674adf7>] netlink_insert+0x187/0x1670 net/netlink/af_netlink.c:590
softirqs last disabled at (1370): [<ffffffff8636284b>] spin_lock_bh include/linux/spinlock.h:359 [inline]
softirqs last disabled at (1370): [<ffffffff8636284b>] release_sock+0x1b/0x1b0 net/core/sock.c:3049

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&s->seqcount#12);
  <Interrupt>
    lock(&s->seqcount#12);

 *** DEADLOCK ***

2 locks held by syz-executor.3/26325:
 #0: ffff88808b507b68 (&net->xfrm.xfrm_cfg_mutex){+.+.}-{3:3}, at: xfrm_netlink_rcv+0x5c/0x90 net/xfrm/xfrm_user.c:2691
 #1: ffff88808b507818 (&(&net->xfrm.policy_hthresh.lock)->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:354 [inline]
 #1: ffff88808b507818 (&(&net->xfrm.policy_hthresh.lock)->lock){+.+.}-{2:2}, at: write_seqlock include/linux/seqlock.h:882 [inline]
 #1: ffff88808b507818 (&(&net->xfrm.policy_hthresh.lock)->lock){+.+.}-{2:2}, at: xfrm_set_spdinfo+0x2b8/0x660 net/xfrm/xfrm_user.c:1185

stack backtrace:
CPU: 1 PID: 26325 Comm: syz-executor.3 Not tainted 5.9.0-rc5-next-20200916-syzkaller #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+0x198/0x1fb lib/dump_stack.c:118
 print_usage_bug kernel/locking/lockdep.c:4377 [inline]
 valid_state kernel/locking/lockdep.c:3705 [inline]
 mark_lock_irq kernel/locking/lockdep.c:3914 [inline]
 mark_lock.cold+0x6f/0x74 kernel/locking/lockdep.c:4375
 mark_usage kernel/locking/lockdep.c:4278 [inline]
 __lock_acquire+0x886/0x56d0 kernel/locking/lockdep.c:4750
 lock_acquire+0x1f2/0xaa0 kernel/locking/lockdep.c:5398
 write_seqcount_t_begin_nested include/linux/seqlock.h:509 [inline]
 write_seqcount_t_begin include/linux/seqlock.h:535 [inline]
 write_seqlock include/linux/seqlock.h:883 [inline]
 xfrm_set_spdinfo+0x302/0x660 net/xfrm/xfrm_user.c:1185
 xfrm_user_rcv_msg+0x41e/0x720 net/xfrm/xfrm_user.c:2684
 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470
 xfrm_netlink_rcv+0x6b/0x90 net/xfrm/xfrm_user.c:2692
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2362
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2416
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2449
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45d5f9
Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f4f1f107c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000002cf80 RCX: 000000000045d5f9
RDX: 0000000000000000 RSI: 0000000020000380 RDI: 0000000000000003
RBP: 000000000118cf80 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118cf4c
R13: 00007fff1cb1835f R14: 00007f4f1f1089c0 R15: 000000000118cf4c

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/09/17 12:10 linux-next 5fa35f247b56 8247808b .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/17 12:06 linux-next 5fa35f247b56 8247808b .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 21:35 linux-next 5fa35f247b56 18d7d030 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 20:19 linux-next 5fa35f247b56 18d7d030 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 16:56 linux-next 5fa35f247b56 18d7d030 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 13:47 linux-next 5fa35f247b56 18d7d030 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 09:30 linux-next 5fa35f247b56 18d7d030 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 09:21 linux-next 5fa35f247b56 18d7d030 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 07:29 linux-next 6b02addb1d17 18d7d030 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 06:51 linux-next 6b02addb1d17 18d7d030 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 03:50 linux-next 6b02addb1d17 6989d6f6 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/16 01:40 linux-next 6b02addb1d17 6989d6f6 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/15 22:40 linux-next 6b02addb1d17 6989d6f6 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/15 10:04 linux-next 6b02addb1d17 6989d6f6 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/15 09:15 linux-next f965d3ec86fa 6989d6f6 .config console log report info ci-upstream-linux-next-kasan-gce-root
2020/09/15 08:49 linux-next f965d3ec86fa 6989d6f6 .config console log report info ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.