Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3633031d authored by Radim Krčmář's avatar Radim Krčmář
Browse files
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.
parents f6bbf1b7 a5efb6b6
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -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)