diff options
author | Nadav Amit <namit@vmware.com> | 2020-06-30 02:45:16 -0700 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-07-01 08:10:30 -0400 |
commit | 2c1ca866799879072d95122759fc81fb34ba6306 (patch) | |
tree | f3bee01366ba5c4ee4b81c29466a0fa7b9e9ed62 | |
parent | c6405e37295930dbb545be178d18a46adcae629f (diff) | |
download | kvm-unit-tests-2c1ca866799879072d95122759fc81fb34ba6306.tar.gz |
x86: svm: avoid advancing rip incorrectly on exc_inject
exc_inject advances the ripon every stage, so it can do so 3 times, but
there are only 2 vmmcall instructions that the guest runs. So, if a
failure happens on the last test, there is no vmmcall instruction to
trigger an exit.
Advance the rip only in the two stages in which vmmcall is expected to
run.
Signed-off-by: Nadav Amit <namit@vmware.com>
Message-Id: <20200630094516.22983-6-namit@vmware.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | x86/svm_tests.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/x86/svm_tests.c b/x86/svm_tests.c index b540527..48f2d8e 100644 --- a/x86/svm_tests.c +++ b/x86/svm_tests.c @@ -1593,8 +1593,6 @@ static void exc_inject_test(struct svm_test *test) static bool exc_inject_finished(struct svm_test *test) { - vmcb->save.rip += 3; - switch (get_test_stage(test)) { case 0: if (vmcb->control.exit_code != SVM_EXIT_VMMCALL) { @@ -1602,6 +1600,7 @@ static bool exc_inject_finished(struct svm_test *test) vmcb->control.exit_code); return true; } + vmcb->save.rip += 3; vmcb->control.event_inj = NMI_VECTOR | SVM_EVTINJ_TYPE_EXEPT | SVM_EVTINJ_VALID; break; @@ -1621,6 +1620,7 @@ static bool exc_inject_finished(struct svm_test *test) vmcb->control.exit_code); return true; } + vmcb->save.rip += 3; report(count_exc == 1, "divide overflow exception injected"); report(!(vmcb->control.event_inj & SVM_EVTINJ_VALID), "eventinj.VALID cleared"); break; |