[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXv3VxEdr1UOjWW9GTFTd_BoUCpThxOxz7a4-YC+d_i=Q@mail.gmail.com>
Date: Tue, 21 Nov 2017 19:44:39 -0800
From: Andy Lutomirski <luto@...nel.org>
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
moritz.lipp@...k.tugraz.at,
Daniel Gruss <daniel.gruss@...k.tugraz.at>,
michael.schwarz@...k.tugraz.at, richard.fellner@...dent.tugraz.at,
Andrew Lutomirski <luto@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Kees Cook <keescook@...gle.com>,
Hugh Dickins <hughd@...gle.com>, X86 ML <x86@...nel.org>
Subject: Re: [PATCH 09/30] x86, kaiser: only populate shadow page tables for userspace
On Tue, Nov 21, 2017 at 2:09 PM, Dave Hansen
<dave.hansen@...ux.intel.com> wrote:
> On 11/20/2017 12:12 PM, Thomas Gleixner wrote:
>>> + */
>>> + native_get_shadow_pgd(pgdp)->pgd = pgd.pgd;
>>> + /*
>>> + * For the copy of the pgd that the kernel
>>> + * uses, make it unusable to userspace. This
>>> + * ensures if we get out to userspace with the
>>> + * wrong CR3 value, userspace will crash
>>> + * instead of running.
>>> + */
>>> + pgd.pgd |= _PAGE_NX;
>>> + }
>>> + } else if (!pgd.pgd) {
>>> + /*
>>> + * We are clearing the PGD and can not check _PAGE_USER
>>> + * in the zero'd PGD.
>>
>> Just the argument cannot be checked because it's clearing the entry. The
>> pgd entry itself is not yet modified, so it could be checked.
>
> So, I guess we could enforce that only PGDs with _PAGE_USER set can ever
> be cleared. That has a nice symmetry to it because we set the shadow
> when we see _PAGE_USER and we would then clear the shadow when we see
> _PAGE_USER.
Is this code path ever hit in any case other than tearing down an LDT?
I'm tempted to suggest that KAISER just disable the MODIFY_LDT config
option for now...
Powered by blists - more mailing lists