On Mon, May 09, 2016 at 05:30:44PM +0200, Ralf Baechle wrote: > On Mon, May 09, 2016 at 04:22:33PM +0200, Paolo Bonzini wrote: > > > On 06/05/2016 15:36, James Hogan wrote: > > > - It is actually redundant, since the host ASID will be restored > > > correctly by kvm_arch_vcpu_put(), which is called almost immediately > > > after kvm_arch_vcpu_ioctl_run() returns. > > > > What happens if the guest does a rogue access to the area where the host > > kernel resides? Would that cause a wrong entry in the TLB? > > The kernel and lowmem reside in KSEG0/XKPYS which are "unmapped segments". > Unmapped means, the TLB isn't accessed at all nor does the ASID matter > in the address translation process in one of these unmapped segments. Yes, although kernel modules (KVM can be built as module) do run from tlb mapped memory, but trap & emulate KVM as found in mainline should work as accessing kernel segments from user mode (which is where guest runs) causes address error exception, triggering emulation of MMIO accesses rather than TLB fills. Hmm, perhaps locore.S should be restoring correct root ASID properly however before returning to the caller or calling the exit handler, either of which could be tlb mapped module code. Cheers James
Attachment:
signature.asc
Description: Digital signature