kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marc Zyngier <maz@kernel.org>,
	stable@vger.kernel.org, kvm@vger.kernel.org,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [stable-5.4][PATCH] KVM: Forbid the use of tagged userspace addresses for memslots
Date: Mon, 1 Feb 2021 14:55:08 +0100	[thread overview]
Message-ID: <YBgIPLYuf3P4lqB3@kroah.com> (raw)
In-Reply-To: <b08e3ccf-9a69-819a-8632-46c82dade2fa@redhat.com>

On Mon, Feb 01, 2021 at 02:38:05PM +0100, Paolo Bonzini wrote:
> On 01/02/21 14:31, Marc Zyngier wrote:
> > commit 139bc8a6146d92822c866cf2fd410159c56b3648 upstream.
> > 
> > The use of a tagged address could be pretty confusing for the
> > whole memslot infrastructure as well as the MMU notifiers.
> > 
> > Forbid it altogether, as it never quite worked the first place.
> > 
> > Cc: stable@vger.kernel.org
> > Reported-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
> > Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> >   Documentation/virt/kvm/api.txt | 3 +++
> >   virt/kvm/kvm_main.c            | 1 +
> >   2 files changed, 4 insertions(+)
> > 
> > diff --git a/Documentation/virt/kvm/api.txt b/Documentation/virt/kvm/api.txt
> > index a18e996fa54b..7064efd3b5ea 100644
> > --- a/Documentation/virt/kvm/api.txt
> > +++ b/Documentation/virt/kvm/api.txt
> > @@ -1132,6 +1132,9 @@ field userspace_addr, which must point at user addressable memory for
> >   the entire memory slot size.  Any object may back this memory, including
> >   anonymous memory, ordinary files, and hugetlbfs.
> > +On architectures that support a form of address tagging, userspace_addr must
> > +be an untagged address.
> > +
> >   It is recommended that the lower 21 bits of guest_phys_addr and userspace_addr
> >   be identical.  This allows large pages in the guest to be backed by large
> >   pages in the host.
> > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> > index 8f3b40ec02b7..f25b5043cbca 100644
> > --- a/virt/kvm/kvm_main.c
> > +++ b/virt/kvm/kvm_main.c
> > @@ -1017,6 +1017,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
> >   	/* We can read the guest memory with __xxx_user() later on. */
> >   	if ((id < KVM_USER_MEM_SLOTS) &&
> >   	    ((mem->userspace_addr & (PAGE_SIZE - 1)) ||
> > +	     (mem->userspace_addr != untagged_addr(mem->userspace_addr)) ||
> >   	     !access_ok((void __user *)(unsigned long)mem->userspace_addr,
> >   			mem->memory_size)))
> >   		goto out;
> > 
> 
> Indeed untagged_addr was added in 5.3.
> 
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Now queued up, thanks.

greg k-h

      reply	other threads:[~2021-02-01 13:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 13:31 [stable-5.4][PATCH] KVM: Forbid the use of tagged userspace addresses for memslots Marc Zyngier
2021-02-01 13:38 ` Paolo Bonzini
2021-02-01 13:55   ` Greg KH [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=YBgIPLYuf3P4lqB3@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=stable@vger.kernel.org \
    /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).