[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] RFC: PVH set vcpu info context in vmcs....
>>> On 13.08.13 at 03:45, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> wrote: > int vmx_pvh_set_vcpu_info(struct vcpu *v, struct vcpu_guest_context *ctxtp) > { > int rc; > > if ( v->vcpu_id == 0 ) > return 0; Bogus/pointless. > if ( !(ctxtp->flags & VGCF_in_kernel) ) > return -EINVAL; > > if ( ctxtp->ldt_base || ctxtp->ldt_ents || > (ctxtp->user_regs.cs & 4) || ctxtp->user_regs.ss || > ctxtp->user_regs.es || ctxtp->user_regs.ds ) > return -EINVAL; How about FS/GS? If you don't enforce these selectors to be zero too, then loading only base and selector values below isn't sufficient (and again potentially inconsistent). > > if ( ctxtp->user_regs.cs == 0 ) > return -EINVAL; Perhaps also check RPL == 0? > vmx_vmcs_enter(v); > __vmwrite(GUEST_GDTR_BASE, ctxtp->gdt.pvh.addr); > __vmwrite(GUEST_GDTR_LIMIT, ctxtp->gdt.pvh.limit); > > __vmwrite(GUEST_FS_BASE, ctxtp->fs_base); > __vmwrite(GUEST_GS_BASE, ctxtp->gs_base_kernel); > > /* IA-32e: ss/es/ds are ignored, we load cs only. */ > __vmwrite(GUEST_CS_SELECTOR, ctxtp->user_regs.cs); > if ( (rc = hvm_load_segment_selector(x86_seg_cs, ctxtp->user_regs.cs)) ) > return rc; You can't use that function here without modification, as it assumes v == current. Jan > > __vmwrite(GUEST_FS_SELECTOR, ctxtp->user_regs.fs); > __vmwrite(GUEST_GS_SELECTOR, ctxtp->user_regs.gs); > > if ( (rc = vmx_add_guest_msr(MSR_SHADOW_GS_BASE)) ) > { > vmx_vmcs_exit(v); > return rc; > } > vmx_write_guest_msr(MSR_SHADOW_GS_BASE, ctxtp->gs_base_user); > > vmx_vmcs_exit(v); > return 0; > } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |