From: Greg KH <gregkh@linuxfoundation.org>
To: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Cc: rafael@kernel.org, dakr@kernel.org, driver-core@lists.linux.dev,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 0/2] debugfs: fix UAF and double-free in debugfs_str read/write
Date: Sun, 27 Sep 2026 18:34:44 +0200 [thread overview]
Message-ID: <2026092726-posh-handyman-43a0@gregkh> (raw)
In-Reply-To: <20260926134726.1063068-1-qwe.aldo@gmail.com>
On Sat, Sep 26, 2026 at 10:47:26AM -0300, Aldo Ariel Panzardo wrote:
> On Sat, Sep 26, 2026 at 08:53:06AM +0200, Greg Kroah-Hartman wrote:
> > Did you forget an Assisted-by: tag here?
>
> Yes, apologies. Both patches now carry:
>
> Assisted-by: sashiko.dev <sashiko-bot@kernel.org>
No LLM was used to generate the patch?
> > And how was this found and tested?
>
> sashiko.dev flagged that the write path uses rcu_assign_pointer() /
> synchronize_rcu() / kfree() but the read path dereferences the same
> pointer without rcu_read_lock(). I then manually reviewed the write
> path and found the second issue: no mutual exclusion between concurrent
> writers, leading to a double-free of `old`.
>
> Tested on QEMU/KVM with CONFIG_KASAN=y. The double-free in the write
> path reproduces immediately (~3900 KASAN reports in a single run with 8
> concurrent writers):
>
> BUG: KASAN: double-free in debugfs_write_file_str+0x194/0x200
>
> Full splat is included in patch 2/2.
>
> The read-path UAF has a narrower race window (just a couple of
> instructions between pointer load and strlen()) and did not trigger in
> KASAN testing, but it is structurally obvious: the write path calls
> synchronize_rcu() + kfree(old) and the read path does not hold
> rcu_read_lock().
>
> > And what kernel was tested, debugfs strings were changed a bunch in 7.1,
> > what bug report are you working off of here?
>
> Verified against torvalds/linux master at v7.3-rc4 (commit
> 6812ce4e4379, 2026-09-26). Both bugs are present in the current code
> at debugfs_read_file_str() and debugfs_write_file_str() in
> fs/debugfs/file.c.
>
> This is not from a bug report. It was found by sashiko.dev reviewing
> an adjacent patch and I verified it independently.
Again, no LLM for all of this?
I'd like to see the userspace test scripts for this...
thanks,
greg k-h
next prev parent reply other threads:[~2026-09-27 16:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 17:58 [PATCH] " Aldo Ariel Panzardo
2026-09-26 6:53 ` Greg KH
2026-09-26 13:47 ` [PATCH v2 0/2] " Aldo Ariel Panzardo
2026-09-27 16:34 ` Greg KH [this message]
2026-09-27 20:29 ` Aldo Ariel Panzardo
2026-09-26 13:47 ` [PATCH v2 1/2] debugfs: fix use-after-free in debugfs_read_file_str() Aldo Ariel Panzardo
2026-09-26 13:48 ` [PATCH v2 2/2] debugfs: serialize concurrent writers in debugfs_write_file_str() Aldo Ariel Panzardo
2026-09-26 14:09 ` [PATCH v3 0/2] debugfs: fix UAF and double-free in debugfs_str read/write Aldo Ariel Panzardo
2026-09-26 14:09 ` [PATCH v3 1/2] debugfs: fix use-after-free in debugfs_read_file_str() Aldo Ariel Panzardo
2026-09-26 15:53 ` Danilo Krummrich
2026-09-26 14:09 ` [PATCH v3 2/2] debugfs: serialize concurrent writers in debugfs_write_file_str() Aldo Ariel Panzardo
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=2026092726-posh-handyman-43a0@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=qwe.aldo@gmail.com \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.org \
/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®