* FAILED: patch "[PATCH] KVM: Forbid the use of tagged userspace addresses for" failed to apply to 5.4-stable tree
@ 2021-02-01 12:41 gregkh
2021-02-01 13:29 ` Marc Zyngier
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2021-02-01 12:41 UTC (permalink / raw)
To: maz, catalin.marinas, rick.p.edgecombe; +Cc: stable
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 139bc8a6146d92822c866cf2fd410159c56b3648 Mon Sep 17 00:00:00 2001
From: Marc Zyngier <maz@kernel.org>
Date: Thu, 21 Jan 2021 12:08:15 +0000
Subject: [PATCH] KVM: Forbid the use of tagged userspace addresses for
memslots
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>
diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index 4e5316ed10e9..c347b7083abf 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -1269,6 +1269,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 2541a17ff1c4..a9abaf5f8e53 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1290,6 +1290,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
return -EINVAL;
/* We can read the guest memory with __xxx_user() later on. */
if ((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))
return -EINVAL;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] KVM: Forbid the use of tagged userspace addresses for" failed to apply to 5.4-stable tree
2021-02-01 12:41 FAILED: patch "[PATCH] KVM: Forbid the use of tagged userspace addresses for" failed to apply to 5.4-stable tree gregkh
@ 2021-02-01 13:29 ` Marc Zyngier
2021-02-01 13:50 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2021-02-01 13:29 UTC (permalink / raw)
To: gregkh; +Cc: catalin.marinas, rick.p.edgecombe, stable
Hi Greg,
On 2021-02-01 12:41, gregkh@linuxfoundation.org wrote:
> The patch below does not apply to the 5.4-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
>
> thanks,
>
> greg k-h
>
> ------------------ original commit in Linus's tree ------------------
>
> From 139bc8a6146d92822c866cf2fd410159c56b3648 Mon Sep 17 00:00:00 2001
> From: Marc Zyngier <maz@kernel.org>
> Date: Thu, 21 Jan 2021 12:08:15 +0000
> Subject: [PATCH] KVM: Forbid the use of tagged userspace addresses for
> memslots
>
> 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>
>
> diff --git a/Documentation/virt/kvm/api.rst
> b/Documentation/virt/kvm/api.rst
> index 4e5316ed10e9..c347b7083abf 100644
> --- a/Documentation/virt/kvm/api.rst
> +++ b/Documentation/virt/kvm/api.rst
> @@ -1269,6 +1269,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 2541a17ff1c4..a9abaf5f8e53 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1290,6 +1290,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
> return -EINVAL;
> /* We can read the guest memory with __xxx_user() later on. */
> if ((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))
> return -EINVAL;
I'll post a revised patch for 5.4. No need to go beyond that as that's
the point where we allowed tagged addresses at the syscall boundary.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: FAILED: patch "[PATCH] KVM: Forbid the use of tagged userspace addresses for" failed to apply to 5.4-stable tree
2021-02-01 13:29 ` Marc Zyngier
@ 2021-02-01 13:50 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-02-01 13:50 UTC (permalink / raw)
To: Marc Zyngier; +Cc: catalin.marinas, rick.p.edgecombe, stable
On Mon, Feb 01, 2021 at 01:29:02PM +0000, Marc Zyngier wrote:
> Hi Greg,
>
> On 2021-02-01 12:41, gregkh@linuxfoundation.org wrote:
> > The patch below does not apply to the 5.4-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> >
> > thanks,
> >
> > greg k-h
> >
> > ------------------ original commit in Linus's tree ------------------
> >
> > From 139bc8a6146d92822c866cf2fd410159c56b3648 Mon Sep 17 00:00:00 2001
> > From: Marc Zyngier <maz@kernel.org>
> > Date: Thu, 21 Jan 2021 12:08:15 +0000
> > Subject: [PATCH] KVM: Forbid the use of tagged userspace addresses for
> > memslots
> >
> > 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>
> >
> > diff --git a/Documentation/virt/kvm/api.rst
> > b/Documentation/virt/kvm/api.rst
> > index 4e5316ed10e9..c347b7083abf 100644
> > --- a/Documentation/virt/kvm/api.rst
> > +++ b/Documentation/virt/kvm/api.rst
> > @@ -1269,6 +1269,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 2541a17ff1c4..a9abaf5f8e53 100644
> > --- a/virt/kvm/kvm_main.c
> > +++ b/virt/kvm/kvm_main.c
> > @@ -1290,6 +1290,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
> > return -EINVAL;
> > /* We can read the guest memory with __xxx_user() later on. */
> > if ((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))
> > return -EINVAL;
>
> I'll post a revised patch for 5.4. No need to go beyond that as that's
> the point where we allowed tagged addresses at the syscall boundary.
Great, thanks, I didn't know how far back to take it :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-01 13:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 12:41 FAILED: patch "[PATCH] KVM: Forbid the use of tagged userspace addresses for" failed to apply to 5.4-stable tree gregkh
2021-02-01 13:29 ` Marc Zyngier
2021-02-01 13:50 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.