Skip to content

Commit f88af72

Browse files
Stefano Stabellinibostrovs
authored andcommitted
xen/arm: do not setup the runstate info page if kpti is enabled
The VCPUOP_register_runstate_memory_area hypercall takes a virtual address of a buffer as a parameter. The semantics of the hypercall are such that the virtual address should always be valid. When KPTI is enabled and we are running userspace code, the virtual address is not valid, thus, Linux is violating the semantics of VCPUOP_register_runstate_memory_area. Do not call VCPUOP_register_runstate_memory_area when KPTI is enabled. Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> CC: Bertrand Marquis <Bertrand.Marquis@arm.com> CC: boris.ostrovsky@oracle.com CC: jgross@suse.com Link: https://lore.kernel.org/r/20200924234955.15455-1-sstabellini@kernel.org Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
1 parent bba91dd commit f88af72

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

arch/arm/include/asm/xen/page.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
#include <xen/arm/page.h>
2+
3+
static inline bool xen_kernel_unmapped_at_usr(void)
4+
{
5+
return false;
6+
}

arch/arm/xen/enlighten.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ static int xen_starting_cpu(unsigned int cpu)
158158
BUG_ON(err);
159159
per_cpu(xen_vcpu, cpu) = vcpup;
160160

161-
xen_setup_runstate_info(cpu);
161+
if (!xen_kernel_unmapped_at_usr())
162+
xen_setup_runstate_info(cpu);
162163

163164
after_register_vcpu_info:
164165
enable_percpu_irq(xen_events_irq, 0);
@@ -387,7 +388,8 @@ static int __init xen_guest_init(void)
387388
return -EINVAL;
388389
}
389390

390-
xen_time_setup_guest();
391+
if (!xen_kernel_unmapped_at_usr())
392+
xen_time_setup_guest();
391393

392394
if (xen_initial_domain())
393395
pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);

arch/arm64/include/asm/xen/page.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
#include <xen/arm/page.h>
2+
#include <asm/mmu.h>
3+
4+
static inline bool xen_kernel_unmapped_at_usr(void)
5+
{
6+
return arm64_kernel_unmapped_at_el0();
7+
}

0 commit comments

Comments
 (0)