On 12/05/20 19:17, Babu Moger wrote: > > On 5/12/20 11:39 AM, Jim Mattson wrote: >> On Mon, May 11, 2020 at 4:33 PM Babu Moger <babu.moger@xxxxxxx> wrote: >>> MPK feature is supported by both VMX and SVM. So we can >>> safely move pkru state save/restore to common code. Also >>> move all the pkru data structure to kvm_vcpu_arch. >>> >>> Also fixes the problem Jim Mattson pointed and suggested below. >>> >>> "Though rdpkru and wrpkru are contingent upon CR4.PKE, the PKRU >>> resource isn't. It can be read with XSAVE and written with XRSTOR. >>> So, if we don't set the guest PKRU value here(kvm_load_guest_xsave_state), >>> the guest can read the host value. >>> >>> In case of kvm_load_host_xsave_state, guest with CR4.PKE clear could >>> potentially use XRSTOR to change the host PKRU value" >>> >>> Signed-off-by: Babu Moger <babu.moger@xxxxxxx> >> I would do the bugfix as a separate commit, to ease backporting it to >> the stable branches. > Ok. Sure. I will take care of this for v4 (pick this patch up and put it in 5.7-rc, package everything as a topic branch, merge it to kvm/next). Paolo