FAILED: patch "[PATCH] KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration" failed to apply to 5.15-stable tree
Subsystems (4)
Sasha Levin
maintainerThe patch below does not apply to the 5.15-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 <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x eacdb76c5f04956035c5d7f7e1973028f30684a2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From eacdb76c5f04956035c5d7f7e1973028f30684a2 Mon Sep 17 00:00:00 2001
From: David Woodhouse <[email protected]>
Date: Mon, 31 Aug 2026 22:26:37 +0100
Subject: [PATCH] KVM: x86/xen: Enforce 4-byte alignment of vcpu_info
registration
Xen's map_guest_area() enforces that vcpu_info is aligned to sizeof(xen_ulong_t). KVM has no such check, allowing a guest to register vcpu_info at an arbitrary byte alignment.
Enforce unconditional 4-byte alignment regardless of the current shinfo mode. This is sufficient because subsequent commits ensure that all locked atomic operations on vcpu_info fields use at most 32-bit accesses. Return -ENXIO on failure, matching Xen's map_guest_area() behaviour for unaligned requests.
Originally observed in review of an unrelated patch:
https://lore.kernel.org/all/[email protected]/
--- arch/x86/kvm/xen.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/kvm/xen.c +8 -0
@@ -941,6 +941,10 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data)break ; } + r = -ENXIO ; +if (!IS_ALIGNED (data->u.gpa,sizeof (u32))) +break ; + r =kvm_gpc_activate (&vcpu->arch.xen.vcpu_info_cache, data->u.gpa,sizeof (struct vcpu_info )); }else {
@@ -950,6 +954,10 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data)break ; } + r = -ENXIO ; +if (!IS_ALIGNED (data->u.hva,sizeof (u32))) +break ; + r =kvm_gpc_activate_hva (&vcpu->arch.xen.vcpu_info_cache, data->u.hva,sizeof (struct vcpu_info )); }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration
From: David Woodhouse <[email protected]>
[ Upstream commit eacdb76c5f04956035c5d7f7e1973028f30684a2 ]
Xen's map_guest_area() enforces that vcpu_info is aligned to sizeof(xen_ulong_t). KVM has no such check, allowing a guest to register vcpu_info at an arbitrary byte alignment.
Enforce unconditional 4-byte alignment regardless of the current shinfo mode. This is sufficient because subsequent commits ensure that all locked atomic operations on vcpu_info fields use at most 32-bit accesses. Return -ENXIO on failure, matching Xen's map_guest_area() behaviour for unaligned requests.
Originally observed in review of an unrelated patch:
https://lore.kernel.org/all/[email protected]/
--- arch/x86/kvm/xen.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kvm/xen.c +4 -0
@@ -356,6 +356,10 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data)break ; } + r = -ENXIO ; +if (!IS_ALIGNED (data->u.gpa,sizeof (u32))) +break ; +/* It must fit within a single page */ if ((data->u.gpa & ~PAGE_MASK ) +sizeof (struct vcpu_info ) >PAGE_SIZE ) { r = -EINVAL ;
Signature · 1 line
2.53.0