FAILED: patch "[PATCH] KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration" failed to apply to 6.6-stable tree
Subsystems (4)
Sasha Levin
maintainerThe patch below does not apply to the 6.6-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-6.6.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 6.6.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/5 KVM: remove more traces of device assignment UAPI
From: Paolo Bonzini <[email protected]>
[ Upstream commit c0a411904e1548d287dc4a031ff19d00e0569202 ]
Stable-dep-of: eacdb76c5f04 ("KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration")
--- include/uapi/linux/kvm.h | 50 ---------------------------------------- 1 file changed, 50 deletions(-)
include/uapi/linux/kvm.h +0 -50
@@ -2015,56 +2015,6 @@ struct kvm_sev_receive_update_data {__u32 trans_len; }; -#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) -#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) -#define KVM_DEV_ASSIGN_MASK_INTX (1 << 2) - -struct kvm_assigned_pci_dev { -__u32 assigned_dev_id; -__u32 busnr; -__u32 devfn; -__u32 flags; -__u32 segnr; -union { -__u32 reserved[11 ]; - }; -}; - -#define KVM_DEV_IRQ_HOST_INTX (1 << 0) -#define KVM_DEV_IRQ_HOST_MSI (1 << 1) -#define KVM_DEV_IRQ_HOST_MSIX (1 << 2) - -#define KVM_DEV_IRQ_GUEST_INTX (1 << 8) -#define KVM_DEV_IRQ_GUEST_MSI (1 << 9) -#define KVM_DEV_IRQ_GUEST_MSIX (1 << 10) - -#define KVM_DEV_IRQ_HOST_MASK 0x00ff -#define KVM_DEV_IRQ_GUEST_MASK 0xff00 - -struct kvm_assigned_irq { -__u32 assigned_dev_id; -__u32 host_irq;/* ignored (legacy field) */ -__u32 guest_irq; -__u32 flags; -union { -__u32 reserved[12 ]; - }; -}; - -struct kvm_assigned_msix_nr { -__u32 assigned_dev_id; -__u16 entry_nr; -__u16 padding; -}; - -#define KVM_MAX_MSIX_PER_DEV 256 -struct kvm_assigned_msix_entry { -__u32 assigned_dev_id; -__u32 gsi; -__u16 entry;/* The index of entry in the MSI-X table */ -__u16 padding[3 ]; -}; -#define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0)#define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1)
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/5 KVM: pfncache: stop open-coding offset_in_page()
From: Paul Durrant <[email protected]>
[ Upstream commit 53e63e953e14a66b7d0d7e9c616cd602f3da9291 ]
Some code in pfncache uses offset_in_page() but in other places it is open- coded. Use offset_in_page() consistently everywhere.
Stable-dep-of: eacdb76c5f04 ("KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration")
--- virt/kvm/pfncache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
virt/kvm/pfncache.c +3 -3
@@ -83,7 +83,7 @@ bool kvm_gpc_check(struct gfn_to_pfn_cache *gpc, unsigned long len)if (!gpc->active)return false; -if ((gpc->gpa & ~PAGE_MASK ) + len >PAGE_SIZE ) +if (offset_in_page (gpc->gpa) + len >PAGE_SIZE )return false;if (gpc->generation != slots->generation ||kvm_is_error_hva (gpc->uhva))
@@ -219,7 +219,7 @@ static kvm_pfn_t hva_to_pfn_retry(struct gfn_to_pfn_cache *gpc) gpc->valid = true; gpc->pfn = new_pfn; - gpc->khva = new_khva + (gpc->gpa & ~PAGE_MASK ); + gpc->khva = new_khva +offset_in_page (gpc->gpa);/* * Put the reference to the _new_ pfn. The pfn is now tracked by the
@@ -240,7 +240,7 @@ static int __kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, gpa_t gpa, unsigned long len) {struct kvm_memslots *slots =kvm_memslots (gpc->kvm); -unsigned long page_offset = gpa & ~PAGE_MASK ; +unsigned long page_offset =offset_in_page (gpa);bool unmap_old = false;unsigned long old_uhva;kvm_pfn_t old_pfn;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/5 KVM: pfncache: include page offset in uhva and use it consistently
In reply to Sasha LevinFrom: Paul Durrant <[email protected]>
[ Upstream commit 406c10962a4cbb1e04aa7993ea466db1a4533ae4 ]
Currently the pfncache page offset is sometimes determined using the gpa and sometimes the khva, whilst the uhva is always page-aligned. After a subsequent patch is applied the gpa will not always be valid so adjust the code to include the page offset in the uhva and use it consistently as the source of truth.
Also, where a page-aligned address is required, use PAGE_ALIGN_DOWN() for clarity.
No functional change intended.
Stable-dep-of: eacdb76c5f04 ("KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration")
--- virt/kvm/pfncache.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
virt/kvm/pfncache.c +21 -8
@@ -83,10 +83,10 @@ bool kvm_gpc_check(struct gfn_to_pfn_cache *gpc, unsigned long len)if (!gpc->active)return false; -if (offset_in_page (gpc->gpa) + len >PAGE_SIZE ) +if (gpc->generation != slots->generation ||kvm_is_error_hva (gpc->uhva))return false; -if (gpc->generation != slots->generation ||kvm_is_error_hva (gpc->uhva)) +if (offset_in_page (gpc->uhva) + len >PAGE_SIZE )return false;if (!gpc->valid)
@@ -140,7 +140,7 @@ static inline bool mmu_notifier_retry_cache(struct kvm *kvm, unsigned long mmu_sstatic kvm_pfn_t hva_to_pfn_retry (struct gfn_to_pfn_cache *gpc) {/* Note, the new page offset may be different than the old! */ -void *old_khva = gpc->khva -offset_in_page (gpc->khva); +void *old_khva = (void *)PAGE_ALIGN_DOWN ((uintptr_t )gpc->khva);kvm_pfn_t new_pfn =KVM_PFN_ERR_FAULT ;void *new_khva =NULL ;unsigned long mmu_seq;
@@ -219,7 +219,7 @@ static kvm_pfn_t hva_to_pfn_retry(struct gfn_to_pfn_cache *gpc) gpc->valid = true; gpc->pfn = new_pfn; - gpc->khva = new_khva +offset_in_page (gpc->gpa); + gpc->khva = new_khva +offset_in_page (gpc->uhva);/* * Put the reference to the _new_ pfn. The pfn is now tracked by the
@@ -244,6 +244,7 @@ static int __kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, gpa_t gpa,bool unmap_old = false;unsigned long old_uhva;kvm_pfn_t old_pfn; +bool hva_change = false;void *old_khva;int ret;
@@ -269,10 +270,10 @@ static int __kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, gpa_t gpa, } old_pfn = gpc->pfn; - old_khva = gpc->khva -offset_in_page (gpc->khva); - old_uhva = gpc->uhva; + old_khva = (void *)PAGE_ALIGN_DOWN ((uintptr_t )gpc->khva); + old_uhva =PAGE_ALIGN_DOWN (gpc->uhva); -/* If the userspace HVA is invalid, refresh that first */ +/* Refresh the userspace HVA if necessary */ if (gpc->gpa != gpa || gpc->generation != slots->generation ||kvm_is_error_hva (gpc->uhva)) {gfn_t gfn =gpa_to_gfn (gpa);
@@ -286,13 +287,25 @@ static int __kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, gpa_t gpa, ret = -EFAULT ; goto out; } + +/* +* Even if the GPA and/or the memslot generation changed, the +* HVA may still be the same. +*/ +if (gpc->uhva != old_uhva) + hva_change = true; + }else { + gpc->uhva = old_uhva; } +/* Note: the offset must be correct before calling hva_to_pfn_retry() */ + gpc->uhva += page_offset; +/* * If the userspace HVA changed or the PFN was already invalid, * drop the lock and do the HVA to PFN lookup again. */ -if (!gpc->valid || old_uhva != gpc->uhva) { +if (!gpc->valid || hva_change) { ret =hva_to_pfn_retry (gpc); }else {/*
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/5 KVM: s390: Refactor kvm_is_error_gpa() into kvm_is_gpa_in_memslot()
In reply to Sasha LevinFrom: Sean Christopherson <[email protected]>
[ Upstream commit 9e7325acb3dc8df8a6370ebc18aef107aae17ef0 ]
Rename kvm_is_error_gpa() to kvm_is_gpa_in_memslot() and invert the polarity accordingly in order to (a) free up kvm_is_error_gpa() to match with kvm_is_error_{hva,page}(), and (b) to make it more obvious that the helper is doing a memslot lookup, i.e. not simply checking for INVALID_GPA.
No functional change intended.
Stable-dep-of: eacdb76c5f04 ("KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration")
--- arch/s390/kvm/diag.c | 2 +- arch/s390/kvm/gaccess.c | 14 +++++++------- arch/s390/kvm/kvm-s390.c | 4 ++-- arch/s390/kvm/priv.c | 4 ++-- arch/s390/kvm/sigp.c | 2 +- include/linux/kvm_host.h | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-)
arch/s390/kvm/diag.c +1 -1
@@ -102,7 +102,7 @@ static int __diag_page_ref_service(struct kvm_vcpu *vcpu) parm.token_addr & 7 || parm.zarch != 0x8000000000000000ULL)return kvm_s390_inject_program_int (vcpu,PGM_SPECIFICATION ); -if (kvm_is_error_gpa (vcpu->kvm, parm.token_addr)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, parm.token_addr))return kvm_s390_inject_program_int (vcpu,PGM_ADDRESSING ); vcpu->arch.pfault_token = parm.token_addr;
arch/s390/kvm/gaccess.c +7 -7
@@ -681,7 +681,7 @@ static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva,case ASCE_TYPE_REGION1 : {union region1_table_entry rfte; -if (kvm_is_error_gpa (vcpu->kvm, ptr)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, ptr))return PGM_ADDRESSING ;if (deref_table (vcpu->kvm, ptr, &rfte.val))return -EFAULT ;
@@ -699,7 +699,7 @@ static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva,case ASCE_TYPE_REGION2 : {union region2_table_entry rste; -if (kvm_is_error_gpa (vcpu->kvm, ptr)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, ptr))return PGM_ADDRESSING ;if (deref_table (vcpu->kvm, ptr, &rste.val))return -EFAULT ;
@@ -717,7 +717,7 @@ static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva,case ASCE_TYPE_REGION3 : {union region3_table_entry rtte; -if (kvm_is_error_gpa (vcpu->kvm, ptr)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, ptr))return PGM_ADDRESSING ;if (deref_table (vcpu->kvm, ptr, &rtte.val))return -EFAULT ;
@@ -745,7 +745,7 @@ static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva,case ASCE_TYPE_SEGMENT : {union segment_table_entry ste; -if (kvm_is_error_gpa (vcpu->kvm, ptr)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, ptr))return PGM_ADDRESSING ;if (deref_table (vcpu->kvm, ptr, &ste.val))return -EFAULT ;
@@ -765,7 +765,7 @@ static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva, ptr = ste.fc0.pto * (PAGE_SIZE /2 ) + vaddr.px *8 ; } } -if (kvm_is_error_gpa (vcpu->kvm, ptr)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, ptr))return PGM_ADDRESSING ;if (deref_table (vcpu->kvm, ptr, &pte.val))return -EFAULT ;
@@ -787,7 +787,7 @@ static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva, *prot =PROT_TYPE_IEP ;return PGM_PROTECTION ; } -if (kvm_is_error_gpa (vcpu->kvm, raddr.addr)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, raddr.addr))return PGM_ADDRESSING ; *gpa = raddr.addr;return 0 ;
@@ -974,7 +974,7 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,return rc; }else { gpa =kvm_s390_real_to_abs (vcpu, ga); -if (kvm_is_error_gpa (vcpu->kvm, gpa)) { +if (!kvm_is_gpa_in_memslot (vcpu->kvm, gpa)) { rc =PGM_ADDRESSING ; prot =PROT_TYPE_DUMMY ; }
arch/s390/kvm/kvm-s390.c +2 -2
@@ -2878,7 +2878,7 @@ static int kvm_s390_vm_mem_op_abs(struct kvm *kvm, struct kvm_s390_mem_op *mop) srcu_idx =srcu_read_lock (&kvm->srcu); -if (kvm_is_error_gpa (kvm, mop->gaddr)) { +if (!kvm_is_gpa_in_memslot (kvm, mop->gaddr)) { r =PGM_ADDRESSING ; goto out_unlock; }
@@ -2940,7 +2940,7 @@ static int kvm_s390_vm_mem_op_cmpxchg(struct kvm *kvm, struct kvm_s390_mem_op *m srcu_idx =srcu_read_lock (&kvm->srcu); -if (kvm_is_error_gpa (kvm, mop->gaddr)) { +if (!kvm_is_gpa_in_memslot (kvm, mop->gaddr)) { r =PGM_ADDRESSING ; goto out_unlock; }
arch/s390/kvm/priv.c +2 -2
@@ -149,7 +149,7 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu)* first page, since address is 8k aligned and memory pieces are always * at least 1MB aligned and have at least a size of 1MB. */ -if (kvm_is_error_gpa (vcpu->kvm, address)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, address))return kvm_s390_inject_program_int (vcpu,PGM_ADDRESSING );kvm_s390_set_prefix (vcpu, address);
@@ -464,7 +464,7 @@ static int handle_test_block(struct kvm_vcpu *vcpu)return kvm_s390_inject_prog_irq (vcpu, &vcpu->arch.pgm); addr =kvm_s390_real_to_abs (vcpu, addr); -if (kvm_is_error_gpa (vcpu->kvm, addr)) +if (!kvm_is_gpa_in_memslot (vcpu->kvm, addr))return kvm_s390_inject_program_int (vcpu,PGM_ADDRESSING );/* * We don't expect errors on modern systems, and do not care
arch/s390/kvm/sigp.c +1 -1
@@ -172,7 +172,7 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu,* first page, since address is 8k aligned and memory pieces are always * at least 1MB aligned and have at least a size of 1MB. */ -if (kvm_is_error_gpa (vcpu->kvm, irq.u.prefix.address)) { +if (!kvm_is_gpa_in_memslot (vcpu->kvm, irq.u.prefix.address)) { *reg &=0xffffffff00000000UL ; *reg |=SIGP_STATUS_INVALID_PARAMETER ;return SIGP_CC_STATUS_STORED ;
include/linux/kvm_host.h +2 -2
@@ -1772,11 +1772,11 @@ static inline hpa_t pfn_to_hpa(kvm_pfn_t pfn)return (hpa_t )pfn <<PAGE_SHIFT ; } -static inline bool kvm_is_error_gpa (struct kvm *kvm,gpa_t gpa) +static inline bool kvm_is_gpa_in_memslot (struct kvm *kvm,gpa_t gpa) {unsigned long hva =gfn_to_hva (kvm,gpa_to_gfn (gpa)); -return kvm_is_error_hva (hva); +return !kvm_is_error_hva (hva); }enum kvm_stat_kind {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/5 KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration
In reply to Sasha LevinFrom: 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
@@ -742,6 +742,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 ));if (!r)
Signature · 1 line
2.53.0
Re: [PATCH 6.6.y 5/5] KVM: x86/xen: Enforce 4-byte alignment of vcpu_info registration
Quoted 14 lines · Sasha Levin
From: David Woodhouse <[email protected]>
[ Upstream commit
eacdb76c5f04956035c5d7f7e1973028f30684a2]Xen's
map_guest_area()enforces thatvcpu_infois aligned tosizeof(xen_ulong_t). KVM has no such check, allowing a guest to registervcpu_infoat 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_infofields use at most 32-bit accesses. Return-ENXIOon failure, matching Xen'smap_guest_area()behaviour for unaligned requests.
Quoted 4 lines
Originally observed in review of an unrelated patch:
https://lore.kernel.org/all/[email protected]/
Huh. Do we actually need this backported to older kernels? I'm not opposed to the backports, but this seems like a rather benign issue.
Oh, /facepalm. We didn't tag these two for stable:
https://lore.kernel.org/all/[email protected]
https://lore.kernel.org/all/[email protected]
a.k.a.
301a5ced32e08e96212b413e896ef4c32d1ce961 KVM: x86/xen: Use 32-bit atomics if vCPU's evtchn_pending_sel isn't aligned 1835551d4304abb1edcbf5d1ba71945279051236 KVM: x86/xen: Use 32-bit locked bts for vcpu_info evtchn_pending_sel
If those cherry-pick cleanly on top of this patch, then:
for *this* patch. Otherwise, I vote to scrap this unless someone cares deeply about guarding against an oscure userspace attack.
Sean Christopherson
maintainerRe: [PATCH 6.6.y 4/5] KVM: s390: Refactor kvm_is_error_gpa() into kvm_is_gpa_in_memslot()
In reply to Sasha LevinQuoted 9 lines · Sasha Levin
From: Sean Christopherson <[email protected]>
[ Upstream commit
9e7325acb3dc8df8a6370ebc18aef107aae17ef0]Rename
kvm_is_error_gpa()tokvm_is_gpa_in_memslot()and invert the polarity accordingly in order to (a) free upkvm_is_error_gpa()to match with kvm_is_error_{hva,page}(), and (b) to make it more obvious that the helper is doing a memslot lookup, i.e. not simply checking forINVALID_GPA.
Quoted 5 lines
No functional change intended.
Signed-off-by Sean Christopherson <[email protected]>Stable-dep-of:
eacdb76c5f04("KVM: x86/xen: Enforce 4-byte alignment ofvcpu_inforegistration")
NAK. AFAICT, there are no dependencies, i.e. the patch failed to apply purely because of the resolved conflict:
[ sashal: Omitted the HVA alignment check because only GPA registration is supported. ]
Re: [PATCH 6.6.y 3/5] KVM: pfncache: include page offset in uhva and use it consistently
In reply to Sasha LevinQuoted 13 lines · Sasha Levin
From: Paul Durrant <[email protected]>
[ Upstream commit
406c10962a4cbb1e04aa7993ea466db1a4533ae4]Currently the pfncache page offset is sometimes determined using the gpa and sometimes the khva, whilst the uhva is always page-aligned. After a subsequent patch is applied the gpa will not always be valid so adjust the code to include the page offset in the uhva and use it consistently as the source of truth.
Also, where a page-aligned address is required, use
PAGE_ALIGN_DOWN()for clarity.
Quoted 7 lines
No functional change intended.
Signed-off-by Paul Durrant <[email protected]>Reviewed-by David Woodhouse <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Stable-dep-of:
eacdb76c5f04("KVM: x86/xen: Enforce 4-byte alignment ofvcpu_inforegistration")
NAK, patch 5 should work without this.
Re: [PATCH 6.6.y 2/5] KVM: pfncache: stop open-coding offset_in_page()
In reply to Sasha LevinQuoted 4 lines · Sasha Levin
From: Paul Durrant <[email protected]>
[ Upstream commit
53e63e953e14a66b7d0d7e9c616cd602f3da9291]
Quoted 8 lines
Some code in pfncache uses
offset_in_page()but in other places it is open- coded. Useoffset_in_page()consistently everywhere.Signed-off-by Paul Durrant <[email protected]>Reviewed-by David Woodhouse <[email protected]>Signed-off-by Sean Christopherson <[email protected]>Stable-dep-of:
eacdb76c5f04("KVM: x86/xen: Enforce 4-byte alignment ofvcpu_inforegistration")
NAK, patch 5 should work without this.
Re: [PATCH 6.6.y 1/5] KVM: remove more traces of device assignment UAPI
In reply to Sasha LevinQuoted 6 lines · Sasha Levin
From: Paolo Bonzini <[email protected]>
[ Upstream commit
c0a411904e1548d287dc4a031ff19d00e0569202]Signed-off-by Paolo Bonzini <[email protected]>Stable-dep-of:
eacdb76c5f04("KVM: x86/xen: Enforce 4-byte alignment ofvcpu_inforegistration")
NAK, this makes no sense whatsoever.