All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+1fa663a2100308ab6eab@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bpf?] possible deadlock in kvfree_call_rcu
Date: Sun, 31 Mar 2024 14:19:58 +0800	[thread overview]
Message-ID: <20240331061958.3340-1-hdanton@sina.com> (raw)
In-Reply-To: <000000000000716bb60614acbf37@google.com>

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
--

  parent reply	other threads:[~2024-03-31  6:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 19:00 [syzbot] [bpf?] possible deadlock in kvfree_call_rcu syzbot
2024-03-26 19:53 ` false positive deadlock? Was: " Alexei Starovoitov
2024-03-27  4:37   ` Paul E. McKenney
2024-03-27  5:04     ` Paul E. McKenney
2024-03-28  0:12       ` Alexei Starovoitov
2024-03-27 23:27 ` syzbot
2024-03-28 23:07   ` Hillf Danton
2024-03-29 16:17     ` syzbot
2024-03-30  0:27   ` Hillf Danton
2024-03-30 15:34     ` syzbot
2024-03-30 23:42   ` Hillf Danton
2024-03-30 23:42     ` Hillf Danton
2024-03-31  5:43     ` syzbot
2024-03-31  6:19   ` Hillf Danton [this message]
2024-03-31  7:03     ` syzbot
2024-03-31  7:03       ` syzbot
2024-03-30 17:55 ` Uladzislau Rezki
2024-03-31  6:23   ` Hillf Danton
2024-03-31  6:23     ` Hillf Danton
2024-03-31  7:25     ` Uladzislau Rezki
2024-03-31  6:28 ` Uladzislau Rezki
2024-03-31  6:54   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240331061958.3340-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+1fa663a2100308ab6eab@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.