- hw/virtio/virtio-crypto: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/char/virtio-serial-bus: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/display/virtio-gpu: Protect from DMA re-entrancy bugs(CVE-2024-3446) - hw/virtio: Introduce virtio_bh_new_guarded() helper - hw: replace most qemu_bh_new calls with qemu_bh_new_guarded - checkpatch: add qemu_bh_new/aio_bh_new checks - async: avoid use-after-free on re-entrancy guard - async: Add an optional reentrancy guard to the BH API - hw/sd/sdhci: Do not update TRNMOD when Command Inhibit (DAT) is set(CVE-2024-3447) - rtl8139: Remove unused variable - tulip: Remove unused variable - virtio-mem: Fix the bitmap index of the section offset - virtio-mem: Fix the iterator variable in a vmem->rdl_list loop - system/memory: use ldn_he_p/stn_he_p - block: Fix crash when loading snapshot on inactive node - smmu: Clear SMMUPciBus pointer cache when system reset - block/mirror: Fix NULL s->job in active writes - amd_iommu: Fix APIC address check - virtio-crypto: fix NULL pointer dereference in virtio_crypto_free_reques - libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick cherry-pick from 66e411885a23c96ff73742d06b793fec3ceaebb7 - ivshmem-test.c: enable test_ivshmem_server for ppc64 arch - ivshmem.c: change endianness to LITTLE_ENDIAN - hw/ppc/mac.h: Remove MAX_CPUS macro - configure: remove dead variables - virtio-gpu: do not byteswap padding - hw/intc: clean-up error reporting for failed ITS cmd - qemu-iotests: Discard stderr when probing devices - linux-user: un-parent OBJECT(cpu) when closing thread - hw/net/rocker: Avoid undefined shifts with more than 31 ports - contrib/vhost-user-blk: Clean up deallocation of VuVirtqElement - scsi-disk: fix overflow when block size is not a multiple of BDRV_SECTOR_SIZE Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com> (cherry picked from commit bf54b48c2963c869dfdc89977c57be4bd9e772aa)
66 lines
2.5 KiB
Diff
66 lines
2.5 KiB
Diff
From 41f426180f0d5d5a1720166a77a0d741fd072680 Mon Sep 17 00:00:00 2001
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
Date: Mon, 25 Mar 2024 09:32:04 +0000
|
|
Subject: [PATCH] linux-user: un-parent OBJECT(cpu) when closing thread
|
|
mainline inclusion
|
|
commit 52f0c1607671293afcdb2acc2f83e9bccbfa74bb
|
|
category: bugfix
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
---------------------------------------------------------------
|
|
|
|
While forcing the CPU to unrealize by hand does trigger the clean-up
|
|
code we never fully free resources because refcount never reaches
|
|
zero. This is because QOM automatically added objects without an
|
|
explicit parent to /unattached/, incrementing the refcount.
|
|
|
|
Instead of manually triggering unrealization just unparent the object
|
|
and let the device machinery deal with that for us.
|
|
|
|
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/866
|
|
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
|
|
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
|
|
Message-Id: <20220811151413.3350684-2-alex.bennee@linaro.org>
|
|
|
|
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
|
---
|
|
linux-user/syscall.c | 13 +++++++------
|
|
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
|
|
index 92df0f9d8c..a5fe399277 100644
|
|
--- a/linux-user/syscall.c
|
|
+++ b/linux-user/syscall.c
|
|
@@ -8345,7 +8345,13 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
|
if (CPU_NEXT(first_cpu)) {
|
|
TaskState *ts = cpu->opaque;
|
|
|
|
- object_property_set_bool(OBJECT(cpu), "realized", false, NULL);
|
|
+ if (ts->child_tidptr) {
|
|
+ put_user_u32(0, ts->child_tidptr);
|
|
+ do_sys_futex(g2h(cpu, ts->child_tidptr),
|
|
+ FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
|
|
+ }
|
|
+
|
|
+ object_unparent(OBJECT(cpu));
|
|
object_unref(OBJECT(cpu));
|
|
/*
|
|
* At this point the CPU should be unrealized and removed
|
|
@@ -8355,11 +8361,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
|
|
|
pthread_mutex_unlock(&clone_lock);
|
|
|
|
- if (ts->child_tidptr) {
|
|
- put_user_u32(0, ts->child_tidptr);
|
|
- do_sys_futex(g2h(cpu, ts->child_tidptr),
|
|
- FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
|
|
- }
|
|
thread_cpu = NULL;
|
|
g_free(ts);
|
|
rcu_unregister_thread();
|
|
--
|
|
2.27.0
|
|
|