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: <Zd8x3w2mwyAufKvm@casper.infradead.org>
Date: Wed, 28 Feb 2024 13:15:11 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Sean Christopherson <seanjc@...gle.com>,
	Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org,
	kvm@...r.kernel.org, michael.roth@....com, isaku.yamahata@...el.com,
	thomas.lendacky@....com
Subject: Re: [PATCH 17/21] filemap: add FGP_CREAT_ONLY

On Tue, Feb 27, 2024 at 06:17:34PM -0800, Yosry Ahmed wrote:
> On Tue, Feb 27, 2024 at 6:15 PM Sean Christopherson <seanjc@...gle.com> wrote:
> >
> > On Tue, Feb 27, 2024, Paolo Bonzini wrote:
> >
> > This needs a changelog, and also needs to be Cc'd to someone(s) that can give it
> > a thumbs up.
> 
> +Matthew Wilcox

If only there were an entry in MAINTAINERS for filemap.c ...

This looks bogus to me, and if it's not bogus, it's incomplete.
But it's hard to judge without a commit message that describes what it's
supposed to mean.

> >
> > > Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> > > ---
> > >  include/linux/pagemap.h | 2 ++
> > >  mm/filemap.c            | 4 ++++
> > >  2 files changed, 6 insertions(+)
> > >
> > > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> > > index 2df35e65557d..e8ac0b32f84d 100644
> > > --- a/include/linux/pagemap.h
> > > +++ b/include/linux/pagemap.h
> > > @@ -586,6 +586,7 @@ pgoff_t page_cache_prev_miss(struct address_space *mapping,
> > >   * * %FGP_CREAT - If no folio is present then a new folio is allocated,
> > >   *   added to the page cache and the VM's LRU list.  The folio is
> > >   *   returned locked.
> > > + * * %FGP_CREAT_ONLY - Fail if a folio is not present
> > >   * * %FGP_FOR_MMAP - The caller wants to do its own locking dance if the
> > >   *   folio is already in cache.  If the folio was allocated, unlock it
> > >   *   before returning so the caller can do the same dance.
> > > @@ -606,6 +607,7 @@ typedef unsigned int __bitwise fgf_t;
> > >  #define FGP_NOWAIT           ((__force fgf_t)0x00000020)
> > >  #define FGP_FOR_MMAP         ((__force fgf_t)0x00000040)
> > >  #define FGP_STABLE           ((__force fgf_t)0x00000080)
> > > +#define FGP_CREAT_ONLY               ((__force fgf_t)0x00000100)
> > >  #define FGF_GET_ORDER(fgf)   (((__force unsigned)fgf) >> 26) /* top 6 bits */
> > >
> > >  #define FGP_WRITEBEGIN               (FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE)
> > > diff --git a/mm/filemap.c b/mm/filemap.c
> > > index 750e779c23db..d5107bd0cd09 100644
> > > --- a/mm/filemap.c
> > > +++ b/mm/filemap.c
> > > @@ -1854,6 +1854,10 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
> > >               folio = NULL;
> > >       if (!folio)
> > >               goto no_page;
> > > +     if (fgp_flags & FGP_CREAT_ONLY) {
> > > +             folio_put(folio);
> > > +             return ERR_PTR(-EEXIST);
> > > +     }
> > >
> > >       if (fgp_flags & FGP_LOCK) {
> > >               if (fgp_flags & FGP_NOWAIT) {
> > > --
> > > 2.39.0
> > >
> > >
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ