syzbot


inconsistent lock state in inet_shutdown

Status: auto-closed as invalid on 2019/02/24 23:29
First crash: 2185d, last: 2061d

Sample crash report:
=================================
[ INFO: inconsistent lock state ]
4.9.124-g09eb2ba #31 Tainted: G        W      
---------------------------------
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
syz-executor1/22916 [HC0[0]:SC1[3]:HE1:SE0] takes:
 (sk_lock-AF_PPPOX){+.?.+.}, at: [<ffffffff83428dd9>] lock_sock include/net/sock.h:1404 [inline]
 (sk_lock-AF_PPPOX){+.?.+.}, at: [<ffffffff83428dd9>] inet_shutdown+0x69/0x360 net/ipv4/af_inet.c:823
  mark_held_locks+0xc7/0x130 kernel/locking/lockdep.c:2660
  __trace_hardirqs_on_caller kernel/locking/lockdep.c:2689 [inline]
  trace_hardirqs_on_caller+0x38b/0x590 kernel/locking/lockdep.c:2736
  trace_hardirqs_on+0xd/0x10 kernel/locking/lockdep.c:2743
  __local_bh_enable_ip+0x6a/0xd0 kernel/softirq.c:190
  local_bh_enable include/linux/bottom_half.h:31 [inline]
  lock_sock_nested+0xdc/0x120 net/core/sock.c:2512
  lock_sock include/net/sock.h:1404 [inline]
  pppol2tp_connect+0xd9/0x18f0 net/l2tp/l2tp_ppp.c:590
  SYSC_connect+0x1b8/0x300 net/socket.c:1575
  SyS_connect+0x24/0x30 net/socket.c:1556
  do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
  entry_SYSCALL_64_after_swapgs+0x5d/0xdb
irq event stamp: 676
hardirqs last  enabled at (676): [<ffffffff81eb9628>] dump_stack+0x100/0x128 lib/dump_stack.c:56
hardirqs last disabled at (675): [<ffffffff81eb9554>] dump_stack+0x2c/0x128 lib/dump_stack.c:38
softirqs last  enabled at (0): [<ffffffff81130b22>] copy_process.part.51+0x1172/0x6330 kernel/fork.c:1625
softirqs last disabled at (539): [<ffffffff8114d554>] invoke_softirq kernel/softirq.c:368 [inline]
softirqs last disabled at (539): [<ffffffff8114d554>] irq_exit+0x114/0x150 kernel/softirq.c:409

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

       CPU0
       ----
  lock(sk_lock-AF_PPPOX);
  <Interrupt>
    lock(sk_lock-AF_PPPOX);

 *** DEADLOCK ***

2 locks held by syz-executor1/22916:
 #0:  (&mm->mmap_sem){++++++}, at: [<ffffffff810dcabb>] __do_page_fault+0x36b/0xd50 arch/x86/mm/fault.c:1337
 #1:  (rcu_callback){......}, at: [<ffffffff81289ace>] __rcu_reclaim kernel/rcu/rcu.h:108 [inline]
 #1:  (rcu_callback){......}, at: [<ffffffff81289ace>] rcu_do_batch kernel/rcu/tree.c:2789 [inline]
 #1:  (rcu_callback){......}, at: [<ffffffff81289ace>] invoke_rcu_callbacks kernel/rcu/tree.c:3053 [inline]
 #1:  (rcu_callback){......}, at: [<ffffffff81289ace>] __rcu_process_callbacks kernel/rcu/tree.c:3020 [inline]
 #1:  (rcu_callback){......}, at: [<ffffffff81289ace>] rcu_process_callbacks+0x98e/0x12b0 kernel/rcu/tree.c:3037

stack backtrace:
CPU: 0 PID: 22916 Comm: syz-executor1 Tainted: G        W       4.9.124-g09eb2ba #31
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801db207a58 ffffffff81eb95e9 ffff88019a45c800 ffffffff85616bb0
 ffff88019a45d118 ffff88019a45d138 0000000000000000 ffff8801db207ac8
 ffffffff81429ccd 0000000000000003 0000000000000001 ffff880100000000
Call Trace:
 <IRQ> [  314.139181]  [<ffffffff81eb95e9>] __dump_stack lib/dump_stack.c:15 [inline]
 <IRQ> [  314.139181]  [<ffffffff81eb95e9>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff81429ccd>] print_usage_bug.cold.57+0x327/0x421 kernel/locking/lockdep.c:2387
 [<ffffffff81237726>] valid_state kernel/locking/lockdep.c:2400 [inline]
 [<ffffffff81237726>] mark_lock_irq kernel/locking/lockdep.c:2602 [inline]
 [<ffffffff81237726>] mark_lock+0xcc6/0x1280 kernel/locking/lockdep.c:3065
 [<ffffffff812390f0>] mark_irqflags kernel/locking/lockdep.c:2923 [inline]
 [<ffffffff812390f0>] __lock_acquire+0xd40/0x4070 kernel/locking/lockdep.c:3302
 [<ffffffff8123ce90>] lock_acquire+0x130/0x3e0 kernel/locking/lockdep.c:3756
 [<ffffffff8302b806>] lock_sock_nested+0xc6/0x120 net/core/sock.c:2511
 [<ffffffff83428dd9>] lock_sock include/net/sock.h:1404 [inline]
 [<ffffffff83428dd9>] inet_shutdown+0x69/0x360 net/ipv4/af_inet.c:823
 [<ffffffff836cb740>] pppol2tp_session_close+0xa0/0xe0 net/l2tp/l2tp_ppp.c:441
 [<ffffffff836c4f71>] l2tp_tunnel_closeall+0x231/0x350 net/l2tp/l2tp_core.c:1368
 [<ffffffff836c57f2>] l2tp_tunnel_destruct+0x2f2/0x590 net/l2tp/l2tp_core.c:1324
 [<ffffffff830281f5>] __sk_destruct+0x55/0x590 net/core/sock.c:1428
 [<ffffffff812899ee>] __rcu_reclaim kernel/rcu/rcu.h:118 [inline]
 [<ffffffff812899ee>] rcu_do_batch kernel/rcu/tree.c:2789 [inline]
 [<ffffffff812899ee>] invoke_rcu_callbacks kernel/rcu/tree.c:3053 [inline]
 [<ffffffff812899ee>] __rcu_process_callbacks kernel/rcu/tree.c:3020 [inline]
 [<ffffffff812899ee>] rcu_process_callbacks+0x8ae/0x12b0 kernel/rcu/tree.c:3037
 [<ffffffff83a085c0>] __do_softirq+0x210/0x940 kernel/softirq.c:288
 [<ffffffff8114d554>] invoke_softirq kernel/softirq.c:368 [inline]
 [<ffffffff8114d554>] irq_exit+0x114/0x150 kernel/softirq.c:409
 [<ffffffff83a071a1>] exiting_irq arch/x86/include/asm/apic.h:669 [inline]
 [<ffffffff83a071a1>] smp_apic_timer_interrupt+0x81/0xa0 arch/x86/kernel/apic/apic.c:962
 [<ffffffff83a03330>] apic_timer_interrupt+0xa0/0xb0 arch/x86/entry/entry_64.S:648
 <EOI> [  314.310045]  [<ffffffff8145332f>] ? arch_local_irq_restore arch/x86/include/asm/paravirt.h:768 [inline]
 <EOI> [  314.310045]  [<ffffffff8145332f>] ? buffered_rmqueue mm/page_alloc.c:2692 [inline]
 <EOI> [  314.310045]  [<ffffffff8145332f>] ? get_page_from_freelist+0xcbf/0x1a00 mm/page_alloc.c:2999
 [<ffffffff81456c47>] __alloc_pages_nodemask+0x237/0x700 mm/page_alloc.c:3843
 [<ffffffff8154a2f5>] __alloc_pages include/linux/gfp.h:433 [inline]
 [<ffffffff8154a2f5>] __alloc_pages_node include/linux/gfp.h:446 [inline]
 [<ffffffff8154a2f5>] alloc_pages_node include/linux/gfp.h:460 [inline]
 [<ffffffff8154a2f5>] do_huge_pmd_anonymous_page+0x265/0x1140 mm/huge_memory.c:695
 [<ffffffff814d3d98>] create_huge_pmd mm/memory.c:3438 [inline]
 [<ffffffff814d3d98>] __handle_mm_fault mm/memory.c:3588 [inline]
 [<ffffffff814d3d98>] handle_mm_fault+0x1b88/0x2a00 mm/memory.c:3649
 [<ffffffff810dccff>] __do_page_fault+0x5af/0xd50 arch/x86/mm/fault.c:1408
 [<ffffffff810dd4c7>] do_page_fault+0x27/0x30 arch/x86/mm/fault.c:1471
 [<ffffffff83a02b48>] page_fault+0x28/0x30 arch/x86/entry/entry_64.S:951
==================================================================
BUG: KASAN: use-after-free in l2tp_sock_to_tunnel net/l2tp/l2tp_core.h:234 [inline]
BUG: KASAN: use-after-free in pppol2tp_sendmsg+0x681/0x790 net/l2tp/l2tp_ppp.c:304
Read of size 8 at addr ffff8801b74ccb50 by task syz-executor5/22915

CPU: 0 PID: 22915 Comm: syz-executor5 Tainted: G        W       4.9.124-g09eb2ba #31
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801b8ddf8e0 ffffffff81eb95e9 ffffea0006dd3200 ffff8801b74ccb50
 0000000000000000 ffff8801b74ccb50 ffff8801b74cc780 ffff8801b8ddf918
 ffffffff8156c35e ffff8801b74ccb50 0000000000000008 0000000000000000
Call Trace:
 [<ffffffff81eb95e9>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81eb95e9>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff8156c35e>] print_address_description+0x6c/0x234 mm/kasan/report.c:256
 [<ffffffff8156c768>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<ffffffff8156c768>] kasan_report.cold.6+0x242/0x2fe mm/kasan/report.c:412
 [<ffffffff8153faf4>] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 [<ffffffff836cfa51>] l2tp_sock_to_tunnel net/l2tp/l2tp_core.h:234 [inline]
 [<ffffffff836cfa51>] pppol2tp_sendmsg+0x681/0x790 net/l2tp/l2tp_ppp.c:304
 [<ffffffff8301e0ac>] sock_sendmsg_nosec net/socket.c:648 [inline]
 [<ffffffff8301e0ac>] sock_sendmsg+0xcc/0x110 net/socket.c:658
 [<ffffffff8301f8ca>] ___sys_sendmsg+0x47a/0x840 net/socket.c:1982
 [<ffffffff83021e31>] __sys_sendmmsg+0x161/0x3d0 net/socket.c:2072
 [<ffffffff830220d5>] SYSC_sendmmsg net/socket.c:2103 [inline]
 [<ffffffff830220d5>] SyS_sendmmsg+0x35/0x60 net/socket.c:2098
 [<ffffffff81006316>] do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 [<ffffffff83a019d3>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Allocated by task 22909:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:609
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:547
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 kmem_cache_alloc+0xbe/0x290 mm/slub.c:2728
 sk_prot_alloc+0x69/0x290 net/core/sock.c:1332
 sk_alloc+0x3a/0x3a0 net/core/sock.c:1394
 inet6_create+0x2d9/0xd80 net/ipv6/af_inet6.c:198
 __sock_create+0x2f1/0x5f0 net/socket.c:1195
 sock_create net/socket.c:1235 [inline]
 SYSC_socket net/socket.c:1265 [inline]
 SyS_socket+0xf0/0x1b0 net/socket.c:1245
 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 22916:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:582
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kmem_cache_free+0xbe/0x310 mm/slub.c:2980
 sk_prot_free net/core/sock.c:1375 [inline]
 __sk_destruct+0x3b9/0x590 net/core/sock.c:1455
 __rcu_reclaim kernel/rcu/rcu.h:118 [inline]
 rcu_do_batch kernel/rcu/tree.c:2789 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:3053 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:3020 [inline]
 rcu_process_callbacks+0x8ae/0x12b0 kernel/rcu/tree.c:3037
 __do_softirq+0x210/0x940 kernel/softirq.c:288

The buggy address belongs to the object at ffff8801b74cc780
 which belongs to the cache UDPv6 of size 1496
The buggy address is located 976 bytes inside of
 1496-byte region [ffff8801b74cc780, ffff8801b74ccd58)
The buggy address belongs to the page:
page:ffffea0006dd3200 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x8000000000004080(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801b74cca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b74cca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801b74ccb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff8801b74ccb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b74ccc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/08/28 23:27 https://android.googlesource.com/kernel/common android-4.9 09eb2ba5ed0c b771b17e .config console log report ci-android-49-kasan-gce-root
2018/08/25 07:35 https://android.googlesource.com/kernel/common android-4.9 09eb2ba5ed0c 9be5aa1d .config console log report ci-android-49-kasan-gce-root
2018/04/26 22:32 https://android.googlesource.com/kernel/common android-4.9 71fce1edd26d 73417389 .config console log report ci-android-49-kasan-gce-root
* Struck through repros no longer work on HEAD.