[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240331061958.3340-1-hdanton@sina.com>
Date: Sun, 31 Mar 2024 14:19:58 +0800
From: Hillf Danton <hdanton@...a.com>
To: syzbot <syzbot+1fa663a2100308ab6eab@...kaller.appspotmail.com>
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [bpf?] possible deadlock in kvfree_call_rcu
On Wed, 27 Mar 2024 16:27:19 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 443574b03387 riscv, bpf: Fix kfunc parameters incompatibil..
> git tree: bpf
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16ca53c9180000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git fe46a7dd189e
--- x/kernel/rcu/tree.c
+++ y/kernel/rcu/tree.c
@@ -2957,7 +2957,8 @@ krc_this_cpu_lock(unsigned long *flags)
local_irq_save(*flags); // For safely calling this_cpu_ptr().
krcp = this_cpu_ptr(&krc);
- raw_spin_lock(&krcp->lock);
+ while (!raw_spin_trylock(&krcp->lock))
+ ;
return krcp;
}
--- x/kernel/bpf/lpm_trie.c
+++ y/kernel/bpf/lpm_trie.c
@@ -382,9 +382,10 @@ static long trie_update_elem(struct bpf_
trie->n_entries--;
rcu_assign_pointer(*slot, new_node);
- kfree_rcu(node, rcu);
- goto out;
+ spin_unlock_irqrestore(&trie->lock, irq_flags);
+ kfree_rcu(node, rcu);
+ return 0;
}
/* If the new node matches the prefix completely, it must be inserted
--
Powered by blists - more mailing lists