Re: [PATCH 12/30] x86, kaiser: map GDT into user page tables

From: Dave Hansen
Date: Tue Nov 21 2017 - 19:37:14 EST


On 11/21/2017 04:17 PM, Andy Lutomirski wrote:
> On Tue, Nov 21, 2017 at 3:42 PM, Dave Hansen
> unsigned long start = (unsigned long)get_cpu_entry_area(cpu);
> for (unsigned long addr = start; addr < start + sizeof(struct
> cpu_entry_area); addr += PAGE_SIZE) {
> pte_t pte = *pte_offset_k(addr); /* or however you do this */
> kaiser_add_mapping(pte_pfn(pte), pte_prot(pte));
> }
>
> modulo the huge pile of typos in there that surely exist.

That would work. I just need to find a suitable pte_offset_k() in the
kernel and make sure it works for these purposes. We probably have one.

> But I still prefer my approach of just sharing the cpu_entry_area pmd
> entries between the user and kernel tables.

That would be spiffy.