lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240828113802.xw5wzlq2hxrquclb@quentin>
Date: Wed, 28 Aug 2024 11:38:02 +0000
From: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
To: David Howells <dhowells@...hat.com>
Cc: Christian Brauner <christian@...uner.io>,
	Steve French <sfrench@...ba.org>,
	Pankaj Raghav <p.raghav@...sung.com>,
	Paulo Alcantara <pc@...guebit.com>,
	Jeff Layton <jlayton@...nel.org>,
	Matthew Wilcox <willy@...radead.org>, netfs@...ts.linux.dev,
	linux-afs@...ts.infradead.org, linux-cifs@...r.kernel.org,
	linux-nfs@...r.kernel.org, ceph-devel@...r.kernel.org,
	v9fs@...ts.linux.dev, linux-erofs@...ts.ozlabs.org,
	linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Marc Dionne <marc.dionne@...istor.com>
Subject: Re: [PATCH 1/9] mm: Fix missing folio invalidation calls during
 truncation

On Fri, Aug 23, 2024 at 09:08:09PM +0100, David Howells wrote:
> When AS_RELEASE_ALWAYS is set on a mapping, the ->release_folio() and
> ->invalidate_folio() calls should be invoked even if PG_private and
> PG_private_2 aren't set.  This is used by netfslib to keep track of the
Should we update the comment in pagemap? 

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 55b254d951da..18dd6174e6cc 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -204,7 +204,8 @@ enum mapping_flags {
        AS_EXITING      = 4,    /* final truncate in progress */
        /* writeback related tags are not used */
        AS_NO_WRITEBACK_TAGS = 5,
-       AS_RELEASE_ALWAYS = 6,  /* Call ->release_folio(), even if no private data */
+       AS_RELEASE_ALWAYS = 6,  /* Call ->release_folio() and ->invalidate_folio,
+                                  even if no private data */
        AS_STABLE_WRITES = 7,   /* must wait for writeback before modifying
                                   folio contents */
        AS_INACCESSIBLE = 8,    /* Do not attempt direct R/W access to the mapping */

> point above which reads can be skipped in favour of just zeroing pagecache
> locally.
> 
> There are a couple of places in truncation in which invalidation is only
> called when folio_has_private() is true.  Fix these to check
> folio_needs_release() instead.
> 
> Without this, the generic/075 and generic/112 xfstests (both fsx-based
> tests) fail with minimum folio size patches applied[1].
> 
> Fixes: b4fa966f03b7 ("mm, netfs, fscache: stop read optimisation when folio removed from pagecache")
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: Matthew Wilcox (Oracle) <willy@...radead.org>
> cc: Pankaj Raghav <p.raghav@...sung.com>
> cc: Jeff Layton <jlayton@...nel.org>
> cc: Marc Dionne <marc.dionne@...istor.com>
> cc: linux-afs@...ts.infradead.org
> cc: netfs@...ts.linux.dev
> cc: linux-mm@...ck.org
> cc: linux-fsdevel@...r.kernel.org
> Link: https://lore.kernel.org/r/20240815090849.972355-1-kernel@pankajraghav.com/ [1]
> ---
>  mm/truncate.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/truncate.c b/mm/truncate.c
> index 4d61fbdd4b2f..0668cd340a46 100644
> --- a/mm/truncate.c
> +++ b/mm/truncate.c
> @@ -157,7 +157,7 @@ static void truncate_cleanup_folio(struct folio *folio)
>  	if (folio_mapped(folio))
>  		unmap_mapping_folio(folio);
>  
> -	if (folio_has_private(folio))
> +	if (folio_needs_release(folio))
>  		folio_invalidate(folio, 0, folio_size(folio));
>  
>  	/*
> @@ -219,7 +219,7 @@ bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end)
>  	if (!mapping_inaccessible(folio->mapping))
>  		folio_zero_range(folio, offset, length);
>  
> -	if (folio_has_private(folio))
> +	if (folio_needs_release(folio))
>  		folio_invalidate(folio, offset, length);
>  	if (!folio_test_large(folio))
>  		return true;
> 

-- 
Pankaj Raghav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ