kernel_optimize_test/arch/s390/kvm
Christian Borntraeger a5efb6b6c9 KVM: s390: reject invalid modes for runtime instrumentation
Usually a validity intercept is a programming error of the host
because of invalid entries in the state description.
We can get a validity intercept if the mode of the runtime
instrumentation control block is wrong. As the host does not know
which modes are valid, this can be used by userspace to trigger
a WARN.
Instead of printing a WARN let's return an error to userspace as
this can only happen if userspace provides a malformed initial
value (e.g. on migration). The kernel should never warn on bogus
input. Instead let's log it into the s390 debug feature.

While at it, let's return -EINVAL for all validity intercepts as
this will trigger an error in QEMU like

error: kvm run failed Invalid argument
PSW=mask 0404c00180000000 addr 000000000063c226 cc 00
R00=000000000000004f R01=0000000000000004 R02=0000000000760005 R03=000000007fe0a000
R04=000000000064ba2a R05=000000049db73dd0 R06=000000000082c4b0 R07=0000000000000041
R08=0000000000000002 R09=000003e0804042a8 R10=0000000496152c42 R11=000000007fe0afb0
[...]

This will avoid an endless loop of validity intercepts.

Cc: stable@vger.kernel.org # v4.5+
Fixes: c6e5f16637 ("KVM: s390: implement the RI support of guest")
Acked-by: Fan Zhang <zhangfan@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2016-10-20 20:06:12 +02:00
..
diag.c KVM: s390: provide logging for diagnose 0x500 2016-06-10 12:07:26 +02:00
gaccess.c KVM: s390: gaccess: simplify translation exception handling 2016-09-08 09:07:53 +02:00
gaccess.h s390/mm: take ipte_lock during shadow faults 2016-06-20 09:54:40 +02:00
guestdbg.c KVM: s390: Use memdup_user() rather than duplicating code 2016-09-08 13:40:55 +02:00
intercept.c KVM: s390: reject invalid modes for runtime instrumentation 2016-10-20 20:06:12 +02:00
interrupt.c KVM: s390: allow 255 VCPUs when sca entries aren't used 2016-09-08 13:40:53 +02:00
irq.h
Kconfig KVM: halt_polling: provide a way to qualify wakeups during poll 2016-05-13 17:29:23 +02:00
kvm-s390.c KVM updates for v4.9-rc1 2016-10-06 10:49:01 -07:00
kvm-s390.h KVM: s390: allow 255 VCPUs when sca entries aren't used 2016-09-08 13:40:53 +02:00
Makefile KVM: s390: vsie: initial support for nested virtualization 2016-06-21 09:43:33 +02:00
priv.c KVM: s390: lazy enable RI 2016-09-08 13:40:39 +02:00
sigp.c KVM: s390: don't use CPUSTAT_WAIT to detect if a VCPU is idle 2016-06-21 09:43:45 +02:00
sthyi.c KVM: s390: Limit sthyi execution 2016-06-10 12:07:12 +02:00
trace-s390.h KVM: s390: obey kptr_restrict in traces 2015-12-15 17:06:32 +01:00
trace.h KVM: s390: trace and count all skey intercepts 2016-06-10 12:07:31 +02:00
vsie.c KVM: s390: vsie: fix riccbd 2016-09-05 13:48:50 +02:00