Re: [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write()
From: Andrew Morton
Date: Mon Nov 21 2022 - 14:48:48 EST
On Mon, 21 Nov 2022 12:21:30 +0100 Alexander Potapenko <glider@xxxxxxxxxx> 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?
If true, this important info should be included in each changelog,
please.
If false, please provide a full description of the end-user visible
effects of the bug.
Also, it would be helpful to describe why it is not considered
practical to teach KMSAN to handle this?
> --- a/fs/ext4/verity.c
> +++ b/fs/ext4/verity.c
> @@ -79,7 +79,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count,
> size_t n = min_t(size_t, count,
> PAGE_SIZE - offset_in_page(pos));
> struct page *page;
> - void *fsdata;
> + void *fsdata = NULL;
> int res;
>
> res = aops->write_begin(NULL, mapping, pos, n, &page, &fsdata);