public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/qemu] eln: * Mon Oct 26 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-3
@ 2026-11-25  8:58 Miroslav Rezanina
  0 siblings, 0 replies; only message in thread
From: Miroslav Rezanina @ 2026-11-25  8:58 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/qemu
            Branch : eln
            Commit : e9bbaa1da4fc03ee915f96776d136210138dfaf1
            Author : Miroslav Rezanina <mrezanin@redhat.com>
            Date   : 2026-11-24T20:22:07-05:00
            Stats  : +181/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/qemu/c/e9bbaa1da4fc03ee915f96776d136210138dfaf1?branch=eln

            Log:
            * Mon Oct 26 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-3

- kvm-hw-arm-tegra241-cmdqv-Keep-VINTF-page0-region-alive.patch [RHEL-254706]
- Resolves: RHEL-254706
  (NVIDIA:Backport hw/arm/tegra241-cmdqv: Keep VINTF page0 region alive - RHEL 10.4)

---
diff --git a/kvm-hw-arm-tegra241-cmdqv-Keep-VINTF-page0-region-alive.patch b/kvm-hw-arm-tegra241-cmdqv-Keep-VINTF-page0-region-alive.patch
new file mode 100644
index 0000000..0c5ebcc
--- /dev/null
+++ b/kvm-hw-arm-tegra241-cmdqv-Keep-VINTF-page0-region-alive.patch
@@ -0,0 +1,173 @@
+From 93862e9917e9e815dba9ee5216484615c264cf35 Mon Sep 17 00:00:00 2001
+From: Gustavo Romero <gromero@redhat.com>
+Date: Tue, 20 Oct 2026 13:17:15 -0400
+Subject: [PATCH] hw/arm/tegra241-cmdqv: Keep VINTF page0 region alive
+
+RH-Author: Gustavo Romero <None>
+RH-MergeRequest: 527: hw/arm/tegra241-cmdqv: Keep VINTF page0 region alive
+RH-Jira: RHEL-254706
+RH-Acked-by: Sebastian Ott <sebott@redhat.com>
+RH-Acked-by: Eric Auger <eric.auger@redhat.com>
+RH-Commit: [1/1] 931cb9d4d89f11ddd97a45dbdb73b86c438629fe (gbromero/qemu-kvm)
+
+JIRA: https://redhat.atlassian.net/browse/RHEL-254706
+
+commit 4bb3b6e7c9668436fd30ebfe7c65ca6c9c15104f
+Author: Matthew R. Ochs <mochs@nvidia.com>
+Date:   Mon Sep 14 15:25:54 2026 -0700
+
+    hw/arm/tegra241-cmdqv: Keep VINTF page0 region alive
+
+    With CMDQV enabled, resetting a guest after it enables VINTF invokes
+    the VINTF page0 unmap path. The resulting crash is intermittent and
+    has been observed on the RCU reclaim thread as:
+
+      reboot: Restarting system
+      double free or corruption (!prev)
+      ...
+      #5 address_space_dispatch_free
+      #6 flatview_destroy
+      #7 call_rcu_thread
+
+    FlatViews retain raw MemoryRegion pointers and release their references
+    asynchronously through RCU. The VINTF page0 unmap path removes the
+    subregion and immediately unparents and frees it. An old FlatView can
+    then access the freed region during teardown, resulting in a
+    use-after-free and heap corruption.
+
+    Embed the VINTF page0 MemoryRegion in Tegra241CMDQV and tie its lifetime
+    to the VINTF page0 mmap. Initialize and add the region disabled after
+    successful vIOMMU allocation, and remove and unparent it before releasing
+    the mmap during allocation unwind. Guest VINTF enable and disable then
+    only toggle the region with memory_region_set_enabled(). New FlatViews
+    omit the disabled region, while old views continue to reference valid
+    storage.
+
+    Keeping the region initialized across VINTF disable and reset is safe
+    because the vIOMMU association and its VINTF page0 mmap remain stable
+    once the guest CMDQ has been initialized. QEMU blocks hot-unplug of the
+    device that established the association, so later hot-adds reuse it
+    instead of associating the initialized guest CMDQ with a different host
+    SMMUv3. The CMDQV free_viommu path is therefore only invoked while
+    unwinding initial allocation, when the region is still disabled and has
+    never entered a FlatView.
+
+    Fixes: 5965b81ce283 ("hw/arm/tegra241-cmdqv: Use mmap'd host VINTF page0 for virtual VINTF page0")
+    Suggested-by: Shameer Kolothum <skolothumtho@nvidia.com>
+    Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
+    Message-id: 20260914222554.708582-1-mochs@nvidia.com
+    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
+    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
+
+Signed-off-by: Gustavo Romero <gromero@redhat.com>
+---
+ hw/arm/tegra241-cmdqv.c | 54 +++++++++++++++++++++--------------------
+ hw/arm/tegra241-cmdqv.h |  2 +-
+ 2 files changed, 29 insertions(+), 27 deletions(-)
+
+diff --git a/hw/arm/tegra241-cmdqv.c b/hw/arm/tegra241-cmdqv.c
+index 273633e629..57041408a7 100644
+--- a/hw/arm/tegra241-cmdqv.c
++++ b/hw/arm/tegra241-cmdqv.c
+@@ -131,36 +131,12 @@ static void tegra241_cmdqv_reset_vcmdq_cache(Tegra241CMDQV *cmdqv, int index)
+ 
+ static void tegra241_cmdqv_guest_unmap_vintf_page0(Tegra241CMDQV *cmdqv)
+ {
+-    if (!cmdqv->mr_vintf_page0) {
+-        return;
+-    }
+-
+-    memory_region_del_subregion(&cmdqv->mmio_cmdqv, cmdqv->mr_vintf_page0);
+-    object_unparent(OBJECT(cmdqv->mr_vintf_page0));
+-    g_free(cmdqv->mr_vintf_page0);
+-    cmdqv->mr_vintf_page0 = NULL;
++    memory_region_set_enabled(&cmdqv->mr_vintf_page0, false);
+ }
+ 
+ static void tegra241_cmdqv_guest_map_vintf_page0(Tegra241CMDQV *cmdqv)
+ {
+-    char *name;
+-
+-    if (cmdqv->mr_vintf_page0) {
+-        return;
+-    }
+-
+-    name = g_strdup_printf("%s vintf-page0",
+-                           memory_region_name(&cmdqv->mmio_cmdqv));
+-    cmdqv->mr_vintf_page0 = g_malloc0(sizeof(*cmdqv->mr_vintf_page0));
+-    memory_region_init_ram_device_ptr(cmdqv->mr_vintf_page0,
+-                                      memory_region_owner(&cmdqv->mmio_cmdqv),
+-                                      name, VINTF_PAGE_SIZE,
+-                                      cmdqv->vintf_page0);
+-    memory_region_set_skip_iommu_map(cmdqv->mr_vintf_page0, true);
+-    memory_region_add_subregion_overlap(&cmdqv->mmio_cmdqv,
+-                                        CMDQV_VINTF_PAGE0_BASE,
+-                                        cmdqv->mr_vintf_page0, 1);
+-    g_free(name);
++    memory_region_set_enabled(&cmdqv->mr_vintf_page0, true);
+ }
+ 
+ static void tegra241_cmdqv_free_vcmdq(Tegra241CMDQV *cmdqv, int index)
+@@ -899,6 +875,9 @@ static void tegra241_cmdqv_free_viommu(SMMUv3State *s)
+         cmdqv->veventq = NULL;
+     }
+     if (cmdqv->vintf_page0) {
++        memory_region_del_subregion(&cmdqv->mmio_cmdqv,
++                                    &cmdqv->mr_vintf_page0);
++        object_unparent(OBJECT(&cmdqv->mr_vintf_page0));
+         munmap(cmdqv->vintf_page0, VINTF_PAGE_SIZE);
+         cmdqv->vintf_page0 = NULL;
+     }
+@@ -910,6 +889,7 @@ tegra241_cmdqv_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
+                             uint32_t *out_viommu_id, Error **errp)
+ {
+     Tegra241CMDQV *cmdqv = s->s_accel->cmdqv;
++    char *name;
+     uint32_t viommu_id, veventq_id, veventq_fd;
+     IOMMUFDVeventq *veventq;
+     int flags;
+@@ -955,6 +935,28 @@ tegra241_cmdqv_alloc_viommu(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
+ 
+     /* Set up event handler for veventq fd */
+     qemu_set_fd_handler(veventq_fd, tegra241_cmdqv_event_read, NULL, cmdqv);
++
++    /*
++     * Tie the MemoryRegion lifetime to the VINTF page0 mmap. Initialize it
++     * disabled. If initial vIOMMU setup later unwinds, the region has never
++     * entered a FlatView and can be removed and unparented before releasing
++     * the mmap. After successful setup, keep it parented across guest disable
++     * and reset, and only toggle its enabled state so old FlatViews continue
++     * to reference valid storage.
++     */
++    name = g_strdup_printf("%s vintf-page0",
++                           memory_region_name(&cmdqv->mmio_cmdqv));
++    memory_region_init_ram_device_ptr(&cmdqv->mr_vintf_page0,
++                                      memory_region_owner(&cmdqv->mmio_cmdqv),
++                                      name, VINTF_PAGE_SIZE,
++                                      cmdqv->vintf_page0);
++    memory_region_set_skip_iommu_map(&cmdqv->mr_vintf_page0, true);
++    memory_region_set_enabled(&cmdqv->mr_vintf_page0, false);
++    memory_region_add_subregion_overlap(&cmdqv->mmio_cmdqv,
++                                        CMDQV_VINTF_PAGE0_BASE,
++                                        &cmdqv->mr_vintf_page0, 1);
++    g_free(name);
++
+     *out_viommu_id = viommu_id;
+     return true;
+ 
+diff --git a/hw/arm/tegra241-cmdqv.h b/hw/arm/tegra241-cmdqv.h
+index de4c1e5335..bba985099e 100644
+--- a/hw/arm/tegra241-cmdqv.h
++++ b/hw/arm/tegra241-cmdqv.h
+@@ -49,7 +49,7 @@ typedef struct Tegra241CMDQV {
+     IOMMUFDVeventq *veventq;
+     IOMMUFDHWqueue *vcmdq[TEGRA241_CMDQV_MAX_CMDQ];
+     void *vintf_page0;
+-    MemoryRegion *mr_vintf_page0;
++    MemoryRegion mr_vintf_page0;
+ 
+     /* CMDQ-V Config page register cache */
+     uint32_t config;
+-- 
+2.56.0
+

diff --git a/qemu.spec b/qemu.spec
index 8123da2..ce5e738 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -143,7 +143,7 @@ Obsoletes: %{name}-block-ssh <= %{epoch}:%{version}                    \
 Summary: QEMU is a machine emulator and virtualizer
 Name: qemu-kvm
 Version: 11.1.0
-Release: 2%{?rcrel}%{?dist}%{?cc_suffix}
+Release: 3%{?rcrel}%{?dist}%{?cc_suffix}
 # Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
 # Epoch 15 used for RHEL 8
 # Epoch 17 used for RHEL 9 (due to release versioning offset in RHEL 8.5)
@@ -205,6 +205,8 @@ Patch0034: 0034-q35-add-new-machine-type-pc-q35-rhel10.4.0.patch
 Patch35: kvm-block-Fix-corruption-from-broken-RMW-atomicity.patch
 # For RHEL-272836 - Data corruption while using multiple iothreads on 4K backend disk
 Patch36: kvm-block-Remove-now-redundant-bdrv_wait_serialising_req.patch
+# For RHEL-254706 - NVIDIA:Backport hw/arm/tegra241-cmdqv: Keep VINTF page0 region alive - RHEL 10.4
+Patch37: kvm-hw-arm-tegra241-cmdqv-Keep-VINTF-page0-region-alive.patch
 
 %if %{have_clang}
 BuildRequires: clang
@@ -1294,6 +1296,11 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
 %endif
 
 %changelog
+* Mon Oct 26 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-3
+- kvm-hw-arm-tegra241-cmdqv-Keep-VINTF-page0-region-alive.patch [RHEL-254706]
+- Resolves: RHEL-254706
+  (NVIDIA:Backport hw/arm/tegra241-cmdqv: Keep VINTF page0 region alive - RHEL 10.4)
+
 * Wed Oct 21 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-2
 - kvm-spec-Add-http-to-block_drivers_ro_list.patch [RHEL-276051]
 - kvm-block-Fix-corruption-from-broken-RMW-atomicity.patch [RHEL-272836]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-25  8:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25  8:58 [rpms/qemu] eln: * Mon Oct 26 2026 Miroslav Rezanina <mrezanin@redhat.com> - 11.1.0-3 Miroslav Rezanina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox