mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 12:52:20 +0200	[thread overview]
Message-ID: <47eb1a4a-d015-b573-d773-e34e578ad753@amazon.de> (raw)
In-Reply-To: <6edd5e08-92c2-40ff-57be-37b92d1ca2bc@redhat.com>



On 20.10.20 12:34, Paolo Bonzini wrote:
> 
> On 20/10/20 11:48, Alexander Graf wrote:
>>
>>      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.
> 
> Yes, but the idea is that x2apic registers are always allowed, even
> overriding default_allow, and therefore it makes no sense to have them
> in a range.  The patch is only making things fail early for userspace,
> the policy is defined by Sean's patch.

I don't think we should fail on the following:

{
     default_allow: false,
     ranges: [
         {
             flags: KVM_MSR_FILTER_READ,
             nmsrs: 4096,
             base: 0,
             bitmap: { 1, 1, 1, 1, [...] },
         },
         {
             flags: KVM_MSR_FILTER_READ,
             nmsrs: 4096,
             base: 0xc0000000,
             bitmap: { 1, 1, 1, 1, [...] },
         },
     ],
}

as a way to say "everything in normal ranges is allowed, the rest please 
deflect". Or even just to set default policies with less ranges.

Or to say it differently: Why can't we just check explicitly after 
setting up all filter lists whether x2apic MSRs are *denied*? If so, 
clear the filter and return -EINVAL.

That still leaves the case where x2apic is not handled in-kernel, but 
I'm perfectly happy to ignore that one as "user space should not care" :).


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



  reply	other threads:[~2020-10-20 10:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 17:05 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
2020-10-20 10:34       ` Paolo Bonzini
2020-10-20 10:52         ` Alexander Graf [this message]
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=47eb1a4a-d015-b573-d773-e34e578ad753@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

all inboxes | Powered by JetHome®