From: Alexander Graf <graf@amazon.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
Aaron Lewis <aaronlewis@google.com>, Peter Xu <peterx@redhat.com>,
Sean Christopherson <sean.j.christopherson@intel.com>
Subject: Re: [PATCH] KVM: VMX: Forbid userspace MSR filters for x2APIC
Date: Tue, 20 Oct 2020 11:48:07 +0200 [thread overview]
Message-ID: <bce2aee1-bfac-0640-066b-068fa5f12cf8@amazon.de> (raw)
In-Reply-To: <c9dd6726-2783-2dfd-14d1-5cec6f69f051@redhat.com>
On 20.10.20 11:27, Paolo Bonzini wrote:
>
> On 19/10/20 19:45, Graf (AWS), Alexander wrote:
>>> + * In principle it would be possible to trap x2apic ranges
>>> + * if !lapic_in_kernel. This however would be complicated
>>> + * because KVM_X86_SET_MSR_FILTER can be called before
>>> + * KVM_CREATE_IRQCHIP or KVM_ENABLE_CAP.
>>> + */
>>> + for (i = 0; i < ARRAY_SIZE(filter.ranges); i++)
>>> + if (range_overlaps_x2apic(&filter.ranges[i]))
>>> + return -EINVAL;
>>
>> What if the default action of the filter is to "deny"? Then only an
>> MSR filter to allow access to x2apic MSRs would make the full
>> filtering logic adhere to the constraints, no?
>
> Right; or more precisely, that is handled by Sean's patch that he had
> posted earlier. This patch only makes it impossible to set up such a
> filter.
What I'm saying is that a "filter rule" can either mean "allow" or
"deny". Here you're only checking if there is a rule. What you want to
filter for is whether there is a denying rule (including default
fallback) for x2apic after all rules are in place.
Imagine you add the following filter:
{
count: 1,
default_allow: false,
ranges: [
{
flags: KVM_MSR_FILTER_READ,
nmsrs: 1,
base: MSR_EFER,
bitmap: { 1 },
},
],
}
That filter would set all x2apic registers to "deny", but would not be
caught by the code above. Conversely, a range that explicitly allows
x2apic ranges with default_allow=0 would be rejected by this patch.
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
next prev parent reply other threads:[~2020-10-20 9:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 17:05 [PATCH] KVM: VMX: Forbid userspace MSR filters for x2APIC Paolo Bonzini
2020-10-19 17:35 ` Peter Xu
2020-10-19 17:45 ` Graf (AWS), Alexander
2020-10-20 9:27 ` Paolo Bonzini
2020-10-20 9:48 ` Alexander Graf [this message]
2020-10-20 10:34 ` Paolo Bonzini
2020-10-20 10:52 ` Alexander Graf
2020-10-20 11:49 ` Paolo Bonzini
2020-10-21 21:36 Paolo Bonzini
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=bce2aee1-bfac-0640-066b-068fa5f12cf8@amazon.de \
--to=graf@amazon.de \
--cc=aaronlewis@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=sean.j.christopherson@intel.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).