From: Alexander Graf <graf@amazon.com>
To: Aaron Lewis <aaronlewis@google.com>
Cc: <pshier@google.com>, <jmattson@google.com>, <kvm@vger.kernel.org>
Subject: Re: [PATCH 4/4] selftests: kvm: Test MSR exiting to userspace
Date: Wed, 7 Oct 2020 15:21:00 +0200 [thread overview]
Message-ID: <8e887492-1512-87bf-6406-22b6aabfb703@amazon.com> (raw)
In-Reply-To: <20201006210444.1342641-5-aaronlewis@google.com>
On 06.10.20 23:04, Aaron Lewis wrote:
>
> Add a selftest to test that when the ioctl KVM_X86_SET_MSR_FILTER is
> called with an MSR list, those MSRs exit to userspace.
>
> This test uses 3 MSRs to test this:
> 1. MSR_IA32_XSS, an MSR the kernel knows about.
> 2. MSR_IA32_FLUSH_CMD, an MSR the kernel does not know about.
> 3. MSR_NON_EXISTENT, an MSR invented in this test for the purposes of
> passing a fake MSR from the guest to userspace. KVM just acts as a
> pass through.
>
> Userspace is also able to inject a #GP. This is demonstrated when
> MSR_IA32_XSS and MSR_IA32_FLUSH_CMD are misused in the test. When this
> happens a #GP is initiated in userspace to be thrown in the guest which is
> handled gracefully by the expection handling framework introduced earlier
exception?
> in this series.
>
> Tests for the generic instruction emulator were also added. For this to
> work the module parameter kvm.force_emulation_prefix=1 has to be enabled.
> If it isn't enabled the tests will be skipped.
>
> A test was also added to ensure the MSR permission bitmap is being set
> correctly by executing reads and writes of MSR_FS_BASE and MSR_GS_BASE
> in the guest while alternating which MSR userspace should intercept. If
> the permission bitmap is being set correctly only one of the MSRs should
> be coming through at a time, and the guest should be able to read and
> write the other one directly.
>
> Signed-off-by: Aaron Lewis <aaronlewis@google.com>
Reviewed-by: Alexander Graf <graf@amazon.com>
Alex
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879
prev parent reply other threads:[~2020-10-07 13:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-06 21:04 [PATCH 0/4] Test MSR exits to userspace Aaron Lewis
2020-10-06 21:04 ` [PATCH 1/4] selftests: kvm: Fix the segment descriptor layout to match the actual layout Aaron Lewis
2020-10-07 12:31 ` Alexander Graf
2020-10-06 21:04 ` [PATCH 2/4] selftests: kvm: Clear uc so UCALL_NONE is being properly reported Aaron Lewis
2020-10-07 12:32 ` Alexander Graf
2020-10-06 21:04 ` [PATCH 3/4] selftests: kvm: Add exception handling to selftests Aaron Lewis
2020-10-07 13:08 ` Alexander Graf
2020-10-06 21:04 ` [PATCH 4/4] selftests: kvm: Test MSR exiting to userspace Aaron Lewis
2020-10-07 13:21 ` Alexander Graf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8e887492-1512-87bf-6406-22b6aabfb703@amazon.com \
--to=graf@amazon.com \
--cc=aaronlewis@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pshier@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).