From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585666856; cv=none; d=zohomail.com; s=zohoarc; b=Z75ist/z3MQx6jYOSxUPcimwNEQT3ZOWZ008vt3llKtc++Vt9M3+4LVAnytFNbDD9w4bNpo+oawcaWGtAInrqgC+mAyWKsuVeRIIS3FE6vOCgKyAWka4pP/yHjlI8VfLhNUH30r/IO5/74oxgiFKfwooGoOHxjipiaeI7sgJErk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585666856; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RvegJ88q70bON/LohdWsxFm4RI480T8ytw4ZvouggGw=; b=k5tRzCs2GC5A3Uyl+zq9HAXtvTsrPz/xiLllcdlrY696g7R/z+9FXjqbYNFWYhrsNLwUGDu04qRlLdsv3d7VZam54Sma1R+M7oGq0Wv5EGoWGQobNxQVGazoLODbaBSGOjp2gjIbUdI1+ve6IhU1GW1m9qQPKSvurkUuPf6XY1I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585666856621939.1637375685691; Tue, 31 Mar 2020 08:00:56 -0700 (PDT) Received: from localhost ([::1]:39634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJINq-0004yR-7J for importer@patchew.org; Tue, 31 Mar 2020 11:00:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56366) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKE-00083F-3X for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKC-00052E-MG for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:10 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:42389 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKC-00051p-I2 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:08 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-KPSvr1VPNiapxXDe5XLS6g-1; Tue, 31 Mar 2020 10:57:04 -0400 Received: by mail-wm1-f71.google.com with SMTP id s15so802347wmc.0 for ; Tue, 31 Mar 2020 07:57:04 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id m19sm4097428wml.48.2020.03.31.07.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666628; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RvegJ88q70bON/LohdWsxFm4RI480T8ytw4ZvouggGw=; b=Ad9uoukPAoLmk7MnuICsihEVEMlraos5garenEH+Tkq9HNtD1aovpc2NbKCm7nqwX+Ua50 cOt+dazakpNbt/7f3/RsNgYTnfIBnCNKSILLMgNyAGtS2OinAJ9F1Cjpoe9n3cd/NKoC77 bD3/z+wpRyQJ+bqDKRg8/qZD8juIA3A= X-MC-Unique: KPSvr1VPNiapxXDe5XLS6g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=muzU+wYjkhlwqhSb/6Hfi5D5d8nln1GaBm49ftTglK8=; b=Vb7blaUKHo9WGc8tBF2C7p7IANfpLB176tk+w9WsDC2SaJFufZQNhqygHNIytkcBDh tTcnguTtcmKiKJlC1ia+xATJzgKq9SPv/djyQC+sZQaiy8DKYfBS7vbXsf2Rs9xLXdFm Omk9IKDSJDPlr4+xUNOnxyK4/44uC5aPj1KA0HjNg8kQRBADXl17otlb2AkuNIwEQ71X brCC0rsmECIDBKRtASRW1XmaztuYoIQEbWZjZA1SFXk9+JjaSS7ytrWldbgKckaG8436 nrKRj0HzqtU4CqfF2NvswS81VGxEc2gPgaPq9cZOTlkCzO2gzvNRRRXlpjt4KlWV6cJU MZYQ== X-Gm-Message-State: ANhLgQ1SpgJgK/h/43AsjkmrbcqcURV0i7/gQoDZmaS5BxBM2nzOTF5r 2WpNGguYN+xgB7UfJAB1kKIuXEWAmwYF5fQ+YI3x/46FX2bZmuzJC9agXUn775fjkVU6OT2M6Xq jgw6gjEtxoL/K/vA= X-Received: by 2002:adf:9f42:: with SMTP id f2mr21461372wrg.246.1585666623072; Tue, 31 Mar 2020 07:57:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvPl9ghByRiQrYQlg+cUEurP8Q5uxhGbJthzEUJ6/1t/7ec8uGatW0BhCHJxXLgUfSG2fT96w== X-Received: by 2002:adf:9f42:: with SMTP id f2mr21461346wrg.246.1585666622808; Tue, 31 Mar 2020 07:57:02 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 01/10] checkpatch: enforce process for expected files Message-ID: <20200331145631.135630-2-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson , Stefan Hajnoczi , Igor Mammedov , Paolo Bonzini , Alex =?utf-8?Q?Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" If the process documented in tests/qtest/bios-tables-test.c is followed, then same patch never touches both expected files and code. Teach checkpatch to enforce this rule. Tested-by: Igor Mammedov Reviewed-by: Stefan Hajnoczi Signed-off-by: Michael S. Tsirkin --- scripts/checkpatch.pl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b27e4ff5e9..e658e6546f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -35,6 +35,8 @@ my $summary_file =3D 0; my $root; my %debug; my $help =3D 0; +my $acpi_testexpected; +my $acpi_nontestexpected; =20 sub help { my ($exitcode) =3D @_; @@ -1256,6 +1258,27 @@ sub WARN { } } =20 +# According to tests/qtest/bios-tables-test.c: do not +# change expected file in the same commit with adding test +sub checkfilename { + my ($name) =3D @_; + if ($name =3D~ m#^tests/data/acpi/# and + # make exception for a shell script that rebuilds the files + not $name =3D~ m#^\.sh$# or + $name =3D~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) { + $acpi_testexpected =3D $name; + } else { + $acpi_nontestexpected =3D $name; + } + if (defined $acpi_testexpected and defined $acpi_nontestexpected) { + ERROR("Do not add expected files together with tests, " . + "follow instructions in " . + "tests/qtest/bios-tables-test.c: both " . + $acpi_testexpected . " and " . + $acpi_nontestexpected . " found\n"); + } +} + sub process { my $filename =3D shift; =20 @@ -1431,9 +1454,11 @@ sub process { if ($line =3D~ /^diff --git.*?(\S+)$/) { $realfile =3D $1; $realfile =3D~ s@^([^/]*)/@@ if (!$file); + checkfilename($realfile); } elsif ($line =3D~ /^\+\+\+\s+(\S+)/) { $realfile =3D $1; $realfile =3D~ s@^([^/]*)/@@ if (!$file); + checkfilename($realfile); =20 $p1_prefix =3D $1; if (!$file && $tree && $p1_prefix ne '' && --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585666695; cv=none; d=zohomail.com; s=zohoarc; b=R3/cOka595ui0N7AeNlKhpamgJyUCgA4n+L9532TqvpgSc4UFwpu3PEv8ukKeF21CLB9Su2qQXN0eVC7ZVXFLfNxKrm/56+7ufbdH9UmlsW+ATWnYi7lKOmTHGeoCdcRats+aFjpPXlVlbPwqFvDoc1nF+EymEY0pnO410jlgjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585666695; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y3JDDCxeHsu0uxBdU3hqYhD9IDIpl6gR6DiqYZM/Jw0=; b=ZDqKIctqTn7HFZQ2KfYIVcISGYyWARryHVeEvy3GzGCv5htj7G0jVpcYLHZmWT3K6GthijctMRnnFHw7aWmB0RvqqWAvpu4IXDGAQ0Vi8BFJo6SZoLMkhUAUc+GrSw1nHfjkEYnshlraVlBx7yYJM4ZVl49c3KITtnqC/H2SUyI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585666695296296.66172814232664; Tue, 31 Mar 2020 07:58:15 -0700 (PDT) Received: from localhost ([::1]:39588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJILG-0001Ro-2P for importer@patchew.org; Tue, 31 Mar 2020 10:58:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56380) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKF-00085S-47 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKD-000535-Sh for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:11 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59689 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKD-00052q-OJ for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:09 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-106-IRJ2DvtTP0aK9WxFsFMU3w-1; Tue, 31 Mar 2020 10:57:07 -0400 Received: by mail-wr1-f70.google.com with SMTP id d1so13066545wru.15 for ; Tue, 31 Mar 2020 07:57:06 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id f187sm4240956wme.9.2020.03.31.07.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666629; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y3JDDCxeHsu0uxBdU3hqYhD9IDIpl6gR6DiqYZM/Jw0=; b=W+CsjTzFiTgh0ruyYntWxCsqeA51dRXEz6mQ1MojsU4K/n3QYncr+qipN2sq+RdVvLSksv 97vLqj5WI0BbWzuuAJ07Juw3uE/oehnqSJnuC2d3kWRNgjoxATYT7Fz+i2jOR+Gr0lT1eb GZmo1G7fKkGOiWibhuISywGJ3q4Vkk8= X-MC-Unique: IRJ2DvtTP0aK9WxFsFMU3w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0MtgQcn82XAWmRqhItN4weyN5S4MhXPLIRVwnSTTFuQ=; b=BD0KZCah4atoLcXwnWsTN/oeANjS9UATOfL12/Y5jbHR3WP/CGbzLQ4uSb+hO8xJO8 V44XwYDGkwlEOZo6ipIMmdhhmhD9H7QZt59jzaJn4obhxGd3UYhTY6HrxsE30ROCHoUK UyoeF5OkaYLgbpAfLQ2djyLt9yw428jV76LG8LZcL2XSmWDe8Dvg1TmxR9eVSpBNHZ0x y+6VCaprHtWc6Ku3ibuye8xyz1aILhDlYe9Rj8+lIcXuRqiTVo4skuu0hMzIg/CxDAYo +x03UpvNkBVzZqs0nRwAsqykRN5rWaAoxrB+45QVUpL4Gw5W45HG2tvKkvMe1Dwe0Z1Z Tn9g== X-Gm-Message-State: ANhLgQ1zmPQfBGLpvX12LL3r+y6m10tkFBfY/AOPNSn0uJB4q4HQYfUk ufn27bY39WKLcXX9fGQrSN6651pWVRG0uKE21qIDXI5ed8iu9AcVeXURJc+BWoA2eRnLGyAt3fB U36afm7NU4Exl6SU= X-Received: by 2002:a1c:4d7:: with SMTP id 206mr3754950wme.5.1585666625678; Tue, 31 Mar 2020 07:57:05 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt20bX8cLcjWZW8/qj5zisx4hb73rI+EShQcVb6YRqVRIUYWc/KtesLFJgkX1UcRObq10FVvw== X-Received: by 2002:a1c:4d7:: with SMTP id 206mr3754931wme.5.1585666625473; Tue, 31 Mar 2020 07:57:05 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:03 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 02/10] MAINTAINERS: Add myself as virtio-balloon co-maintainer Message-ID: <20200331145631.135630-3-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , Laurent Vivier , Markus Armbruster , Aleksandar Markovic , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand As suggested by Michael, let's add me as co-maintainer of virtio-balloon. While at it, also add "balloon.c" and "include/sysemu/balloon.h" to the file list. Cc: Michael S. Tsirkin Cc: Peter Maydell Signed-off-by: David Hildenbrand Message-Id: <20200312133725.8192-1-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index b5c86ec494..e580276603 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1634,6 +1634,15 @@ F: hw/virtio/trace-events F: net/vhost-user.c F: include/hw/virtio/ =20 +virtio-balloon +M: Michael S. Tsirkin +M: David Hildenbrand +S: Maintained +F: hw/virtio/virtio-balloon*.c +F: include/hw/virtio/virtio-balloon.h +F: balloon.c +F: include/sysemu/balloon.h + virtio-9p M: Greg Kurz R: Christian Schoenebeck --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585666848; cv=none; d=zohomail.com; s=zohoarc; b=izbw9vIZ4ao+GTIZcIgnK5KitqcybG1yYOU9dfl+ZDQqa9whlYSIJG7AAxQKKc9aQqb8EUxVJN7SvHukqrH5P2eWaVlq0005AxTL4cz6ms2WaG+rclhr6cCnTMCVl8FQMxg8v8LDD41I7cBuK9lwb7GDiOrUbUAG52tit1PfcAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585666848; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DnDNbYeUvmpDorhgokm/1iNeL5qLJps3iYBTT93GLig=; b=J8uYdNtjDDcD3y+PgP1job6FdDHn5lFB2t7DtXWjolv4atbQruUQNx7aQulrHaTF42upNhNr1rxD6MPaRkv8Kv7xckaCxhJu58ZKT/CpqG9Jhlzekbk9FO7h2Bi559DtnexgX7KsnaIIvdQX2fnOU7RwGmtWEkKBCnKARm5sI7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585666848393803.5028905515171; Tue, 31 Mar 2020 08:00:48 -0700 (PDT) Received: from localhost ([::1]:39632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJINf-0004ry-BG for importer@patchew.org; Tue, 31 Mar 2020 11:00:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56393) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKH-0008BE-Td for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKG-00056J-O3 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:13 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:53255 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKG-000551-J5 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:12 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-254-ScQylzUfM1ih5NAbtI1Xlw-1; Tue, 31 Mar 2020 10:57:10 -0400 Received: by mail-wr1-f70.google.com with SMTP id b2so12615775wrq.8 for ; Tue, 31 Mar 2020 07:57:10 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id b15sm26679526wru.70.2020.03.31.07.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666632; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DnDNbYeUvmpDorhgokm/1iNeL5qLJps3iYBTT93GLig=; b=WoHIVVjj93phhO1A0q5uQqcsiDZerWRrkcbxkDUwh93LF2Xyf5NLTLoJfuKVZgXVp11i/3 17b/fzPsxOuXRiV2gAC4KJ7xfyhORoMu0zTeL7nRe/ufvzVk/3MZ8cdg6Zq3BM50cCideF dASu7eokz0j9s6w28TeGNi3glXohEFg= X-MC-Unique: ScQylzUfM1ih5NAbtI1Xlw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=X/uo4ffLJZzLWVp0KxSsnKk6uH/r18lUhk47tb/+9jM=; b=Fq9Uc75S4X7sfGDZp6hS865nhA5+zoz7yx7OHa6FiZ2iY3XDQV6C0mZXd8CNwyphjm 6WHHR1FeeJeoUfEZQDGAzbyAj10A9//qZeGeKuwmdlcYhWZJ+wKA8FVwFwyBmMst+eW+ IGCkFRbkEDfBo7R4u0gIjuNyKFgsgLrnTOQ87HG8ZE6FmSwPgIn+4bilDxNtsKdWiYqt rK2UkLtp5dSVeh9rs28kgGgZqauTF2DNCf72A5MVGo/9d5aM4tJEmh10939yEGcLIe3R 19mvIPzYdbP+xkYz9LcCa1tDkX2q+PhqkmNV6tnWu6Y3WYDDlhlxd+2Fj+EhAXhiJwuj pTNA== X-Gm-Message-State: ANhLgQ1qyVG12ituFssfEaFNRlWrVQW+Oh+VUMMolEUzHtHqMG9jiLab Og5YsO6p4G953VI7uDP5tZstUrcQFDKh0Vv5I5rRtPzn37dFuV6JbVhzPSwWiDHJfhvEstgoB2C BNYcadIX0q2Rm8ps= X-Received: by 2002:a05:600c:214a:: with SMTP id v10mr3770216wml.71.1585666628369; Tue, 31 Mar 2020 07:57:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuuDqCqN3lZmsXFPEvI8nPGtdCcxPYSXyacNae6nHkhz14vPjvmtDSGFjllINaww41O1BvaBg== X-Received: by 2002:a05:600c:214a:: with SMTP id v10mr3770198wml.71.1585666628170; Tue, 31 Mar 2020 07:57:08 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 03/10] virtio-serial-bus: Plug memory leak on realize() error paths Message-ID: <20200331145631.135630-4-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Amit Shah , Pan Nengyuan , Markus Armbruster , Paolo Bonzini , Euler Robot , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan We neglect to free port->bh on the error paths. Fix that. Reproducer: {'execute': 'device_add', 'arguments': {'id': 'virtio_serial_pci0', 'dr= iver': 'virtio-serial-pci', 'bus': 'pci.0', 'addr': '0x5'}, 'id': 'yVkZcGgV= '} {'execute': 'device_add', 'arguments': {'id': 'port1', 'driver': 'virts= erialport', 'name': 'port1', 'chardev': 'channel1', 'bus': 'virtio_serial_p= ci0.0', 'nr': 1}, 'id': '3dXdUgJA'} {'execute': 'device_add', 'arguments': {'id': 'port2', 'driver': 'virts= erialport', 'name': 'port2', 'chardev': 'channel2', 'bus': 'virtio_serial_p= ci0.0', 'nr': 1}, 'id': 'qLzcCkob'} {'execute': 'device_add', 'arguments': {'id': 'port2', 'driver': 'virts= erialport', 'name': 'port2', 'chardev': 'channel2', 'bus': 'virtio_serial_p= ci0.0', 'nr': 2}, 'id': 'qLzcCkob'} The leak stack: Direct leak of 40 byte(s) in 1 object(s) allocated from: #0 0x7f04a8008ae8 in __interceptor_malloc (/lib64/libasan.so.5+0xefae8) #1 0x7f04a73cf1d5 in g_malloc (/lib64/libglib-2.0.so.0+0x531d5) #2 0x56273eaee484 in aio_bh_new /mnt/sdb/backup/qemu/util/async.c:125 #3 0x56273eafe9a8 in qemu_bh_new /mnt/sdb/backup/qemu/util/main-loop.c:= 532 #4 0x56273d52e62e in virtser_port_device_realize /mnt/sdb/backup/qemu/h= w/char/virtio-serial-bus.c:946 #5 0x56273dcc5040 in device_set_realized /mnt/sdb/backup/qemu/hw/core/q= dev.c:891 #6 0x56273e5ebbce in property_set_bool /mnt/sdb/backup/qemu/qom/object.= c:2238 #7 0x56273e5e5a9c in object_property_set /mnt/sdb/backup/qemu/qom/objec= t.c:1324 #8 0x56273e5ef5f8 in object_property_set_qobject /mnt/sdb/backup/qemu/q= om/qom-qobject.c:26 #9 0x56273e5e5e6a in object_property_set_bool /mnt/sdb/backup/qemu/qom/= object.c:1390 #10 0x56273daa40de in qdev_device_add /mnt/sdb/backup/qemu/qdev-monitor= .c:680 #11 0x56273daa53e9 in qmp_device_add /mnt/sdb/backup/qemu/qdev-monitor.= c:805 Fixes: 199646d81522509ac2dba6d28c31e8c7d807bc93 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Markus Armbruster Reviewed-by: Amit Shah Message-Id: <20200309021738.30072-1-pannengyuan@huawei.com> Reviewed-by: Laurent Vivier Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/char/virtio-serial-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 941ed5aca9..99a65bab7f 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -943,7 +943,6 @@ static void virtser_port_device_realize(DeviceState *de= v, Error **errp) Error *err =3D NULL; =20 port->vser =3D bus->vser; - port->bh =3D qemu_bh_new(flush_queued_data_bh, port); =20 assert(vsc->have_data); =20 @@ -992,6 +991,7 @@ static void virtser_port_device_realize(DeviceState *de= v, Error **errp) return; } =20 + port->bh =3D qemu_bh_new(flush_queued_data_bh, port); port->elem =3D NULL; } =20 --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; 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=1585667005; cv=none; d=zohomail.com; s=zohoarc; b=clmU4TVg+HHiaollz96rHG1gd0xDheEjw+SEJ3zoXtzvoSNQhflPXs+yqpRuDzSbpPyauC0h9uFCNBnYTZ4lXFdTkzWqc3lkkw7H3mdYf7Fq+Y33WWMOIRWiDzrnM1p94v+nkqLsQnx5xXWPdiGiiI/d3G0rfdpvmABxR+GfYUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585667005; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eJ9Xth7wqdOj25TgGKfdDH1GcrDV7YNI8nWtz5DyfF8=; b=VdQgjwGop8UpfnVUKpGOLBnSGiXmbor1jQ7dxTLWeIGnGKVv31cu8Q5s9snZ2OP6rjR/IQOvh2pU4M7/3TO8lIdIv8FHBJVZ7P17+2N/ROaNO1xRCBK7cZ7W2nXTwHi7xaFvxv2MP42dBkKaepHwQlV7C7eURCtIz2ZwIuk/Teo= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585667005956612.9885734024878; Tue, 31 Mar 2020 08:03:25 -0700 (PDT) Received: from localhost ([::1]:39704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIQG-0000sB-IX for importer@patchew.org; Tue, 31 Mar 2020 11:03:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56408) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKL-0008FV-3b for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKJ-00058e-32 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:17 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:41910 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKI-00058F-UN for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:15 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-ysb1C8sBN-qoLyYroSfG4g-1; Tue, 31 Mar 2020 10:57:12 -0400 Received: by mail-wr1-f71.google.com with SMTP id i18so13011461wrx.17 for ; Tue, 31 Mar 2020 07:57:11 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id o14sm4130920wmh.22.2020.03.31.07.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666634; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eJ9Xth7wqdOj25TgGKfdDH1GcrDV7YNI8nWtz5DyfF8=; b=LwOK4TQbIfgQCdPIDJV3OqYQ7Xjf7UbaiEPzaRd6bgpDeTka9qPsbDFwB0Tkz8CATi9KRN JqlD8yahUKLGJsCGU3/Q8jF5j5d0xFb1Bw0u9+ixyCCW6CEH45Whggz8xpyGCblvf69O4e cbtod52Ut7deHgWjxfIAH891EiKcnLY= X-MC-Unique: ysb1C8sBN-qoLyYroSfG4g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=624vl1Deh+cu1AvcgEkyNrweiLps7QJqCr3A1oEA78g=; b=NRWx3vR/bXHChbxA13ysOFH2DeGBGDOzvo2qbzgXXt0QsmOkETjeSuHXbZNCY91Jk+ GCp9gx1PlUuP1oG/QwAtQdHLL96SYQCDhgxIdBiqVJlKDLqf9xdXL7cKOaHoY915DMPR liPU0kijXBm7ECoxHl5NEDONPThrMyzbQnABqET2LGQEQi8oXbzMyvM+gCZJSDcfrdDz nfuEmfifG48pZ1/VxQFiZ0UAuaRvkAIJj/y2zU5jvs6cHMro0a1jkaSpXEr8Z+zzKIAV rVoyYgAiRn5bt/gVGV0FDFsDGDMsX8m4YcO/m/USV6OqQ7U1+45220Yxc7la1xB7/YYy hQlw== X-Gm-Message-State: ANhLgQ2/LcI8qbzSBK9xAFnj9bk2wuBompqtGBG08fH7ChDYKe2dt9aY o4jnbfiPngKNajKpacGRyzBfWmq79Bp8+ej+NANwDz+XJpdMp/AL02e6apD92Cyfvlkzz2eOZzx 5W2IpHlOY/oEVa3s= X-Received: by 2002:a1c:3b89:: with SMTP id i131mr3825620wma.35.1585666630831; Tue, 31 Mar 2020 07:57:10 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs49Nbmi8uiQ2el0IQ00U4nMKaxNjpfZaMMpD+jEUVav7mn8Xq1T/LfkjKJWIZNLPQ1900z2Q== X-Received: by 2002:a1c:3b89:: with SMTP id i131mr3825604wma.35.1585666630595; Tue, 31 Mar 2020 07:57:10 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 04/10] acpi: pcihp: fix left shift undefined behavior in acpi_pcihp_eject_slot() Message-ID: <20200331145631.135630-5-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Coverity spots subj in following guest triggered code path pci_write(, data =3D 0) -> acpi_pcihp_eject_slot(,slots =3D 0) uinst32_t slot =3D ctz32(slots) ... ... =3D ~(1U << slot) where 'slot' value is 32 in case 'slots' bitmap is empty. 'slots' is a bitmap and empty one shouldn't do anything so return early doing nothing if resulted slot value is not valid (i.e. not in 0-31 range) Reported-by: Peter Maydell Signed-off-by: Igor Mammedov Message-Id: <20200326135624.32464-1-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/pcihp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 4dcef372bf..0dc963e983 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -154,7 +154,7 @@ static void acpi_pcihp_eject_slot(AcpiPciHpState *s, un= signed bsel, unsigned slo =20 trace_acpi_pci_eject_slot(bsel, slot); =20 - if (!bus) { + if (!bus || slot > 31) { return; } =20 --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585666973; cv=none; d=zohomail.com; s=zohoarc; b=ibLjX1eVBncrvhrjJCuEY14QOpQAXoilsb/JRcZkeZGBgS7HVfgZOHM1/hC3KXAVIcSJlSchAFD7CYtu8qDPufEq5atGT3+3/hk7V7Y2pIuCwPnkZSjTB/QE5+cBxzVWrcuNZp7W2OTPpDkpohfbrJ2ByaOisP11CUlvrRNMY+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585666973; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3OeRqcLUXp1PJx7mcVe0fqJObCbo/Ql8xyOG7ICszLk=; b=bYYJrv2+Pw+ZP5x9HUbu35k/UXEk84F7eY72wT/TLeD9BkltF5IqZQUExA6K7JQxLzLA3x65dEzJkzPhLR1wlJ4ZvE9tu/zZ+BlgpP1fFGRhuv9OPmQI5tS1TTCJgJD2KBkwPE7aglNqbsJQ/FYukTf11vXXPNedIzB7aIPW3MA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585666973788669.0787983853738; Tue, 31 Mar 2020 08:02:53 -0700 (PDT) Received: from localhost ([::1]:39696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIPk-00084e-D3 for importer@patchew.org; Tue, 31 Mar 2020 11:02:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56933) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIN5-0005FE-L7 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 11:00:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIN4-0007IO-JI for qemu-devel@nongnu.org; Tue, 31 Mar 2020 11:00:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:40544 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIN4-0007I1-EH for qemu-devel@nongnu.org; Tue, 31 Mar 2020 11:00:06 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-137-WgDs7YOEMfKYOPBgs17fnA-1; Tue, 31 Mar 2020 10:57:15 -0400 Received: by mail-wr1-f71.google.com with SMTP id e10so13178209wrm.2 for ; Tue, 31 Mar 2020 07:57:15 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id i1sm25889977wrq.89.2020.03.31.07.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666806; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3OeRqcLUXp1PJx7mcVe0fqJObCbo/Ql8xyOG7ICszLk=; b=I5WByNhbMTOvDnIrB2YOyKAWEmUaUGW9LUQdCmUM0BiLuUfVYK4tbb1a4SktLHGqsRuk29 MLzDWoLgH67fgyxZeO7H24f/hLMYJHkN9JSPTwDIoUCTdIKs9849xRhuhWjNca8P8+ETcL /dK117SBr3vIKDFeXGWj3265LibjPSQ= X-MC-Unique: WgDs7YOEMfKYOPBgs17fnA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Gu0oKcpP+vwX8QcmHaw4U7wfdMFOS+p6K77U2kBOCC0=; b=jEVNJpIlEOpy8rIkhGrN1anLAYrSIlgD79xIVCd1Tgq4Ngkhn0fQjDxPluy7mgA130 F2WpisD3JXKfjuSyT3KnAxypJriX/ggdSfm35eA1QrzaDf/G3BfnFhb2n6K6OUqZnn1m Q4gLtIOWutqed6d1DaNAQTGVdCXUsUuU6nkaNPUhCR+9qtt4Qj4Onzqkd1D4ydPSS79p gueHRXGCwYde9KMXeaZC6r3cyMgX7lWXqiucLIImCXTwLKJzBrpt2MZpegNwIJuGp6im ypky4TEad8Sd1lANxVsP0bhTwM/gDyNb4pKLZAp6zu2+hXD1I19ZoV1w5LUpMBRipqku QZFw== X-Gm-Message-State: ANhLgQ3TquyJo5d1+/BNV+LP0F8oHQAOn91JWRzaUH51DpMySBXps4YD YVrDxiiG5r7N/bfkdmxEx1o4j01IjqKWOGdIJZfywMl9ZDsCt7zOemZ71QWLnDkMTsXXDd0qZkk +V/y9gMqEkeBHaDg= X-Received: by 2002:a1c:1904:: with SMTP id 4mr3820678wmz.21.1585666634407; Tue, 31 Mar 2020 07:57:14 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsEI1lr9oQXddAAT4w6D4ZQUD3u1Wo65vDG8K+QoEx4/euA4+apMmE4RDlFJzdf+BTMIBGz8Q== X-Received: by 2002:a1c:1904:: with SMTP id 4mr3820660wmz.21.1585666634219; Tue, 31 Mar 2020 07:57:14 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:10 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 05/10] virtio-blk: delete vqs on the error path in realize() Message-ID: <20200331145631.135630-6-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Pan Nengyuan , Max Reitz , Stefan Hajnoczi , Euler Robot , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan virtio_vqs forgot to free on the error path in realize(). Fix that. The asan stack: Direct leak of 14336 byte(s) in 1 object(s) allocated from: #0 0x7f58b93fd970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970) #1 0x7f58b858249d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d) #2 0x5562cc627f49 in virtio_add_queue /mnt/sdb/qemu/hw/virtio/virtio.c:= 2413 #3 0x5562cc4b524a in virtio_blk_device_realize /mnt/sdb/qemu/hw/block/v= irtio-blk.c:1202 #4 0x5562cc613050 in virtio_device_realize /mnt/sdb/qemu/hw/virtio/virt= io.c:3615 #5 0x5562ccb7a568 in device_set_realized /mnt/sdb/qemu/hw/core/qdev.c:8= 91 #6 0x5562cd39cd45 in property_set_bool /mnt/sdb/qemu/qom/object.c:2238 Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Stefano Garzarella Message-Id: <20200328005705.29898-2-pannengyuan@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/block/virtio-blk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 142863a3b2..97ba8a2187 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1204,6 +1204,9 @@ static void virtio_blk_device_realize(DeviceState *de= v, Error **errp) virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err); if (err !=3D NULL) { error_propagate(errp, err); + for (i =3D 0; i < conf->num_queues; i++) { + virtio_del_queue(vdev, i); + } virtio_cleanup(vdev); return; } --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; 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=1585666997; cv=none; d=zohomail.com; s=zohoarc; b=X9rRDH4FJxORlr7NS912wj/rUYAxcNBb50HHkLN0HKMbX7Mn/XVWxbZYpXyZM7wy7aFEWlKTXhhSINHfk+Fgt6Vx+3KqfltCR+dkYxN0Ph+yZ3b5vj4QTbq+JkdA1M0gho46ikbes8OxK8z1rdebfoDH2BpefILtUhC2EHU5OD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585666997; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oFBT6Saz02hT5NP2gKNT3/lC8x4Qhc9zDb0zWjI7XDA=; b=FA5GE+HX1UQzdBfwjvYdL61S6xVsiX+EXzcLtPUzv2+1MKoOrqCfmXo7TSUW5T+eHFFNmpKx8iYecRplf/R8IMbpbc2Xu4V9LaR7PMnKbptrFl9RjUfeSL1qbtpCwxSBhHLdilc9HZyBPd5Tb1erHPSJSrYBdcAQXmKZtMccV0Q= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585666997153174.5428191071726; Tue, 31 Mar 2020 08:03:17 -0700 (PDT) Received: from localhost ([::1]:39700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIQ8-0000Wi-1M for importer@patchew.org; Tue, 31 Mar 2020 11:03:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56442) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKS-00005d-F7 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKR-0005ED-Ef for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:27229 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKR-0005Df-AU for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:23 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-407-9xFCsXWSNBOI9nHZa11udA-1; Tue, 31 Mar 2020 10:57:20 -0400 Received: by mail-wr1-f69.google.com with SMTP id c8so11201319wru.20 for ; Tue, 31 Mar 2020 07:57:20 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id i21sm4392794wmb.23.2020.03.31.07.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666642; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oFBT6Saz02hT5NP2gKNT3/lC8x4Qhc9zDb0zWjI7XDA=; b=O3Jul1SuPMTxlXhT6sphlhEKg54m+yLQPm59uFX17tKH+k7jUprYHZHDFnqSiqBzelpbDI uK0QsA9aSz408zCWtMU1IKUjGZyREkHpkFfBL0nobjRR9XjsGt8P4ZF2coP7KjGjxjY8hr MHkogkwrr51qoqeABvMrtWx8HaLLoDg= X-MC-Unique: 9xFCsXWSNBOI9nHZa11udA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0zH6PKQ4PTkqUI6BTEFD7QJzk8gWk/DfG7PE6omZvKA=; b=QhXdfvRtWieBKabqKULsaweVC96Xwd9Mq/UZdSl8h4+hShoK2mJ1hG7WrFpUOLYRZn aRbHFbVsrB5n3FhukUkTgahzeTFD0LjtMBbGw+ivxpI9NZc+cE5WD91doxNIs/BiGKwF Yr/xoEJq6HT8Ztx6KV5NJCKiJ95X614WWvlRg5wblSrJg4uj1pdpDUuaggGXcixCpC8M Ayws5Un3WXBv6mxpO0ctg2yeWbjqI6Sl9eguer5QMBrKzpD0ssPpGK/TVeuGu7qmTQpa rQtiy7L3uSgiUD0aIN/i4Tb+JdUf+U9QAA5VrgMdBQB3zuf3J5VJCxYfeJuPw+Gjo+qh RLoQ== X-Gm-Message-State: ANhLgQ0YFtP6+RAJPwUtVOmeIVdu/SUq0V/cn8YDnTIIVB+d72Jhfpw3 TUKFFuem8zgJV9OPSr3OwyCWsVmm1suhW5VdP4Nh2fIMlAHZjVCpXQ6aoBL6XOTC37XCQhqfvlW kBJwZ1EzIScdo1O8= X-Received: by 2002:a1c:2489:: with SMTP id k131mr3985351wmk.86.1585666636571; Tue, 31 Mar 2020 07:57:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtoQzxKeA+Ao4d+OJv0fwjKHt/r6I9lJc6AR6YgqbJJ+6narmsmO6PGQnE4osYk3hCEks9jnQ== X-Received: by 2002:a1c:2489:: with SMTP id k131mr3985333wmk.86.1585666636361; Tue, 31 Mar 2020 07:57:16 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:14 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 06/10] virtio-iommu: avoid memleak in the unrealize Message-ID: <20200331145631.135630-7-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Pan Nengyuan , Eric Auger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan req_vq/event_vq forgot to free in unrealize. Fix that. And also do clean 's->as_by_busptr' hash table in unrealize to fix another = leak. Signed-off-by: Pan Nengyuan Acked-by: Eric Auger Message-Id: <20200328005705.29898-3-pannengyuan@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 4cee8083bc..22ba8848c2 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -693,9 +693,12 @@ static void virtio_iommu_device_unrealize(DeviceState = *dev, Error **errp) VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); VirtIOIOMMU *s =3D VIRTIO_IOMMU(dev); =20 + g_hash_table_destroy(s->as_by_busptr); g_tree_destroy(s->domains); g_tree_destroy(s->endpoints); =20 + virtio_delete_queue(s->req_vq); + virtio_delete_queue(s->event_vq); virtio_cleanup(vdev); } =20 --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585666743; cv=none; d=zohomail.com; s=zohoarc; b=W7BgXrbNapTr/HZET4tyypM0/RTdPZ5V4hl/Iea0TwcR5bHFUxZGMkEM6v9ImBW5b2XTehwkaO/VXP4gryYekFtQS+btZkAJHOmCne3CVhRgRX9u2ohwjStmRpaQcxAmG1A/DOBjm0mXYVyUQs1bLSvWTHjdY0bh+Jj7acROhBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585666743; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3H/VwsSTTvhtpNg2QmTT6j5ZuTBdZBFJCOku4RulJDk=; b=Pu2wrKeMywmaHry3s/5EcU8Wg7jD232dVSmya0hCrzSzrXB3X1buBh74thwvbz+9m1a6Hn63PChwtqdni4zO/D++VKpKGWzs+jbX5A96LdzKUE72c9z5tgWwBgxZjNbnJEhEQstKbU5AOfJUCrV1Tt+AlQ0JiyRpeXVxCtV6V/Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585666743988533.1308001799927; Tue, 31 Mar 2020 07:59:03 -0700 (PDT) Received: from localhost ([::1]:39596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIM2-0002Ni-RH for importer@patchew.org; Tue, 31 Mar 2020 10:59:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56471) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKU-0000By-Mi for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKT-0005G4-K7 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:26 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:23365 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKT-0005Fj-FR for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:25 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-B_AKgg2nPpyJNTrOcIntFQ-1; Tue, 31 Mar 2020 10:57:23 -0400 Received: by mail-wm1-f71.google.com with SMTP id f9so796422wme.7 for ; Tue, 31 Mar 2020 07:57:23 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id b7sm25930878wrn.67.2020.03.31.07.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666645; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3H/VwsSTTvhtpNg2QmTT6j5ZuTBdZBFJCOku4RulJDk=; b=cziBRy+uqQHgTbEl1vZ1oD0CcDACXQNLgOpzegKU/ejqJVXuWVJ2ZztA8K/LJpuG/wdWO8 EvGLHIEBezLpqAS2p5jEXWzeVdhGYc60OIJG0BHjueX8b8UNhpqgoS1hSjvPIRB7QbBfEM h1s2WMzJcgsGuI7Mw/SEAz89KVRNc2Q= X-MC-Unique: B_AKgg2nPpyJNTrOcIntFQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=x+B8mYBE9cPql6HF4nADxpZb0302JvKpESQBouHDOpE=; b=NoZDlS/LCntetufih4v95kytRnVRCKgK9BRaBYbd4chcW9DwxfyL408RQGTpAXmJg+ /PsNEgV1cbC8xfeUVwWLV3pB6+z4OntkkX6WjW0zvcnyJmI31mkDiqj4+MJ7d+BZ1hew r5UQ/CbjXuXxa/XKKViB3lse1itJOZrGECit+4L6FQBY3+sQOtw2yUl/NfGpZQlpMhOX YRd0f+NoSt3F2Lxx5Flih0039Ob6bQYUw2NDQtWIPEyS//lzTeS8yPIZ2DZ0s3vp/Wqg 0704KD9V5MXyuDw9YX/qiKo1Gl4X9o7scveXuWM74RK5cicE7IBXJJ7bXcUtk6DL9Lac gD/Q== X-Gm-Message-State: ANhLgQ1vUMLa8NnPQrQn6FMKJkvbpAvMT43bXuCo+rfVMqx92ApbSCFt bhrs2Wv9/s21rwdoCMNzZNixR2do20nJBZ2+VNCDEwgiqpiZUCKbgwNbAh/G2LQsrLMMdPP3519 mo1jworN6EFFIvew= X-Received: by 2002:a1c:80d3:: with SMTP id b202mr3849892wmd.8.1585666638938; Tue, 31 Mar 2020 07:57:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvVoH4R9vtDDuaLznvDxX/poSm1H3whYVjMA2qNC0MpWjmDebAWhqr97YCe6yT4gD9Y0EKRKg== X-Received: by 2002:a1c:80d3:: with SMTP id b202mr3849882wmd.8.1585666638768; Tue, 31 Mar 2020 07:57:18 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 07/10] hw/i386/amd_iommu.c: Fix corruption of log events passed to guest Message-ID: <20200331145631.135630-8-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , qemu-stable@nongnu.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Maydell In the function amdvi_log_event(), we write an event log buffer entry into guest ram, whose contents are passed to the function via the "uint64_t *evt" argument. Unfortunately, a spurious '&' in the call to dma_memory_write() meant that instead of writing the event to the guest we would write the literal value of the pointer, plus whatever was in the following 8 bytes on the stack. This error was spotted by Coverity. Fix the bug by removing the '&'. Fixes: CID 1421945 Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Message-Id: <20200326105349.24588-1-peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/amd_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index b1175e52c7..fd75cae024 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -181,7 +181,7 @@ static void amdvi_log_event(AMDVIState *s, uint64_t *ev= t) } =20 if (dma_memory_write(&address_space_memory, s->evtlog + s->evtlog_tail, - &evt, AMDVI_EVENT_LEN)) { + evt, AMDVI_EVENT_LEN)) { trace_amdvi_evntlog_fail(s->evtlog, s->evtlog_tail); } =20 --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585667131; cv=none; d=zohomail.com; s=zohoarc; b=A8ryx6FUTmMcxpvrkyIB/3Dvb9Qvlp4yKWl9Ox8psPqXaZ6urSfuDMH0SuJZ5u8ux6fxKgP//moqD7cz4WBN28cEfS6URmHggNR1Y8HOcYVI9cBICRgEWmAHw1YTSEQOaau8b1ewCPxuzfaL0RRO5acCNdRVll2BNp+xhnexfX4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585667131; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NtNJ5H8JIBmysvGE2yyA792DHd77xM9UtTPllB8vSog=; b=UtOHXErmNaK2ah8VQe+gQt44rHYtZ0q47aOLMpVJe4Cd7Py6UICwI0czMl+Gy7d7R4DZcjVTfJ9IM7f3QJLgXLXePuisL8dLxJ2mOz5rz0W8UUY/KPdQvSROPXvlfnGdy9bZst8FObw8Z0uFXfYSDlUkOG1K8fu3cF1qzwxsm5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585667131910176.08571946122868; Tue, 31 Mar 2020 08:05:31 -0700 (PDT) Received: from localhost ([::1]:39746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJISH-0004TB-Jp for importer@patchew.org; Tue, 31 Mar 2020 11:05:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56464) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKU-0000AY-5y for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKT-0005FW-2P for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:26 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29493 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKS-0005FE-Tp for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:25 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-CsxtWD41MvesUr3Rao5l6w-1; Tue, 31 Mar 2020 10:57:22 -0400 Received: by mail-wm1-f72.google.com with SMTP id w9so801922wmi.2 for ; Tue, 31 Mar 2020 07:57:22 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id 61sm28951824wrn.82.2020.03.31.07.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666644; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NtNJ5H8JIBmysvGE2yyA792DHd77xM9UtTPllB8vSog=; b=h2k66394gcwz3yMQbM+Gn5iP8LqCYuO7cpvcCjGjFuAbKavGt9KiZcRE3dc06luaYKv9/3 5JKj+SWAOxcat+9CSdDAhHbakK6gGg34iMvMxUNpdLNNp3cCita7cISnYLHpAYexeJe9Xf 0QZr+lNOoB0c1E4HaV5B3iKXsZrgMEk= X-MC-Unique: CsxtWD41MvesUr3Rao5l6w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5kY1maDIkBgF7StU6AeIayvxOoSaIDJsW8zxlcAXMcY=; b=DT6OUKC7ck/lMBAxoJatAYcdfU6wNaatfejisNGG6JeOAXcZ0vBMjXjvbICPJvZiaC 0qkZb9TClpPtF8/h5JHNeVTBH7mxA9mDDTGWUC7/vHXdEvPqtAbW5sXRQ9VQ6tMFxsZi N8emNPIDeA+SaIZZHvXI9Jcw2ERzU2F/58d9DX67PAduPete62AXwa78euu0STejbgCm l7i8xunzyBwqycCSZp5KSyoHcDcyWzUOPCNwClJiCnL+gQgjhZ2ZqosOeHpoqbNCgYtR jUiic0ejOy3wLWzVTqDc29dWaVmNHit+lXca/tJsU7VkYZxwBKBlqdfVbUgGKBOv5kV5 z0aA== X-Gm-Message-State: ANhLgQ07I12jW5zMqLToI74bV6CxQvoVQSEKlhmB2RYbVn+M7PArKrMa qrtOi1g4Kn07I/P+a8sgfPfUZ2uWvc/aUtFTao444jV6auhOXrFSZ6M0ayLqNrMc4DEdxTvtFhR mhBgGnCvUgHnrpVo= X-Received: by 2002:a1c:6a14:: with SMTP id f20mr4003865wmc.53.1585666641234; Tue, 31 Mar 2020 07:57:21 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvXYs3jOXyoal1+/84Xncq4ecxi43FIB2U3eYPognXbh6eI7KCa0oH5TugXgZfC1Qlkw0PmYg== X-Received: by 2002:a1c:6a14:: with SMTP id f20mr4003850wmc.53.1585666641071; Tue, 31 Mar 2020 07:57:21 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:19 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 08/10] fix vhost_user_blk_watch crash Message-ID: <20200331145631.135630-9-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , Li Feng , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Li Feng the G_IO_HUP is watched in tcp_chr_connect, and the callback vhost_user_blk_watch is not needed, because tcp_chr_hup is registered as callback. And it will close the tcp link. Signed-off-by: Li Feng Message-Id: <20200323052924.29286-1-fengli@smartx.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user-blk.h | 1 - hw/block/vhost-user-blk.c | 19 ------------------- 2 files changed, 20 deletions(-) diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-u= ser-blk.h index 05ea0ad183..34ad6f0c0e 100644 --- a/include/hw/virtio/vhost-user-blk.h +++ b/include/hw/virtio/vhost-user-blk.h @@ -38,7 +38,6 @@ typedef struct VHostUserBlk { VhostUserState vhost_user; struct vhost_virtqueue *vhost_vqs; VirtQueue **virtqs; - guint watch; bool connected; } VHostUserBlk; =20 diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 12925a47ec..17df5338e7 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -349,18 +349,6 @@ static void vhost_user_blk_disconnect(DeviceState *dev) vhost_dev_cleanup(&s->dev); } =20 -static gboolean vhost_user_blk_watch(GIOChannel *chan, GIOCondition cond, - void *opaque) -{ - DeviceState *dev =3D opaque; - VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); - VHostUserBlk *s =3D VHOST_USER_BLK(vdev); - - qemu_chr_fe_disconnect(&s->chardev); - - return true; -} - static void vhost_user_blk_event(void *opaque, QEMUChrEvent event) { DeviceState *dev =3D opaque; @@ -373,15 +361,9 @@ static void vhost_user_blk_event(void *opaque, QEMUChr= Event event) qemu_chr_fe_disconnect(&s->chardev); return; } - s->watch =3D qemu_chr_fe_add_watch(&s->chardev, G_IO_HUP, - vhost_user_blk_watch, dev); break; case CHR_EVENT_CLOSED: vhost_user_blk_disconnect(dev); - if (s->watch) { - g_source_remove(s->watch); - s->watch =3D 0; - } break; case CHR_EVENT_BREAK: case CHR_EVENT_MUX_IN: @@ -428,7 +410,6 @@ static void vhost_user_blk_device_realize(DeviceState *= dev, Error **errp) =20 s->inflight =3D g_new0(struct vhost_inflight, 1); s->vhost_vqs =3D g_new0(struct vhost_virtqueue, s->num_queues); - s->watch =3D 0; s->connected =3D false; =20 qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, vhost_user_blk_even= t, --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585667295; cv=none; d=zohomail.com; s=zohoarc; b=g9+2ONXVFYGEHqXQ645KG0/7o9GoiWtZh0zoi8rD/sI5Y6PiKXmv3sKsMtEFVia+jzLIxgfh821IyokfxLuf8rMJTu4nJNwq8U1Lb0ijK+J4vY4hgL7PlNEEeIwcdPqyk85COIrcQ77qTfaj9yBocCafr4B4BQx8zBVE/rRdvFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585667295; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8QtCPGEv/CZtqoxyrND20GKfQEi1sCdM3G8yZMGmfOo=; b=b5MiU1VYIdkWu+Jt4KzzmeIvalpBdgZDbt0iU/Sh7JGyC7+/txdJzIfNMSD84IDEBQI1QV9KzxGhwgSq2TOkn4ud1MLzWOHCSaAOGnXUAgOJNns4cF6zlUWNH8FALQSvgtpnSRyH97IW7EGmetrzAgwO6CyvarO+InSq4zWrBFg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585667295167524.0020993239211; Tue, 31 Mar 2020 08:08:15 -0700 (PDT) Received: from localhost ([::1]:39790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIUv-0008JN-4B for importer@patchew.org; Tue, 31 Mar 2020 11:08:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57178) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIO7-0006EQ-C5 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 11:01:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIO5-00080a-8V for qemu-devel@nongnu.org; Tue, 31 Mar 2020 11:01:11 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:34729 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIO5-000806-23 for qemu-devel@nongnu.org; Tue, 31 Mar 2020 11:01:09 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-CvKrA3lANWGZDHzeQmcIUw-1; Tue, 31 Mar 2020 10:57:25 -0400 Received: by mail-wr1-f71.google.com with SMTP id q14so3493925wro.7 for ; Tue, 31 Mar 2020 07:57:25 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id h132sm4418038wmf.18.2020.03.31.07.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666868; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8QtCPGEv/CZtqoxyrND20GKfQEi1sCdM3G8yZMGmfOo=; b=TpjmreC1ggTpJwQ6ZPV+5sX4kLqX635IzoOETSEBkPnOSxbhhwbK//sNxLofAVbhJxaOoT 0GjstE8XFxz2CwZIVo/MyxfsuJhfjgFix9mPcBUa6CdU921xOWtGvYNEs9gGd+M9ujZEgQ qlNASUrPoY891Wit3jneS1ydRIgoNrc= X-MC-Unique: CvKrA3lANWGZDHzeQmcIUw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=DO2c2hX6OozgKYw5tPhyMzNh8a/0BxHCgkRpZwXkAWc=; b=KrZrYikkbrsCrRdxS/Vs5SwEa3os8wLbDt83Rw468BM6nEbatYd9ge/73sADLjRoXH 3kAF5qUQXNPd9Ru3W/olWFJ9SUKv+tPHeZD0RgGflK1btaFgnqwlm/nYtpbzHvOvSs8e Hy8gvY7onaBD6uzTzvRvUEtWlU5X5eeZBC4QQi5To20LVRvyS287z4cJ+UAnxw96xII2 ilcfxS+AQ6IvubOZyTk9MVuteTVMb8YJD06Wk4O8KLeER3ITJKW3lkH/olsJhkvspdUS /1O1ixVurdy5AGetAUX9Ni6wdYqtCcGJWr0OiPKcZDESMJG50VC+Pw9CSlxRCuXtkmtx VqJA== X-Gm-Message-State: ANhLgQ09EH60ac0MQIwBpjFNOMf0WUd7zqU5sCmLl9b3xOCKh1ndMKvL O/7S54t1t9Tw9WEXLxc4Fn22g2LuISBlACpHq+4pU4h5U2MFZFfkXVhUqp9yn/vWSwLeXU7WElt 7FjXP/nF7pO7aIr4= X-Received: by 2002:a7b:ce12:: with SMTP id m18mr4015333wmc.135.1585666644229; Tue, 31 Mar 2020 07:57:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvGqh0jVELlp9RIfPxzRwvnIvptq/Vxtp7Zqjpso8OKFqrVi+aYe84EXdMqYl5VNwozajMsxA== X-Received: by 2002:a7b:ce12:: with SMTP id m18mr4015311wmc.135.1585666643935; Tue, 31 Mar 2020 07:57:23 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 09/10] acpi: add acpi=OnOffAuto machine property to x86 and arm virt Message-ID: <20200331145631.135630-10-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Shannon Zhao , qemu-arm@nongnu.org, Gerd Hoffmann , Paolo Bonzini , Igor Mammedov , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann Remove the global acpi_enabled bool and replace it with an acpi OnOffAuto machine property. qemu throws an error now if you use -no-acpi while the machine type you are using doesn't support acpi in the first place. Signed-off-by: Gerd Hoffmann Message-Id: <20200320100136.11717-1-kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Paolo Bonzini Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/acpi.h | 1 - include/hw/arm/virt.h | 2 ++ include/hw/i386/x86.h | 3 +++ hw/arm/virt-acpi-build.c | 2 +- hw/arm/virt.c | 36 ++++++++++++++++++++++++++++++++++-- hw/i386/acpi-build.c | 2 +- hw/i386/pc.c | 4 ++-- hw/i386/pc_piix.c | 2 +- hw/i386/x86.c | 32 ++++++++++++++++++++++++++++++++ softmmu/vl.c | 4 ++-- 10 files changed, 78 insertions(+), 10 deletions(-) diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index 1f2dafbd7d..4bef575312 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -181,7 +181,6 @@ void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq, void acpi_update_sci(ACPIREGS *acpi_regs, qemu_irq irq); =20 /* acpi.c */ -extern int acpi_enabled; extern char unsigned *acpi_tables; extern size_t acpi_tables_len; =20 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 893796d3b0..60b2f521eb 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -131,6 +131,7 @@ typedef struct { bool highmem_ecam; bool its; bool virt; + OnOffAuto acpi; VirtGICType gic_version; VirtIOMMUType iommu; uint16_t virtio_iommu_bdf; @@ -163,6 +164,7 @@ typedef struct { OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE) =20 void virt_acpi_setup(VirtMachineState *vms); +bool virt_is_acpi_enabled(VirtMachineState *vms); =20 /* Return the number of used redistributor regions */ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms) diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 22babcb3bb..54af8ab5cf 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -64,6 +64,7 @@ typedef struct { unsigned smp_dies; =20 OnOffAuto smm; + OnOffAuto acpi; =20 /* * Address space used by IOAPIC device. All IOAPIC interrupts @@ -74,6 +75,7 @@ typedef struct { =20 #define X86_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" #define X86_MACHINE_SMM "smm" +#define X86_MACHINE_ACPI "acpi" =20 #define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86") #define X86_MACHINE(obj) \ @@ -104,6 +106,7 @@ void x86_load_linux(X86MachineState *x86ms, bool linuxboot_dma_enabled); =20 bool x86_machine_is_smm_enabled(X86MachineState *x86ms); +bool x86_machine_is_acpi_enabled(X86MachineState *x86ms); =20 /* Global System Interrupts */ =20 diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index fb4b166f82..7ef0733d71 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -910,7 +910,7 @@ void virt_acpi_setup(VirtMachineState *vms) return; } =20 - if (!acpi_enabled) { + if (!virt_is_acpi_enabled(vms)) { trace_virt_acpi_setup(); return; } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 94f93dda54..7dc96abf72 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -67,6 +67,7 @@ #include "kvm_arm.h" #include "hw/firmware/smbios.h" #include "qapi/visitor.h" +#include "qapi/qapi-visit-common.h" #include "standard-headers/linux/input.h" #include "hw/arm/smmuv3.h" #include "hw/acpi/acpi.h" @@ -1844,7 +1845,7 @@ static void machvirt_init(MachineState *machine) =20 create_pcie(vms); =20 - if (has_ged && aarch64 && firmware_loaded && acpi_enabled) { + if (has_ged && aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)= ) { vms->acpi_dev =3D create_acpi_ged(vms); } else { create_gpio(vms); @@ -1934,6 +1935,31 @@ static void virt_set_its(Object *obj, bool value, Er= ror **errp) vms->its =3D value; } =20 +bool virt_is_acpi_enabled(VirtMachineState *vms) +{ + if (vms->acpi =3D=3D ON_OFF_AUTO_OFF) { + return false; + } + return true; +} + +static void virt_get_acpi(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + OnOffAuto acpi =3D vms->acpi; + + visit_type_OnOffAuto(v, name, &acpi, errp); +} + +static void virt_set_acpi(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + visit_type_OnOffAuto(v, name, &vms->acpi, errp); +} + static char *virt_get_gic_version(Object *obj, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); @@ -2113,7 +2139,7 @@ static HotplugHandler *virt_machine_get_hotplug_handl= er(MachineState *machine, if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) { VirtMachineState *vms =3D VIRT_MACHINE(machine); =20 - if (!vms->bootinfo.firmware_loaded || !acpi_enabled) { + if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) { return HOTPLUG_HANDLER(machine); } } @@ -2184,6 +2210,12 @@ static void virt_machine_class_init(ObjectClass *oc,= void *data) mc->numa_mem_supported =3D true; mc->auto_enable_numa_with_memhp =3D true; mc->default_ram_id =3D "mach-virt.ram"; + + object_class_property_add(oc, "acpi", "OnOffAuto", + virt_get_acpi, virt_set_acpi, + NULL, NULL, &error_abort); + object_class_property_set_description(oc, "acpi", + "Enable ACPI", &error_abort); } =20 static void virt_instance_init(Object *obj) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9a19c14e66..2a7e55bae7 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -3024,7 +3024,7 @@ void acpi_setup(void) return; } =20 - if (!acpi_enabled) { + if (!x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) { ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); return; } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 98ee763f68..0bf0aaca52 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1297,7 +1297,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplu= g_dev, DeviceState *dev, * but pcms->acpi_dev is still created. Check !acpi_enabled in * addition to cover this case. */ - if (!pcms->acpi_dev || !acpi_enabled) { + if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))= ) { error_setg(errp, "memory hotplug is not enabled: missing acpi device or = acpi disabled"); return; @@ -1351,7 +1351,7 @@ static void pc_memory_unplug_request(HotplugHandler *= hotplug_dev, * but pcms->acpi_dev is still created. Check !acpi_enabled in * addition to cover this case. */ - if (!pcms->acpi_dev || !acpi_enabled) { + if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))= ) { error_setg(&local_err, "memory hotplug is not enabled: missing acpi device or = acpi disabled"); goto out; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index e6756216f9..9cceae3e2c 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -275,7 +275,7 @@ static void pc_init1(MachineState *machine, pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); } =20 - if (pcmc->pci_enabled && acpi_enabled) { + if (pcmc->pci_enabled && x86_machine_is_acpi_enabled(X86_MACHINE(pcms)= )) { DeviceState *piix4_pm; =20 smi_irq =3D qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0); diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 87b73fe33c..6ca3cf936f 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -904,11 +904,37 @@ static void x86_machine_set_smm(Object *obj, Visitor = *v, const char *name, visit_type_OnOffAuto(v, name, &x86ms->smm, errp); } =20 +bool x86_machine_is_acpi_enabled(X86MachineState *x86ms) +{ + if (x86ms->acpi =3D=3D ON_OFF_AUTO_OFF) { + return false; + } + return true; +} + +static void x86_machine_get_acpi(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86MachineState *x86ms =3D X86_MACHINE(obj); + OnOffAuto acpi =3D x86ms->acpi; + + visit_type_OnOffAuto(v, name, &acpi, errp); +} + +static void x86_machine_set_acpi(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86MachineState *x86ms =3D X86_MACHINE(obj); + + visit_type_OnOffAuto(v, name, &x86ms->acpi, errp); +} + static void x86_machine_initfn(Object *obj) { X86MachineState *x86ms =3D X86_MACHINE(obj); =20 x86ms->smm =3D ON_OFF_AUTO_AUTO; + x86ms->acpi =3D ON_OFF_AUTO_AUTO; x86ms->max_ram_below_4g =3D 0; /* use default */ x86ms->smp_dies =3D 1; } @@ -937,6 +963,12 @@ static void x86_machine_class_init(ObjectClass *oc, vo= id *data) NULL, NULL, &error_abort); object_class_property_set_description(oc, X86_MACHINE_SMM, "Enable SMM", &error_abort); + + object_class_property_add(oc, X86_MACHINE_ACPI, "OnOffAuto", + x86_machine_get_acpi, x86_machine_set_acpi, + NULL, NULL, &error_abort); + object_class_property_set_description(oc, X86_MACHINE_ACPI, + "Enable ACPI", &error_abort); } =20 static const TypeInfo x86_machine_info =3D { diff --git a/softmmu/vl.c b/softmmu/vl.c index 814537bb42..a331fb5321 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -144,7 +144,6 @@ static Chardev **serial_hds; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; int win2k_install_hack =3D 0; int singlestep =3D 0; -int acpi_enabled =3D 1; int no_hpet =3D 0; int fd_bootchk =3D 1; static int no_reboot; @@ -3516,7 +3515,8 @@ void qemu_init(int argc, char **argv, char **envp) vnc_parse(optarg, &error_fatal); break; case QEMU_OPTION_no_acpi: - acpi_enabled =3D 0; + olist =3D qemu_find_opts("machine"); + qemu_opts_parse_noisily(olist, "acpi=3Doff", false); break; case QEMU_OPTION_no_hpet: no_hpet =3D 1; --=20 MST From nobody Fri May 3 20:12:34 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585667150; cv=none; d=zohomail.com; s=zohoarc; b=EEbjufju9SD7uA0/93wl9+hHGrTbtkFJqXXr6vBmRL6uFdJ1xW/6HE3ZiPuPvnrFlvQ+6Hf8lfJwPgB91jB+7CJUt9XPjdIPMmCvuc49FmhRPoCauQmeXy6TdhB3a8wII/BLpRz1LlbfwUMcDBcDqPpMgW7xEJYo4x0e887DcX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585667150; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EX4DdBDhDDZZyh+2RG837/MZoX3Ur21s6lnBV3Fy1bk=; b=BzJAAYlXNy4tyP18BavRLKUno1O8FtLeTUWtpdgIZJYXC1X1FQsrShRMmVTqxN5pSV72u1QIrHwtNTe1v+JiR0nMiZE3JadDCNq0cWzHtAhM+rSCoK6ak0dTEWJeGf9YRCdfjU6rBvkPzkhuoKadhNO9R/d8H6FrmwvF1SEWAZw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585667150214981.089166875738; Tue, 31 Mar 2020 08:05:50 -0700 (PDT) Received: from localhost ([::1]:39748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJISb-0004vT-2M for importer@patchew.org; Tue, 31 Mar 2020 11:05:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56498) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIKZ-0000Qj-GA for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJIKY-0005Jo-Gb for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:31 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:40673 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJIKY-0005JO-CI for qemu-devel@nongnu.org; Tue, 31 Mar 2020 10:57:30 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-482-z-QwqaXvOAyKs_q4CyYspw-1; Tue, 31 Mar 2020 10:57:27 -0400 Received: by mail-wr1-f72.google.com with SMTP id w12so13067875wrl.23 for ; Tue, 31 Mar 2020 07:57:27 -0700 (PDT) Received: from redhat.com (bzq-79-176-51-222.red.bezeqint.net. [79.176.51.222]) by smtp.gmail.com with ESMTPSA id d13sm26563832wrv.34.2020.03.31.07.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 07:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585666650; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EX4DdBDhDDZZyh+2RG837/MZoX3Ur21s6lnBV3Fy1bk=; b=gk5nOQCy8lFnt8iYU0yQ2zoypYNjjbMEu41r7yEyjbXH9wLJd9sg4MKoPPSCRus7zXxL+S ucvOk+xX6PZCVjBpNCe+N78cyyFkjDSKJmC7SR2NRaPULjPgWVWbtVRWrtyeFCPamvdgb7 11H3iA9BPTH9YMt0mPwO1/MZna3qN2M= X-MC-Unique: z-QwqaXvOAyKs_q4CyYspw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=T5KbyKMpvzo40XJ5nR1jV2vHhbQADCZ+A9k5qVWlqLE=; b=OFdISj1ZsVuo5gGkIWp66b84ZjaC77gpMmV0mrNND0zbeo1M+yTvGJRiEpE3kKRomR 6JEJwBlsoNkG6JWg5RhMXMPl8yHJcN/8Mk0DKj3zhFREyaLEXueGDFawXAnQBFU7AnxH VtNf4D88WpPVNPgMzMEXLob214Pj1b908npOKcz7oZsd5N0T6eSbenzVgihAMqjQCSxo /QKoavoBomCsZYcfdBizOhHFAv14Yr2DAkdAnQy0SZMk0r6oUS9EdCYTOEf7MCxzW+/+ 1PzOdq4BaDsb34g4fH8ci8HmDS/HdHmy6WIZTZCeYLcjc5b7Zq3i5KiXljKvotDnUhCq OcxQ== X-Gm-Message-State: ANhLgQ1kLS3xKBrYjolgwEMjQjPXXZTzOrwWjdHe7tWTDwglPBaR7/V0 ZeskWgKDRWQeLWPRi8om0VAe9HHbOjX6KdnTcmvc8v/iNelJWA4L0wGmNTX40hbQ3wsMkKnpdBN g+G0F8l9SMbmTRaM= X-Received: by 2002:adf:f64f:: with SMTP id x15mr15969489wrp.70.1585666646357; Tue, 31 Mar 2020 07:57:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vve3FdVcmaozi8BMqvtIxs/GY/iMwN6yd7UWbLLIDqFdvXh/4HK7aDwRaE3Yys9zDib6flWZg== X-Received: by 2002:adf:f64f:: with SMTP id x15mr15969473wrp.70.1585666646212; Tue, 31 Mar 2020 07:57:26 -0700 (PDT) Date: Tue, 31 Mar 2020 10:57:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 10/10] vhost-vsock: fix double close() in the realize() error path Message-ID: <20200331145631.135630-11-mst@redhat.com> References: <20200331145631.135630-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200331145631.135630-1-mst@redhat.com> X-Mailer: git-send-email 2.24.1.751.gd10ce2899c X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Stefano Garzarella vhost_dev_cleanup() closes the vhostfd parameter passed to vhost_dev_init(), so this patch avoids closing it twice in the vhost_vsock_device_realize() error path. Signed-off-by: Stefano Garzarella Message-Id: <20200331075910.42529-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi --- hw/virtio/vhost-vsock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index 9f9093e196..09b6b07f94 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -364,12 +364,16 @@ static void vhost_vsock_device_realize(DeviceState *d= ev, Error **errp) =20 err_vhost_dev: vhost_dev_cleanup(&vsock->vhost_dev); + /* vhost_dev_cleanup() closes the vhostfd passed to vhost_dev_init() */ + vhostfd =3D -1; err_virtio: virtio_delete_queue(vsock->recv_vq); virtio_delete_queue(vsock->trans_vq); virtio_delete_queue(vsock->event_vq); virtio_cleanup(vdev); - close(vhostfd); + if (vhostfd >=3D 0) { + close(vhostfd); + } return; } =20 --=20 MST