From nobody Tue Nov 26 04:44:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710145034; cv=none; d=zohomail.com; s=zohoarc; b=LDrwa+4lpuCJhGsC0o7gB8OKmrHjxA7r6cbhIw3XkA7yE4Prt47ZPi3yzUXF+SaeGn7327n3d4zARyH6Pk5E5P6OvBUu1DfBSw+KorCAOWDi0qHMEUNZtuQ333qqprMEFYW31O7ZMP5uJ5ap11b6galtWDKj3MMUxyuH36u3qYY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710145034; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=o6u5chL0ZKfspPibUdL3kaZu+1Hx9Y3Ha5YkUxPtjaI=; b=h++uJkp6z57ve0EtsvH6aZWYJsOCWzdHM7HF0JirGglIa/uwur2zZxWl5rPx71R72MAREehCUatbRXSF03AxD5erkRSgqfGL08cXPLcXOn97nWl4YqV6ihP/XW8H6v8tExddtl9sOL/OmL7gkLgukI3LY88DoyylLO8XMBrgp34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710145034857671.4467168866239; Mon, 11 Mar 2024 01:17:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjapk-0000RQ-Ft; Mon, 11 Mar 2024 04:16:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjaph-0000R6-AL for qemu-devel@nongnu.org; Mon, 11 Mar 2024 04:16:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjape-0005ug-FZ for qemu-devel@nongnu.org; Mon, 11 Mar 2024 04:16:28 -0400 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-313-MjFDK3NfM2S8Fb_1t87KHg-1; Mon, 11 Mar 2024 04:16:23 -0400 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a4488afb812so204333466b.3 for ; Mon, 11 Mar 2024 01:16:23 -0700 (PDT) Received: from [192.168.10.118] ([151.49.77.21]) by smtp.gmail.com with ESMTPSA id bh21-20020a170906a0d500b00a44efa48c24sm2626500ejb.117.2024.03.11.01.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 01:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710144985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o6u5chL0ZKfspPibUdL3kaZu+1Hx9Y3Ha5YkUxPtjaI=; b=M7htUTvr7AbN9F7fb8uHerLIoHrtJ5c+uPyHy0f9FTYd+5EmHxrd04z5PQWALNoWjHQa59 yucP25w7SVASNILkJrUGPDhXQVEeTxPeNDRcAWKSvPgWQJoBi36dR6zE6gpAITWkVonbQs H2q8AeJc0nyrOHnKuIVRp25xjN1SKzY= X-MC-Unique: MjFDK3NfM2S8Fb_1t87KHg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710144981; x=1710749781; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o6u5chL0ZKfspPibUdL3kaZu+1Hx9Y3Ha5YkUxPtjaI=; b=OXlpjIJFV2cOK31OUvvrcF3ISH0RZUc6Zt11pQlfd2jGKnFdmOtP1FRaFwgVLRuqzS mL9jo4HRsBIQUf3vL4ROmbk5VBZomUfoohMhfJWkvYmnKAa7OzvldMGA1b6J8Fs46TyU Yhy2PqfZs+aHQkqHHW1V3QAau2+2lsMWNxWvy8VqVYoUey9p6YC1UcjTRs9/fDIwXFP5 6/GVQ8FzbhOP8DJ9sqdPi+/IQlTrwy6nQsqJx0DkwcrlR3xtJ3vgrpP4crjXYl/tJqaz gb9ajlftfKthZWMQaTrnsbQnztFQSgw5WmIlFwPoxSjn+v/pv9tIe/VIuTQkwDO14+cN c0bg== X-Gm-Message-State: AOJu0YwS6s1kSOT9x7HfF9bdth6u5MuoZpMGo+zX3BDe561rPtfkM6We ewQOLfPw7bxhnemiTYVUUdxTku0gPItPBY9QunM97uVH0ghjpD4a/+/p4LNOHcojeQ6qMZ6Qmph dUgPSswaLEqbsilCFh6vE5rNiZzYTu2yxbfnCyffe50sD5BbXwVsbUYhmm6s/X1Vib5vH00mpiV xP4vHEx/j9H6+I+XZ5UxreoZsH2+6Vre9zpuiY X-Received: by 2002:a17:906:bfe7:b0:a45:f89b:a915 with SMTP id vr7-20020a170906bfe700b00a45f89ba915mr3246493ejb.45.1710144980893; Mon, 11 Mar 2024 01:16:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHb9a8psONN5/uGNiWlBvcaxrz1SgTp5rOmrnJ8QLzP+hCAmMKZf8O3I09u+R9+S6cgGepOXw== X-Received: by 2002:a17:906:bfe7:b0:a45:f89b:a915 with SMTP id vr7-20020a170906bfe700b00a45f89ba915mr3246480ejb.45.1710144980485; Mon, 11 Mar 2024 01:16:20 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH] tests/plugins: fix use-after-free bug Date: Mon, 11 Mar 2024 09:16:19 +0100 Message-ID: <20240311081619.669832-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.945, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710145036189100003 rec->count.score is inside rec, which is freed before rec->count.score is. Reorder the instructions Reported by Coverity as CID 1539967. Cc: Alex Benn=C3=A9e Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- contrib/plugins/howvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 2d10c87e0fb..94bbc53820a 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -167,9 +167,9 @@ static gint cmp_exec_count(gconstpointer a, gconstpoint= er b) static void free_record(gpointer data) { InsnExecCount *rec =3D (InsnExecCount *) data; + qemu_plugin_scoreboard_free(rec->count.score); g_free(rec->insn); g_free(rec); - qemu_plugin_scoreboard_free(rec->count.score); } =20 static void plugin_exit(qemu_plugin_id_t id, void *p) --=20 2.43.2