On 10/03/2018 00:06, Christopherson, Sean J wrote: > All that being said, I only encountered this bug due to the vcms02 sync > bug (https://patchwork.kernel.org/patch/10259389/), e.g. L0 incorrectly > thought L1 was attempting to run L2 with invalid guest state in vmcs12. > Thinking about it more, L0 can only reach handle_invalid_guest_state() > in the context of L2 if L0 has a bug, or if L1 attempts to run L2 with > invalid state, e.g. L1 knowingly ignores the fact that unrestricted guest > is disabled or has a bug of its own. > > So, I think the correct fix would be to return 1 from prepare_vmcs02 > if emulation_required is true, i.e. signal VMEntry failed due to > EXIT_REASON_INVALID_STATE, and add a BUG either in vmx_vcpu_run() or > handle_invalid_guest_state() that fires if we're emulating L2, i.e. > BUG_ON(vmx->emulation_required && vmx->nested.nested_run_pending); I agree (though it should be a WARN_ON_ONCE, not a BUG_ON). Paolo