[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 5 May 2021 11:38:39 -0700
From: Kees Cook <keescook@...omium.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Rick Edgecombe <rick.p.edgecombe@...el.com>, dave.hansen@...el.com,
luto@...nel.org, linux-mm@...ck.org, x86@...nel.org,
akpm@...ux-foundation.org, linux-hardening@...r.kernel.org,
kernel-hardening@...ts.openwall.com, ira.weiny@...el.com,
rppt@...nel.org, dan.j.williams@...el.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 0/9] PKS write protected page tables
On Wed, May 05, 2021 at 10:37:29AM +0200, Peter Zijlstra wrote:
> On Tue, May 04, 2021 at 11:25:31PM -0700, Kees Cook wrote:
>
> > It looks like PKS-protected page tables would be much like the
> > RO-protected text pages in the sense that there is already code in
> > the kernel to do things to make it writable, change text, and set it
> > read-only again (alternatives, ftrace, etc).
>
> We don't actually modify text by changing the mapping at all. We modify
> through a writable (but not executable) temporary alias on the page (on
> x86).
>
> Once a mapping is RX it will *never* be writable again (until we tear it
> all down).
Yes, quite true. I was trying to answer the concern about "is it okay
that there is a routine in the kernel that can write to page tables
(via temporary disabling of PKS)?" by saying "yes, this is fine -- we
already have similar routines in the kernel that bypass memory
protections, and that's okay because the defense is primarily about
blocking flaws that allow attacker-controlled writes to be used to
leverage greater control over kernel state, of which the page tables are
pretty central. :)
--
Kees Cook
Powered by blists - more mailing lists