Date: Wed, 5 May 2021 19:46:12 +0000 From: "Edgecombe, Rick P" <rick.p.edgecombe@...el.com> To: "peterz@...radead.org" <peterz@...radead.org>, "vbabka@...e.cz" <vbabka@...e.cz> CC: "kernel-hardening@...ts.openwall.com" <kernel-hardening@...ts.openwall.com>, "Hansen, Dave" <dave.hansen@...el.com>, "luto@...nel.org" <luto@...nel.org>, "x86@...nel.org" <x86@...nel.org>, "linux-mm@...ck.org" <linux-mm@...ck.org>, "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "rppt@...nel.org" <rppt@...nel.org>, "linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>, "Weiny, Ira" <ira.weiny@...el.com>, "Williams, Dan J" <dan.j.williams@...el.com> Subject: Re: [PATCH RFC 0/9] PKS write protected page tables On Wed, 2021-05-05 at 13:56 +0200, Peter Zijlstra wrote: > On Wed, May 05, 2021 at 01:08:35PM +0200, Vlastimil Babka wrote: > > On 5/5/21 2:30 AM, Rick Edgecombe wrote: > > > > Why use PKS for this? > > > ===================== > > > PKS is an upcoming CPU feature that allows supervisor virtual > > > memory > > > permissions to be changed without flushing the TLB, like PKU does > > > for user > > > memory. Protecting page tables would normally be really expensive > > > because you > > > would have to do it with paging itself. PKS helps by providing a > > > way to toggle > > > the writability of the page tables with just a per-cpu MSR. > > > > I can see in patch 8/9 that you are flipping the MSR around > > individual > > operations on page table entries. In my patch I hooked making the > > page table > > writable to obtaining the page table lock (IIRC I had only the PTE > > level fully > > handled though). Wonder if that would be better tradeoff even for > > your MSR approach? > Hmm, I see, that could reduce the sprinkling of the enable/disable calls. It seems some(most?) of the kernel address space page table modification don't take the page table locks though so those callers would have to call something else to be able to write. > There's also the HIGHPTE code we could abuse to kmap an alias while > we're at it. For a non-PKS debug feature? It might fit pretty easily into CONFIG_DEBUG_PAGEALLOC on top of this series. enable/disable_pgtable_write() could take a pointer that is ignored in PKS mode, but triggers a cpa call in a CONFIG_DEBUG_PAGETABLE_WRITE mode.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.