public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Michael Young <m.a.young@durham.ac.uk>
To: git-commits@fedoraproject.org
Subject: [rpms/xen] f44: 6 security updates
Date: Sun, 18 Oct 2026 21:44:56 GMT [thread overview]
Message-ID: <179235989630.1.5009244340006866031.rpms-xen-f73fb7ca433c@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/xen
Branch : f44
Commit : f73fb7ca433ce150bcc86bb3f8b721e12f41c8d6
Author : Michael Young <m.a.young@durham.ac.uk>
Date : 2026-10-18T21:09:54+01:00
Stats : +638/-1 in 8 file(s)
URL : https://src.fedoraproject.org/rpms/xen/c/f73fb7ca433ce150bcc86bb3f8b721e12f41c8d6?branch=f44
Log:
6 security updates
x86/AMD: ineffectual Zenbleed workaround [XSA-515, CVE-2026-79608]
x86: XPTI may break on huge-memory systems [XSA-516, CVE-2026-79609]
grant-table: double version change race [XSA-517, CVE-2026-79610]
VMX: VMentry failure with branch tracing and blocked states
[XSA-518, CVE-2026-79611]
Arm: multiple issues with GNTTABOP_cache_flush
[XSA-519, CVE-2026-102699, CVE-2026-102702]
gnttab: cache-flush handling may cause page reference leak
[XSA-520, CVE-2026-102700]
---
diff --git a/xen.spec b/xen.spec
index b5487e6..29f645f 100644
--- a/xen.spec
+++ b/xen.spec
@@ -51,7 +51,7 @@
Summary: Xen is a virtual machine monitor
Name: xen
Version: 4.21.2
-Release: 2%{?dist}
+Release: 4%{?dist}
# Automatically converted from old format: GPLv2+ and LGPLv2+ and BSD - review is highly recommended.
License: GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+ AND LicenseRef-Callaway-BSD
URL: http://xen.org/
@@ -83,6 +83,13 @@ Patch11: xsa510.patch
Patch12: xsa511-4.21.patch
Patch13: xsa512-1.patch
Patch14: xsa512-2.patch
+Patch15: xsa515.patch
+Patch16: xsa516.patch
+Patch17: xsa517.patch
+Patch18: xsa518.patch
+Patch19: xsa519-1.patch
+Patch20: xsa519-2.patch
+Patch21: xsa520.patch
# build using Fedora seabios and ipxe packages for roms
@@ -273,6 +280,13 @@ This package contains files used in testing the xen builds
%patch 12 -p1
%patch 13 -p1
%patch 14 -p1
+%patch 15 -p1
+%patch 16 -p1
+%patch 17 -p1
+%patch 18 -p1
+%patch 19 -p1
+%patch 20 -p1
+%patch 21 -p1
# stubdom sources
cp -v %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} %{SOURCE15} stubdom
@@ -828,6 +842,17 @@ fi
%{_libexecdir}/xen/tests/*
%changelog
+* Sun Oct 18 2026 Michael Young <m.a.young@durham.ac.uk> - 4.21.2-4
+- x86/AMD: ineffectual Zenbleed workaround [XSA-515, CVE-2026-79608]
+ x86: XPTI may break on huge-memory systems [XSA-516, CVE-2026-79609]
+ grant-table: double version change race [XSA-517, CVE-2026-79610]
+ VMX: VMentry failure with branch tracing and blocked states
+ [XSA-518, CVE-2026-79611]
+ Arm: multiple issues with GNTTABOP_cache_flush
+ [XSA-519, CVE-2026-102699, CVE-2026-102702]
+ gnttab: cache-flush handling may cause page reference leak
+ [XSA-520, CVE-2026-102700]
+
* Wed Sep 16 2026 Michael Young <m.a.young@durham.ac.uk> - 4.21.2-2
- x86: DMs may cause mem leak by IRQ binding [XSA-509, CVE-2026-62437]
x86: improper handling of HVM emulation return codes
diff --git a/xsa515.patch b/xsa515.patch
new file mode 100644
index 0000000..ca6e6f8
--- /dev/null
+++ b/xsa515.patch
@@ -0,0 +1,36 @@
+From: Andrew Cooper <andrew.cooper3@citrix.com>
+Subject: x86/amd: Fix inverted condition in zenbleed_use_chickenbit()
+
+The identified commit inverted the condition under which Xen chooses
+to set the Zenbleed chickenbit.
+
+Undo that, and leave a better comment explaining why.
+
+Found by AI review of the referenced commit.
+
+This is XSA-515 / CVE-2026-79608.
+
+Fixes: d0c75dc4c028 ("x86/amd: Fix race editing DE_CFG")
+Assisted-by: Sashiko + Opus 5.0
+Reported-by: George Dunlap <dunlapg@umich.edu>
+Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
+Reviewed-by: Jan Beulich <jbeulich@suse.com>
+
+diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
+index 70783c9a0af0..148886fe2ea1 100644
+--- a/xen/arch/x86/cpu/amd.c
++++ b/xen/arch/x86/cpu/amd.c
+@@ -887,7 +887,12 @@ static bool zenbleed_use_chickenbit(void)
+ return is_zen2_uarch();
+ }
+
+- return (uint8_t)curr_rev >= fixed_rev;
++ /*
++ * Zenbleed can be mitigated by disabling Floating-Point
++ * Mov-Elimination, but this is expensive. Only do so when we
++ * don't have a fix in microcode.
++ */
++ return (uint8_t)curr_rev < fixed_rev;
+ }
+
+ void amd_init_de_cfg(const struct cpuinfo_x86 *c)
diff --git a/xsa516.patch b/xsa516.patch
new file mode 100644
index 0000000..ee60d85
--- /dev/null
+++ b/xsa516.patch
@@ -0,0 +1,250 @@
+From: George Dunlap <gwd@xenproject.org>
+Subject: x86/pv: map each vCPU's root page table in its per-domain area
+
+For XPTI enabled VMs, restore_all_guest() copies most of the active L4
+pagetable into the per-CPU root_pgt. The L4 is read via the
+directmap.
+
+Unfortunately, there was no accounting for the fact that PV guests
+have short directmaps. For an L4 living beyond the 5T boundary (3.5T
+for CONFIG_BIGMEM), Xen will copy arbitrary data from guest-controlled
+virtual address space into the per-CPU root_pgt, instead of the
+intended L4.
+
+Xen has per-domain mappings for the LDT and GDT, with two pages
+reserved for Xen's use in the GDT but only one in use. Reuse GDT page
+15 to map the effective L4. The GDT limit keeps implicit accesses out
+of this page.
+
+We update this mapping in make_cr3(), the only place a non-empty value
+of v->arch.cr3 is written into a guest's vcpu struct, for two reasons.
+First is reference counting: this makes it easier to argue that the
+reference for v->arch.cr3 itself covers the reference for the mapping.
+
+Secondly, this guarantees that all updates, even updates made in
+shadow mode, result in an update to the mapping. During live
+migration, it's possible for guest_get_eff_kern_l1e() to result in a
+modified value of v->arch.cr3 (sketch below); placing the mapping
+update at make_cr3() catches this, while other candidate locations
+like write_ptbase() and toggle_guest_mode() don't.
+
+Note that we introduce the idea of an "effective L4" here, to mean
+"guest L4 after any transformations": XPTI copies either the actual
+guest L4 if not shadowed, or the shadow L4 (transformed) if shadowed.
+
+Sketch: guest_get_eff_kern_l1e() has a pair of toggle_guest_pt() calls
+which happen if the guest is in user mode. During live migration, a
+log-dirty clean will do a domain_pause and then call
+shadow_blow_tables(), unpinning the shadow of the guest user root
+pagetable. After execution resumes, the first toggle_guest_pt() could
+then cause that page to become unshadowed. The second
+toggle_guest_pt() would then re-shadow it, possibly with a different
+backing shadow page.
+
+This is XSA-516 / CVE-2026-79609.
+
+Fixes: 5784de3e2067 ("x86: Meltdown band-aid against malicious 64-bit PV guests")
+Assisted-by: Claude Code:claude-fable-5-1
+Signed-off-by: George Dunlap <gwd@xenproject.org>
+Reviewed-by: Jan Beulich <jbeulich@suse.com>
+---
+
+Changes in v4:
+- Reworded the pv_unmap_eff_root_pt() comment and the lifetime note
+ below. The window has exactly v->arch.cr3's validity: in shadow mode
+ both name the top-level shadow after shadow_teardown() has released
+ it, until vcpu_destroy_pagetables() clears them, and nothing uses
+ either by then. The earlier wording claimed more.
+- Tweaked commit message wording re sketch to make it clear it's not a race
+- Reworked "last page of GDT" comment to be more technically accurate
+
+(A patch marked v3 was sent erroneously.)
+
+Changes in v2 (of security@ posting):
+- Merged is_pv_domain() condition in make_cr3()
+- Use KB(64) as requested during review
+- BUILD_BUG_ON() now expressed with LAST_RESERVED_GDT_BYTE as
+ requested during review
+- Switched to "PV_EFF_ROOT_PT" to specify that this is after potential
+ shadow transformations
+- Trimmed down the commit message, clarified make_cr3() rationale.
+
+Relative to v5:
+- The window is the spare GDT page after Xen's reserved range rather
+ than a new sub-area: no allocation (v2's array drew a 32x
+ over-allocation remark) and nothing to create or tear down per vCPU.
+- The refresh is in make_cr3(), which every root change passes through,
+ shadow mode included, instead of write_ptbase() plus the toggle.
+- The window is cleared in vcpu_destroy_pagetables() alongside
+ v->arch.cr3, so it has exactly v->arch.cr3's validity.
+- The entry.S computation keeps the v2 shape; the mapping stays
+ read-only, as suggested on v2.
+- Build-time checks pin the window to the reserved range.
+It applies on its own to current staging, using the per-vCPU GDT L1
+table Xen already keeps.
+---
+ xen/arch/x86/include/asm/config.h | 23 ++++++++++++++--
+ xen/arch/x86/include/asm/desc.h | 10 +++++++
+ xen/arch/x86/mm.c | 45 +++++++++++++++++++++++++++++--
+ xen/arch/x86/x86_64/asm-offsets.c | 1 +
+ xen/arch/x86/x86_64/entry.S | 7 ++++-
+ 5 files changed, 81 insertions(+), 5 deletions(-)
+
+diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h
+index 1b28349a42..0c004edc66 100644
+--- a/xen/arch/x86/include/asm/config.h
++++ b/xen/arch/x86/include/asm/config.h
+@@ -249,11 +249,30 @@ extern unsigned long xen_phys_start;
+ #define GDT_LDT_VIRT_START PERDOMAIN_VIRT_SLOT(0)
+ #define GDT_LDT_VIRT_END (GDT_LDT_VIRT_START + (GDT_LDT_MBYTES << 20))
+
+-/* The address of a particular VCPU's GDT or LDT. */
++/*
++ * The address of a particular VCPU's GDT or LDT; each is the architectural
++ * maximum of 64k.
++ */
++#define GDT_VIRT_SIZE KB(64)
+ #define GDT_VIRT_START(v) \
+ (PERDOMAIN_VIRT_START + ((v)->vcpu_id << GDT_LDT_VCPU_VA_SHIFT))
+ #define LDT_VIRT_START(v) \
+- (GDT_VIRT_START(v) + (64*1024))
++ (GDT_VIRT_START(v) + GDT_VIRT_SIZE)
++
++/*
++ * The vCPU's effective root page table, mapped read-only in the last
++ * page of its GDT: the page after Xen's reserved range, beyond the
++ * GDT limit Xen loads (LAST_RESERVED_GDT_BYTE), so no selector can
++ * reach it. "Effective" is the root page table the vCPU is meant to
++ * run on after any transformation: the guest's own, or its shadow
++ * under shadow paging. XPTI does not transform it further but copies
++ * from it: the exit path reads the guest-visible L4 slots from here.
++ * Adding a reserved GDT page would mean moving the window out of the
++ * GDT first; pv_map_eff_root_pt() checks the layout at build time.
++ */
++#define PV_EFF_ROOT_PT_PAGE (FIRST_RESERVED_GDT_PAGE + 1)
++#define PV_EFF_ROOT_PT_OFFSET (PV_EFF_ROOT_PT_PAGE << PAGE_SHIFT)
++#define PV_EFF_ROOT_PT(v) (GDT_VIRT_START(v) + PV_EFF_ROOT_PT_OFFSET)
+
+ /* map_domain_page() map cache. The second per-domain-mapping sub-area. */
+ #define MAPCACHE_VCPU_ENTRIES (CONFIG_PAGING_LEVELS * CONFIG_PAGING_LEVELS)
+diff --git a/xen/arch/x86/include/asm/desc.h b/xen/arch/x86/include/asm/desc.h
+index dcbdac3ff7..7cbb9a7336 100644
+--- a/xen/arch/x86/include/asm/desc.h
++++ b/xen/arch/x86/include/asm/desc.h
+@@ -6,6 +6,16 @@
+ /*
+ * Xen reserves a memory page of GDT entries.
+ * No guest GDT entries exist beyond the Xen reserved area.
++ *
++ * The page after the reserved area, the last of the GDT's 64k, is the
++ * PV effective root-table window (PV_EFF_ROOT_PT_PAGE, config.h):
++ * beyond the GDT limit Xen loads (LAST_RESERVED_GDT_BYTE), so no
++ * selector reaches it. Xen uses only a few of the reserved page's
++ * 512 slots, so more Xen descriptors never need another page; if one
++ * were needed regardless, the window would have to move out of the
++ * GDT first (into a per-domain sub-area of its own), as this is the
++ * GDT's last page. pv_map_eff_root_pt() checks the layout at build
++ * time.
+ */
+ #define NR_RESERVED_GDT_PAGES 1
+ #define NR_RESERVED_GDT_BYTES (NR_RESERVED_GDT_PAGES * PAGE_SIZE)
+diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
+index b158742408..f4b87ed5ec 100644
+--- a/xen/arch/x86/mm.c
++++ b/xen/arch/x86/mm.c
+@@ -510,13 +510,52 @@ void share_xen_page_with_guest(struct page_info *page, struct domain *d,
+ nrspin_unlock(&d->page_alloc_lock);
+ }
+
++/*
++ * Map @mfn read-only at v's PV_EFF_ROOT_PT() window. The window lives in
++ * v's per-domain area, so v need not be current; the local flush is for
++ * when it is, with its own page tables loaded.
++ */
++static void pv_map_eff_root_pt(const struct vcpu *v, mfn_t mfn)
++{
++ /*
++ * The window must lie beyond the GDT limit Xen loads, so that no
++ * selector reaches it, and within the GDT's 64k.
++ */
++ BUILD_BUG_ON(PV_EFF_ROOT_PT_OFFSET <= LAST_RESERVED_GDT_BYTE);
++ BUILD_BUG_ON(PV_EFF_ROOT_PT_OFFSET + PAGE_SIZE > GDT_VIRT_SIZE);
++
++ l1e_write(pv_gdt_ptes(v) + PV_EFF_ROOT_PT_PAGE,
++ l1e_from_mfn(mfn, __PAGE_HYPERVISOR_RO));
++ flush_tlb_one_local(PV_EFF_ROOT_PT(v));
++}
++
++/*
++ * Clear the window. Its lifetime is v->arch.cr3's: make_cr3() writes it
++ * wherever v->arch.cr3 is set, and vcpu_destroy_pagetables() clears it where
++ * v->arch.cr3 is zeroed. In shadow mode both name a top-level shadow, which
++ * shadow_teardown() releases before that point; nothing uses either once the
++ * vCPU can no longer run.
++ */
++static void pv_unmap_eff_root_pt(const struct vcpu *v)
++{
++ l1e_write(pv_gdt_ptes(v) + PV_EFF_ROOT_PT_PAGE, l1e_empty());
++ flush_tlb_one_local(PV_EFF_ROOT_PT(v));
++}
++
+ void make_cr3(struct vcpu *v, mfn_t mfn)
+ {
+ struct domain *d = v->domain;
+
+ v->arch.cr3 = mfn_x(mfn) << PAGE_SHIFT;
+- if ( is_pv_domain(d) && d->arch.pv.pcid )
+- v->arch.cr3 |= get_pcid_bits(v, false);
++
++ if ( is_pv_domain(d) )
++ {
++ if ( d->arch.pv.pcid )
++ v->arch.cr3 |= get_pcid_bits(v, false);
++
++ if ( d->arch.pv.xpti )
++ pv_map_eff_root_pt(v, mfn);
++ }
+ }
+
+ void write_ptbase(struct vcpu *v)
+@@ -3224,6 +3263,8 @@ int vcpu_destroy_pagetables(struct vcpu *v)
+ return rc;
+
+ v->arch.cr3 = 0;
++ if ( is_pv_domain(v->domain) && v->domain->arch.pv.xpti )
++ pv_unmap_eff_root_pt(v);
+
+ /*
+ * Get the top-level guest page; either the guest_table itself, for
+diff --git a/xen/arch/x86/x86_64/asm-offsets.c b/xen/arch/x86/x86_64/asm-offsets.c
+index baf266ab80..0549fd5e8d 100644
+--- a/xen/arch/x86/x86_64/asm-offsets.c
++++ b/xen/arch/x86/x86_64/asm-offsets.c
+@@ -82,6 +82,7 @@ void __dummy__(void)
+
+ #undef OFFSET_EF
+
++ OFFSET(VCPU_id, struct vcpu, vcpu_id);
+ OFFSET(VCPU_processor, struct vcpu, processor);
+ OFFSET(VCPU_domain, struct vcpu, domain);
+ OFFSET(VCPU_vcpu_info, struct vcpu, vcpu_info_area.map);
+diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
+index 59953c9f52..ba175bde7c 100644
+--- a/xen/arch/x86/x86_64/entry.S
++++ b/xen/arch/x86/x86_64/entry.S
+@@ -200,9 +200,14 @@ FUNC_LOCAL(restore_all_guest)
+ movabs $PADDR_MASK & PAGE_MASK, %rsi
+ movabs $DIRECTMAP_VIRT_START, %rcx
+ and %rsi, %rdi
+- and %r9, %rsi
+ add %rcx, %rdi
++
++ /* Effective root page table is mapped at PV_EFF_ROOT_PT(v) */
++ mov VCPU_id(%rbx), %esi
++ shl $GDT_LDT_VCPU_VA_SHIFT, %rsi
++ movabs $GDT_LDT_VIRT_START + PV_EFF_ROOT_PT_OFFSET, %rcx
+ add %rcx, %rsi
++
+ mov $ROOT_PAGETABLE_FIRST_XEN_SLOT, %ecx
+ mov root_table_offset(SH_LINEAR_PT_VIRT_START)*8(%rsi), %r8
+ mov %r8, root_table_offset(SH_LINEAR_PT_VIRT_START)*8(%rdi)
diff --git a/xsa517.patch b/xsa517.patch
new file mode 100644
index 0000000..e4a0740
--- /dev/null
+++ b/xsa517.patch
@@ -0,0 +1,45 @@
+From: Jan Beulich <jbeulich@suse.com>
+Subject: gnttab: address fallout from XSA-501
+
+A v1 -> v2 change isn't the only scenario where "status" may go stale in
+map_grant_ref(). Across a v2 -> v1 -> v2 change the status pages would
+have been freed and re-populated, possibly changing the pages used for the
+array. Check the pointer against the expected version-dependent value.
+
+This is XSA-517 / CVE-2026-79610.
+
+Fixes: 96dfeb41774a ("gnttab: cope with version changes racing other operations")
+Assisted-by: Claude
+Reported-by: Teddy Astie <teddy.astie@vates.tech>
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
+---
+v2: Add parentheses around the || expression.
+
+--- a/xen/common/grant_table.c
++++ b/xen/common/grant_table.c
+@@ -1350,13 +1350,19 @@ map_grant_ref(
+
+ grant_read_lock(rgt);
+
+- if ( unlikely(evaluate_nospec((rgt->gt_version == 1) !=
+- (status == &shah->flags))) )
++ /*
++ * After a v1 -> v2 change behind our backs "ref" may now be out of
++ * bounds. While after a v2 -> v1 -> v2 change "ref" would still be
++ * suitably bounded, the underlying status page may have moved.
++ */
++ if ( evaluate_nospec(rgt->gt_version == 1
++ ? status != &shah->flags
++ : (ref >= nr_grant_entries(rgt) ||
++ status != &status_entry(rgt, ref))) )
+ {
+ /*
+- * After a v1 -> v2 change behind our backs "ref" may now be out of
+- * bounds. Recalculate it, but only for reserved entries. Others
+- * will have been cleared anyway by the version change.
++ * Recalculate status, but only for reserved entries. Others will
++ * have been cleared anyway by the version change(s).
+ */
+ if ( ref < GNTTAB_NR_RESERVED_ENTRIES )
+ status = evaluate_nospec(rgt->gt_version == 1)
diff --git a/xsa518.patch b/xsa518.patch
new file mode 100644
index 0000000..7c9cf54
--- /dev/null
+++ b/xsa518.patch
@@ -0,0 +1,76 @@
+From: Andrew Cooper <andrew.cooper3@citrix.com>
+Subject: x86/vmx: Rework #DB intercept logic to fix VMEntry failure with BTF
+
+The consistency checks in effect when Blocked-by-STI/MovSS are active includes
+DEBUGCTL.BTF too. Take this into account when editing PENDING_DBG.BS.
+
+This ends up narrowing the cases where PENDING_DBG is modified. Rework the
+comment to be more precise.
+
+This is XSA-518 / CVE-2026-79611.
+
+Fixes: 1d3eb8259804 ("x86/vtx: Work around SingleStep + STI/MovSS VMEntry failures")
+Reported-by: Teddy Astie <teddy.astie@vates.tech>
+Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
+Reviewed-by: Jan Beulich <jbeulich@suse.com>
+Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
+---
+ xen/arch/x86/hvm/vmx/vmx.c | 41 +++++++++++++++++---------------------
+ 1 file changed, 18 insertions(+), 23 deletions(-)
+
+diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
+index 6237623a4c16..97dd37dd7ce4 100644
+--- a/xen/arch/x86/hvm/vmx/vmx.c
++++ b/xen/arch/x86/hvm/vmx/vmx.c
+@@ -4396,33 +4396,28 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
+ * We intercept #DB unconditionally to work around CVE-2015-8104 /
+ * XSA-156 (guest-kernel induced host DoS).
+ *
+- * STI/MovSS shadows block/defer interrupts/exceptions (exact
+- * details are complicated and poorly documented). Debug
+- * exceptions delayed for any reason are stored in the
+- * PENDING_DBG_EXCEPTIONS field.
++ * Most sources of #DB accumuate status in PENDING_DBG, which are
++ * then dispatched in priority order prior to fetching the next
++ * instruction. When the #DB intercept triggers, PENDING_DBG is 0
++ * with the status bits having moved into EXIT_QUALIFICATION.
+ *
+- * The falling edge of PENDING_DBG causes #DB to be delivered,
+- * resulting in a VMExit, as #DB is intercepted. The VMCS still
+- * reports blocked-by-STI/MovSS.
++ * At any point if Blocked-by-STI/MovSS are active, extra VMEntry
++ * consistency checks are applied, cross-checking EFLAGS.TF,
++ * PENDING_DBG.BS and DEBUGCTL.BTF. These consistency checks
++ * apply to Activity-state-HLT too, but Xen doesn't support this.
+ *
+- * The VMEntry checks when EFLAGS.TF is set don't like a VMCS in
+- * this state. Despite a #DB queued in VMENTRY_INTR_INFO, the
+- * state is rejected as DR6.BS isn't pending. Fix this up.
++ * The VMCS state at the point of #DB intercept does not satisfy
++ * the consistency checks. In the case that a SingleStep should
++ * be pending, fill PENDING_DBG back in to satisfy the consitency
++ * check.
+ */
+- if ( unlikely(regs->eflags & X86_EFLAGS_TF) )
++ if ( unlikely(regs->eflags & X86_EFLAGS_TF) &&
++ (vmread(GUEST_INTERRUPTIBILITY_INFO) &
++ (VMX_INTR_SHADOW_STI | VMX_INTR_SHADOW_MOV_SS)) &&
++ !(vmread(GUEST_IA32_DEBUGCTL) & IA32_DEBUGCTLMSR_BTF) )
+ {
+- unsigned long int_info;
+-
+- __vmread(GUEST_INTERRUPTIBILITY_INFO, &int_info);
+-
+- if ( int_info & (VMX_INTR_SHADOW_STI | VMX_INTR_SHADOW_MOV_SS) )
+- {
+- unsigned long pending_dbg;
+-
+- __vmread(GUEST_PENDING_DBG_EXCEPTIONS, &pending_dbg);
+- __vmwrite(GUEST_PENDING_DBG_EXCEPTIONS,
+- pending_dbg | DR_STEP);
+- }
++ ASSERT(vmread(GUEST_PENDING_DBG_EXCEPTIONS) == 0);
++ __vmwrite(GUEST_PENDING_DBG_EXCEPTIONS, X86_DR6_BS);
+ }
+
+ if ( !v->domain->debugger_attached )
diff --git a/xsa519-1.patch b/xsa519-1.patch
new file mode 100644
index 0000000..5cdc504
--- /dev/null
+++ b/xsa519-1.patch
@@ -0,0 +1,116 @@
+From: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
+Subject: xen/arm: Fix size underflow in invalidate_dcache_va_range()
+
+When the start address is not cacheline aligned, the bytes covered by
+the first, partial cacheline are subtracted from 'size'. Nothing checks
+that the region actually extends beyond that cacheline, so if it does
+not, the unsigned subtraction underflows and the loop that follows walks
+practically the entire address space.
+
+For example, with a 64-byte cacheline, p = 0x40000001 and size = 1:
+
+ p & cacheline_mask -> 1, so the partial head is taken
+ size -= 64 - 1 -> 1 - 63 underflows to 0xffffffffffffffc2
+
+Instead of a single "dc civac" at 0x40000000, the loop then runs
+288230376151711743 times, issuing "dc ivac" from 0x40000040 upwards.
+Invalidating without cleaning discards dirty cachelines, so this
+corrupts whatever is mapped along the way until Xen takes a data abort.
+
+Moreover, _cache_flush() in common/grant_table.c, reachable from a guest
+via GNTTABOP_cache_flush, bounds 'offset' and 'length' against the page
+size but requires no alignment, so GNTTAB_CACHE_INVAL with offset = 1
+and length = 1 is enough to trigger this. Note that the page may belong
+to a different domain (the d != owner path), so the data being discarded
+is not necessarily the caller's own.
+
+The subtraction dates back to the fix for XSA-437, so this is a regression
+in that change.
+
+Fix this by detecting the underflow instead of letting it happen: if the
+region ends inside the first cacheline, there is nothing left to flush
+and the function bails out right after cleaning it. Partially covered
+cachelines are still cleaned as well as invalidated, so that data outside
+of the region is not discarded.
+
+Additionally, drop 'idx' and advance 'p' directly instead. It simplifies
+the logic while using fewer variables and less arithmetic.
+
+Note that the partial head is now cleaned using the unaligned start of the
+region instead of the start of its cacheline. This is permitted by the
+architecture; the Arm ARM (DDI 0487) states:
+
+ "When a DC instruction requires an address argument this takes the form
+ of a 64-bit register that holds the VA argument. No alignment
+ restrictions apply for this address."
+
+The same applies on Arm32.
+
+Also, switch the asm() in the loop to asm_inline, like the neighbouring
+ones: the wrapper expands to a single instruction with a trailing
+semicolon, which GCC counts as two statements, overestimating the size
+of the function when deciding whether to inline it.
+
+This is CVE-2026-102699, part of XSA-519.
+
+Fixes: 9a216e92de9f ("xen/arm: page: Handle cache flush of an element at the top of the address space")
+Signed-off-by: Leonid Komarianskyi <leonid_komarianskyi@epam.com>
+Reviewed-by: Jan Beulich <jbeulich@suse.com>
+Reviewed-by: Julien Grall <julien@xen.org>
+
+diff --git a/xen/arch/arm/include/asm/page.h b/xen/arch/arm/include/asm/page.h
+index 90100a96dfda..6da4745736a2 100644
+--- a/xen/arch/arm/include/asm/page.h
++++ b/xen/arch/arm/include/asm/page.h
+@@ -168,7 +168,7 @@ static inline size_t read_dcache_line_bytes(void)
+ static inline int invalidate_dcache_va_range(const void *p, unsigned long size)
+ {
+ size_t cacheline_mask = dcache_line_bytes - 1;
+- unsigned long idx = 0;
++ unsigned long partial_head;
+
+ if ( !size )
+ return 0;
+@@ -178,23 +178,35 @@ static inline int invalidate_dcache_va_range(const void *p, unsigned long size)
+
+ dsb(sy); /* So the CPU issues all writes to the range */
+
+- if ( (uintptr_t)p & cacheline_mask )
++ /*
++ * A cacheline only partially covered by the region has to be cleaned as
++ * well as invalidated, so that data living outside of the region is not
++ * discarded.
++ */
++ partial_head = (uintptr_t)p & cacheline_mask;
++ if ( partial_head )
+ {
+- size -= dcache_line_bytes - ((uintptr_t)p & cacheline_mask);
+- p = (void *)((uintptr_t)p & ~cacheline_mask);
++ unsigned long rem = dcache_line_bytes - partial_head;
++
+ asm_inline volatile (
+ __clean_and_invalidate_dcache_one(0) :: "r" (p) );
+- p += dcache_line_bytes;
++ p += rem;
++
++ /* The region may end within this cacheline, leaving nothing to do. */
++ if ( __builtin_usubl_overflow(size, rem, &size) )
++ goto done;
+ }
+
+ for ( ; size >= dcache_line_bytes;
+- idx += dcache_line_bytes, size -= dcache_line_bytes )
+- asm volatile (__invalidate_dcache_one(0) : : "r" (p + idx));
++ p += dcache_line_bytes, size -= dcache_line_bytes )
++ asm_inline volatile (__invalidate_dcache_one(0) : : "r" (p));
+
++ /* Partial tail must be cleaned as well. */
+ if ( size > 0 )
+ asm_inline volatile (
+- __clean_and_invalidate_dcache_one(0) :: "r" (p + idx) );
++ __clean_and_invalidate_dcache_one(0) :: "r" (p) );
+
++ done:
+ dsb(sy); /* So we know the flushes happen before continuing */
+
+ return 0;
diff --git a/xsa519-2.patch b/xsa519-2.patch
new file mode 100644
index 0000000..5a24b70
--- /dev/null
+++ b/xsa519-2.patch
@@ -0,0 +1,66 @@
+From: Andrew Cooper <andrew.cooper3@citrix.com>
+Subject: xen/gnttab: Prevent GNTTABOP_cache_flush from corrupting RO grants
+
+Grants can be offered read-only by the owning domain. While a domain mapping
+a RO grant may have a need to invalidate the cache, it must not modify the
+other-guests data while doing so. Force-upgrade to a clean operation in this
+case.
+
+This is CVE-2026-102702, part of XSA-519.
+
+Fixes: 18e8d22fe750 ("introduce GNTTABOP_cache_flush")
+Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
+Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
+
+diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
+index 8892653ced70..03e919fd2424 100644
+--- a/xen/common/grant_table.c
++++ b/xen/common/grant_table.c
+@@ -983,6 +983,13 @@ static struct active_grant_entry *grant_map_exists(const struct domain *ld,
+
+ return ERR_PTR(-EINVAL);
+ }
++
++static bool grant_map_is_ro(struct active_grant_entry *act)
++{
++ ASSERT(spin_is_locked(&act->lock));
++
++ return (act->pin & (GNTPIN_hstw_mask | GNTPIN_devw_mask)) == 0;
++}
+ #endif /* CONFIG_HAS_GRANT_CACHE_FLUSH */
+
+ union maptrack_node {
+@@ -3597,7 +3604,7 @@ gnttab_swap_grant_ref(XEN_GUEST_HANDLE_PARAM(gnttab_swap_grant_ref_t) uop,
+ }
+
+ #ifdef CONFIG_HAS_GRANT_CACHE_FLUSH
+-static int _cache_flush(const gnttab_cache_flush_t *cflush, grant_ref_t *cur_ref)
++static int _cache_flush(gnttab_cache_flush_t *cflush, grant_ref_t *cur_ref)
+ {
+ struct domain *d, *owner;
+ struct page_info *page;
+@@ -3648,6 +3655,24 @@ static int _cache_flush(const gnttab_cache_flush_t *cflush, grant_ref_t *cur_ref
+ put_page(page);
+ return act ? PTR_ERR(act) : 1;
+ }
++
++ /*
++ * If the grant mapping is read-only, it must be cleaned as well as
++ * invalidated. Invalidation without cleaning may modify memory the
++ * granter is expecting not to change.
++ *
++ * It is highly unlikely but legal to have multiple grant mappings of
++ * differing read-only-ness. If a read-write grant mapping is found
++ * first, then it's fine to invalidate without clean.
++ *
++ * If a read-only grant mapping is found first, a later read-write
++ * mapping could be missed. Assume that the read-only mapping is the
++ * only mapping. The cost is a clean of up to 4k, while the saving is
++ * not requiring the search of grant maps to be exhaustive in order to
++ * spot a corner-case expected not to exist in practice.
++ */
++ if ( grant_map_is_ro(act) )
++ cflush->op |= GNTTAB_CACHE_CLEAN;
+ }
+
+ v = map_domain_page(mfn);
diff --git a/xsa520.patch b/xsa520.patch
new file mode 100644
index 0000000..c519e51
--- /dev/null
+++ b/xsa520.patch
@@ -0,0 +1,23 @@
+From: Jan Beulich <jbeulich@suse.com>
+Subject: gnttab: properly drop page ref on a GNTTAB_cache_flush error path
+
+Ordinary domains always have a grant table. System domains don't, but they
+also don't normally "own" pages - except for DOM_IO and DOM_COW on x86.
+
+This is XSA-520 / CVE-2026-102700.
+
+Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
+Reported-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+
+--- a/xen/common/grant_table.c
++++ b/xen/common/grant_table.c
+@@ -3624,6 +3624,8 @@ static int _cache_flush(const gnttab_cac
+ owner = page_get_owner_and_reference(page);
+ if ( !owner || !owner->grant_table )
+ {
++ if ( owner )
++ put_page(page);
+ rcu_unlock_domain(d);
+ return -EPERM;
+ }
reply other threads:[~2026-10-18 21:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=179235989630.1.5009244340006866031.rpms-xen-f73fb7ca433c@fedoraproject.org \
--to=m.a.young@durham.ac.uk \
--cc=git-commits@fedoraproject.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