fc2ddd6b1c
- kvm-memory-prevent-dma-reentracy-issues.patch [bz#1999236] - kvm-async-Add-an-optional-reentrancy-guard-to-the-BH-API.patch [bz#1999236] - kvm-checkpatch-add-qemu_bh_new-aio_bh_new-checks.patch [bz#1999236] - kvm-hw-replace-most-qemu_bh_new-calls-with-qemu_bh_new_g.patch [bz#1999236] - kvm-lsi53c895a-disable-reentrancy-detection-for-script-R.patch [bz#1999236] - kvm-bcm2835_property-disable-reentrancy-detection-for-io.patch [bz#1999236] - kvm-raven-disable-reentrancy-detection-for-iomem.patch [bz#1999236] - kvm-apic-disable-reentrancy-detection-for-apic-msi.patch [bz#1999236] - kvm-async-avoid-use-after-free-on-re-entrancy-guard.patch [bz#1999236] - kvm-memory-stricter-checks-prior-to-unsetting-engaged_in.patch [bz#1999236] - kvm-lsi53c895a-disable-reentrancy-detection-for-MMIO-reg.patch [bz#1999236] - kvm-hw-scsi-lsi53c895a-Fix-reentrancy-issues-in-the-LSI-.patch [bz#1999236] - kvm-target-i386-add-support-for-FLUSH_L1D-feature.patch [bz#2216203] - kvm-target-i386-add-support-for-FB_CLEAR-feature.patch [bz#2216203] - kvm-migration-Disable-postcopy-multifd-migration.patch [bz#2169733] - Resolves: bz#1999236 (CVE-2021-3750 virt:rhel/qemu-kvm: QEMU: hcd-ehci: DMA reentrancy issue leads to use-after-free [rhel-8]) - Resolves: bz#2216203 ([qemu-kvm]VM reports vulnerabilty to mmio_stale_data on patched host with microcode) - Resolves: bz#2169733 (Qemu on destination host crashed if migrate with postcopy and multifd enabled)
72 lines
2.5 KiB
Diff
72 lines
2.5 KiB
Diff
From d754050d260e2ad890cecd975df6e163c531b40e Mon Sep 17 00:00:00 2001
|
|
From: Jon Maloy <jmaloy@redhat.com>
|
|
Date: Tue, 9 May 2023 10:29:03 -0400
|
|
Subject: [PATCH 09/15] async: avoid use-after-free on re-entrancy guard
|
|
|
|
RH-Author: Jon Maloy <jmaloy@redhat.com>
|
|
RH-MergeRequest: 277: memory: prevent dma-reentracy issues
|
|
RH-Bugzilla: 1999236
|
|
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
RH-Commit: [9/12] d357650e581c3921bbfe3e2fde5e3f55853b5fab (redhat/rhel/src/qemu-kvm/jons-qemu-kvm-2)
|
|
|
|
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1999236
|
|
Upstream: Merged
|
|
CVE: CVE-2021-3750
|
|
|
|
commit 7915bd06f25e1803778081161bf6fa10c42dc7cd
|
|
Author: Alexander Bulekov <alxndr@bu.edu>
|
|
Date: Mon May 1 10:19:56 2023 -0400
|
|
|
|
async: avoid use-after-free on re-entrancy guard
|
|
|
|
A BH callback can free the BH, causing a use-after-free in aio_bh_call.
|
|
Fix that by keeping a local copy of the re-entrancy guard pointer.
|
|
|
|
Buglink: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58513
|
|
Fixes: 9c86c97f12 ("async: Add an optional reentrancy guard to the BH API")
|
|
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
|
|
Message-Id: <20230501141956.3444868-1-alxndr@bu.edu>
|
|
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
|
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
|
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
|
---
|
|
util/async.c | 14 ++++++++------
|
|
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/util/async.c b/util/async.c
|
|
index 1fff02e7fc..ffe0541c3b 100644
|
|
--- a/util/async.c
|
|
+++ b/util/async.c
|
|
@@ -146,18 +146,20 @@ void aio_bh_call(QEMUBH *bh)
|
|
{
|
|
bool last_engaged_in_io = false;
|
|
|
|
- if (bh->reentrancy_guard) {
|
|
- last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
|
|
- if (bh->reentrancy_guard->engaged_in_io) {
|
|
+ /* Make a copy of the guard-pointer as cb may free the bh */
|
|
+ MemReentrancyGuard *reentrancy_guard = bh->reentrancy_guard;
|
|
+ if (reentrancy_guard) {
|
|
+ last_engaged_in_io = reentrancy_guard->engaged_in_io;
|
|
+ if (reentrancy_guard->engaged_in_io) {
|
|
trace_reentrant_aio(bh->ctx, bh->name);
|
|
}
|
|
- bh->reentrancy_guard->engaged_in_io = true;
|
|
+ reentrancy_guard->engaged_in_io = true;
|
|
}
|
|
|
|
bh->cb(bh->opaque);
|
|
|
|
- if (bh->reentrancy_guard) {
|
|
- bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
|
|
+ if (reentrancy_guard) {
|
|
+ reentrancy_guard->engaged_in_io = last_engaged_in_io;
|
|
}
|
|
}
|
|
|
|
--
|
|
2.37.3
|
|
|