From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] sysfs: upgrade OOB write by buggy .show hook into WARNing
Date: Thu, 7 May 2026 11:05:16 +0200 [thread overview]
Message-ID: <2026050720-plating-cling-153a@gregkh> (raw)
In-Reply-To: <3cc3e8c6-c6e8-4625-a88f-f5708b935dab@p183>
On Thu, May 07, 2026 at 12:01:43PM +0300, Alexey Dobriyan wrote:
> Buggy .show hook will get just 1 line of dmesg:
>
> fill_read_buffer: ext4_attr_show+0x0/0x600 returned bad count
>
> It may or may not oops later in some unrelated process.
>
> But buggy .show hook most likely is corrupting random memory past sysfs
> buffer therefore deserving more. WARN, make it more visible and let
> QA machines panic earlier.
>
> Also, delete useless cast -- "count" is >=0 at this point.
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
>
> fs/sysfs/file.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
The first was fine, no need for [PATCH] :)
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -70,9 +70,8 @@ static int sysfs_kf_seq_show(struct seq_file *sf, void *v)
> * The code works fine with PAGE_SIZE return but it's likely to
> * indicate truncated result or overflow in normal use cases.
> */
> - if (count >= (ssize_t)PAGE_SIZE) {
> - printk("fill_read_buffer: %pS returned bad count\n",
> - ops->show);
> + if (count >= PAGE_SIZE) {
> + WARN(1, "OOB write or bad count %zd at %pS\n", count, ops->show);
This is going to be interesting to see what triggers, so I'll go queue
this up soon.
And this implies you did hit this on ext4? What sysfs file for ext4 is
doing this? That should not be a valid sysfs file at all.
thanks,
greg k-h
next prev parent reply other threads:[~2026-05-07 9:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 15:04 sysfs: upgrade OOB write by buggy .show hook into WARNing Alexey Dobriyan
2026-05-07 9:01 ` [PATCH] " Alexey Dobriyan
2026-05-07 9:05 ` Greg Kroah-Hartman [this message]
2026-05-07 13:51 ` Alexey Dobriyan
2026-05-07 9:28 ` Danilo Krummrich
2026-05-07 13:52 ` Alexey Dobriyan
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=2026050720-plating-cling-153a@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=adobriyan@gmail.com \
--cc=dakr@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rafael@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