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: <20200525165637.GG744@ziepe.ca>
Date:   Mon, 25 May 2020 13:56:37 -0300
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Peter Xu <peterx@...hat.com>, John Hubbard <jhubbard@...dia.com>
Cc:     Alex Williamson <alex.williamson@...hat.com>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, cohuck@...hat.com, cai@....pw,
        Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [PATCH v3 3/3] vfio-pci: Invalidate mmaps and block MMIO access
 on disabled memory

On Mon, May 25, 2020 at 11:11:42AM -0400, Peter Xu wrote:
> On Mon, May 25, 2020 at 11:46:51AM -0300, Jason Gunthorpe wrote:
> > On Mon, May 25, 2020 at 10:28:06AM -0400, Peter Xu wrote:
> > > On Mon, May 25, 2020 at 09:26:07AM -0300, Jason Gunthorpe wrote:
> > > > On Sat, May 23, 2020 at 07:52:57PM -0400, Peter Xu wrote:
> > > > 
> > > > > For what I understand now, IMHO we should still need all those handlings of
> > > > > FAULT_FLAG_RETRY_NOWAIT like in the initial version.  E.g., IIUC KVM gup will
> > > > > try with FOLL_NOWAIT when async is allowed, before the complete slow path.  I'm
> > > > > not sure what would be the side effect of that if fault() blocked it.  E.g.,
> > > > > the caller could be in an atomic context.
> > > > 
> > > > AFAICT FAULT_FLAG_RETRY_NOWAIT only impacts what happens when
> > > > VM_FAULT_RETRY is returned, which this doesn't do?
> > > 
> > > Yes, that's why I think we should still properly return VM_FAULT_RETRY if
> > > needed..  because IMHO it is still possible that the caller calls with
> > > FAULT_FLAG_RETRY_NOWAIT.
> > > 
> > > My understanding is that FAULT_FLAG_RETRY_NOWAIT majorly means:
> > > 
> > >   - We cannot release the mmap_sem, and,
> > >   - We cannot sleep
> > 
> > Sleeping looks fine, look at any FS implementation of fault, say,
> > xfs. The first thing it does is xfs_ilock() which does down_write().
> 
> Yeah.  My wild guess is that maybe fs code will always be without
> FAULT_FLAG_RETRY_NOWAIT so it's safe to sleep unconditionally (e.g., I think
> the general #PF should be fine to sleep in fault(); gup should be special, but
> I didn't observe any gup code called upon file systems)?

get_user_pages is called on filesystem backed pages.

I have no idea what FAULT_FLAG_RETRY_NOWAIT is supposed to do. Maybe
John was able to guess when he reworked that stuff?

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ