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] [thread-next>] [day] [month] [year] [list]
Message-ID: <c39524ab0e2b2045f21bc64f3742ac2b96abd2b9.camel@venev.name>
Date: Mon, 05 Aug 2024 18:34:23 +0300
From: Hristo Venev <hristo@...ev.name>
To: Trond Myklebust <trondmy@...merspace.com>, "max.kellermann@...os.com"
	 <max.kellermann@...os.com>, "dhowells@...hat.com" <dhowells@...hat.com>
Cc: "dan.aloni@...tdata.com" <dan.aloni@...tdata.com>, "xiubli@...hat.com"
 <xiubli@...hat.com>, "linux-fsdevel@...r.kernel.org"
 <linux-fsdevel@...r.kernel.org>, "ceph-devel@...r.kernel.org"
 <ceph-devel@...r.kernel.org>, "linux-kernel@...r.kernel.org"
 <linux-kernel@...r.kernel.org>, "netfs@...ts.linux.dev"
 <netfs@...ts.linux.dev>,  "jlayton@...nel.org" <jlayton@...nel.org>,
 "idryomov@...il.com" <idryomov@...il.com>,  "willy@...radead.org"
 <willy@...radead.org>, "blokos@...e.fr" <blokos@...e.fr>, 
 "linux-nfs@...r.kernel.org" <linux-nfs@...r.kernel.org>
Subject: Re: [PATCH] netfs: Set NETFS_RREQ_WRITE_TO_CACHE when caching is
 possible

On Sun, 2024-08-04 at 23:22 +0000, Trond Myklebust wrote:
> On Sun, 2024-08-04 at 16:57 +0300, Hristo Venev wrote:
> > In addition to Ceph, in NFS there are also some crashes related to
> > the
> > use of 0x356 as a pointer.
> > 
> > `netfs_is_cache_enabled()` only returns true when the fscache
> > cookie
> > is
> > fully initialized. This may happen after the request has been
> > created,
> > so check for the cookie's existence instead.
> > 
> > Link:
> > https://lore.kernel.org/linux-nfs/b78c88db-8b3a-4008-94cb-82ae08f0e37b@free.fr/T/
> > Fixes: 2ff1e97587f4 ("netfs: Replace PG_fscache by setting folio-
> > > private and marking dirty")
> > Cc: linux-nfs@...r.kernel.org <linux-nfs@...r.kernel.org>
> > Cc: blokos <blokos@...e.fr>
> > Cc: Trond Myklebust <trondmy@...merspace.com>
> > Cc: dan.aloni@...tdata.com <dan.aloni@...tdata.com>
> > Signed-off-by: Hristo Venev <hristo@...ev.name>
> > ---
> >  fs/netfs/objects.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/netfs/objects.c b/fs/netfs/objects.c
> > index f4a6427274792..a74ca90c86c9b 100644
> > --- a/fs/netfs/objects.c
> > +++ b/fs/netfs/objects.c
> > @@ -27,7 +27,6 @@ struct netfs_io_request
> > *netfs_alloc_request(struct
> > address_space *mapping,
> >  	bool is_unbuffered = (origin == NETFS_UNBUFFERED_WRITE ||
> >  			      origin == NETFS_DIO_READ ||
> >  			      origin == NETFS_DIO_WRITE);
> > -	bool cached = !is_unbuffered &&
> > netfs_is_cache_enabled(ctx);
> >  	int ret;
> >  
> >  	for (;;) {
> > @@ -56,8 +55,9 @@ struct netfs_io_request
> > *netfs_alloc_request(struct
> > address_space *mapping,
> >  	refcount_set(&rreq->ref, 1);
> >  
> >  	__set_bit(NETFS_RREQ_IN_PROGRESS, &rreq->flags);
> > -	if (cached) {
> > -		__set_bit(NETFS_RREQ_WRITE_TO_CACHE, &rreq-
> > >flags);
> > +	if (!is_unbuffered &&
> > fscache_cookie_valid(netfs_i_cookie(ctx))) {
> > +		if(netfs_is_cache_enabled(ctx))
> > +			__set_bit(NETFS_RREQ_WRITE_TO_CACHE,
> > &rreq-
> > > flags);
> >  		if (test_bit(NETFS_ICTX_USE_PGPRIV2, &ctx->flags))
> >  			/* Filesystem uses deprecated PG_private_2
> > marking. */
> >  			__set_bit(NETFS_RREQ_USE_PGPRIV2, &rreq-
> > > flags);
> 
> Does this mean that netfs could still end up setting a value for
> folio-
> > private in NFS given some other set of circumstances?

Hopefully not? For NFS the cookie should be allocated in
`nfs_fscache_init_inode`, and for Ceph I think `ceph_fill_inode` (which
calls `ceph_fscache_register_inode_cookie`) should also be called early
enough as well.

> -- 
> Trond Myklebust
> Linux NFS client maintainer, Hammerspace
> trond.myklebust@...merspace.com
> 
> 


Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ