From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexander Potapenko <glider@google.com>,
linux-kernel@vger.kernel.org, tytso@mit.edu,
adilger.kernel@dilger.ca, jaegeuk@kernel.org, chao@kernel.org,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
Eric Biggers <ebiggers@kernel.org>,
syzbot+9767be679ef5016b6082@syzkaller.appspotmail.com
Subject: Re: [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write()
Date: Tue, 22 Nov 2022 03:40:31 +0000 [thread overview]
Message-ID: <Y3xEr3hhbYfdei+k@casper.infradead.org> (raw)
In-Reply-To: <20221121114840.c407626c13706ff993efabe3@linux-foundation.org>
On Mon, Nov 21, 2022 at 11:48:40AM -0800, Andrew Morton wrote:
> On Mon, 21 Nov 2022 12:21:30 +0100 Alexander Potapenko <glider@google.com> wrote:
>
> > When aops->write_begin() does not initialize fsdata, KMSAN reports
> > an error passing the latter to aops->write_end().
> >
> > Fix this by unconditionally initializing fsdata.
> >
> > ...
> >
>
> I'm assuming that this is not-a-bug, and that these changes are purely
> workarounds for a KMSAN shortcoming?
It's a weird one. It used to be not-a-bug. Then we changed from
std=gnu99 to std=gnu11 or something. And in the intervening years,
the C standards ctte decided that passing an uninitialised pointer to a
function was UB. So we start by passing a pointer to the pointer to
->write_begin(). Some ->write_begin functions initialise that pointer;
others don't. Then we pass the pointer directly to ->write_end. If
->write_begin initialised the pointer, that's fine, and if not, it's UB.
Of course the ->write_end doesn't use it if the ->write_begin didn't
initialise it, but it's too late because merely calling the function
was UB. Thanks, Itanium!
next prev parent reply other threads:[~2022-11-22 3:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 11:21 Alexander Potapenko
2022-11-21 11:21 ` [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate() Alexander Potapenko
2022-11-21 19:46 ` Eric Biggers
2022-11-22 8:57 ` Alexander Potapenko
2022-11-22 14:56 ` David Sterba
2023-01-10 12:27 ` Alexander Potapenko
2023-01-10 12:47 ` David Sterba
2023-01-10 18:42 ` Eric Biggers
2022-11-21 11:21 ` [PATCH 3/5] fs: f2fs: initialize fsdata in pagecache_write() Alexander Potapenko
2022-11-21 19:53 ` Eric Biggers
2023-01-23 6:59 ` Eric Biggers
2023-01-26 21:09 ` Jaegeuk Kim
2022-11-21 11:21 ` [PATCH 4/5] fs: hfs: initialize fsdata in hfs_file_truncate() Alexander Potapenko
2023-01-24 10:51 ` Alexander Potapenko
2023-01-24 21:04 ` Andrew Morton
2023-01-25 9:51 ` Alexander Potapenko
2022-11-21 11:21 ` [PATCH 5/5] fs: hfsplus: initialize fsdata in hfsplus_file_truncate() Alexander Potapenko
2022-11-21 19:48 ` [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Andrew Morton
2022-11-22 3:40 ` Matthew Wilcox [this message]
2022-11-21 19:52 ` Eric Biggers
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=Y3xEr3hhbYfdei+k@casper.infradead.org \
--to=willy@infradead.org \
--cc=adilger.kernel@dilger.ca \
--cc=akpm@linux-foundation.org \
--cc=chao@kernel.org \
--cc=ebiggers@kernel.org \
--cc=glider@google.com \
--cc=jaegeuk@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+9767be679ef5016b6082@syzkaller.appspotmail.com \
--cc=tytso@mit.edu \
/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®