[PATCH] powerpc/mm/radix: Only add X for pages overlapping kernel text
Michael Ellerman
mpe at ellerman.id.au
Tue Jun 6 20:17:02 AEST 2017
Balbir Singh <bsingharora at gmail.com> writes:
> On Tue, Jun 6, 2017 at 3:48 PM, Michael Ellerman <mpe at ellerman.id.au> wrote:
>> Currently we map the whole linear mapping with PAGE_KERNEL_X. Instead we
>> should check if the page overlaps the kernel text and only then add
>> PAGE_KERNEL_X.
...
>> @@ -145,8 +147,14 @@ static int __meminit create_physical_mapping(unsigned long start,
>> start = addr;
>> }
>>
>> - rc = radix__map_kernel_page((unsigned long)__va(addr), addr,
>> - PAGE_KERNEL_X, mapping_size);
>> + vaddr = (unsigned long)__va(addr);
>> +
>> + if (overlaps_kernel_text(vaddr, vaddr + mapping_size))
>> + prot = PAGE_KERNEL_X;
>> + else
>> + prot = PAGE_KERNEL;
>
> Do we need the kvm tmp/trampoline bits like hash?
Ugh, I hope not. What is that crap.
It appears to be epapr paravirt only:
static int __init kvm_guest_init(void)
{
if (!kvm_para_available())
goto free_tmp;
if (!epapr_paravirt_enabled)
goto free_tmp;
But I can't convince myself whether epapr_paravirt_enabled is ever set
on Book3S guests or not.
Looking at Qemu it looks like it *could* be.
And why isn't that code in arch/powerpc/kvm ?
cheers
More information about the Linuxppc-dev
mailing list