From nobody Sat May 4 08:20:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537896271171954.6000665783216; Tue, 25 Sep 2018 10:24:31 -0700 (PDT) Received: from localhost ([::1]:54471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4r4O-0006eP-Tl for importer@patchew.org; Tue, 25 Sep 2018 13:24:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4r3Z-0006Kt-Tt for qemu-devel@nongnu.org; Tue, 25 Sep 2018 13:23:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4r3W-00051K-NT for qemu-devel@nongnu.org; Tue, 25 Sep 2018 13:23:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60694) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g4r3W-000509-C5 for qemu-devel@nongnu.org; Tue, 25 Sep 2018 13:23:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2940A83F44; Tue, 25 Sep 2018 17:23:24 +0000 (UTC) Received: from localhost (ovpn-112-33.ams2.redhat.com [10.36.112.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id E42C15D6AA; Tue, 25 Sep 2018 17:23:18 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Tue, 25 Sep 2018 21:23:05 +0400 Message-Id: <20180925172305.5105-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 25 Sep 2018 17:23:24 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] cpus: fix TCG timer leak X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson , Peter Crosthwaite , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Spotted by ASAN: QTEST_QEMU_BINARY=3Dx86_64-softmmu/qemu-system-x86_64 tests/bios-tables-tes= t -p /x86_64/acpi/piix4/cpuhp /x86_64/acpi/piix4/cpuhp: Could not access KVM kernel module: No such file = or directory qemu-system-x86_64: failed to initialize KVM: No such file or directory qemu-system-x86_64: Back to tcg accelerator =3D=3D21216=3D=3DWARNING: ASan doesn't fully support makecontext/swapcontex= t functions and may produce false positives in some cases! =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D21216=3D=3DERROR: LeakSanitizer: detected memory leaks Direct leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7f77c0668e50 in calloc (/lib64/libasan.so.5+0xeee50) #1 0x7f77beb7b41d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d) #2 0x557f756df5bd in timer_new /home/elmarco/src/qemu/include/qemu/time= r.h:561 #3 0x557f756df5ee in timer_new_ns /home/elmarco/src/qemu/include/qemu/t= imer.h:584 #4 0x557f756e4690 in start_tcg_kick_timer /home/elmarco/src/qemu/cpus.c= :965 #5 0x557f756e64d7 in qemu_tcg_rr_wait_io_event /home/elmarco/src/qemu/c= pus.c:1210 #6 0x557f756e90ad in qemu_tcg_rr_cpu_thread_fn /home/elmarco/src/qemu/c= pus.c:1536 #7 0x557f76e9f233 in qemu_thread_start /home/elmarco/src/qemu/util/qemu= -thread-posix.c:504 #8 0x7f77b4a11593 in start_thread (/lib64/libpthread.so.0+0x7593) Direct leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7f77c0668e50 in calloc (/lib64/libasan.so.5+0xeee50) #1 0x7f77beb7b41d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5241d) #2 0x557f756df5bd in timer_new /home/elmarco/src/qemu/include/qemu/time= r.h:561 #3 0x557f756df5ee in timer_new_ns /home/elmarco/src/qemu/include/qemu/t= imer.h:584 #4 0x557f756e4690 in start_tcg_kick_timer /home/elmarco/src/qemu/cpus.c= :965 #5 0x557f756e8616 in qemu_tcg_rr_cpu_thread_fn /home/elmarco/src/qemu/c= pus.c:1466 #6 0x557f76e9f233 in qemu_thread_start /home/elmarco/src/qemu/util/qemu= -thread-posix.c:504 #7 0x7f77b4a11593 in start_thread (/lib64/libpthread.so.0+0x7593) SUMMARY: AddressSanitizer: 96 byte(s) leaked in 2 allocation(s). Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- cpus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cpus.c b/cpus.c index 719788320f..0513c657f4 100644 --- a/cpus.c +++ b/cpus.c @@ -973,6 +973,7 @@ static void stop_tcg_kick_timer(void) assert(!mttcg_enabled); if (tcg_kick_vcpu_timer) { timer_del(tcg_kick_vcpu_timer); + timer_free(tcg_kick_vcpu_timer); tcg_kick_vcpu_timer =3D NULL; } } --=20 2.19.0.271.gfe8321ec05