linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write()
@ 2022-11-21 11:21 Alexander Potapenko
  2022-11-21 11:21 ` [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate() Alexander Potapenko
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Alexander Potapenko @ 2022-11-21 11:21 UTC (permalink / raw)
  To: glider
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers,
	syzbot+9767be679ef5016b6082

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.

Cc: Eric Biggers <ebiggers@kernel.org>
Fixes: c93d8f885809 ("ext4: add basic fs-verity support")
Reported-by: syzbot+9767be679ef5016b6082@syzkaller.appspotmail.com
Signed-off-by: Alexander Potapenko <glider@google.com>
---
 fs/ext4/verity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c
index 3c640bd7ecaeb..30e3b65798b50 100644
--- 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);
-- 
2.38.1.584.g0f3c55d4c2-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate()
  2022-11-21 11:21 [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Alexander Potapenko
@ 2022-11-21 11:21 ` Alexander Potapenko
  2022-11-21 19:46   ` Eric Biggers
  2022-11-22 14:56   ` David Sterba
  2022-11-21 11:21 ` [PATCH 3/5] fs: f2fs: initialize fsdata in pagecache_write() Alexander Potapenko
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Alexander Potapenko @ 2022-11-21 11:21 UTC (permalink / raw)
  To: glider
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers

When aops->write_begin() does not initialize fsdata, KMSAN may report
an error passing the latter to aops->write_end().

Fix this by unconditionally initializing fsdata.

Suggested-by: Eric Biggers <ebiggers@kernel.org>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Alexander Potapenko <glider@google.com>
---
 fs/affs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/affs/file.c b/fs/affs/file.c
index cefa222f7881c..8daeed31e1af9 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -880,7 +880,7 @@ affs_truncate(struct inode *inode)
 	if (inode->i_size > AFFS_I(inode)->mmu_private) {
 		struct address_space *mapping = inode->i_mapping;
 		struct page *page;
-		void *fsdata;
+		void *fsdata = NULL;
 		loff_t isize = inode->i_size;
 		int res;
 
-- 
2.38.1.584.g0f3c55d4c2-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/5] fs: f2fs: initialize fsdata in pagecache_write()
  2022-11-21 11:21 [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Alexander Potapenko
  2022-11-21 11:21 ` [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate() Alexander Potapenko
@ 2022-11-21 11:21 ` Alexander Potapenko
  2022-11-21 19:53   ` Eric Biggers
  2022-11-21 11:21 ` [PATCH 4/5] fs: hfs: initialize fsdata in hfs_file_truncate() Alexander Potapenko
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Alexander Potapenko @ 2022-11-21 11:21 UTC (permalink / raw)
  To: glider
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers

When aops->write_begin() does not initialize fsdata, KMSAN may report
an error passing the latter to aops->write_end().

Fix this by unconditionally initializing fsdata.

Suggested-by: Eric Biggers <ebiggers@kernel.org>
Fixes: 95ae251fe828 ("f2fs: add fs-verity support")
Signed-off-by: Alexander Potapenko <glider@google.com>
---
 fs/f2fs/verity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
index c352fff88a5e6..3f4f3295f1c66 100644
--- a/fs/f2fs/verity.c
+++ b/fs/f2fs/verity.c
@@ -81,7 +81,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);
-- 
2.38.1.584.g0f3c55d4c2-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/5] fs: hfs: initialize fsdata in hfs_file_truncate()
  2022-11-21 11:21 [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Alexander Potapenko
  2022-11-21 11:21 ` [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate() Alexander Potapenko
  2022-11-21 11:21 ` [PATCH 3/5] fs: f2fs: initialize fsdata in pagecache_write() Alexander Potapenko
@ 2022-11-21 11:21 ` Alexander Potapenko
  2023-01-24 10:51   ` Alexander Potapenko
  2022-11-21 11:21 ` [PATCH 5/5] fs: hfsplus: initialize fsdata in hfsplus_file_truncate() Alexander Potapenko
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Alexander Potapenko @ 2022-11-21 11:21 UTC (permalink / raw)
  To: glider
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers

When aops->write_begin() does not initialize fsdata, KMSAN may report
an error passing the latter to aops->write_end().

Fix this by unconditionally initializing fsdata.

Suggested-by: Eric Biggers <ebiggers@kernel.org>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Alexander Potapenko <glider@google.com>
---
 fs/hfs/extent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index 3f7e9bef98743..6d1878b99b305 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -486,7 +486,7 @@ void hfs_file_truncate(struct inode *inode)
 		inode->i_size);
 	if (inode->i_size > HFS_I(inode)->phys_size) {
 		struct address_space *mapping = inode->i_mapping;
-		void *fsdata;
+		void *fsdata = NULL;
 		struct page *page;
 
 		/* XXX: Can use generic_cont_expand? */
-- 
2.38.1.584.g0f3c55d4c2-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/5] fs: hfsplus: initialize fsdata in hfsplus_file_truncate()
  2022-11-21 11:21 [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Alexander Potapenko
                   ` (2 preceding siblings ...)
  2022-11-21 11:21 ` [PATCH 4/5] fs: hfs: initialize fsdata in hfs_file_truncate() Alexander Potapenko
@ 2022-11-21 11:21 ` Alexander Potapenko
  2022-11-21 19:48 ` [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Andrew Morton
  2022-11-21 19:52 ` Eric Biggers
  5 siblings, 0 replies; 20+ messages in thread
From: Alexander Potapenko @ 2022-11-21 11:21 UTC (permalink / raw)
  To: glider
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers

When aops->write_begin() does not initialize fsdata, KMSAN may report
an error passing the latter to aops->write_end().

Fix this by unconditionally initializing fsdata.

Suggested-by: Eric Biggers <ebiggers@kernel.org>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Alexander Potapenko <glider@google.com>
---
 fs/hfsplus/extents.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 721f779b4ec3e..7a542f3dbe502 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -554,7 +554,7 @@ void hfsplus_file_truncate(struct inode *inode)
 	if (inode->i_size > hip->phys_size) {
 		struct address_space *mapping = inode->i_mapping;
 		struct page *page;
-		void *fsdata;
+		void *fsdata = NULL;
 		loff_t size = inode->i_size;
 
 		res = hfsplus_write_begin(NULL, mapping, size, 0,
-- 
2.38.1.584.g0f3c55d4c2-goog


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate()
  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
  1 sibling, 1 reply; 20+ messages in thread
From: Eric Biggers @ 2022-11-21 19:46 UTC (permalink / raw)
  To: Alexander Potapenko
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel

On Mon, Nov 21, 2022 at 12:21:31PM +0100, Alexander Potapenko wrote:
> When aops->write_begin() does not initialize fsdata, KMSAN may report
> an error passing the latter to aops->write_end().
> 
> Fix this by unconditionally initializing fsdata.
> 
> Suggested-by: Eric Biggers <ebiggers@kernel.org>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")

Are you sure that is the correct Fixes commit?  What about commit f2b6a16eb8f5
("fs: affs convert to new aops")?

- Eric

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write()
  2022-11-21 11:21 [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Alexander Potapenko
                   ` (3 preceding siblings ...)
  2022-11-21 11:21 ` [PATCH 5/5] fs: hfsplus: initialize fsdata in hfsplus_file_truncate() Alexander Potapenko
@ 2022-11-21 19:48 ` Andrew Morton
  2022-11-22  3:40   ` Matthew Wilcox
  2022-11-21 19:52 ` Eric Biggers
  5 siblings, 1 reply; 20+ messages in thread
From: Andrew Morton @ 2022-11-21 19:48 UTC (permalink / raw)
  To: Alexander Potapenko
  Cc: linux-kernel, tytso, adilger.kernel, jaegeuk, chao, linux-fsdevel,
	linux-ext4, linux-f2fs-devel, Eric Biggers,
	syzbot+9767be679ef5016b6082

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?

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);


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write()
  2022-11-21 11:21 [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Alexander Potapenko
                   ` (4 preceding siblings ...)
  2022-11-21 19:48 ` [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Andrew Morton
@ 2022-11-21 19:52 ` Eric Biggers
  5 siblings, 0 replies; 20+ messages in thread
From: Eric Biggers @ 2022-11-21 19:52 UTC (permalink / raw)
  To: Alexander Potapenko
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel,
	syzbot+9767be679ef5016b6082

On Mon, Nov 21, 2022 at 12:21:30PM +0100, Alexander Potapenko 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.
> 
> Cc: Eric Biggers <ebiggers@kernel.org>
> Fixes: c93d8f885809 ("ext4: add basic fs-verity support")
> Reported-by: syzbot+9767be679ef5016b6082@syzkaller.appspotmail.com
> Signed-off-by: Alexander Potapenko <glider@google.com>
> ---
>  fs/ext4/verity.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c
> index 3c640bd7ecaeb..30e3b65798b50 100644
> --- 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);

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/5] fs: f2fs: initialize fsdata in pagecache_write()
  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
  0 siblings, 1 reply; 20+ messages in thread
From: Eric Biggers @ 2022-11-21 19:53 UTC (permalink / raw)
  To: Alexander Potapenko
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel

On Mon, Nov 21, 2022 at 12:21:32PM +0100, Alexander Potapenko wrote:
> When aops->write_begin() does not initialize fsdata, KMSAN may report
> an error passing the latter to aops->write_end().
> 
> Fix this by unconditionally initializing fsdata.
> 
> Suggested-by: Eric Biggers <ebiggers@kernel.org>
> Fixes: 95ae251fe828 ("f2fs: add fs-verity support")
> Signed-off-by: Alexander Potapenko <glider@google.com>
> ---
>  fs/f2fs/verity.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
> index c352fff88a5e6..3f4f3295f1c66 100644
> --- a/fs/f2fs/verity.c
> +++ b/fs/f2fs/verity.c
> @@ -81,7 +81,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);

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write()
  2022-11-21 19:48 ` [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() Andrew Morton
@ 2022-11-22  3:40   ` Matthew Wilcox
  0 siblings, 0 replies; 20+ messages in thread
From: Matthew Wilcox @ 2022-11-22  3:40 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Alexander Potapenko, linux-kernel, tytso, adilger.kernel, jaegeuk,
	chao, linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers,
	syzbot+9767be679ef5016b6082

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!


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate()
  2022-11-21 19:46   ` Eric Biggers
@ 2022-11-22  8:57     ` Alexander Potapenko
  0 siblings, 0 replies; 20+ messages in thread
From: Alexander Potapenko @ 2022-11-22  8:57 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel

On Mon, Nov 21, 2022 at 8:46 PM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Mon, Nov 21, 2022 at 12:21:31PM +0100, Alexander Potapenko wrote:
> > When aops->write_begin() does not initialize fsdata, KMSAN may report
> > an error passing the latter to aops->write_end().
> >
> > Fix this by unconditionally initializing fsdata.
> >
> > Suggested-by: Eric Biggers <ebiggers@kernel.org>
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>
> Are you sure that is the correct Fixes commit?  What about commit f2b6a16eb8f5
> ("fs: affs convert to new aops")?

Hmm, indeed, you are right.

> - Eric



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate()
  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 14:56   ` David Sterba
  2023-01-10 12:27     ` Alexander Potapenko
  1 sibling, 1 reply; 20+ messages in thread
From: David Sterba @ 2022-11-22 14:56 UTC (permalink / raw)
  To: Alexander Potapenko
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers

On Mon, Nov 21, 2022 at 12:21:31PM +0100, Alexander Potapenko wrote:
> When aops->write_begin() does not initialize fsdata, KMSAN may report
> an error passing the latter to aops->write_end().
> 
> Fix this by unconditionally initializing fsdata.
> 
> Suggested-by: Eric Biggers <ebiggers@kernel.org>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Alexander Potapenko <glider@google.com>

With the fixed Fixes: reference,

Acked-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate()
  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
  0 siblings, 2 replies; 20+ messages in thread
From: Alexander Potapenko @ 2023-01-10 12:27 UTC (permalink / raw)
  To: dsterba
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers

On Tue, Nov 22, 2022 at 3:56 PM David Sterba <dsterba@suse.cz> wrote:
>
> On Mon, Nov 21, 2022 at 12:21:31PM +0100, Alexander Potapenko wrote:
> > When aops->write_begin() does not initialize fsdata, KMSAN may report
> > an error passing the latter to aops->write_end().
> >
> > Fix this by unconditionally initializing fsdata.
> >
> > Suggested-by: Eric Biggers <ebiggers@kernel.org>
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > Signed-off-by: Alexander Potapenko <glider@google.com>
>
> With the fixed Fixes: reference,
>
> Acked-by: David Sterba <dsterba@suse.com>

Hi David,

I've noticed that the ext4 counterpart of this patch is in the
upstream tree already, whereas the affs, f2fs, hfs and hfsplus
versions are not.
Are they picked via a different tree?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate()
  2023-01-10 12:27     ` Alexander Potapenko
@ 2023-01-10 12:47       ` David Sterba
  2023-01-10 18:42       ` Eric Biggers
  1 sibling, 0 replies; 20+ messages in thread
From: David Sterba @ 2023-01-10 12:47 UTC (permalink / raw)
  To: Alexander Potapenko
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers

On Tue, Jan 10, 2023 at 01:27:03PM +0100, Alexander Potapenko wrote:
> On Tue, Nov 22, 2022 at 3:56 PM David Sterba <dsterba@suse.cz> wrote:
> >
> > On Mon, Nov 21, 2022 at 12:21:31PM +0100, Alexander Potapenko wrote:
> > > When aops->write_begin() does not initialize fsdata, KMSAN may report
> > > an error passing the latter to aops->write_end().
> > >
> > > Fix this by unconditionally initializing fsdata.
> > >
> > > Suggested-by: Eric Biggers <ebiggers@kernel.org>
> > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > > Signed-off-by: Alexander Potapenko <glider@google.com>
> >
> > With the fixed Fixes: reference,
> >
> > Acked-by: David Sterba <dsterba@suse.com>
> 
> Hi David,
> 
> I've noticed that the ext4 counterpart of this patch is in the
> upstream tree already, whereas the affs, f2fs, hfs and hfsplus
> versions are not.
> Are they picked via a different tree?

I thought it would go in with the rest of the series but it seems that
the patches are meant to be merged independently, so I'll do the affs
part.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/5] fs: affs: initialize fsdata in affs_truncate()
  2023-01-10 12:27     ` Alexander Potapenko
  2023-01-10 12:47       ` David Sterba
@ 2023-01-10 18:42       ` Eric Biggers
  1 sibling, 0 replies; 20+ messages in thread
From: Eric Biggers @ 2023-01-10 18:42 UTC (permalink / raw)
  To: Alexander Potapenko
  Cc: dsterba, linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel

On Tue, Jan 10, 2023 at 01:27:03PM +0100, Alexander Potapenko wrote:
> On Tue, Nov 22, 2022 at 3:56 PM David Sterba <dsterba@suse.cz> wrote:
> >
> > On Mon, Nov 21, 2022 at 12:21:31PM +0100, Alexander Potapenko wrote:
> > > When aops->write_begin() does not initialize fsdata, KMSAN may report
> > > an error passing the latter to aops->write_end().
> > >
> > > Fix this by unconditionally initializing fsdata.
> > >
> > > Suggested-by: Eric Biggers <ebiggers@kernel.org>
> > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > > Signed-off-by: Alexander Potapenko <glider@google.com>
> >
> > With the fixed Fixes: reference,
> >
> > Acked-by: David Sterba <dsterba@suse.com>
> 
> Hi David,
> 
> I've noticed that the ext4 counterpart of this patch is in the
> upstream tree already, whereas the affs, f2fs, hfs and hfsplus
> versions are not.
> Are they picked via a different tree?

Generally each filesystem has its own development tree.  All the information is
in MAINTAINERS.  hfs and hfsplus are unmaintained, though.

Maybe try asking Andrew Morton to apply the hfs and hfsplus patches, and any
others that don't get applied, as "maintainer of last resort".

- Eric

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/5] fs: f2fs: initialize fsdata in pagecache_write()
  2022-11-21 19:53   ` Eric Biggers
@ 2023-01-23  6:59     ` Eric Biggers
  2023-01-26 21:09       ` Jaegeuk Kim
  0 siblings, 1 reply; 20+ messages in thread
From: Eric Biggers @ 2023-01-23  6:59 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: tytso, linux-kernel, linux-f2fs-devel, adilger.kernel,
	linux-fsdevel, jaegeuk, akpm, linux-ext4, Alexander Potapenko

On Mon, Nov 21, 2022 at 07:53:19PM +0000, Eric Biggers wrote:
> On Mon, Nov 21, 2022 at 12:21:32PM +0100, Alexander Potapenko wrote:
> > When aops->write_begin() does not initialize fsdata, KMSAN may report
> > an error passing the latter to aops->write_end().
> > 
> > Fix this by unconditionally initializing fsdata.
> > 
> > Suggested-by: Eric Biggers <ebiggers@kernel.org>
> > Fixes: 95ae251fe828 ("f2fs: add fs-verity support")
> > Signed-off-by: Alexander Potapenko <glider@google.com>
> > ---
> >  fs/f2fs/verity.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
> > index c352fff88a5e6..3f4f3295f1c66 100644
> > --- a/fs/f2fs/verity.c
> > +++ b/fs/f2fs/verity.c
> > @@ -81,7 +81,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);
> 
> Reviewed-by: Eric Biggers <ebiggers@google.com>
> 

Jaegeuk, can you please apply this patch?

- Eric

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/5] fs: hfs: initialize fsdata in hfs_file_truncate()
  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
  0 siblings, 1 reply; 20+ messages in thread
From: Alexander Potapenko @ 2023-01-24 10:51 UTC (permalink / raw)
  To: glider
  Cc: linux-kernel, akpm, tytso, adilger.kernel, jaegeuk, chao,
	linux-fsdevel, linux-ext4, linux-f2fs-devel, Eric Biggers

On Mon, Nov 21, 2022 at 12:21 PM Alexander Potapenko <glider@google.com> wrote:
>
> When aops->write_begin() does not initialize fsdata, KMSAN may report
> an error passing the latter to aops->write_end().
>
> Fix this by unconditionally initializing fsdata.
>
> Suggested-by: Eric Biggers <ebiggers@kernel.org>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Alexander Potapenko <glider@google.com>

Dear FS maintainers,

HFS/HFSPLUS are orphaned, can someone take this patch to their tree?
Thanks in advance!
(same for "fs: hfsplus: initialize fsdata in hfsplus_file_truncate()":
https://lore.kernel.org/all/20221121112134.407362-5-glider@google.com/)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/5] fs: hfs: initialize fsdata in hfs_file_truncate()
  2023-01-24 10:51   ` Alexander Potapenko
@ 2023-01-24 21:04     ` Andrew Morton
  2023-01-25  9:51       ` Alexander Potapenko
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew Morton @ 2023-01-24 21:04 UTC (permalink / raw)
  To: Alexander Potapenko
  Cc: linux-kernel, tytso, adilger.kernel, jaegeuk, chao, linux-fsdevel,
	linux-ext4, linux-f2fs-devel, Eric Biggers

On Tue, 24 Jan 2023 11:51:30 +0100 Alexander Potapenko <glider@google.com> wrote:

> On Mon, Nov 21, 2022 at 12:21 PM Alexander Potapenko <glider@google.com> wrote:
> >
> > When aops->write_begin() does not initialize fsdata, KMSAN may report
> > an error passing the latter to aops->write_end().
> >
> > Fix this by unconditionally initializing fsdata.
> >
> > Suggested-by: Eric Biggers <ebiggers@kernel.org>
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > Signed-off-by: Alexander Potapenko <glider@google.com>
> 
> Dear FS maintainers,
> 
> HFS/HFSPLUS are orphaned, can someone take this patch to their tree?
> Thanks in advance!
> (same for "fs: hfsplus: initialize fsdata in hfsplus_file_truncate()":
> https://lore.kernel.org/all/20221121112134.407362-5-glider@google.com/)

I grabbed both.

I removed the

	Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")

because that might provoke the backport bots to backport this fix
across eight years worth of kernels.  Before KMSAN existed!

If you intended that this be backported then please let's come up with a
more precise Fixes: target and we'll add cc:stable.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/5] fs: hfs: initialize fsdata in hfs_file_truncate()
  2023-01-24 21:04     ` Andrew Morton
@ 2023-01-25  9:51       ` Alexander Potapenko
  0 siblings, 0 replies; 20+ messages in thread
From: Alexander Potapenko @ 2023-01-25  9:51 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, tytso, adilger.kernel, jaegeuk, chao, linux-fsdevel,
	linux-ext4, linux-f2fs-devel, Eric Biggers

On Tue, Jan 24, 2023 at 10:04 PM Andrew Morton
<akpm@linux-foundation.org> wrote:
>
> On Tue, 24 Jan 2023 11:51:30 +0100 Alexander Potapenko <glider@google.com> wrote:
>
> > On Mon, Nov 21, 2022 at 12:21 PM Alexander Potapenko <glider@google.com> wrote:
> > >
> > > When aops->write_begin() does not initialize fsdata, KMSAN may report
> > > an error passing the latter to aops->write_end().
> > >
> > > Fix this by unconditionally initializing fsdata.
> > >
> > > Suggested-by: Eric Biggers <ebiggers@kernel.org>
> > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > > Signed-off-by: Alexander Potapenko <glider@google.com>
> >
> > Dear FS maintainers,
> >
> > HFS/HFSPLUS are orphaned, can someone take this patch to their tree?
> > Thanks in advance!
> > (same for "fs: hfsplus: initialize fsdata in hfsplus_file_truncate()":
> > https://lore.kernel.org/all/20221121112134.407362-5-glider@google.com/)
>
> I grabbed both.
>
> I removed the
>
>         Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>
> because that might provoke the backport bots to backport this fix
> across eight years worth of kernels.  Before KMSAN existed!

Right, makes sense.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/5] fs: f2fs: initialize fsdata in pagecache_write()
  2023-01-23  6:59     ` Eric Biggers
@ 2023-01-26 21:09       ` Jaegeuk Kim
  0 siblings, 0 replies; 20+ messages in thread
From: Jaegeuk Kim @ 2023-01-26 21:09 UTC (permalink / raw)
  To: Eric Biggers
  Cc: tytso, linux-kernel, linux-f2fs-devel, adilger.kernel,
	linux-fsdevel, akpm, linux-ext4, Alexander Potapenko

On 01/22, Eric Biggers wrote:
> On Mon, Nov 21, 2022 at 07:53:19PM +0000, Eric Biggers wrote:
> > On Mon, Nov 21, 2022 at 12:21:32PM +0100, Alexander Potapenko wrote:
> > > When aops->write_begin() does not initialize fsdata, KMSAN may report
> > > an error passing the latter to aops->write_end().
> > > 
> > > Fix this by unconditionally initializing fsdata.
> > > 
> > > Suggested-by: Eric Biggers <ebiggers@kernel.org>
> > > Fixes: 95ae251fe828 ("f2fs: add fs-verity support")
> > > Signed-off-by: Alexander Potapenko <glider@google.com>
> > > ---
> > >  fs/f2fs/verity.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
> > > index c352fff88a5e6..3f4f3295f1c66 100644
> > > --- a/fs/f2fs/verity.c
> > > +++ b/fs/f2fs/verity.c
> > > @@ -81,7 +81,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);
> > 
> > Reviewed-by: Eric Biggers <ebiggers@google.com>
> > 
> 
> Jaegeuk, can you please apply this patch?

Yup, applied.

> 
> - Eric

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-01-26 21:10 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-21 11:21 [PATCH 1/5] fs: ext4: initialize fsdata in pagecache_write() 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
2022-11-21 19:52 ` Eric Biggers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).