mbox series

[0/6] Some fixes and a test for KVM_CAP_ENFORCE_PV_CPUID

Message ID 20201027231044.655110-1-oupton@google.com (mailing list archive)
Headers show
Series Some fixes and a test for KVM_CAP_ENFORCE_PV_CPUID | expand

Message

Oliver Upton Oct. 27, 2020, 11:10 p.m. UTC
Patches 1-2 address some small issues with documentation and the kvm selftests,
unrelated to the overall intent of this series.

Patch 3 applies the same PV MSR filtering mechanism to guest reads of KVM
paravirt msrs.

Patch 4 makes enabling KVM_CAP_ENFORCE_PV_FEATURE_CPUID idempotent with regards
to when userspace sets the guest's CPUID, ensuring that the cached copy of
KVM_CPUID_FEATURES.EAX is always current.

Patch 5 fixes a regression introduced with KVM_CAP_ENFORCE_PV_CPUID, wherein
the kvm masterclock isn't updated every time the guest uses a different system
time msr than before.

Lastly, Patch 6 introduces a test for the overall paravirtual restriction
mechanism, verifying that guests GP when touching MSRs they shouldn't and
get -KVM_ENOSYS when using restricted kvm hypercalls. Please note that this test
is dependent upon patches 1-3 of Aaron's userspace MSR test, which add support
for guest handling of the IDT in KVM selftests [1].

This series (along with Aaron's aforementioned changes) applies to
commit 77377064c3a9 ("KVM: ioapic: break infinite recursion on lazy
EOI").

[1] http://lore.kernel.org/r/20201012194716.3950330-1-aaronlewis@google.com

Oliver Upton (6):
  selftests: kvm: add tsc_msrs_test binary to gitignore
  Documentation: kvm: fix ordering of msr filter, pv documentation
  kvm: x86: reads of restricted pv msrs should also result in #GP
  kvm: x86: ensure pv_cpuid.features is initialized when enabling cap
  kvm: x86: request masterclock update any time guest uses different msr
  selftests: kvm: test enforcement of paravirtual cpuid features

 Documentation/virt/kvm/api.rst                |   4 +-
 arch/x86/kvm/cpuid.c                          |  23 +-
 arch/x86/kvm/cpuid.h                          |   1 +
 arch/x86/kvm/x86.c                            |  38 ++-
 tools/testing/selftests/kvm/.gitignore        |   2 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../testing/selftests/kvm/include/kvm_util.h  |   2 +
 .../selftests/kvm/include/x86_64/processor.h  |  12 +
 tools/testing/selftests/kvm/lib/kvm_util.c    |  28 +++
 .../selftests/kvm/lib/x86_64/processor.c      |  29 +++
 .../selftests/kvm/x86_64/kvm_pv_test.c        | 234 ++++++++++++++++++
 11 files changed, 364 insertions(+), 10 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/kvm_pv_test.c

Comments

Oliver Upton Nov. 3, 2020, 7:50 a.m. UTC | #1
Friendly ping (this series contains bugfixes)

On Tue, Oct 27, 2020 at 4:10 PM Oliver Upton <oupton@google.com> wrote:
>
> Patches 1-2 address some small issues with documentation and the kvm selftests,
> unrelated to the overall intent of this series.
>
> Patch 3 applies the same PV MSR filtering mechanism to guest reads of KVM
> paravirt msrs.
>
> Patch 4 makes enabling KVM_CAP_ENFORCE_PV_FEATURE_CPUID idempotent with regards
> to when userspace sets the guest's CPUID, ensuring that the cached copy of
> KVM_CPUID_FEATURES.EAX is always current.
>
> Patch 5 fixes a regression introduced with KVM_CAP_ENFORCE_PV_CPUID, wherein
> the kvm masterclock isn't updated every time the guest uses a different system
> time msr than before.
>
> Lastly, Patch 6 introduces a test for the overall paravirtual restriction
> mechanism, verifying that guests GP when touching MSRs they shouldn't and
> get -KVM_ENOSYS when using restricted kvm hypercalls. Please note that this test
> is dependent upon patches 1-3 of Aaron's userspace MSR test, which add support
> for guest handling of the IDT in KVM selftests [1].
>
> This series (along with Aaron's aforementioned changes) applies to
> commit 77377064c3a9 ("KVM: ioapic: break infinite recursion on lazy
> EOI").
>
> [1] http://lore.kernel.org/r/20201012194716.3950330-1-aaronlewis@google.com
>
> Oliver Upton (6):
>   selftests: kvm: add tsc_msrs_test binary to gitignore
>   Documentation: kvm: fix ordering of msr filter, pv documentation
>   kvm: x86: reads of restricted pv msrs should also result in #GP
>   kvm: x86: ensure pv_cpuid.features is initialized when enabling cap
>   kvm: x86: request masterclock update any time guest uses different msr
>   selftests: kvm: test enforcement of paravirtual cpuid features
>
>  Documentation/virt/kvm/api.rst                |   4 +-
>  arch/x86/kvm/cpuid.c                          |  23 +-
>  arch/x86/kvm/cpuid.h                          |   1 +
>  arch/x86/kvm/x86.c                            |  38 ++-
>  tools/testing/selftests/kvm/.gitignore        |   2 +
>  tools/testing/selftests/kvm/Makefile          |   1 +
>  .../testing/selftests/kvm/include/kvm_util.h  |   2 +
>  .../selftests/kvm/include/x86_64/processor.h  |  12 +
>  tools/testing/selftests/kvm/lib/kvm_util.c    |  28 +++
>  .../selftests/kvm/lib/x86_64/processor.c      |  29 +++
>  .../selftests/kvm/x86_64/kvm_pv_test.c        | 234 ++++++++++++++++++
>  11 files changed, 364 insertions(+), 10 deletions(-)
>  create mode 100644 tools/testing/selftests/kvm/x86_64/kvm_pv_test.c
>
> --
> 2.29.0.rc2.309.g374f81d7ae-goog
>