KVM: s390: Fix for user-triggerable WARN_ON

A malicious user space can provide an invalid mode for runtime
 instrumentation via the interfaces that are normally used on
 the target host during migration. This would trigger a WARN_ON
 via validity intercept. Let's detect this special case.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJYCQniAAoJEBF7vIC1phx8Zy4QAKT7aZ9n3zPReHk9dLvhd0S8
 rzpQDhX+tQ0puGyHC3eQaV9FkpFm7t0nRpIrS6w5KsLq1IoaVxL3xz4e4bFJCG7J
 HOpmaWnAHKcsI0xq+cBmtZONrVpgCnMeSoz/bi24HvIZpZZDE3a1P7eFA6MW166q
 qRW7zGEiHVmh0/v//qRDTxexoTdTdJQEOJ2Xxtg5EguWmd41fkJFZclN3rqqfqMo
 vochsEPerhuKVEXjSvtRls6IVxk8mb540UuWPbZgp9j8xEV7C8q+HLNUQ5AI6EMF
 3+0lI5T/Opktr/b/afNb16OXhhWpGIui7rsN4qRmSac/DRKmZ64NxSsUpSijAXyu
 wWWpvPVp5VQLgM7ZBiKiuXc/4B4kE6T+qdkl1cvjuZUZQXbs9xbi0XVcsPBU5/O9
 fZ8JQcAVIDpevUw61DYgOQcpYiFajJpZHVHvwOgilztZA9ZUgws5ydaZgeAq3hSp
 X7NKhNKslM5tCvGS8bF+/tyBDvA5UpCJMk6pmc7CUEEuhbNrGeokho7uEopMh9G9
 lbSoAPWKbOouEHgBoPsdkMkw3Kj/bimGL49nApYqKlXkLxpFss7gqz02nmYKUcV3
 09+sa7fosI0TnNKQoVXE6EYcU86SD1DRXrfgTv7emo5GsqYaF5Fg/Q1dWhQ9X882
 cCEEWKxR1djLZIoeVTW/
 =+ie5
 -----END PGP SIGNATURE-----

Merge tag 'kvm-s390-master-4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux

KVM: s390: Fix for user-triggerable WARN_ON

A malicious user space can provide an invalid mode for runtime
instrumentation via the interfaces that are normally used on
the target host during migration. This would trigger a WARN_ON
via validity intercept. Let's detect this special case.
This commit is contained in:
Radim Krčmář 2016-10-20 20:31:01 +02:00
commit 3633031db5
1 changed files with 7 additions and 2 deletions

View File

@ -119,8 +119,13 @@ static int handle_validity(struct kvm_vcpu *vcpu)
vcpu->stat.exit_validity++;
trace_kvm_s390_intercept_validity(vcpu, viwhy);
WARN_ONCE(true, "kvm: unhandled validity intercept 0x%x\n", viwhy);
return -EOPNOTSUPP;
KVM_EVENT(3, "validity intercept 0x%x for pid %u (kvm 0x%pK)", viwhy,
current->pid, vcpu->kvm);
/* do not warn on invalid runtime instrumentation mode */
WARN_ONCE(viwhy != 0x44, "kvm: unhandled validity intercept 0x%x\n",
viwhy);
return -EINVAL;
}
static int handle_instruction(struct kvm_vcpu *vcpu)