[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1f0fd9f4-295f-6b44-47ff-b6b56892e680@intel.com>
Date: Thu, 2 Jun 2022 09:47:33 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc: Mel Gorman <mgorman@...hsingularity.net>,
Tom Lendacky <thomas.lendacky@....com>,
Rick Edgecombe <rick.p.edgecombe@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Tianyu Lan <Tianyu.Lan@...rosoft.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org, vbabka@...e.cz,
akpm@...ux-foundation.org, willy@...radead.org
Subject: Re: Is _PAGE_PROTNONE set only for user mappings?
On 5/29/22 03:32, Hyeonggon Yoo wrote:
> On Mon, May 16, 2022 at 07:04:32AM -0700, Dave Hansen wrote:
> Writing code I'm a bit confused:
> commit d1440b23c922d8 ("x86/mm: Factor out pageattr
> _PAGE_GLOBAL setting") says:
>
> "This unconditional setting of _PAGE_GLOBAL is a problem when we have
> PTI and non-PTI and we want some areas to have _PAGE_GLOBAL and some
> not."
>
> Is this this sentence not valid anymore in PTI,
> and just unconditionally setting _PAGE_GLOBAL would be okay in kernel
> side regardless of PTI?
I believe it's still valid.
IIRC, there are three cases:
1. No KPTI. All kernel mappings are _PAGE_GLOBAL. Basically, for
present mappings, if _PAGE_USER is clear, _PAGE_GLOBAL is set.
2. KPTI with PCID hardware support (or in a few other cases): The kernel
image is mostly non-global. Anything mapped into userspace *is*
marked global, like entry text.
3. KPTI without PCIDs: Basically case #2, but with more of the kernel
image left global.
So, not only are there different KPTI modes, there a different pars of
the kernel that require different _PAGE_GLOBAL behavior.
pti_kernel_image_global_ok() in arch/x86/mm/pti.c explains it pretty well.
Powered by blists - more mailing lists