Skip to content

Two AMD SVM vulnerability tests

Martin Doucha ltp 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 9 repliesIn review
  2. v17 patches 19 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7KVM: Add VMSAVE/VMLOAD intercept constantstestcases/kernel/kvm/include/kvm_x86_svm.h+5 -00 replies
2/7Add test for CVE 2021-3656runtest/kvm testcases/kernel/kvm/.gitignore testcases/kernel/kvm/kvm_svm02.c+154 -04 replies
3/7lib: Add safe functions for pthread_kill() and mutexesinclude/tst_safe_pthread.h lib/safe_pthread.c+213 -00 replies
4/7KVM: Add async communication helper functionstestcases/kernel/kvm/Makefile testcases/kernel/kvm/include/kvm_common.h testcases/kernel/kvm/include/kvm_guest.h +3 more+86 -03 replies
5/7KVM: Allow expected KVM_RUN errors in tst_kvm_run_instance()doc/kvm-test-api.txt testcases/kernel/kvm/include/kvm_host.h testcases/kernel/kvm/lib_host.c+29 -80 replies
6/7KVM: Add STGI/CLGI intercept constantstestcases/kernel/kvm/include/kvm_x86_svm.h+4 -01 reply
7/7Add KVM test for CPU lockup through malicous SVM guestruntest/kvm testcases/kernel/kvm/.gitignore testcases/kernel/kvm/Makefile +1 more+174 -00 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchPetr VorelCyril Hrubis
1/7A-b
2/7A-b
3/7R-b R-b
4/7R-b
5/7R-b R-b
6/7A-b
7/7A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [LTP] [PATCH v2 0/7] Two AMD SVM vulnerability tests

Here are two more kernel vulnerability tests for AMD SVM:

kvm_svm02 checks that the host kernel intercepts VMLOAD and VMSAVE instructions in nested VMs and translates guest addresses to the correct physical address. Without the translation, nested SVM guest can read and write part of an arbitrary physical memory page chosen by the parent VM.

The test tries to detect the CVE bug harmlessly at first by using VMLOAD to read a buffer full of zeroes. If it finds any non-zero bytes in the VMCB fields accessed by VMLOAD/VMSAVE, it'll fail because they must have come from host memory due to missing address translation.

Since the harmless approach can produce false negatives, it'll also try a destructive approach and write into memory using VMSAVE. If the bug is present, the byte pattern in the destination buffer will not change and the test will reliably fail.

kvm_svm03 checks that the host kernel correctly handles global interrupt flag in nested VMs. Otherwise a malicious VM could lock up all CPUs assigned to it, causing a limited denial of service attack.

The test needs synchronization between the VM and another host thread so the patchset includes the necessary helper functions.

Martin Doucha (7):
KVM: Add VMSAVE/VMLOAD intercept constants
Add test for CVE 2021-3656
lib: Add safe functions for pthread_kill() and mutexes
KVM: Add async communication helper functions
KVM: Allow expected KVM_RUN errors in tst_kvm_run_instance()
KVM: Add STGI/CLGI intercept constants
Add KVM test for CPU lockup through malicous SVM guest

 doc/kvm-test-api.txt                       |   9 +-
 include/tst_safe_pthread.h                 |  52 +++++++
 lib/safe_pthread.c                         | 161 ++++++++++++++++++++
 runtest/kvm                                |   2 +
 testcases/kernel/kvm/.gitignore            |   2 +
 testcases/kernel/kvm/Makefile              |   4 +
 testcases/kernel/kvm/include/kvm_common.h  |   8 +
 testcases/kernel/kvm/include/kvm_guest.h   |  14 ++
 testcases/kernel/kvm/include/kvm_host.h    |  20 ++-
 testcases/kernel/kvm/include/kvm_x86_svm.h |   9 ++
 testcases/kernel/kvm/kvm_svm02.c           | 152 ++++++++++++++++++
 testcases/kernel/kvm/kvm_svm03.c           | 169 +++++++++++++++++++++
 testcases/kernel/kvm/lib_guest.c           |  16 ++
 testcases/kernel/kvm/lib_host.c            |  55 ++++++-
 14 files changed, 665 insertions(+), 8 deletions(-)
 create mode 100644 testcases/kernel/kvm/kvm_svm02.c
 create mode 100644 testcases/kernel/kvm/kvm_svm03.c
Signature · 5 lines
2.40.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp