Skip to contentSkip to conversation

nested VMX issues/questions

DISCUSSION Jan Beulich 2 participants 3 messages Oct 14, 2014 – Oct 16, 2014

lore
Share & tools
lore
#0 lore raw

Hi,

first I noticed that nvmx_vcpu_initialise() doesn't set the two MSR bitmap related flags, but nvmx_handle_vmwrite() apparently expects them to be set. Is that correct (and if so, why)?

Furthermore I question whether the handling of partial writes (for 32-bit L1 guests) in nvmx_handle_vmwrite() is really correct: After only one half of the register got written, the _map_{io,msr}_bitmap() functions are not impossible to fail, causing the guest VMWRITE to get failed with VMFAIL_VALID (which, if coded like Xen, would cause such a guest to crash).

Jan

#1 lore raw

Jan Beulich wrote on 2014-10-14:

Quoted 5 lines

Hi,

first I noticed that nvmx_vcpu_initialise() doesn't set the two MSR bitmap related flags, but nvmx_handle_vmwrite() apparently expects them to be set. Is that correct (and if so, why)?

What flags do you mean?

Quoted 7 lines

Furthermore I question whether the handling of partial writes (for 32-bit L1
guests) in nvmx_handle_vmwrite() is really correct: After only one half of the register got written, the _map_{io,msr}_bitmap() functions are not impossible to fail, causing the guest VMWRITE to get failed with VMFAIL_VALID (which, if coded like Xen, would cause such a guest to crash).

yes, the right place to do the check should in virtual vmentry not vmwrite.

Quoted 2 lines

Jan

Best regards,
Yang

#2 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 16.10.14 at 08:13, <[email protected]> wrote:

Jan Beulich wrote on 2014-10-14:

Quoted 2 lines

first I noticed that nvmx_vcpu_initialise() doesn't set the two MSR bitmap related flags, but nvmx_handle_vmwrite() apparently expects them to

be set.

Quoted 1 line

Is that correct (and if so, why)?

What flags do you mean?

Contrast this

        /*
         * For the following 4 encodings, we need to handle them in VMM.
         * Let them vmexit as usual.
         */
        set_bit(IO_BITMAP_A, vw);
        set_bit(IO_BITMAP_A_HIGH, vw);
        set_bit(IO_BITMAP_B, vw);
        set_bit(IO_BITMAP_B_HIGH, vw);

(in nvmx_vcpu_initialise()) with this

    switch ( vmcs_encoding )
    {
    case IO_BITMAP_A: case IO_BITMAP_A_HIGH:
        okay = _map_io_bitmap(v, IO_BITMAP_A);
        break;
    case IO_BITMAP_B: case IO_BITMAP_B_HIGH:
        okay = _map_io_bitmap(v, IO_BITMAP_B);
        break;
    case MSR_BITMAP: case MSR_BITMAP_HIGH:
        okay = _map_msr_bitmap(v);
        break;
    }

(in nvmx_handle_vmwrite()).

Jan