[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] RFC: PVH set vcpu info context in vmcs....
On Wed, 14 Aug 2013 10:12:18 +0100 "Jan Beulich" <JBeulich@xxxxxxxx> wrote: > >>> On 14.08.13 at 04:12, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> > >>> wrote: > > On Tue, 13 Aug 2013 11:56:36 +0100 > > "Jan Beulich" <JBeulich@xxxxxxxx> wrote: > > ... > >> > if ( v->vcpu_id == 0 ) > >> > return 0; > >> > >> Bogus/pointless. > > > > No, we don't have anything for the boot vcpu. It's totally coming up > > on the flat address space. For non boot, the vcpu is coming up on > > the kernel GDT. Recall it's a PV guest (coming up in an HVM > > container). > > No, that's the wrong perspective. You either should never get here > for vCPU 0, or you should refuse this for all already initialized > vCPU-s. Ok, i'll move the check to caller. FWIW, the vcpu->is_initialised is inapplicable here because this is relevant for non-boot vcpus only. >> >> if ( ctxtp->user_regs.cs == 0 || (ctxtp->user_regs.cs & 3) == 3 ) >> return -EINVAL; >Perhaps better check for any non-zero RPL, as the RPL needs >to match of the (enforced) CS hidden fields? Well, we now load the descriptor provided by the guest in the GDT so that's kinda un needed now.. thats why i thought we don't need to enforce RPL or check VGCF_in_kernel. But, that would work too... thanks, mukesh Final(hopefully) version: /* * Set vmcs fields in support of vcpu_op -> VCPUOP_initialise hcall used * to initialise a secondary vcpu prior to boot. (boot vcpu 0 context is * set by the tools via do_domctl -> vcpu_initialise). Called from * arch_set_info_guest() which sets the (PVH relevant) non-vmcs fields. * * In case of linux: * The call comes from cpu_initialize_context(). * * PVH 32bitfixme: this function needs to be modified for 32bit guest. */ int vmx_pvh_set_vcpu_info(struct vcpu *v, struct vcpu_guest_context *ctxtp) { int rc; if ( !(ctxtp->flags & VGCF_in_kernel) ) return -EINVAL; if ( ctxtp->ldt_base || ctxtp->ldt_ents || ctxtp->user_regs.ss || ctxtp->user_regs.es || ctxtp->user_regs.ds || ctxtp->user_regs.fs || ctxtp->user_regs.gs ) return -EINVAL; if ( ctxtp->user_regs.cs == 0 || (ctxtp->user_regs.cs & 7) ) return -EINVAL; vmx_vmcs_enter(v); __vmwrite(GUEST_GDTR_BASE, ctxtp->gdt.pvh.addr); __vmwrite(GUEST_GDTR_LIMIT, ctxtp->gdt.pvh.limit); /* IA-32e: ss/es/ds are ignored. */ if ( (rc = hvm_load_segment_selector(v, x86_seg_cs, ctxtp->user_regs.cs)) ) goto out; __vmwrite(GUEST_FS_BASE, ctxtp->fs_base); __vmwrite(GUEST_GS_BASE, ctxtp->gs_base_kernel); if ( (rc = vmx_add_guest_msr(MSR_SHADOW_GS_BASE)) ) goto out; vmx_write_guest_msr(MSR_SHADOW_GS_BASE, ctxtp->gs_base_user); out: vmx_vmcs_exit(v); return rc; } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |