====================================================== WARNING: possible circular locking dependency detected 6.10.0-rc6-syzkaller-00055-g734610514cb0 #0 Not tainted ------------------------------------------------------ syz.1.209/5999 is trying to acquire lock: ffff88803fffece0 (&pgdat->kswapd_wait){....}-{2:2}, at: __wake_up_common_lock kernel/sched/wait.c:105 [inline] ffff88803fffece0 (&pgdat->kswapd_wait){....}-{2:2}, at: __wake_up+0x1c/0x60 kernel/sched/wait.c:127 but task is already holding lock: ffff88802b6199f8 (&trie->lock){-...}-{2:2}, at: trie_update_elem+0xc7/0xdb0 kernel/bpf/lpm_trie.c:333 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&trie->lock){-...}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 trie_delete_elem+0xb0/0x820 kernel/bpf/lpm_trie.c:462 0xffffffffa0001ff7 bpf_dispatcher_nop_func include/linux/bpf.h:1243 [inline] __bpf_prog_run include/linux/filter.h:691 [inline] bpf_prog_run include/linux/filter.h:698 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2403 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2444 trace_tlb_flush+0xf3/0x170 include/trace/events/tlb.h:38 switch_mm_irqs_off+0x68b/0xbc0 arch/x86/mm/tlb.c:642 context_switch kernel/sched/core.c:5392 [inline] __schedule+0xd2b/0x5d00 kernel/sched/core.c:6745 schedule_idle+0x59/0x90 kernel/sched/core.c:6863 do_idle+0x287/0x3f0 kernel/sched/idle.c:360 cpu_startup_entry+0x4f/0x60 kernel/sched/idle.c:430 start_secondary+0x220/0x2b0 arch/x86/kernel/smpboot.c:313 common_startup_64+0x13e/0x148 -> #2 (&rq->__lock){-.-.}-{2:2}: _raw_spin_lock_nested+0x31/0x40 kernel/locking/spinlock.c:378 raw_spin_rq_lock_nested+0x29/0x130 kernel/sched/core.c:559 raw_spin_rq_lock kernel/sched/sched.h:1406 [inline] rq_lock kernel/sched/sched.h:1702 [inline] task_fork_fair+0x73/0x250 kernel/sched/fair.c:12710 sched_cgroup_fork+0x3cf/0x510 kernel/sched/core.c:4844 copy_process+0x4710/0x6f50 kernel/fork.c:2499 kernel_clone+0xfd/0x980 kernel/fork.c:2797 user_mode_thread+0xb4/0xf0 kernel/fork.c:2875 rest_init+0x23/0x2b0 init/main.c:712 start_kernel+0x3df/0x4c0 init/main.c:1103 x86_64_start_reservations+0x18/0x30 arch/x86/kernel/head64.c:507 x86_64_start_kernel+0xb2/0xc0 arch/x86/kernel/head64.c:488 common_startup_64+0x13e/0x148 -> #1 (&p->pi_lock){-.-.}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:553 [inline] try_to_wake_up+0x9a/0x13e0 kernel/sched/core.c:4262 autoremove_wake_function+0x16/0x150 kernel/sched/wait.c:384 __wake_up_common+0x131/0x1e0 kernel/sched/wait.c:89 __wake_up_common_lock kernel/sched/wait.c:106 [inline] __wake_up+0x31/0x60 kernel/sched/wait.c:127 wakeup_kswapd+0x45e/0x640 mm/vmscan.c:7240 rmqueue mm/page_alloc.c:3027 [inline] get_page_from_freelist+0x9bc/0x2e50 mm/page_alloc.c:3422 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4683 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2265 folio_alloc_noprof+0x1e/0xc0 mm/mempolicy.c:2343 filemap_alloc_folio_noprof+0x3ba/0x490 mm/filemap.c:1008 page_cache_ra_unbounded+0x1c8/0x5a0 mm/readahead.c:248 do_page_cache_ra mm/readahead.c:303 [inline] page_cache_ra_order+0x6e5/0xae0 mm/readahead.c:547 ondemand_readahead+0x520/0x1140 mm/readahead.c:669 page_cache_async_ra mm/readahead.c:718 [inline] page_cache_async_ra+0x123/0x150 mm/readahead.c:700 filemap_readahead mm/filemap.c:2504 [inline] filemap_get_pages+0x357/0x1830 mm/filemap.c:2545 filemap_read+0x3af/0xd10 mm/filemap.c:2625 generic_file_read_iter+0x350/0x460 mm/filemap.c:2806 ext4_file_read_iter+0x1dc/0x6c0 fs/ext4/file.c:147 __kernel_read+0x3ec/0xb50 fs/read_write.c:434 integrity_kernel_read+0x7f/0xb0 security/integrity/iint.c:28 ima_calc_file_hash_tfm+0x2cf/0x3e0 security/integrity/ima/ima_crypto.c:480 ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline] ima_calc_file_hash+0x1c6/0x4a0 security/integrity/ima/ima_crypto.c:568 ima_collect_measurement+0x8b3/0xa20 security/integrity/ima/ima_api.c:293 process_measurement+0x1289/0x23a0 security/integrity/ima/ima_main.c:372 ima_file_check+0xc1/0x110 security/integrity/ima/ima_main.c:572 security_file_post_open+0x6d/0xc0 security/security.c:2982 do_open fs/namei.c:3656 [inline] path_openat+0x76d/0x2e50 fs/namei.c:3813 do_filp_open+0x1dc/0x430 fs/namei.c:3840 file_open_name+0x2a4/0x450 fs/open.c:1358 __do_sys_swapon+0x7ad/0x3e80 mm/swapfile.c:3073 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #0 (&pgdat->kswapd_wait){....}-{2:2}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 __wake_up_common_lock kernel/sched/wait.c:105 [inline] __wake_up+0x1c/0x60 kernel/sched/wait.c:127 wakeup_kswapd+0x45e/0x640 mm/vmscan.c:7240 rmqueue mm/page_alloc.c:3027 [inline] get_page_from_freelist+0x9bc/0x2e50 mm/page_alloc.c:3422 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4683 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] __kmalloc_large_node+0x7f/0x1a0 mm/slub.c:4068 __do_kmalloc_node mm/slub.c:4111 [inline] __kmalloc_node_noprof.cold+0x5/0x5f mm/slub.c:4130 kmalloc_node_noprof include/linux/slab.h:681 [inline] bpf_map_kmalloc_node+0x98/0x4a0 kernel/bpf/syscall.c:422 lpm_trie_node_alloc kernel/bpf/lpm_trie.c:299 [inline] trie_update_elem+0x1ef/0xdb0 kernel/bpf/lpm_trie.c:342 bpf_map_update_value+0x2c1/0x6c0 kernel/bpf/syscall.c:203 generic_map_update_batch+0x454/0x5f0 kernel/bpf/syscall.c:1889 bpf_map_do_batch+0x615/0x6e0 kernel/bpf/syscall.c:5197 __sys_bpf+0x18cb/0x5830 kernel/bpf/syscall.c:5752 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline] __se_sys_bpf kernel/bpf/syscall.c:5793 [inline] __ia32_sys_bpf+0x76/0xe0 kernel/bpf/syscall.c:5793 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e other info that might help us debug this: Chain exists of: &pgdat->kswapd_wait --> &rq->__lock --> &trie->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&trie->lock); lock(&rq->__lock); lock(&trie->lock); lock(&pgdat->kswapd_wait); *** DEADLOCK *** 2 locks held by syz.1.209/5999: #0: ffffffff8dbb4ea0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline] #0: ffffffff8dbb4ea0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:781 [inline] #0: ffffffff8dbb4ea0 (rcu_read_lock){....}-{1:2}, at: bpf_map_update_value+0x24b/0x6c0 kernel/bpf/syscall.c:202 #1: ffff88802b6199f8 (&trie->lock){-...}-{2:2}, at: trie_update_elem+0xc7/0xdb0 kernel/bpf/lpm_trie.c:333 stack backtrace: CPU: 3 PID: 5999 Comm: syz.1.209 Not tainted 6.10.0-rc6-syzkaller-00055-g734610514cb0 #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: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 __wake_up_common_lock kernel/sched/wait.c:105 [inline] __wake_up+0x1c/0x60 kernel/sched/wait.c:127 wakeup_kswapd+0x45e/0x640 mm/vmscan.c:7240 rmqueue mm/page_alloc.c:3027 [inline] get_page_from_freelist+0x9bc/0x2e50 mm/page_alloc.c:3422 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4683 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] __kmalloc_large_node+0x7f/0x1a0 mm/slub.c:4068 __do_kmalloc_node mm/slub.c:4111 [inline] __kmalloc_node_noprof.cold+0x5/0x5f mm/slub.c:4130 kmalloc_node_noprof include/linux/slab.h:681 [inline] bpf_map_kmalloc_node+0x98/0x4a0 kernel/bpf/syscall.c:422 lpm_trie_node_alloc kernel/bpf/lpm_trie.c:299 [inline] trie_update_elem+0x1ef/0xdb0 kernel/bpf/lpm_trie.c:342 bpf_map_update_value+0x2c1/0x6c0 kernel/bpf/syscall.c:203 generic_map_update_batch+0x454/0x5f0 kernel/bpf/syscall.c:1889 bpf_map_do_batch+0x615/0x6e0 kernel/bpf/syscall.c:5197 __sys_bpf+0x18cb/0x5830 kernel/bpf/syscall.c:5752 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline] __se_sys_bpf kernel/bpf/syscall.c:5793 [inline] __ia32_sys_bpf+0x76/0xe0 kernel/bpf/syscall.c:5793 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7485579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f5d9d57c EFLAGS: 00000292 ORIG_RAX: 0000000000000165 RAX: ffffffffffffffda RBX: 000000000000001a RCX: 0000000020000300 RDX: 0000000000000038 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi