From: Tejun Heo <tj@kernel.org>
To: cheung wall <zzqq0103.hey@gmail.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: "KASAN: slab-use-after-free Write in detach_worker" in Linux Kernel v6.12-rc4
Date: Wed, 22 Jan 2025 09:47:24 -1000 [thread overview]
Message-ID: <Z5FLTG33XuIQe6A9@slm.duckdns.org> (raw)
In-Reply-To: <CAKHoSAvP3iQW+GwmKzWjEAOoPvzeWeoMO0Gz7Pp3_4kxt-RMoA@mail.gmail.com>
On Wed, Jan 15, 2025 at 10:10:26AM +0800, cheung wall wrote:
> Hello,
>
> I am writing to report a potential vulnerability identified in the
> Linux Kernel version v6.12-rc4. This vulnerability was discovered
> while I was testing the kernel.
>
> Linux Kernel Repository Git Commit:
> 42f7652d3eb527d03665b09edac47f85fb600924 (tag: v6.12-rc4)
>
> Bug Location: detach_worker+0x164/0x180 kernel/workqueue.c:2709
>
> Attached is the bug log file and report file.
>
> Thank you for your time and attention.
I don't know how reproducible the problem is but can you please see whether
the followign patch resolves the issue?
Thanks.
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 33a23c7b2274..e1d2f8bf28d7 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3516,22 +3516,22 @@ static int rescuer_thread(void *__rescuer)
}
}
- /*
- * Put the reference grabbed by send_mayday(). @pool won't
- * go away while we're still attached to it.
- */
- put_pwq(pwq);
-
/*
* Leave this pool. Notify regular workers; otherwise, we end up
* with 0 concurrency and stalling the execution.
*/
kick_pool(pool);
-
raw_spin_unlock_irq(&pool->lock);
-
worker_detach_from_pool(rescuer);
+ /*
+ * Put the reference grabbed by send_mayday(). This must come
+ * after the final access of the pool.
+ */
+ raw_spin_lock_irq(&pool->lock);
+ put_pwq(pwq);
+ raw_spin_unlock_irq(&pool->lock);
+
raw_spin_lock_irq(&wq_mayday_lock);
}
prev parent reply other threads:[~2025-01-22 19:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 2:10 cheung wall
2025-01-22 19:47 ` Tejun Heo [this message]
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=Z5FLTG33XuIQe6A9@slm.duckdns.org \
--to=tj@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zzqq0103.hey@gmail.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®