On 13/02/19 17:40, Singh, Brijesh wrote: > > KVM is not getting a SMAP page fault. The HW gets a SMAP fault when > trying to fetch the instruction bytes How does the hardware get a SMAP fault when trying to fetch instructions? SMAP faults are only generated for data accesses, not instructions. Now I'm even more confused. :) Paolo , and that fault is ignored (and > instead the ucode just doesn't save any instruction bytes). The fault > code to KVM is the RSVD. While handling the RSVD fault, KVM may come to > the code path which requires instruction emulation. At this time we will > check to see if SMAP was enabled and insn_len is zero. If so, we are > hitting this errata. If we skip the emulation and restart the guest > then in this particular case we will get the *same* fault again and > enter into infinite loop. In case of non SEV, we can workaround it by > letting the KVM read the instruction bytes from the guest RIP. But > in case of SEV we will have no choice other than requesting to restart > and thus causing guest an infinite loop. In SEV, my attempt was to > detect this errata and log it and request the SHUTDOWN of the > guest so that we continue further (in v1 I am doing #GP instead > of the SHUTDOWN request, based on Jim's comment I am switching to use > kvm_make_request(...)).