netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [netfilter?] inconsistent lock state in valid_state (4)
@ 2024-08-19  5:03 syzbot
  2024-08-21 23:00 ` [syzbot] [ppp?] " syzbot
  0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2024-08-19  5:03 UTC (permalink / raw)
  To: coreteam, davem, dsahern, edumazet, kadlec, kuba, linux-kernel,
	netdev, netfilter-devel, pabeni, pablo, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    9d5906799f7d Merge tag 'selinux-pr-20240814' of git://git...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12b7d5ed980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7229118d88b4a71b
dashboard link: https://syzkaller.appspot.com/bug?extid=d43eb079c2addf2439c3
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8e704636e03c/disk-9d590679.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/51ba26ca8f22/vmlinux-9d590679.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8446039662e6/bzImage-9d590679.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d43eb079c2addf2439c3@syzkaller.appspotmail.com

gfs2: fsid=syz:syz.0: can't create logd thread: -4
================================
WARNING: inconsistent lock state
6.11.0-rc3-syzkaller-00036-g9d5906799f7d #0 Not tainted
--------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
syz.4.59/5557 [HC0[0]:SC0[0]:HE1:SE1] takes:
ffff88802cd32548 ((&usbhid->io_retry)){+.?.}-{0:0}, at: touch_wq_lockdep_map kernel/workqueue.c:3876 [inline]
ffff88802cd32548 ((&usbhid->io_retry)){+.?.}-{0:0}, at: __flush_workqueue+0x1b0/0x1710 kernel/workqueue.c:3918
{IN-SOFTIRQ-W} state was registered at:
  lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
  call_timer_fn+0xdd/0x650 kernel/time/timer.c:1789
  expire_timers kernel/time/timer.c:1843 [inline]
  __run_timers kernel/time/timer.c:2417 [inline]
  __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2428
  run_timer_base kernel/time/timer.c:2437 [inline]
  run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2447
  handle_softirqs+0x2c6/0x970 kernel/softirq.c:554
  __do_softirq kernel/softirq.c:588 [inline]
  invoke_softirq kernel/softirq.c:428 [inline]
  __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
  irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
  instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
  sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043
  asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
  __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
  _raw_spin_unlock_irqrestore+0xd8/0x140 kernel/locking/spinlock.c:194
  __debug_check_no_obj_freed lib/debugobjects.c:999 [inline]
  debug_check_no_obj_freed+0x561/0x580 lib/debugobjects.c:1020
  free_pages_prepare mm/page_alloc.c:1101 [inline]
  free_unref_page+0x38a/0xea0 mm/page_alloc.c:2612
  __slab_free+0x31b/0x3d0 mm/slub.c:4384
  qlink_free mm/kasan/quarantine.c:163 [inline]
  qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179
  kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286
  __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322
  kasan_slab_alloc include/linux/kasan.h:201 [inline]
  slab_post_alloc_hook mm/slub.c:3988 [inline]
  slab_alloc_node mm/slub.c:4037 [inline]
  __kmalloc_cache_node_noprof+0x166/0x300 mm/slub.c:4197
  kmalloc_node_noprof include/linux/slab.h:704 [inline]
  __get_vm_area_node+0x113/0x270 mm/vmalloc.c:3109
  __vmalloc_node_range_noprof+0x3bc/0x1460 mm/vmalloc.c:3801
  __vmalloc_node_noprof mm/vmalloc.c:3906 [inline]
  vzalloc_noprof+0x79/0x90 mm/vmalloc.c:3979
  alloc_counters+0xd7/0x740 net/ipv4/netfilter/ip_tables.c:799
  copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:837 [inline]
  get_entries net/ipv6/netfilter/ip6_tables.c:1039 [inline]
  do_ip6t_get_ctl+0xecc/0x1820 net/ipv6/netfilter/ip6_tables.c:1677
  nf_getsockopt+0x29b/0x2c0 net/netfilter/nf_sockopt.c:116
  ipv6_getsockopt+0x263/0x380 net/ipv6/ipv6_sockglue.c:1493
  tcp_getsockopt+0x165/0x1c0 net/ipv4/tcp.c:4409
  do_sock_getsockopt+0x375/0x850 net/socket.c:2386
  __sys_getsockopt+0x271/0x330 net/socket.c:2415
  __do_sys_getsockopt net/socket.c:2425 [inline]
  __se_sys_getsockopt net/socket.c:2422 [inline]
  __x64_sys_getsockopt+0xb5/0xd0 net/socket.c:2422
  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
  do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
  entry_SYSCALL_64_after_hwframe+0x77/0x7f
irq event stamp: 93075
hardirqs last  enabled at (93075): [<ffffffff8bc06683>] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline]
hardirqs last  enabled at (93075): [<ffffffff8bc06683>] _raw_spin_unlock_irq+0x23/0x50 kernel/locking/spinlock.c:202
hardirqs last disabled at (93074): [<ffffffff8bc063cd>] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:117 [inline]
hardirqs last disabled at (93074): [<ffffffff8bc063cd>] _raw_spin_lock_irq+0xad/0x120 kernel/locking/spinlock.c:170
softirqs last  enabled at (92472): [<ffffffff81575bd4>] __do_softirq kernel/softirq.c:588 [inline]
softirqs last  enabled at (92472): [<ffffffff81575bd4>] invoke_softirq kernel/softirq.c:428 [inline]
softirqs last  enabled at (92472): [<ffffffff81575bd4>] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
softirqs last disabled at (92431): [<ffffffff81575bd4>] __do_softirq kernel/softirq.c:588 [inline]
softirqs last disabled at (92431): [<ffffffff81575bd4>] invoke_softirq kernel/softirq.c:428 [inline]
softirqs last disabled at (92431): [<ffffffff81575bd4>] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637

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

       CPU0
       ----
  lock((&usbhid->io_retry));
  <Interrupt>
    lock((&usbhid->io_retry));

 *** DEADLOCK ***

1 lock held by syz.4.59/5557:
 #0: ffff888055c9a0e0 (&type->s_umount_key#66/1){+.+.}-{3:3}, at: alloc_super+0x221/0x9d0 fs/super.c:344

stack backtrace:
CPU: 0 UID: 0 PID: 5557 Comm: syz.4.59 Not tainted 6.11.0-rc3-syzkaller-00036-g9d5906799f7d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 valid_state+0x13a/0x1c0 kernel/locking/lockdep.c:4012
 mark_lock_irq+0xbb/0xc20 kernel/locking/lockdep.c:4215
 mark_lock+0x223/0x350 kernel/locking/lockdep.c:4677
 __lock_acquire+0x11a6/0x2040 kernel/locking/lockdep.c:5096
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
 touch_wq_lockdep_map kernel/workqueue.c:3876 [inline]
 __flush_workqueue+0x1c9/0x1710 kernel/workqueue.c:3918
 drain_workqueue+0xc9/0x3a0 kernel/workqueue.c:4082
 destroy_workqueue+0xba/0xc40 kernel/workqueue.c:5781
 gfs2_fill_super+0x128a/0x2500 fs/gfs2/ops_fstype.c:1310
 get_tree_bdev+0x3f9/0x570 fs/super.c:1635
 gfs2_get_tree+0x54/0x220 fs/gfs2/ops_fstype.c:1329
 vfs_get_tree+0x92/0x2a0 fs/super.c:1800
 do_new_mount+0x2be/0xb40 fs/namespace.c:3472
 do_mount fs/namespace.c:3812 [inline]
 __do_sys_mount fs/namespace.c:4020 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6490f7b0ba
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 7e 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6491d08e68 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f6491d08ef0 RCX: 00007f6490f7b0ba
RDX: 00000000200003c0 RSI: 0000000020037f80 RDI: 00007f6491d08eb0
RBP: 00000000200003c0 R08: 00007f6491d08ef0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020037f80
R13: 00007f6491d08eb0 R14: 0000000000037f59 R15: 0000000020000000
 </TASK>
list_del corruption, ffff88802cd32410->prev is LIST_POISON2 (dead000000000122)
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:61!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 1 UID: 0 PID: 5557 Comm: syz.4.59 Not tainted 6.11.0-rc3-syzkaller-00036-g9d5906799f7d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
RIP: 0010:__list_del_entry_valid_or_report+0x106/0x140 lib/list_debug.c:59
Code: e8 3f e5 fa 06 90 0f 0b 48 c7 c7 e0 6c 60 8c 4c 89 fe e8 2d e5 fa 06 90 0f 0b 48 c7 c7 40 6d 60 8c 4c 89 fe e8 1b e5 fa 06 90 <0f> 0b 48 c7 c7 a0 6d 60 8c 4c 89 fe 48 89 d9 e8 06 e5 fa 06 90 0f
RSP: 0018:ffffc90009017928 EFLAGS: 00010246
RAX: 000000000000004e RBX: dead000000000122 RCX: 6fba748022670100
RDX: ffffc90009049000 RSI: 000000000003ffff RDI: 0000000000040000
RBP: ffff88802cd324f8 R08: ffffffff8173f24c R09: 1ffff92001202ec4
R10: dffffc0000000000 R11: fffff52001202ec5 R12: dffffc0000000000
R13: ffff88802cd32400 R14: ffff88802cd32810 R15: ffff88802cd32410
FS:  00007f6491d096c0(0000) GS:ffff8880b9300000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007faf8fc47d60 CR3: 0000000022a12000 CR4: 0000000000350ef0
Call Trace:
 <TASK>
 __list_del_entry_valid include/linux/list.h:124 [inline]
 __list_del_entry include/linux/list.h:215 [inline]
 list_del_rcu include/linux/rculist.h:157 [inline]
 destroy_workqueue+0x7b3/0xc40 kernel/workqueue.c:5823
 gfs2_fill_super+0x128a/0x2500 fs/gfs2/ops_fstype.c:1310
 get_tree_bdev+0x3f9/0x570 fs/super.c:1635
 gfs2_get_tree+0x54/0x220 fs/gfs2/ops_fstype.c:1329
 vfs_get_tree+0x92/0x2a0 fs/super.c:1800
 do_new_mount+0x2be/0xb40 fs/namespace.c:3472
 do_mount fs/namespace.c:3812 [inline]
 __do_sys_mount fs/namespace.c:4020 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6490f7b0ba
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 7e 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6491d08e68 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f6491d08ef0 RCX: 00007f6490f7b0ba
RDX: 00000000200003c0 RSI: 0000000020037f80 RDI: 00007f6491d08eb0
RBP: 00000000200003c0 R08: 00007f6491d08ef0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020037f80
R13: 00007f6491d08eb0 R14: 0000000000037f59 R15: 0000000020000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_del_entry_valid_or_report+0x106/0x140 lib/list_debug.c:59
Code: e8 3f e5 fa 06 90 0f 0b 48 c7 c7 e0 6c 60 8c 4c 89 fe e8 2d e5 fa 06 90 0f 0b 48 c7 c7 40 6d 60 8c 4c 89 fe e8 1b e5 fa 06 90 <0f> 0b 48 c7 c7 a0 6d 60 8c 4c 89 fe 48 89 d9 e8 06 e5 fa 06 90 0f
RSP: 0018:ffffc90009017928 EFLAGS: 00010246
RAX: 000000000000004e RBX: dead000000000122 RCX: 6fba748022670100
RDX: ffffc90009049000 RSI: 000000000003ffff RDI: 0000000000040000
RBP: ffff88802cd324f8 R08: ffffffff8173f24c R09: 1ffff92001202ec4
R10: dffffc0000000000 R11: fffff52001202ec5 R12: dffffc0000000000
R13: ffff88802cd32400 R14: ffff88802cd32810 R15: ffff88802cd32410
FS:  00007f6491d096c0(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007faaedf66731 CR3: 0000000022a12000 CR4: 0000000000350ef0


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [ppp?] inconsistent lock state in valid_state (4)
  2024-08-19  5:03 [syzbot] [netfilter?] inconsistent lock state in valid_state (4) syzbot
@ 2024-08-21 23:00 ` syzbot
  2024-08-22  6:29   ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2024-08-21 23:00 UTC (permalink / raw)
  To: coreteam, davem, dsahern, edumazet, kadlec, kuba, linux-kernel,
	linux-ppp, netdev, netfilter-devel, pabeni, pablo, syzkaller-bugs

syzbot has found a reproducer for the following issue on:

HEAD commit:    b311c1b497e5 Merge tag '6.11-rc4-server-fixes' of git://gi..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12dccc7b980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=df2f0ed7e30a639d
dashboard link: https://syzkaller.appspot.com/bug?extid=d43eb079c2addf2439c3
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=17cf93d5980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=101bb693980000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-b311c1b4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1c99fa48192f/vmlinux-b311c1b4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/16d5710a012a/bzImage-b311c1b4.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d43eb079c2addf2439c3@syzkaller.appspotmail.com

================================
WARNING: inconsistent lock state
6.11.0-rc4-syzkaller-00019-gb311c1b497e5 #0 Not tainted
--------------------------------
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
ksoftirqd/0/16 [HC0[0]:SC1[1]:HE1:SE0] takes:
ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
{SOFTIRQ-ON-W} state was registered at:
  lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
  __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
  _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
  spin_lock include/linux/spinlock.h:351 [inline]
  ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
  ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
  pppoe_rcv_core+0x117/0x310 drivers/net/ppp/pppoe.c:379
  sk_backlog_rcv include/net/sock.h:1111 [inline]
  __release_sock+0x243/0x350 net/core/sock.c:3004
  release_sock+0x61/0x1f0 net/core/sock.c:3558
  pppoe_sendmsg+0xd5/0x750 drivers/net/ppp/pppoe.c:903
  sock_sendmsg_nosec net/socket.c:730 [inline]
  __sock_sendmsg+0x221/0x270 net/socket.c:745
  ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
  ___sys_sendmsg net/socket.c:2651 [inline]
  __sys_sendmmsg+0x3b2/0x740 net/socket.c:2737
  __do_sys_sendmmsg net/socket.c:2766 [inline]
  __se_sys_sendmmsg net/socket.c:2763 [inline]
  __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2763
  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
  do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
  entry_SYSCALL_64_after_hwframe+0x77/0x7f
irq event stamp: 1309336
hardirqs last  enabled at (1309336): [<ffffffff8bc0d5ff>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
hardirqs last  enabled at (1309336): [<ffffffff8bc0d5ff>] _raw_spin_unlock_irqrestore+0x8f/0x140 kernel/locking/spinlock.c:194
hardirqs last disabled at (1309335): [<ffffffff8bc0d300>] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline]
hardirqs last disabled at (1309335): [<ffffffff8bc0d300>] _raw_spin_lock_irqsave+0xb0/0x120 kernel/locking/spinlock.c:162
softirqs last  enabled at (1309326): [<ffffffff81578ffa>] run_ksoftirqd+0xca/0x130 kernel/softirq.c:928
softirqs last disabled at (1309331): [<ffffffff81578ffa>] run_ksoftirqd+0xca/0x130 kernel/softirq.c:928

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

       CPU0
       ----
  lock(&pch->downl);
  <Interrupt>
    lock(&pch->downl);

 *** DEADLOCK ***

1 lock held by ksoftirqd/0/16:
 #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline]
 #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
 #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2267 [inline]
 #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ppp_input+0x55/0xa10 drivers/net/ppp/ppp_generic.c:2304

stack backtrace:
CPU: 0 UID: 0 PID: 16 Comm: ksoftirqd/0 Not tainted 6.11.0-rc4-syzkaller-00019-gb311c1b497e5 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 valid_state+0x13a/0x1c0 kernel/locking/lockdep.c:4012
 mark_lock_irq+0xbb/0xc20 kernel/locking/lockdep.c:4215
 mark_lock+0x223/0x350 kernel/locking/lockdep.c:4677
 __lock_acquire+0xbf9/0x2040 kernel/locking/lockdep.c:5096
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:351 [inline]
 ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
 ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
 ppp_sync_process+0x71/0x160 drivers/net/ppp/ppp_synctty.c:490
 tasklet_action_common+0x321/0x4d0 kernel/softirq.c:785
 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
 run_ksoftirqd+0xca/0x130 kernel/softirq.c:928
 smpboot_thread_fn+0x544/0xa30 kernel/smpboot.c:164
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [ppp?] inconsistent lock state in valid_state (4)
  2024-08-21 23:00 ` [syzbot] [ppp?] " syzbot
@ 2024-08-22  6:29   ` Eric Dumazet
  2024-08-22 11:09     ` Hillf Danton
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2024-08-22  6:29 UTC (permalink / raw)
  To: syzbot, Tom Parkin
  Cc: coreteam, davem, dsahern, kadlec, kuba, linux-kernel, linux-ppp,
	netdev, netfilter-devel, pabeni, pablo, syzkaller-bugs

On Thu, Aug 22, 2024 at 1:00 AM syzbot
<syzbot+d43eb079c2addf2439c3@syzkaller.appspotmail.com> wrote:
>
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit:    b311c1b497e5 Merge tag '6.11-rc4-server-fixes' of git://gi..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=12dccc7b980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=df2f0ed7e30a639d
> dashboard link: https://syzkaller.appspot.com/bug?extid=d43eb079c2addf2439c3
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=17cf93d5980000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=101bb693980000
>
> Downloadable assets:
> disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-b311c1b4.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/1c99fa48192f/vmlinux-b311c1b4.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/16d5710a012a/bzImage-b311c1b4.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+d43eb079c2addf2439c3@syzkaller.appspotmail.com
>
> ================================
> WARNING: inconsistent lock state
> 6.11.0-rc4-syzkaller-00019-gb311c1b497e5 #0 Not tainted
> --------------------------------
> inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
> ksoftirqd/0/16 [HC0[0]:SC1[1]:HE1:SE0] takes:
> ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
> ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
> ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
> {SOFTIRQ-ON-W} state was registered at:
>   lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
>   __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
>   _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
>   spin_lock include/linux/spinlock.h:351 [inline]
>   ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
>   ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
>   pppoe_rcv_core+0x117/0x310 drivers/net/ppp/pppoe.c:379
>   sk_backlog_rcv include/net/sock.h:1111 [inline]
>   __release_sock+0x243/0x350 net/core/sock.c:3004
>   release_sock+0x61/0x1f0 net/core/sock.c:3558
>   pppoe_sendmsg+0xd5/0x750 drivers/net/ppp/pppoe.c:903
>   sock_sendmsg_nosec net/socket.c:730 [inline]
>   __sock_sendmsg+0x221/0x270 net/socket.c:745
>   ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
>   ___sys_sendmsg net/socket.c:2651 [inline]
>   __sys_sendmmsg+0x3b2/0x740 net/socket.c:2737
>   __do_sys_sendmmsg net/socket.c:2766 [inline]
>   __se_sys_sendmmsg net/socket.c:2763 [inline]
>   __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2763
>   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>   do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
>   entry_SYSCALL_64_after_hwframe+0x77/0x7f
> irq event stamp: 1309336
> hardirqs last  enabled at (1309336): [<ffffffff8bc0d5ff>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
> hardirqs last  enabled at (1309336): [<ffffffff8bc0d5ff>] _raw_spin_unlock_irqrestore+0x8f/0x140 kernel/locking/spinlock.c:194
> hardirqs last disabled at (1309335): [<ffffffff8bc0d300>] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline]
> hardirqs last disabled at (1309335): [<ffffffff8bc0d300>] _raw_spin_lock_irqsave+0xb0/0x120 kernel/locking/spinlock.c:162
> softirqs last  enabled at (1309326): [<ffffffff81578ffa>] run_ksoftirqd+0xca/0x130 kernel/softirq.c:928
> softirqs last disabled at (1309331): [<ffffffff81578ffa>] run_ksoftirqd+0xca/0x130 kernel/softirq.c:928
>
> other info that might help us debug this:
>  Possible unsafe locking scenario:
>
>        CPU0
>        ----
>   lock(&pch->downl);
>   <Interrupt>
>     lock(&pch->downl);
>
>  *** DEADLOCK ***
>
> 1 lock held by ksoftirqd/0/16:
>  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:326 [inline]
>  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:838 [inline]
>  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2267 [inline]
>  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ppp_input+0x55/0xa10 drivers/net/ppp/ppp_generic.c:2304
>
> stack backtrace:
> CPU: 0 UID: 0 PID: 16 Comm: ksoftirqd/0 Not tainted 6.11.0-rc4-syzkaller-00019-gb311c1b497e5 #0
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
> Call Trace:
>  <TASK>
>  __dump_stack lib/dump_stack.c:93 [inline]
>  dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
>  valid_state+0x13a/0x1c0 kernel/locking/lockdep.c:4012
>  mark_lock_irq+0xbb/0xc20 kernel/locking/lockdep.c:4215
>  mark_lock+0x223/0x350 kernel/locking/lockdep.c:4677
>  __lock_acquire+0xbf9/0x2040 kernel/locking/lockdep.c:5096
>  lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
>  __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
>  _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
>  spin_lock include/linux/spinlock.h:351 [inline]
>  ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
>  ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
>  ppp_sync_process+0x71/0x160 drivers/net/ppp/ppp_synctty.c:490
>  tasklet_action_common+0x321/0x4d0 kernel/softirq.c:785
>  handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
>  run_ksoftirqd+0xca/0x130 kernel/softirq.c:928
>  smpboot_thread_fn+0x544/0xa30 kernel/smpboot.c:164
>  kthread+0x2f0/0x390 kernel/kthread.c:389
>  ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
>  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
>  </TASK>
>
>
> ---
> If you want syzbot to run the reproducer, reply with:
> #syz test: git://repo/address.git branch-or-commit-hash
> If you attach or paste a git patch, syzbot will apply it before testing.

Bug probably added in

commit 4cf476ced45d7f12df30a68e833b263e7a2202d1
Author: Tom Parkin <tparkin@katalix.com>
Date:   Thu Dec 10 15:50:57 2020 +0000

    ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls



sk_backlog_rcv() is called without BH being blocked.

Fx would be :

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index eb9acfcaeb097496b5e28c87af13f5b4091a9bed..9d2656afba660a1a0eda5a53903b0f668a11abc9
100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -2269,7 +2269,7 @@ static bool ppp_channel_bridge_input(struct
channel *pch, struct sk_buff *skb)
        if (!pchb)
                goto out_rcu;

-       spin_lock(&pchb->downl);
+       spin_lock_bh(&pchb->downl);
        if (!pchb->chan) {
                /* channel got unregistered */
                kfree_skb(skb);
@@ -2281,7 +2281,7 @@ static bool ppp_channel_bridge_input(struct
channel *pch, struct sk_buff *skb)
                kfree_skb(skb);

 outl:
-       spin_unlock(&pchb->downl);
+       spin_unlock_bh(&pchb->downl);
 out_rcu:
        rcu_read_unlock();

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [ppp?] inconsistent lock state in valid_state (4)
  2024-08-22  6:29   ` Eric Dumazet
@ 2024-08-22 11:09     ` Hillf Danton
  2024-08-22 13:01       ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2024-08-22 11:09 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: syzbot, Thomas Gleixner, Linus Torvalds, Boqun Feng, linux-kernel,
	netdev, syzkaller-bugs

On Thu, 22 Aug 2024 08:29:35 +0200 Eric Dumazet <edumazet@google.com>
> On Thu, Aug 22, 2024 at 1:00=E2=80=AFAM syzbot
> <syzbot+d43eb079c2addf2439c3@syzkaller.appspotmail.com> wrote:
> >
> > syzbot has found a reproducer for the following issue on:
> >
> > HEAD commit:    b311c1b497e5 Merge tag '6.11-rc4-server-fixes' of git://g=
> i..
> > git tree:       upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=3D12dccc7b98000=
> 0
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=3Ddf2f0ed7e30a6=
> 39d
> > dashboard link: https://syzkaller.appspot.com/bug?extid=3Dd43eb079c2addf2=
> 439c3
> > compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Deb=
> ian) 2.40
> > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=3D17cf93d5980=
> 000
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=3D101bb69398000=
> 0
> >
> > Downloadable assets:
> > disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7=
> bc7510fe41f/non_bootable_disk-b311c1b4.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/1c99fa48192f/vmlinu=
> x-b311c1b4.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/16d5710a012a/b=
> zImage-b311c1b4.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the comm=
> it:
> > Reported-by: syzbot+d43eb079c2addf2439c3@syzkaller.appspotmail.com
> >
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D
> > WARNING: inconsistent lock state
> > 6.11.0-rc4-syzkaller-00019-gb311c1b497e5 #0 Not tainted
> > --------------------------------
> > inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
> > ksoftirqd/0/16 [HC0[0]:SC1[1]:HE1:SE0] takes:
> > ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: spin_lock include/linux/s=
> pinlock.h:351 [inline]
> > ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: ppp_channel_bridge_input =
> drivers/net/ppp/ppp_generic.c:2272 [inline]
> > ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: ppp_input+0x18b/0xa10 dri=
> vers/net/ppp/ppp_generic.c:2304
> > {SOFTIRQ-ON-W} state was registered at:
> >   lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
> >   __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
> >   _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
> >   spin_lock include/linux/spinlock.h:351 [inline]
> >   ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
> >   ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
> >   pppoe_rcv_core+0x117/0x310 drivers/net/ppp/pppoe.c:379
> >   sk_backlog_rcv include/net/sock.h:1111 [inline]
> >   __release_sock+0x243/0x350 net/core/sock.c:3004
> >   release_sock+0x61/0x1f0 net/core/sock.c:3558
> >   pppoe_sendmsg+0xd5/0x750 drivers/net/ppp/pppoe.c:903
> >   sock_sendmsg_nosec net/socket.c:730 [inline]
> >   __sock_sendmsg+0x221/0x270 net/socket.c:745
> >   ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
> >   ___sys_sendmsg net/socket.c:2651 [inline]
> >   __sys_sendmmsg+0x3b2/0x740 net/socket.c:2737
> >   __do_sys_sendmmsg net/socket.c:2766 [inline]
> >   __se_sys_sendmmsg net/socket.c:2763 [inline]
> >   __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2763
> >   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> >   do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
> >   entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > irq event stamp: 1309336
> > hardirqs last  enabled at (1309336): [<ffffffff8bc0d5ff>] __raw_spin_unlo=
> ck_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
> > hardirqs last  enabled at (1309336): [<ffffffff8bc0d5ff>] _raw_spin_unloc=
> k_irqrestore+0x8f/0x140 kernel/locking/spinlock.c:194
> > hardirqs last disabled at (1309335): [<ffffffff8bc0d300>] __raw_spin_lock=
> _irqsave include/linux/spinlock_api_smp.h:108 [inline]
> > hardirqs last disabled at (1309335): [<ffffffff8bc0d300>] _raw_spin_lock_=
> irqsave+0xb0/0x120 kernel/locking/spinlock.c:162
> > softirqs last  enabled at (1309326): [<ffffffff81578ffa>] run_ksoftirqd+0=
> xca/0x130 kernel/softirq.c:928
> > softirqs last disabled at (1309331): [<ffffffff81578ffa>] run_ksoftirqd+0=
> xca/0x130 kernel/softirq.c:928
> >
> > other info that might help us debug this:
> >  Possible unsafe locking scenario:
> >
> >        CPU0
> >        ----
> >   lock(&pch->downl);
> >   <Interrupt>
> >     lock(&pch->downl);
> >
> >  *** DEADLOCK ***
> >
> > 1 lock held by ksoftirqd/0/16:
> >  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire i=
> nclude/linux/rcupdate.h:326 [inline]
> >  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock incl=
> ude/linux/rcupdate.h:838 [inline]
> >  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ppp_channel_bridge=
> _input drivers/net/ppp/ppp_generic.c:2267 [inline]
> >  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ppp_input+0x55/0xa=
> 10 drivers/net/ppp/ppp_generic.c:2304
> >
> > stack backtrace:
> > CPU: 0 UID: 0 PID: 16 Comm: ksoftirqd/0 Not tainted 6.11.0-rc4-syzkaller-=
> 00019-gb311c1b497e5 #0

This report looks bogus to me given that kthread is unable to preempt a
userspace task with spinlock held. 

> > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.=
> 16.3-2~bpo12+1 04/01/2014
> > Call Trace:
> >  <TASK>
> >  __dump_stack lib/dump_stack.c:93 [inline]
> >  dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
> >  valid_state+0x13a/0x1c0 kernel/locking/lockdep.c:4012
> >  mark_lock_irq+0xbb/0xc20 kernel/locking/lockdep.c:4215
> >  mark_lock+0x223/0x350 kernel/locking/lockdep.c:4677
> >  __lock_acquire+0xbf9/0x2040 kernel/locking/lockdep.c:5096
> >  lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
> >  __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
> >  _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
> >  spin_lock include/linux/spinlock.h:351 [inline]
> >  ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
> >  ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
> >  ppp_sync_process+0x71/0x160 drivers/net/ppp/ppp_synctty.c:490
> >  tasklet_action_common+0x321/0x4d0 kernel/softirq.c:785
> >  handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
> >  run_ksoftirqd+0xca/0x130 kernel/softirq.c:928
> >  smpboot_thread_fn+0x544/0xa30 kernel/smpboot.c:164
> >  kthread+0x2f0/0x390 kernel/kthread.c:389
> >  ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
> >  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> >  </TASK>
> >
> >
> > ---
> > If you want syzbot to run the reproducer, reply with:
> > #syz test: git://repo/address.git branch-or-commit-hash
> > If you attach or paste a git patch, syzbot will apply it before testing.
> 
> Bug probably added in
> 
> commit 4cf476ced45d7f12df30a68e833b263e7a2202d1
> Author: Tom Parkin <tparkin@katalix.com>
> Date:   Thu Dec 10 15:50:57 2020 +0000
> 
>     ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls
> 
> 
> 
> sk_backlog_rcv() is called without BH being blocked.
> 
> Fx would be :
> 
> diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
> index eb9acfcaeb097496b5e28c87af13f5b4091a9bed..9d2656afba660a1a0eda5a53903=
> b0f668a11abc9
> 100644
> --- a/drivers/net/ppp/ppp_generic.c
> +++ b/drivers/net/ppp/ppp_generic.c
> @@ -2269,7 +2269,7 @@ static bool ppp_channel_bridge_input(struct
> channel *pch, struct sk_buff *skb)
>         if (!pchb)
>                 goto out_rcu;
> 
> -       spin_lock(&pchb->downl);
> +       spin_lock_bh(&pchb->downl);
>         if (!pchb->chan) {
>                 /* channel got unregistered */
>                 kfree_skb(skb);
> @@ -2281,7 +2281,7 @@ static bool ppp_channel_bridge_input(struct
> channel *pch, struct sk_buff *skb)
>                 kfree_skb(skb);
> 
>  outl:
> -       spin_unlock(&pchb->downl);
> +       spin_unlock_bh(&pchb->downl);
>  out_rcu:
>         rcu_read_unlock();
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [ppp?] inconsistent lock state in valid_state (4)
  2024-08-22 11:09     ` Hillf Danton
@ 2024-08-22 13:01       ` Eric Dumazet
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2024-08-22 13:01 UTC (permalink / raw)
  To: Hillf Danton
  Cc: syzbot, Thomas Gleixner, Linus Torvalds, Boqun Feng, linux-kernel,
	netdev, syzkaller-bugs

On Thu, Aug 22, 2024 at 1:10 PM Hillf Danton <hdanton@sina.com> wrote:
>
> On Thu, 22 Aug 2024 08:29:35 +0200 Eric Dumazet <edumazet@google.com>
> > On Thu, Aug 22, 2024 at 1:00=E2=80=AFAM syzbot
> > <syzbot+d43eb079c2addf2439c3@syzkaller.appspotmail.com> wrote:
> > >
> > > syzbot has found a reproducer for the following issue on:
> > >
> > > HEAD commit:    b311c1b497e5 Merge tag '6.11-rc4-server-fixes' of git://g=
> > i..
> > > git tree:       upstream
> > > console output: https://syzkaller.appspot.com/x/log.txt?x=3D12dccc7b98000=
> > 0
> > > kernel config:  https://syzkaller.appspot.com/x/.config?x=3Ddf2f0ed7e30a6=
> > 39d
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=3Dd43eb079c2addf2=
> > 439c3
> > > compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Deb=
> > ian) 2.40
> > > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=3D17cf93d5980=
> > 000
> > > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=3D101bb69398000=
> > 0
> > >
> > > Downloadable assets:
> > > disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7=
> > bc7510fe41f/non_bootable_disk-b311c1b4.raw.xz
> > > vmlinux: https://storage.googleapis.com/syzbot-assets/1c99fa48192f/vmlinu=
> > x-b311c1b4.xz
> > > kernel image: https://storage.googleapis.com/syzbot-assets/16d5710a012a/b=
> > zImage-b311c1b4.xz
> > >
> > > IMPORTANT: if you fix the issue, please add the following tag to the comm=
> > it:
> > > Reported-by: syzbot+d43eb079c2addf2439c3@syzkaller.appspotmail.com
> > >
> > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> > =3D=3D=3D=3D=3D=3D=3D=3D
> > > WARNING: inconsistent lock state
> > > 6.11.0-rc4-syzkaller-00019-gb311c1b497e5 #0 Not tainted
> > > --------------------------------
> > > inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
> > > ksoftirqd/0/16 [HC0[0]:SC1[1]:HE1:SE0] takes:
> > > ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: spin_lock include/linux/s=
> > pinlock.h:351 [inline]
> > > ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: ppp_channel_bridge_input =
> > drivers/net/ppp/ppp_generic.c:2272 [inline]
> > > ffff888039c531e0 (&pch->downl){+.?.}-{2:2}, at: ppp_input+0x18b/0xa10 dri=
> > vers/net/ppp/ppp_generic.c:2304
> > > {SOFTIRQ-ON-W} state was registered at:
> > >   lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
> > >   __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
> > >   _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
> > >   spin_lock include/linux/spinlock.h:351 [inline]
> > >   ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
> > >   ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
> > >   pppoe_rcv_core+0x117/0x310 drivers/net/ppp/pppoe.c:379
> > >   sk_backlog_rcv include/net/sock.h:1111 [inline]
> > >   __release_sock+0x243/0x350 net/core/sock.c:3004
> > >   release_sock+0x61/0x1f0 net/core/sock.c:3558
> > >   pppoe_sendmsg+0xd5/0x750 drivers/net/ppp/pppoe.c:903
> > >   sock_sendmsg_nosec net/socket.c:730 [inline]
> > >   __sock_sendmsg+0x221/0x270 net/socket.c:745
> > >   ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597
> > >   ___sys_sendmsg net/socket.c:2651 [inline]
> > >   __sys_sendmmsg+0x3b2/0x740 net/socket.c:2737
> > >   __do_sys_sendmmsg net/socket.c:2766 [inline]
> > >   __se_sys_sendmmsg net/socket.c:2763 [inline]
> > >   __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2763
> > >   do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> > >   do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
> > >   entry_SYSCALL_64_after_hwframe+0x77/0x7f
> > > irq event stamp: 1309336
> > > hardirqs last  enabled at (1309336): [<ffffffff8bc0d5ff>] __raw_spin_unlo=
> > ck_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
> > > hardirqs last  enabled at (1309336): [<ffffffff8bc0d5ff>] _raw_spin_unloc=
> > k_irqrestore+0x8f/0x140 kernel/locking/spinlock.c:194
> > > hardirqs last disabled at (1309335): [<ffffffff8bc0d300>] __raw_spin_lock=
> > _irqsave include/linux/spinlock_api_smp.h:108 [inline]
> > > hardirqs last disabled at (1309335): [<ffffffff8bc0d300>] _raw_spin_lock_=
> > irqsave+0xb0/0x120 kernel/locking/spinlock.c:162
> > > softirqs last  enabled at (1309326): [<ffffffff81578ffa>] run_ksoftirqd+0=
> > xca/0x130 kernel/softirq.c:928
> > > softirqs last disabled at (1309331): [<ffffffff81578ffa>] run_ksoftirqd+0=
> > xca/0x130 kernel/softirq.c:928
> > >
> > > other info that might help us debug this:
> > >  Possible unsafe locking scenario:
> > >
> > >        CPU0
> > >        ----
> > >   lock(&pch->downl);
> > >   <Interrupt>
> > >     lock(&pch->downl);
> > >
> > >  *** DEADLOCK ***
> > >
> > > 1 lock held by ksoftirqd/0/16:
> > >  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire i=
> > nclude/linux/rcupdate.h:326 [inline]
> > >  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock incl=
> > ude/linux/rcupdate.h:838 [inline]
> > >  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ppp_channel_bridge=
> > _input drivers/net/ppp/ppp_generic.c:2267 [inline]
> > >  #0: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: ppp_input+0x55/0xa=
> > 10 drivers/net/ppp/ppp_generic.c:2304
> > >
> > > stack backtrace:
> > > CPU: 0 UID: 0 PID: 16 Comm: ksoftirqd/0 Not tainted 6.11.0-rc4-syzkaller-=
> > 00019-gb311c1b497e5 #0
>
> This report looks bogus to me given that kthread is unable to preempt a
> userspace task with spinlock held.


This report is absolutely legit.

User space might be interrupted by a softirq.

Issue here is that ppp_channel_bridge_input() can either be run
directly from BH context, or process context.

Therefore it needs to make sure BH are blocked. I will submit the
patch formally.

>
> > > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.=
> > 16.3-2~bpo12+1 04/01/2014
> > > Call Trace:
> > >  <TASK>
> > >  __dump_stack lib/dump_stack.c:93 [inline]
> > >  dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
> > >  valid_state+0x13a/0x1c0 kernel/locking/lockdep.c:4012
> > >  mark_lock_irq+0xbb/0xc20 kernel/locking/lockdep.c:4215
> > >  mark_lock+0x223/0x350 kernel/locking/lockdep.c:4677
> > >  __lock_acquire+0xbf9/0x2040 kernel/locking/lockdep.c:5096
> > >  lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
> > >  __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
> > >  _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
> > >  spin_lock include/linux/spinlock.h:351 [inline]
> > >  ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
> > >  ppp_input+0x18b/0xa10 drivers/net/ppp/ppp_generic.c:2304
> > >  ppp_sync_process+0x71/0x160 drivers/net/ppp/ppp_synctty.c:490
> > >  tasklet_action_common+0x321/0x4d0 kernel/softirq.c:785
> > >  handle_softirqs+0x2c4/0x970 kernel/softirq.c:554
> > >  run_ksoftirqd+0xca/0x130 kernel/softirq.c:928
> > >  smpboot_thread_fn+0x544/0xa30 kernel/smpboot.c:164
> > >  kthread+0x2f0/0x390 kernel/kthread.c:389
> > >  ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
> > >  ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
> > >  </TASK>
> > >
> > >
> > > ---
> > > If you want syzbot to run the reproducer, reply with:
> > > #syz test: git://repo/address.git branch-or-commit-hash
> > > If you attach or paste a git patch, syzbot will apply it before testing.
> >
> > Bug probably added in
> >
> > commit 4cf476ced45d7f12df30a68e833b263e7a2202d1
> > Author: Tom Parkin <tparkin@katalix.com>
> > Date:   Thu Dec 10 15:50:57 2020 +0000
> >
> >     ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls
> >
> >
> >
> > sk_backlog_rcv() is called without BH being blocked.
> >
> > Fx would be :
> >
> > diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
> > index eb9acfcaeb097496b5e28c87af13f5b4091a9bed..9d2656afba660a1a0eda5a53903=
> > b0f668a11abc9
> > 100644
> > --- a/drivers/net/ppp/ppp_generic.c
> > +++ b/drivers/net/ppp/ppp_generic.c
> > @@ -2269,7 +2269,7 @@ static bool ppp_channel_bridge_input(struct
> > channel *pch, struct sk_buff *skb)
> >         if (!pchb)
> >                 goto out_rcu;
> >
> > -       spin_lock(&pchb->downl);
> > +       spin_lock_bh(&pchb->downl);
> >         if (!pchb->chan) {
> >                 /* channel got unregistered */
> >                 kfree_skb(skb);
> > @@ -2281,7 +2281,7 @@ static bool ppp_channel_bridge_input(struct
> > channel *pch, struct sk_buff *skb)
> >                 kfree_skb(skb);
> >
> >  outl:
> > -       spin_unlock(&pchb->downl);
> > +       spin_unlock_bh(&pchb->downl);
> >  out_rcu:
> >         rcu_read_unlock();
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-22 13:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19  5:03 [syzbot] [netfilter?] inconsistent lock state in valid_state (4) syzbot
2024-08-21 23:00 ` [syzbot] [ppp?] " syzbot
2024-08-22  6:29   ` Eric Dumazet
2024-08-22 11:09     ` Hillf Danton
2024-08-22 13:01       ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).