[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/7] target/i386/kvm: Free xsave_buf when destroying vCPU
From: |
Paolo Bonzini |
Subject: |
[PULL 1/7] target/i386/kvm: Free xsave_buf when destroying vCPU |
Date: |
Fri, 25 Mar 2022 08:07:00 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Fix vCPU hot-unplug related leak reported by Valgrind:
==132362== 4,096 bytes in 1 blocks are definitely lost in loss record 8,440
of 8,549
==132362== at 0x4C3B15F: memalign (vg_replace_malloc.c:1265)
==132362== by 0x4C3B288: posix_memalign (vg_replace_malloc.c:1429)
==132362== by 0xB41195: qemu_try_memalign (memalign.c:53)
==132362== by 0xB41204: qemu_memalign (memalign.c:73)
==132362== by 0x7131CB: kvm_init_xsave (kvm.c:1601)
==132362== by 0x7148ED: kvm_arch_init_vcpu (kvm.c:2031)
==132362== by 0x91D224: kvm_init_vcpu (kvm-all.c:516)
==132362== by 0x9242C9: kvm_vcpu_thread_fn (kvm-accel-ops.c:40)
==132362== by 0xB2EB26: qemu_thread_start (qemu-thread-posix.c:556)
==132362== by 0x7EB2159: start_thread (in /usr/lib64/libpthread-2.28.so)
==132362== by 0x9D45DD2: clone (in /usr/lib64/libc-2.28.so)
Reported-by: Mark Kanda <mark.kanda@oracle.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Mark Kanda <mark.kanda@oracle.com>
Message-Id: <20220322120522.26200-1-philippe.mathieu.daude@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/kvm/kvm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 06901c2a43..7396b430d7 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2081,6 +2081,8 @@ int kvm_arch_destroy_vcpu(CPUState *cs)
X86CPU *cpu = X86_CPU(cs);
CPUX86State *env = &cpu->env;
+ g_free(env->xsave_buf);
+
if (cpu->kvm_msr_buf) {
g_free(cpu->kvm_msr_buf);
cpu->kvm_msr_buf = NULL;
--
2.35.1
- [PULL 0/7] (Mostly) x86 fixes for QEMU 7.0.0-rc2, Paolo Bonzini, 2022/03/25
- [PULL 3/7] KVM: x86: workaround invalid CPUID[0xD, 9] info on some AMD processors, Paolo Bonzini, 2022/03/25
- [PULL 2/7] i386: Set MCG_STATUS_RIPV bit for mce SRAR error, Paolo Bonzini, 2022/03/25
- [PULL 1/7] target/i386/kvm: Free xsave_buf when destroying vCPU,
Paolo Bonzini <=
- [PULL 7/7] build: disable fcf-protection on -march=486 -m16, Paolo Bonzini, 2022/03/25
- [PULL 4/7] configure: remove dead int128 test, Paolo Bonzini, 2022/03/25
- [PULL 6/7] target/i386: properly reset TSC on reset, Paolo Bonzini, 2022/03/25
- [PULL 5/7] target/i386: tcg: high bits SSE cmp operation must be ignored, Paolo Bonzini, 2022/03/25
- Re: [PULL 0/7] (Mostly) x86 fixes for QEMU 7.0.0-rc2, Peter Maydell, 2022/03/25