mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+d2adb332fe371b0595e3@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bpf?] WARNING: locking bug in bpf_map_put
Date: Sat,  2 Nov 2024 16:23:33 +0800	[thread overview]
Message-ID: <tencent_F5D894DCE9D6EE76CF4C7BCE6CBC2FAD6E0A@qq.com> (raw)
In-Reply-To: <67251dc5.050a0220.529b6.015c.GAE@google.com>

there is a raw_spin_lock and spin_lock:

      raw_spin_lock(&b->raw_lock);
      spin_lock(&map_idr_lock);
      spin_unlock(&map_idr_lock);
      raw_spin_unlock(&b->raw_lock);

#syz test: upstream master

diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index b14b87463ee0..c2e0b26c8053 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -78,7 +78,7 @@
  */
 struct bucket {
 	struct hlist_nulls_head head;
-	raw_spinlock_t raw_lock;
+	spinlock_t lock;
 };
 
 #define HASHTAB_MAP_LOCK_COUNT 8
@@ -140,8 +140,8 @@ static void htab_init_buckets(struct bpf_htab *htab)
 
 	for (i = 0; i < htab->n_buckets; i++) {
 		INIT_HLIST_NULLS_HEAD(&htab->buckets[i].head, i);
-		raw_spin_lock_init(&htab->buckets[i].raw_lock);
-		lockdep_set_class(&htab->buckets[i].raw_lock,
+		spin_lock_init(&htab->buckets[i].lock);
+		lockdep_set_class(&htab->buckets[i].lock,
 					  &htab->lockdep_key);
 		cond_resched();
 	}
@@ -164,7 +164,7 @@ static inline int htab_lock_bucket(const struct bpf_htab *htab,
 		return -EBUSY;
 	}
 
-	raw_spin_lock(&b->raw_lock);
+	spin_lock(&b->lock);
 	*pflags = flags;
 
 	return 0;
@@ -175,7 +175,7 @@ static inline void htab_unlock_bucket(const struct bpf_htab *htab,
 				      unsigned long flags)
 {
 	hash = hash & min_t(u32, HASHTAB_MAP_LOCK_MASK, htab->n_buckets - 1);
-	raw_spin_unlock(&b->raw_lock);
+	spin_unlock(&b->lock);
 	__this_cpu_dec(*(htab->map_locked[hash]));
 	local_irq_restore(flags);
 	preempt_enable();


  parent reply	other threads:[~2024-11-02  8:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 18:28 syzbot
2024-11-02  1:57 ` Edward Adam Davis
2024-11-02  2:18   ` syzbot
2024-11-02  3:59 ` Edward Adam Davis
2024-11-02  6:16   ` syzbot
2024-11-02  8:23 ` Edward Adam Davis [this message]
2024-11-02  8:46   ` syzbot
2024-11-04  2:29 ` syzbot
2024-11-04 16:28   ` Sebastian Andrzej Siewior
2024-11-05  2:49     ` Hou Tao

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=tencent_F5D894DCE9D6EE76CF4C7BCE6CBC2FAD6E0A@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+d2adb332fe371b0595e3@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®