[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200708143320.GD538949@linux.intel.com>
Date: Wed, 8 Jul 2020 17:33:20 +0300
From: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Sean Christopherson <sean.j.christopherson@...el.com>,
x86@...nel.org, linux-sgx@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
Jethro Beekman <jethro@...tanix.com>,
andriy.shevchenko@...ux.intel.com, asapek@...gle.com, bp@...en8.de,
cedric.xing@...el.com, chenalexchen@...gle.com,
conradparker@...gle.com, cyhanish@...gle.com,
dave.hansen@...el.com, haitao.huang@...el.com,
josh@...htriplett.org, kai.huang@...el.com, kai.svahn@...el.com,
kmoy@...gle.com, ludloff@...gle.com, luto@...nel.org,
nhorman@...hat.com, npmccallum@...hat.com, puiterwijk@...hat.com,
rientjes@...gle.com, tglx@...utronix.de, yaozhangx@...gle.com
Subject: Re: [PATCH v34 10/24] mm: Add vm_ops->mprotect()
On Tue, Jul 07, 2020 at 05:10:46AM +0100, Matthew Wilcox wrote:
> On Tue, Jul 07, 2020 at 07:01:51AM +0300, Jarkko Sakkinen wrote:
> > On Tue, Jul 07, 2020 at 04:24:08AM +0100, Matthew Wilcox wrote:
> > > On Mon, Jul 06, 2020 at 08:22:54PM -0700, Sean Christopherson wrote:
> > > > On Tue, Jul 07, 2020 at 04:14:24AM +0100, Matthew Wilcox wrote:
> > > > > > + if (vma->vm_ops && vma->vm_ops->mprotect) {
> > > > > > + error = vma->vm_ops->mprotect(vma, nstart, tmp, prot);
> > > > > > + if (error)
> > > > > > + goto out;
> > > > > > + }
> > > >
> > > > Based on "... and then the vma owner can do whatever it needs to before
> > > > calling mprotect_fixup(), which is already not static", my interpretation
> > > > is that Matthew's intent was to do:
> > > >
> > > > if (vma->vm_ops && vma->vm_ops->mprotect)
> > > > error = = vma->vm_ops->mprotect(vma, nstart, tmp, prot);
> > > > else
> > > > error = mprotect_fixup(vma, &prev, nstart, tmp, newflags);
> > > > if (error)
> > > > goto out;
> > > >
> > > > i.e. make .mprotect() a full replacement as opposed to a prereq hook.
> > >
> > > Yes, it was. I was just looking at the next patch to be sure this was
> > > how I'd been misunderstood.
> >
> > I'm don't get this part. If mprotect_fixup is called in the tail of the
> > callback, why it has to be called inside the callback and not be called
> > after the callback?
>
> Because that's how every other VM operation works. Look at your
> implementation of get_unmapped_area() for example.
I get the point but I don't think that your proposal could work given
that mprotect-callback takes neither 'prev' nor 'newflags' as its
parameters. The current callback has no means to call mprotect_fixup()
properly.
It would have to be extended
int (*mprotect)(struct vm_area_struct *vma,
struct vm_area_struct **pprev, unsigned long start,
unsigned long end, unsigned long prot,
unsigned long newflags);
Is this what you want?
/Jarkko
Powered by blists - more mailing lists