Skip to contentSkip to conversation

Memory isolation on processes running in isolcpus. Linus, please read.

MODERATED Konrad Rzeszutek Wilk 4 participants 4 messages Aug 20, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

All, I am thinking to bring this up on linux-mm and kvm-devel mailing list but before I go that route I wanted to make sure we are all on the same page(s).

1). Linus, you are cool with the idea of having further kernel page isolation which
Julian captured rather nicely:
“Specifically, while being in the context of process A, memory of process B should not be visible in the kernel. “

And how it is done, well, that may take a while.

Asking this as this feature only impacts cloud vendors and we are not
forefront on your mind, and if you think "Heck no!" then we can save a lot of time on by not focusing on something you are not OK with.

2). And folks are OK if this conversation starts on linux-mm/kvm-devel with
conversation _without_ mentioning the in-depth worry we have about Spectre_v1 + L1TF mix?

In terms of "how "to make this work could we piggyback on the fact that not all memory needs an ‘struct page’ and expand on that?

That is could we remove most (run-time) of the ‘struct page’ in use in the kernel, similar to how NV-DIMM was done where there was no ‘struct page’ for MMIO regions? If so, could we piggyback on that and declare swaths of memory as this until an process is created and then use it? Like on-demand 'struct page' creation.

Then whenever an process is created/scheduled on a CPU we have per-cpu kernel page-tables that only cover the __START_KERNEL to __end, _and_ any memory for the process that is running on it currently?

Obviously if a process switches off the CPU we need to tear this structure and recreate it on another CPU - which is why this all would only be used on processes that are in the isolcpus part?

#1 lore raw
Quoted 4 lines · speck for Konrad Rzeszutek Wilk

1). Linus, you are cool with the idea of having further kernel page isolation which
Julian captured rather nicely:
“Specifically, while being in the context of process A, memory of process B should not be visible in the kernel. “

That actually sounds less effective and probably more work to do than XPFO (https://lwn.net/Articles/700647/). (Not that I'm endorsing XPFO... the patches were still quite a mess last I looked)

It's less effective because it still allows things like "heap spraying" where you let an app who has access to a lot of memory fill up a lot of the kernel address space with juicy, attacker-supplied data.

It's more complicated because you have lots of versions of the kernel address space to manage instead of one. I bet it's also loads of fun to precisely enforce the "memory of process B".

#2 lore raw
Quoted 9 lines · speck for Dave Hansen
Quoted 4 lines · speck for Konrad Rzeszutek Wilk

1). Linus, you are cool with the idea of having further kernel page isolation which Julian captured rather nicely:
“Specifically, while being in the context of process A, memory of process B should not be visible in the kernel. “

That actually sounds less effective and probably more work to do than XPFO (https://lwn.net/Articles/700647/).  (Not that I'm endorsing XPFO... the patches were still quite a mess last I looked)

I don't see the distinction. I think we're basically talking about a version of XPFO — taking pages out of the physmap when they belong to userspace (and other sensitive pages in-kernel that are only reasonably accessed in the context of one process, for example a VMCS and register save areas for a given vCPU).

I wasn't aware of XPFO... I'll go investigate. Thanks for the pointer.

#3 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 8 lines · speck for Konrad Rzeszutek Wilk

All, I am thinking to bring this up on linux-mm and kvm-devel mailing list but before I go that route I wanted to make sure we are all on the same page(s).

1). Linus, you are cool with the idea of having further kernel page isolation which
Julian captured rather nicely:
“Specifically, while being in the context of process A, memory of process B should not be visible in the kernel. “

I'm not cool with even discussing this on the super-sekrit list.

I don't see the point of keeping this secret, and we had much too many issues *because* L1TF was secret.

So I'm done with this list, until we have some actual new embargo patches.

I'm also not sure the above makes sense. The kernel mapping is always available. I do not see how you are going to do it, but if there are patches to discuss it, they shouldn't be discussed on the speck list.

Linus