mbox series

[v4,0/5] MSR filtering and MSR exiting flag clean up

Message ID 20220921151525.904162-1-aaronlewis@google.com (mailing list archive)
Headers show
Series MSR filtering and MSR exiting flag clean up | expand

Message

Aaron Lewis Sept. 21, 2022, 3:15 p.m. UTC
The changes in this series were intended to be accepted at the same time as
commit cf5029d5dd7c ("KVM: x86: Protect the unused bits in MSR exiting
flags").  With that already accepted this series is the rest of the changes
that evolved from the code review.  The RFC tag has been removed because
that part of the change has already been accepted.  All that's left is the
clean up and the selftest.

v3 -> v4
 - Patches 2 and 3 are new.  They were intended to be a part of commit
   cf5029d5dd7c ("KVM: x86: Protect the unused bits in MSR exiting flags"),
   but with that accepted it made sense to split what remained into two.

v2 -> v3
 - Added patch 1/4 to prevent the kernel from using the flag
   KVM_MSR_FILTER_DEFAULT_ALLOW.
 - Cleaned up the selftest code based on feedback.

v1 -> v2
 - Added valid masks KVM_MSR_FILTER_VALID_MASK and
   KVM_MSR_EXIT_REASON_VALID_MASK.
 - Added patch 2/3 to add valid mask KVM_MSR_FILTER_RANGE_VALID_MASK, and
   use it.
 - Added testing to demonstrate flag protection when calling the ioctl for
   KVM_X86_SET_MSR_FILTER or KVM_CAP_X86_USER_SPACE_MSR.

Aaron Lewis (5):
  KVM: x86: Disallow the use of KVM_MSR_FILTER_DEFAULT_ALLOW in the kernel
  KVM: x86: Add a VALID_MASK for the MSR exit reason flags
  KVM: x86: Add a VALID_MASK for the flag in kvm_msr_filter
  KVM: x86: Add a VALID_MASK for the flags in kvm_msr_filter_range
  selftests: kvm/x86: Test the flags in MSR filtering and MSR exiting

 arch/x86/include/uapi/asm/kvm.h               |  5 ++
 arch/x86/kvm/x86.c                            |  8 +-
 include/uapi/linux/kvm.h                      |  3 +
 .../kvm/x86_64/userspace_msr_exit_test.c      | 85 +++++++++++++++++++
 4 files changed, 96 insertions(+), 5 deletions(-)

Comments

Paolo Bonzini Nov. 2, 2022, 5:09 p.m. UTC | #1
On 9/21/22 17:15, Aaron Lewis wrote:
> The changes in this series were intended to be accepted at the same time as
> commit cf5029d5dd7c ("KVM: x86: Protect the unused bits in MSR exiting
> flags").  With that already accepted this series is the rest of the changes
> that evolved from the code review.  The RFC tag has been removed because
> that part of the change has already been accepted.  All that's left is the
> clean up and the selftest.
> 
> v3 -> v4
>   - Patches 2 and 3 are new.  They were intended to be a part of commit
>     cf5029d5dd7c ("KVM: x86: Protect the unused bits in MSR exiting flags"),
>     but with that accepted it made sense to split what remained into two.
> 
> v2 -> v3
>   - Added patch 1/4 to prevent the kernel from using the flag
>     KVM_MSR_FILTER_DEFAULT_ALLOW.
>   - Cleaned up the selftest code based on feedback.
> 
> v1 -> v2
>   - Added valid masks KVM_MSR_FILTER_VALID_MASK and
>     KVM_MSR_EXIT_REASON_VALID_MASK.
>   - Added patch 2/3 to add valid mask KVM_MSR_FILTER_RANGE_VALID_MASK, and
>     use it.
>   - Added testing to demonstrate flag protection when calling the ioctl for
>     KVM_X86_SET_MSR_FILTER or KVM_CAP_X86_USER_SPACE_MSR.
> 
> Aaron Lewis (5):
>    KVM: x86: Disallow the use of KVM_MSR_FILTER_DEFAULT_ALLOW in the kernel
>    KVM: x86: Add a VALID_MASK for the MSR exit reason flags
>    KVM: x86: Add a VALID_MASK for the flag in kvm_msr_filter
>    KVM: x86: Add a VALID_MASK for the flags in kvm_msr_filter_range
>    selftests: kvm/x86: Test the flags in MSR filtering and MSR exiting
> 
>   arch/x86/include/uapi/asm/kvm.h               |  5 ++
>   arch/x86/kvm/x86.c                            |  8 +-
>   include/uapi/linux/kvm.h                      |  3 +
>   .../kvm/x86_64/userspace_msr_exit_test.c      | 85 +++++++++++++++++++
>   4 files changed, 96 insertions(+), 5 deletions(-)

Queued, thanks.

Paolo