From: "Danilo Krummrich" <dakr@kernel.org>
To: "Greg KH" <gregkh@linuxfoundation.org>
Cc: "Aldo Ariel Panzardo" <qwe.aldo@gmail.com>, <rafael@kernel.org>,
<johan@kernel.org>, <driver-core@lists.linux.dev>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
"sashiko . dev" <sashiko-bot@kernel.org>
Subject: Re: [PATCH v4 1/2] debugfs: fix use-after-free in debugfs_read_file_str()
Date: Mon, 28 Sep 2026 10:26:48 +0200 [thread overview]
Message-ID: <DLQT21LPL3SA.2JOOWK2DTIGFS@kernel.org> (raw)
In-Reply-To: <2026092854-script-safehouse-be1c@gregkh>
On Mon Sep 28, 2026 at 7:35 AM CEST, Greg KH wrote:
> On Sun, Sep 27, 2026 at 07:00:04PM +0200, Danilo Krummrich wrote:
>> On Sun Sep 27, 2026 at 6:37 PM CEST, Greg KH wrote:
>> > This is probably not right, don't do loops like this. Either fail or
>> > succeed, don't loop.
>>
>> Please see [1], where I listed a couple of alternatives (e.g. use GFP_NOWAIT and
>> accept allocation failures). I'm not very opinionated about which of the
>> options we use, but GFP_ATOMIC seems wrong for this.
>>
>> > Again, let's see the real use case here, what is hitting this in
>> > userspace today and what debugfs kernel files are causing it?
>>
>> Not sure if this was hit in the field, but in any case, the reader lacks the RCU
>> read-side critical section required by the writer's reclamation.
>>
>> As mentioned in [1], there is also a separate caller-side race in SoundWire [2]:
>> nothing prevents a concurrent write from freeing the string while
>> request_firmware() is using it.
>>
>> This is also why I think the API is a bit of a footgun. Fixing the debugfs
>> reader won't address these caller-side accesses; something like the synchronized
>> accessors suggested in [1] could address the broader API issue.
>
> Ick, how about we just delete it then? I thought we had removed debugfs
> string functions already because of problems like this in the past...
That's an option, but it seems people really seek for having a convinient API
for this. And I think we can provide something that is "hard to get wrong" based
on what I suggested, which I think is better than letting people open-code this.
next prev parent reply other threads:[~2026-09-28 8:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <DLPDB44JJRGJ.3K6JNS746M71C@kernel.org>
2026-09-26 19:58 ` [PATCH v4 0/2] debugfs: fix UAF and double-free in debugfs_str read/write Aldo Ariel Panzardo
2026-09-26 19:58 ` [PATCH v4 1/2] debugfs: fix use-after-free in debugfs_read_file_str() Aldo Ariel Panzardo
2026-09-27 16:37 ` Greg KH
2026-09-27 17:00 ` Danilo Krummrich
2026-09-28 5:35 ` Greg KH
2026-09-28 8:26 ` Danilo Krummrich [this message]
2026-09-27 20:31 ` Aldo Ariel Panzardo
2026-09-26 19:58 ` [PATCH v4 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=DLQT21LPL3SA.2JOOWK2DTIGFS@kernel.org \
--to=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qwe.aldo@gmail.com \
--cc=rafael@kernel.org \
--cc=sashiko-bot@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 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.