lkml.org 
[lkml]   [2017]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 09/30] x86, kaiser: only populate shadow page tables for userspace
From
Date
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.

\
 
 \ /
  Last update: 2017-11-21 23:10    [W:0.082 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site