Re: [RFC v2 00/27] Kernel Address Space Isolation

From: Thomas Gleixner
Date: Fri Jul 12 2019 - 11:23:57 EST


On Fri, 12 Jul 2019, Alexandre Chartre wrote:
> On 7/12/19 3:51 PM, Dave Hansen wrote:
> > BTW, the PTI CR3 writes are not *strictly* about the interrupt coming
> > from user vs. kernel. It's tricky because there's a window both in the
> > entry and exit code where you are in the kernel but have a userspace CR3
> > value. You end up needing a CR3 write when you have a userspace CR3
> > value when the interrupt occurred, not only when you interrupt userspace
> > itself.
> >
>
> Right. ASI is simpler because it comes from the kernel and return to the
> kernel. There's just a small window (on entry) where we have the ASI CR3
> but we quickly switch to the full kernel CR3.

That's wrong in several aspects.

1) You are looking at it purely from the VMM perspective, which is bogus
as you already said, that this can/should be used to be extended to
other scenarios (including kvm ioctl or such).

So no, it's not just coming from kernel space and returning to it.

If that'd be true then the entry code could just stay as is because
you can handle _ALL_ of that very trivial in the atomic VMM
enter/exit code.

2) It does not matter how small that window is. If there is a window
then this needs to be covered, no matter what.

Thanks,

tglx