[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f0244eb7-bd9f-dce4-68a5-cf5f8b43652e@intel.com>
Date: Thu, 14 Dec 2017 12:44:58 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org, tglx@...utronix.de
Cc: x86@...nel.org, Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirsky <luto@...nel.org>,
Borislav Petkov <bpetkov@...e.de>,
Greg KH <gregkh@...uxfoundation.org>, keescook@...gle.com,
hughd@...gle.com, Brian Gerst <brgerst@...il.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Juergen Gross <jgross@...e.com>,
David Laight <David.Laight@...lab.com>,
Eduardo Valentin <eduval@...zon.com>, aliguori@...zon.com,
Will Deacon <will.deacon@....com>, linux-mm@...ck.org,
kirill.shutemov@...ux.intel.com, dan.j.williams@...el.com
Subject: Re: [PATCH v2 01/17] mm/gup: Fixup p*_access_permitted()
On 12/14/2017 06:37 AM, Peter Zijlstra wrote:
> I'm also looking at pte_access_permitted() in handle_pte_fault(); that
> looks very dodgy to me. How does that not result in endlessly CoW'ing
> the same page over and over when we have a PKEY disallowing write access
> on that page?
I'm not seeing the pte_access_permitted() in handle_pte_fault(). I
assume that's something you added in this series.
But, one of the ways that we keep pkeys from causing these kinds of
repeating loops when interacting with other things is this hunk in the
page fault code:
> static inline int
> access_error(unsigned long error_code, struct vm_area_struct *vma)
> {
...
> /*
> * Read or write was blocked by protection keys. This is
> * always an unconditional error and can never result in
> * a follow-up action to resolve the fault, like a COW.
> */
> if (error_code & PF_PK)
> return 1;
That short-circuits the page fault pretty quickly. So, basically, the
rule is: if the hardware says you tripped over pkey permissions, you
die. We don't try to do anything to the underlying page *before* saying
that you die.
Powered by blists - more mailing lists