On Wed, Jul 26, 2017 at 03:33:42PM +1000, Paul Mackerras wrote: > commit 4c3bb4ccd074e1a0552078c0bf94c662367a1658 upstream. > > This restores several special-purpose registers (SPRs) to sane values > on guest exit that were missed before. > > TAR and VRSAVE are readable and writable by userspace, and we need to > save and restore them to prevent the guest from potentially affecting > userspace execution (not that TAR or VRSAVE are used by any known > program that run uses the KVM_RUN ioctl). We save/restore these > in kvmppc_vcpu_run_hv() rather than on every guest entry/exit. > > FSCR affects userspace execution in that it can prohibit access to > certain facilities by userspace. We save/restore it like we do > for TAR and VRSAVE. > > PSPB is normally 0. We restore it to 0 on guest exit to prevent > userspace taking advantage of the guest having set it non-zero > (which would allow userspace to set its SMT priority to high). > > UAMOR is normally 0. We restore it to 0 on guest exit to prevent > the AMR from being used as a covert channel between userspace > processes, since the AMR is not context-switched at present. > > [paulus@xxxxxxxxxx - removed IAMR bits that are only needed on POWER9; > adjusted FSCR save/restore for lack of fscr field in thread_struct.] > > Fixes: b005255e12a3 ("KVM: PPC: Book3S HV: Context-switch new POWER8 SPRs", 2014-01-08) > Cc: stable@xxxxxxxxxxxxxxx # v3.14+ > Signed-off-by: Paul Mackerras <paulus@xxxxxxxxxx> > --- > arch/powerpc/kvm/book3s_hv.c | 13 +++++++++++-- > arch/powerpc/kvm/book3s_hv_rmhandlers.S | 2 ++ > 2 files changed, 13 insertions(+), 2 deletions(-) Now applied, thanks. greg k-h