From patchwork Tue Oct 19 14:08:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8B2BC433F5 for ; Tue, 19 Oct 2021 14:27:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6DC2261029 for ; Tue, 19 Oct 2021 14:27:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6DC2261029 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcq5Y-0008NB-AA for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:27:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpxI-0005ux-5V; Tue, 19 Oct 2021 10:19:04 -0400 Received: from mail-mw2nam10on2084.outbound.protection.outlook.com ([40.107.94.84]:24288 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpxG-0006IS-8h; Tue, 19 Oct 2021 10:19:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DEfrKhEFMq2fr2LTCyT8/oS9HqCy5pkym7uUKefdFVg5dQPWAPuXB50c6O4yOFVu4H1agc3jRedovyus+Zk+mGSMkloOwhSHQbBwmHqQAuCG//jBIOMS5++3hJ5cUKKLk7wjJfpvPFVbdltY7Rc0q83plB1sPloq2Nq6lar78Tv0l1Hh1vHr0Z+QdWqLU2pLQ0r9pR1QRYGDwczmRHZXdIH/VJXFKllWW6onB/0CDQycDEVUMusOMvXbIGXSHFsbOWmPQK24J6OcNv+b8SI7aoAw2ILyr9ccBnBGRylZfwAr9rNPlX6DlHjCp5Ac7Es2/EltatPO/3j8iez/578Y+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EAc2TEeXKtjBvXsZl2es0zUuJ3B9JqUDiMK5IG5cPtI=; b=XME0TkPzrAwUhkWSIxrIfRDnKnHpj9qMnUiscpzM5QnSLRBecc7GfFiMYy0RmsLT6kubAvMNR8f7A39SXyHZWBQ1FgN1kStwUWm/nzpQ++RG39zOxPYrm0lOvkhORSGodwaqVDK7VOlTvOvjOn9JSVrng8oT/IT9ibIZ/kq34NcbAvgSOctFACkQH9oqMXVRxNHZ2AT7BqBVqL5TbMBv4VBYELDGY4Fe9OXEcR6xWlBHT+d9sRX2URU48Fe2cGj3wJKzracOdyPJq46nS4RHxdatNLJUNchJ6hra1BjYFWnnGyZLdsmBIRKiM6S3nvrBDZJwl87qJuXpMnNEsASnFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EAc2TEeXKtjBvXsZl2es0zUuJ3B9JqUDiMK5IG5cPtI=; b=pbg+qbbENjGODI2NMzbX/YaIZvqy0CGl4SGCH9JbAEbt/+cMsmCnFBEyW4nCBRB+2MephyGJCYJCG5M8Blft1R+JZHr4s268QxKw6HSCfhdHnY5JwZ8uQELz/D1awXUjZgWrnGqey9tNPckZjNgLI2q8bJEuWqj3Junbflv8X2c= Received: from BN7PR06CA0070.namprd06.prod.outlook.com (2603:10b6:408:34::47) by CY4PR1201MB0021.namprd12.prod.outlook.com (2603:10b6:910:1a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:18:56 +0000 Received: from BN8NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:408:34:cafe::24) by BN7PR06CA0070.outlook.office365.com (2603:10b6:408:34::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Tue, 19 Oct 2021 14:18:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT056.mail.protection.outlook.com (10.13.177.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:18:56 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:18:53 -0500 From: Michael Roth To: CC: , Zenghui Yu , Jagannathan Raman , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Miroslav Rezanina , Stefan Hajnoczi Subject: [PATCH 01/64] multi-process: Initialize variables declared with g_auto* Date: Tue, 19 Oct 2021 09:08:41 -0500 Message-ID: <20211019140944.152419-2-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f62a9f3d-8311-43e1-a211-08d9930b62e4 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0021: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:327; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VSmORo1HSD8Km/kfBAcizBNB9a8nijOPrBq8Mv8N3prgooFeVifCNkaEoBjO10xAyyLz1MlCE5d2xuUHVHgKrt/N5PkwaXsGwApX1qHhB1V3GIH3Qfnp3nkb0b/dDMo4qfc7RC+VYF///njaccBdXtrRJegnJ1sumJDzARO02u2ZAk7nk/dM9bnPQO5aUwBdUvah5m06PpozHnqDImdqZWqtDguDPVSLMFBZdtkKqK2W3mtpydx3Zy4WZGs63uhpJpzyL4V1Bgn5RlxJeK13qW5xTUT3b7bJl0/xBcaSx+uyAw5WgNYlX8Q3EpL1AJmhuDLhkZ7pPqiRqC+NRz90AqOZiJfbD3AvDa2RAopJgE7EXslN+czvZ4l96kfGkibtarb1Um9bBKFrZ6Sx9Aq4F4iZhXg2MSYb+hxPXuGMXtBG7/CTMqIlBeBYlf6z261GdJgUV6h4Jt7Zhsj7O1SVUHULlIZYHsFInzqj7hJbZcS3FDQd998yMwILAdGmLtWzSPGXwlrjJN9wLHtXv4pC/V8t23L/5gNt1BEusNpDE+OTDWlE0/E6XOnvNywGWbzJWCIb3SeY9nppAQz5fNiYBwyQTns12f6jOxapwMKcdTYCQBqwQaaUZ7JXx7UCjMqZoFpnvSoRLZ6HCvKMrvQB+Iuq1vBVJoGhbVatd07mvQBgCgMEaEtHJMMOQFRYA7BgxnA0vphUHHEZ8axv4o9VOlbMWHTgVd4XnFzyqxGG980= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(16526019)(6916009)(26005)(186003)(86362001)(508600001)(426003)(36860700001)(316002)(4326008)(70206006)(6666004)(83380400001)(356005)(81166007)(70586007)(2616005)(2906002)(1076003)(44832011)(5660300002)(82310400003)(36756003)(54906003)(47076005)(8936002)(8676002)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:18:56.2280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f62a9f3d-8311-43e1-a211-08d9930b62e4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0021 Received-SPF: softfail client-ip=40.107.94.84; envelope-from=Michael.Roth@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Zenghui Yu Quote docs/devel/style.rst (section "Automatic memory deallocation"): * Variables declared with g_auto* MUST always be initialized, otherwise the cleanup function will use uninitialized stack memory Initialize @name properly to get rid of the compilation error (using gcc-7.3.0 on CentOS): ../hw/remote/proxy.c: In function 'pci_proxy_dev_realize': /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'name' may be used uninitialized in this function [-Werror=maybe-uninitialized] g_free (*pp); ^~~~~~~~~~~~ ../hw/remote/proxy.c:350:30: note: 'name' was declared here g_autofree char *name; ^~~~ Signed-off-by: Zenghui Yu Reviewed-by: Jagannathan Raman Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Miroslav Rezanina Message-id: 20210312112143.1369-1-yuzenghui@huawei.com Signed-off-by: Stefan Hajnoczi (cherry picked from commit d90226808b5b1b30b07968e94d8f74bf8804fc89) Signed-off-by: Michael Roth --- hw/remote/memory.c | 5 ++--- hw/remote/proxy.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/remote/memory.c b/hw/remote/memory.c index 32085b1e05..d97947d4b8 100644 --- a/hw/remote/memory.c +++ b/hw/remote/memory.c @@ -42,10 +42,9 @@ void remote_sysmem_reconfig(MPQemuMsg *msg, Error **errp) remote_sysmem_reset(); - for (region = 0; region < msg->num_fds; region++) { - g_autofree char *name; + for (region = 0; region < msg->num_fds; region++, suffix++) { + g_autofree char *name = g_strdup_printf("remote-mem-%u", suffix); subregion = g_new(MemoryRegion, 1); - name = g_strdup_printf("remote-mem-%u", suffix++); memory_region_init_ram_from_fd(subregion, NULL, name, sysmem_info->sizes[region], true, msg->fds[region], diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c index 4fa4be079d..6dda705fc2 100644 --- a/hw/remote/proxy.c +++ b/hw/remote/proxy.c @@ -347,13 +347,12 @@ static void probe_pci_info(PCIDevice *dev, Error **errp) PCI_BASE_ADDRESS_SPACE_IO : PCI_BASE_ADDRESS_SPACE_MEMORY; if (size) { - g_autofree char *name; + g_autofree char *name = g_strdup_printf("bar-region-%d", i); pdev->region[i].dev = pdev; pdev->region[i].present = true; if (type == PCI_BASE_ADDRESS_SPACE_MEMORY) { pdev->region[i].memory = true; } - name = g_strdup_printf("bar-region-%d", i); memory_region_init_io(&pdev->region[i].mr, OBJECT(pdev), &proxy_mr_ops, &pdev->region[i], name, size); From patchwork Tue Oct 19 14:08:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570093 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01EBFC433F5 for ; Tue, 19 Oct 2021 14:39:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C547610E7 for ; Tue, 19 Oct 2021 14:39:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7C547610E7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqHF-0003NP-Ib for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:39:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq1A-0003RN-Oz; Tue, 19 Oct 2021 10:23:05 -0400 Received: from mail-dm6nam10on2086.outbound.protection.outlook.com ([40.107.93.86]:41952 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq16-0001KS-IS; Tue, 19 Oct 2021 10:23:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FZbhQlrGCpdD+o6eO2TugNdgEBwIUAAODUbZcvz0JRLH/WOF+3T9VxWOy/+5E/I9fuANeO8r0szu/bCd85n7GjqpQMwWB9tQ++DRToGDodMejK0376Hfh7hXyh+UcjEg+WkgHyUVO/EK7vWl+iO7nbYA8II8ylox29M4p/fD3YMjVLnsDxJ50Aqg2w0jnhy5DgLCHbzpQT++57LeBofFjsoGH3ut4XX7AIJY0rEPJ1LtDJAyzB8QhlcFryM7d+qAewVJeaB5TKcM3/s8LP3w8+hQV1RRlCvS3h9yfBi6EHsukY6wHTcZDx7EOyxLqDmuI3sE+ZJ9M+JT2aiA7QliwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wvHv9eaWCE3qmCVGDTw3ai276CdKLfaO42BJE6vMc/o=; b=dzkKTY0QBmE6qNyMBa/6f5195eFL2kQR+wKNntjJKc9OtpAQ3UCXR2URoAN1iwgyNm5ovXseehfbKHBO1TlLKatmDd5YBszCON/N5ZQ92YVIuTAlAWA/FFOS5q+dSkp2/19xRzy04X3vjWLXOZI2YIrQWo783RJXYNLTO2s6F52lcGIeKYClwqFFduxqRPO9bw089sOY/rv709/jJ46nyOW2jHvNvrFpPxKtoMG8EpoDEcxi8Kp4mC4TPjparqJr556L8xaTLz/O4wypNpgC3I1wp1Eu9cdrLR3TfRv8VpKBC6JHnVZG7RkCOG9f4PuFl7Gh0czdHCBsmPQDua9MUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wvHv9eaWCE3qmCVGDTw3ai276CdKLfaO42BJE6vMc/o=; b=j4SBFOSq8BnW5qv4MpRBoBL0c3t5/ZPfTen9Fyn27bISVd1zVyhREV9X4HxSVAE/67DPz0HiQFYAaVXrWxcB1lPWI15QeDP/iSN9QEcMexackzjS/ouArPwkaFTwD8d1Tczol5u2fnml6gtj8OwbyWlC9tN0Fw5/XB2rNG7atZY= Received: from DM5PR07CA0159.namprd07.prod.outlook.com (2603:10b6:3:ee::25) by DM5PR12MB1738.namprd12.prod.outlook.com (2603:10b6:3:112::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:22:54 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ee:cafe::97) by DM5PR07CA0159.outlook.office365.com (2603:10b6:3:ee::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:22:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:22:53 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:22:52 -0500 From: Michael Roth To: CC: , Richard Henderson , Peter Maydell Subject: [PATCH 02/64] linux-user/aarch64: Enable hwcap for RND, BTI, and MTE Date: Tue, 19 Oct 2021 09:08:42 -0500 Message-ID: <20211019140944.152419-3-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 305fddac-ad4e-4e12-3844-08d9930bf077 X-MS-TrafficTypeDiagnostic: DM5PR12MB1738: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +9EycFDjytEukygFOSg0b2iaNPDt40UTELwxL6Kk1Q/Yib0kf9aCzm/pE74NfBDqJDi7cj4BR1QYDAfOAeRv7P9CVr22degBnsqD0pQHzjUbwwOqbaIknvwlVc37fLWANtHianUsPiNMLRh6UIIPeTmeSbBCKZUMt5gFWlTFhxKQpddFXV5zLVLPaGEOHeSFLdDq6tri6Qr7Sobivg0be0GvbOiqh/N1V8t12R7oryHmLHtdak9ry0WgdBrBwE+Pl+U90H6jv00bbM1KLvoXSGfegDxktscZ0rIbxIKaVvlIQMTM627498xn0y2sCn8O3jAid7LOV/tY+2aVLklCIayiQpG4OZ7xrJmI5jN/7u7NY75xKjYTkxP7VcwGiaxG9SE2XmtshAG1CBi2CovrQqEaBSjHIOCYhAfSWBaoa/XEdsYF8gvOXHdqi024tyaIG5mmeDcB1sZlQMmo7XVVS398unCm2LQBEdYni52VVWtP8A01CznNbmCD5tf2ehxnoCMh5vP2AFq8vPOXi0ZGznWNRhjojPkp9JD/GVrv0fJgnetRwmqYmNczS4HuTq49w/0GH77nllh2UNtUFhRp3saa/7P+uzz0l7Jf1W5VpT4uVXZD7mwAQJlzBd9B+5+9STkJR0UE+UmSVOtIFAgFm40ovL80wR35+fgJ1v3+eDGwGZtKuS7wwjGXvMRQB7IfKexnEBQ27O/1UvHDik8lzxGhIChl/Y1iyTCDd9q+AiroRNCrbuMMK7la44pZbHSlT9rQe3FQoMaPUtXgc07G0IEWWsRB8K0mVUvxfvYlNsQJyT898Oz/up8rU3v+cIzx X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(426003)(336012)(36860700001)(54906003)(2906002)(1076003)(26005)(44832011)(2616005)(36756003)(6666004)(5660300002)(16526019)(186003)(6916009)(83380400001)(4326008)(508600001)(70206006)(966005)(70586007)(47076005)(8936002)(81166007)(86362001)(356005)(8676002)(316002)(82310400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:22:53.7114 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 305fddac-ad4e-4e12-3844-08d9930bf077 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1738 Received-SPF: softfail client-ip=40.107.93.86; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These three features are already enabled by TCG, but are missing their hwcap bits. Update HWCAP2 from linux v5.12. Cc: qemu-stable@nongnu.org (for 6.0.1) Buglink: https://bugs.launchpad.net/bugs/1926044 Signed-off-by: Richard Henderson Message-id: 20210427214108.88503-1-richard.henderson@linaro.org Signed-off-by: Peter Maydell (cherry picked from commit 68948d18224b93361e2880e2946ab268d0c650d7) Signed-off-by: Michael Roth --- linux-user/elfload.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c6731013fd..fc9c4f12be 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -586,6 +586,16 @@ enum { ARM_HWCAP2_A64_SVESM4 = 1 << 6, ARM_HWCAP2_A64_FLAGM2 = 1 << 7, ARM_HWCAP2_A64_FRINT = 1 << 8, + ARM_HWCAP2_A64_SVEI8MM = 1 << 9, + ARM_HWCAP2_A64_SVEF32MM = 1 << 10, + ARM_HWCAP2_A64_SVEF64MM = 1 << 11, + ARM_HWCAP2_A64_SVEBF16 = 1 << 12, + ARM_HWCAP2_A64_I8MM = 1 << 13, + ARM_HWCAP2_A64_BF16 = 1 << 14, + ARM_HWCAP2_A64_DGH = 1 << 15, + ARM_HWCAP2_A64_RNG = 1 << 16, + ARM_HWCAP2_A64_BTI = 1 << 17, + ARM_HWCAP2_A64_MTE = 1 << 18, }; #define ELF_HWCAP get_elf_hwcap() @@ -640,6 +650,9 @@ static uint32_t get_elf_hwcap2(void) GET_FEATURE_ID(aa64_dcpodp, ARM_HWCAP2_A64_DCPODP); GET_FEATURE_ID(aa64_condm_5, ARM_HWCAP2_A64_FLAGM2); GET_FEATURE_ID(aa64_frint, ARM_HWCAP2_A64_FRINT); + GET_FEATURE_ID(aa64_rndr, ARM_HWCAP2_A64_RNG); + GET_FEATURE_ID(aa64_bti, ARM_HWCAP2_A64_BTI); + GET_FEATURE_ID(aa64_mte, ARM_HWCAP2_A64_MTE); return hwcaps; } From patchwork Tue Oct 19 14:08:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A070CC433EF for ; Tue, 19 Oct 2021 15:18:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33DDC60F9F for ; Tue, 19 Oct 2021 15:18:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 33DDC60F9F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqtD-0001RA-9p for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:18:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq59-0008Df-Jv; Tue, 19 Oct 2021 10:27:11 -0400 Received: from mail-mw2nam10on2074.outbound.protection.outlook.com ([40.107.94.74]:65476 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq57-00043M-HW; Tue, 19 Oct 2021 10:27:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QkB+04n0/M3SDdx+4wwNYMt7R1269dISIUzc2nPNpdv5FDAbxoKzltZSMk4vHmEgV8IyRwfkCycH33PNs6AFwGuUvZ3eLOY4vOV1fbOUtgftmNTPaMXWm1BngbRR1qZqYDCccjvzLynE5Gy5Od5lCjpdiXX/egp8+afOqNCQ+L7dKA58/Qe1dNSVfRzsu1EnahfiCveHgtpkiLsKCpQ16BDFLYE5Go1KMck1c8y6T6DzL74FK92FRYKEuIi0J5nJJe6KW4BvdlpvKBok8vpqc0Ya5Nuuin61+T4d2ZrotbtXEL/JseEV3lIEik85q+Ycw9ITHPs/vpeMaCqCXejJVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eATFIXQsgp8NL06pP86pSYBkK/Gd8ko0uRj9TKjeb2g=; b=d/sXFZ2GjnFX4W4PzRFzSc3SC0h/ybZLmkqL4pSmbP5btxllxPYffjtDfveN0sqgMZnioxpImtKEgHj0+eiMlbG+QEmAzIVRhlNM2mDPfLDG+O3onFlOCah/iBuRUgE8OyfiACjyoWla3AteoEtLkFbkgX+TigNIs96xPk7PhD2Ysm9gSRFxUT+BjrewvYgKXMeQ8K5WEyypMlEW4ZWLf1stHst5seFyvrY5v3L+YGJXtOT9gj/gGm1uxMA0NrceYOQ77pIeGiWRfTQRd52UuUvhAKOFK/guH+oOj3JyoKc6zTUpLzkzqs15fT9242pnQDlpI0cNhaiGgETNQ3xr+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eATFIXQsgp8NL06pP86pSYBkK/Gd8ko0uRj9TKjeb2g=; b=leL781eGvjc6SPK3hTc6o0sl3LFIDq6HIiBVXxd5V5Vn9EIRO4zOZFpFnYCevgc398Ofnr6lmZFEjSw63gc/jLdtj5wLnojtAJ+TaFX5LOyLaZ8QYNI/mstfQNZZTRfA3JIELMTsEQA6+sM5g1bNJLcCAmIbhvdtZlTYU6ye+aQ= Received: from DM3PR08CA0022.namprd08.prod.outlook.com (2603:10b6:0:52::32) by MW3PR12MB4490.namprd12.prod.outlook.com (2603:10b6:303:2f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:27:05 +0000 Received: from DM6NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:0:52:cafe::e5) by DM3PR08CA0022.outlook.office365.com (2603:10b6:0:52::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:27:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT060.mail.protection.outlook.com (10.13.173.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:27:05 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:27:04 -0500 From: Michael Roth To: CC: , Greg Kurz , Laurent Vivier Subject: [PATCH 03/64] docs/system: Document the removal of "compat" property for POWER CPUs Date: Tue, 19 Oct 2021 09:08:43 -0500 Message-ID: <20211019140944.152419-4-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82521485-8ec3-4eff-3c99-08d9930c86b1 X-MS-TrafficTypeDiagnostic: MW3PR12MB4490: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:556; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZYjIjOx1kae4PLkh5W0ughWUwu0sTzJNjIE3GzCJn0ljfg02N4D8UjUW33pSn4HHvacRCFOSKPL6Ow6nIyR52fZwXKOzhhOEtKGDUIouwSt83U5dv6Yk0oL/qvCXLs6R1Wj9VKI5YUIoZ/LNI5ptgwNaP4UaCjfts6pQ9seJ4G8AwpS0ZCxTCnFTLo8gGv7Y2A/OfLCUkRlbJyF2h/fyIsFsBvhnce4f0NgeIztEIt96fS72ntalRSNmP3bs6FcPILFWQBngZFlA7WK/TqiUwfnvpR5ANOrWat4uIFDye0ZqP2AXoF9IfPdNhZAKgdyYPAXlBWIoje6Z3zB6ayssanRs27IdP972+bS5vsDzPkN/L3IJiqMjO87sSTKLdFiJ/0Zma7S9GaW0Fb6SyfPxvozQadyviikSwFmrq0+YBaP3cCmbc2Fb/UdsaYN8GKWXk+0SsHutwjC1b6mSqrBiKaM5lphVCAenybo3nf2Y2BOS6t72nFNu8G4e+U0f+9elzpa2UGAL6wz0P8jvsdX75z2GlDS3sQuEyWAqmjdlo92W2Z4i2e45Cp7blaGwGuHynGQqO1yhi1Ql3dkKZ5uf+uo0+p5fpw/JFhh4fXhJmmWcPGRcqPg8+jdUVyfiLlbje+/7DO6fz6Zz4zLHVso6O2b15ziGCjl3s2K9iNDfBBPFRJFxiFYm44MYSm/BUMvmgdfjvDOqkyew5s/GOllE5j63KnvLZ8P6OP/GSfZ840E= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(8936002)(82310400003)(5660300002)(6666004)(70206006)(356005)(26005)(81166007)(426003)(1076003)(186003)(6916009)(2906002)(36756003)(8676002)(36860700001)(508600001)(316002)(2616005)(47076005)(83380400001)(44832011)(16526019)(86362001)(70586007)(54906003)(4326008)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:27:05.7489 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82521485-8ec3-4eff-3c99-08d9930c86b1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4490 Received-SPF: softfail client-ip=40.107.94.74; envelope-from=Michael.Roth@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz This is just an oversight. Fixes: f518be3aa35b ("target/ppc: Remove "compat" property of server class POWER CPUs") Cc: groug@kaod.org Signed-off-by: Greg Kurz Reviewed-by: Laurent Vivier Message-Id: <161399328834.51902.14269239378658110394.stgit@bahia.lan> Signed-off-by: Laurent Vivier (cherry picked from commit a058b895079348d0854a027a42ce3396a4a00bb7) Signed-off-by: Michael Roth --- docs/system/removed-features.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/system/removed-features.rst b/docs/system/removed-features.rst index 29e90601a5..c21e6fa5ee 100644 --- a/docs/system/removed-features.rst +++ b/docs/system/removed-features.rst @@ -285,6 +285,12 @@ The RISC-V no MMU cpus have been removed. The two CPUs: ``rv32imacu-nommu`` and ``rv64imacu-nommu`` can no longer be used. Instead the MMU status can be specified via the CPU ``mmu`` option when using the ``rv32`` or ``rv64`` CPUs. +``compat`` property of server class POWER CPUs (removed in 6.0) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The ``max-cpu-compat`` property of the ``pseries`` machine type should be used +instead. + System emulator machines ------------------------ From patchwork Tue Oct 19 14:08:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 565A8C433F5 for ; Tue, 19 Oct 2021 15:04:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA5666115A for ; Tue, 19 Oct 2021 15:04:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DA5666115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:54936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqfX-0002Ta-R4 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:04:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq93-0006sl-6S; Tue, 19 Oct 2021 10:31:14 -0400 Received: from mail-dm6nam08on2055.outbound.protection.outlook.com ([40.107.102.55]:10401 helo=NAM04-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq91-0000be-Ab; Tue, 19 Oct 2021 10:31:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J5o0ZISW1ptQrrmdgOs7U008JCVi1Cuqq2yBAxBGNnFD3T38TencObWUCN4RR+JcbgwM/k+SZI0As6Bti0H648g3AuNZaDpoXvXl5UrS+DtDJo8BanO592bFYtZ4BTXjYykWcTB1XjCWGpab2Yt8Ha4LfgfSDwjJaJPOzwKWmS8kFjUXXa+9+TD5eXeSgQ+z+87VdhT84QxnLX7RpWNJ2FXT4VCMYfMhhW2lncTcV3JdNA9ydAXOqyG34+lvqEq+UkPIt7F5+M/ago1pSyolaJMCCoVdG4P0GQLiAf39eKRxzIo4sWQ23yxjq+LvI7BLm3BPWhiBPZJGBQCllWPZsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kmTOjrMR0Dl1GoeTxWZB7KAWX3s+W0EjtNZMg2B1Xv4=; b=DrmBcJQEf2EzyJV38o9URQzXbJK/yNAF7rsJprwHiHAoUkpPBK0e3QrGw/tmz13nczVMDEeD5uw9/Gj3ZWQ6E57tMe8dKLtcA+X2y9x63Y1b8ujp5XMz2RJK4bYqs8gz/plUmXGyGtt3IAYULOhvfhiZUqZWZupnvcx7fOZn3+Dq08cxEfJnoRRBSTfKxhzcVjXWsKNwyyxbvT+3l+EU4875cqLkybKwr29iGyN7OETJHLEfYShtDPEWpqrbs6VCOzZ07/9hJAmPCIa0dJd7KmveEBmRD7XQwLuH7On1zjVKIQRD0rX9v4lvdtA7E5iySpA8KFunUYzYwyk+klaang== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kmTOjrMR0Dl1GoeTxWZB7KAWX3s+W0EjtNZMg2B1Xv4=; b=uuu6uWpSCcPiJf7mYp+mx0DS5qdCX/j+82UNBWzTvGf4ljV+fbDwatxgxxe13waIgSDVLHWv/BqJAwuWVjiGcIPcuBHZfdymWUTKHfHHEg1/6x4hXEOwEBjRgewvDUPArkExCX1Lkcig1VtrUg/z61aGjcAGS9MTTirMHdXnQyU= Received: from DM5PR13CA0031.namprd13.prod.outlook.com (2603:10b6:3:7b::17) by PH0PR12MB5465.namprd12.prod.outlook.com (2603:10b6:510:ec::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:31:07 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:3:7b:cafe::db) by DM5PR13CA0031.outlook.office365.com (2603:10b6:3:7b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.10 via Frontend Transport; Tue, 19 Oct 2021 14:31:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:31:07 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:31:07 -0500 From: Michael Roth To: CC: , Stefan Reiter , Wolfgang Bumiller , Kevin Wolf , Markus Armbruster Subject: [PATCH 04/64] monitor/qmp: fix race on CHR_EVENT_CLOSED without OOB Date: Tue, 19 Oct 2021 09:08:44 -0500 Message-ID: <20211019140944.152419-5-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5da0cc0-774f-4594-f876-08d9930d16e4 X-MS-TrafficTypeDiagnostic: PH0PR12MB5465: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:357; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KXgFHB3x1wE/TAJbX13oYuH4chuHnvagz6gxPWzrLcTn/J7DlPWkeJDNJEyE+xBYjDxHYiEDW2vEoUGg0IeFdRk/nrpFpGxWJBcPUva6uRzyANU/ta2y7koEhQ7sx/qeybStjzQAYqoWSqszumUoSbAhzlC8RzYf/Y7bFL5tkBy8rZq5Jpnv+L8PqSOgNUzr5h23kR1p5EpOxiNG5BW4vaF2qIjc4vlUi0jjHivF2HLkQWcBBGr3ck6O8jSosLE7J9QV+k4EDYWFS8cpJHO+mI5O0RqvTEbsonb012OdbjacLLIIbKv2AAjINzkqDGQm49FycC8a44xdgQ16KxwbTT26TD2Q6vBgmgEJ8sY8hWWK5FnLO6bMzHfe5bh/5g3g1kqv1SRyHUxJJjH8qUg9/6P8LkwJ1WNH0XjFCQZm5Fo+51K2IPSzYFX6ls1JcwuRp+p7Bac8DfLGph9KEiRjED2BBw1RDFyzefMF4l0G3PDQ3Du4UUOL8a1WUPQl7/WkCDc3+1qOJPI7ASwTx44Guh/UF1BtaGl6AydA51AhZue/iKwC5PP96+fWTF2HtkoNmS5AXgc9ftZmsth4yFPgpXsqvJ2DUNOgDOLkEgRCV+WnMBllbp5xWzmjau8SyGlv4Q/BnURLpxb3aavI8NtTg4bm/hxa7XwWNCbC+SsFCkIEjgskVxLqQew5N00ZiPD90fAAsuv2izC9qHyY3VX6wNuGew8PYWNU2BJzwCngUhE= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(316002)(36860700001)(47076005)(4326008)(8936002)(6916009)(36756003)(26005)(8676002)(5660300002)(2906002)(81166007)(508600001)(54906003)(44832011)(83380400001)(2616005)(186003)(6666004)(426003)(82310400003)(16526019)(356005)(336012)(86362001)(70206006)(70586007)(1076003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:31:07.6838 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5da0cc0-774f-4594-f876-08d9930d16e4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5465 Received-SPF: softfail client-ip=40.107.102.55; envelope-from=Michael.Roth@amd.com; helo=NAM04-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Stefan Reiter The QMP dispatcher coroutine holds the qmp_queue_lock over a yield point, where it expects to be rescheduled from the main context. If a CHR_EVENT_CLOSED event is received just then, it can race and block the main thread on the mutex in monitor_qmp_cleanup_queue_and_resume. monitor_resume does not need to be called from main context, so we can call it immediately after popping a request from the queue, which allows us to drop the qmp_queue_lock mutex before yielding. Suggested-by: Wolfgang Bumiller Signed-off-by: Stefan Reiter Message-Id: <20210322154024.15011-1-s.reiter@proxmox.com> Reviewed-by: Kevin Wolf Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster (cherry picked from commit a67b996e7894edfafbcd3fd007c9f58f26d25908) Signed-off-by: Michael Roth --- monitor/qmp.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/monitor/qmp.c b/monitor/qmp.c index 2b0308f933..092c527b6f 100644 --- a/monitor/qmp.c +++ b/monitor/qmp.c @@ -257,24 +257,6 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data) trace_monitor_qmp_in_band_dequeue(req_obj, req_obj->mon->qmp_requests->length); - if (qatomic_xchg(&qmp_dispatcher_co_busy, true) == true) { - /* - * Someone rescheduled us (probably because a new requests - * came in), but we didn't actually yield. Do that now, - * only to be immediately reentered and removed from the - * list of scheduled coroutines. - */ - qemu_coroutine_yield(); - } - - /* - * Move the coroutine from iohandler_ctx to qemu_aio_context for - * executing the command handler so that it can make progress if it - * involves an AIO_WAIT_WHILE(). - */ - aio_co_schedule(qemu_get_aio_context(), qmp_dispatcher_co); - qemu_coroutine_yield(); - /* * @req_obj has a request, we hold req_obj->mon->qmp_queue_lock */ @@ -298,8 +280,30 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data) monitor_resume(&mon->common); } + /* + * Drop the queue mutex now, before yielding, otherwise we might + * deadlock if the main thread tries to lock it. + */ qemu_mutex_unlock(&mon->qmp_queue_lock); + if (qatomic_xchg(&qmp_dispatcher_co_busy, true) == true) { + /* + * Someone rescheduled us (probably because a new requests + * came in), but we didn't actually yield. Do that now, + * only to be immediately reentered and removed from the + * list of scheduled coroutines. + */ + qemu_coroutine_yield(); + } + + /* + * Move the coroutine from iohandler_ctx to qemu_aio_context for + * executing the command handler so that it can make progress if it + * involves an AIO_WAIT_WHILE(). + */ + aio_co_schedule(qemu_get_aio_context(), qmp_dispatcher_co); + qemu_coroutine_yield(); + /* Process request */ if (req_obj->req) { if (trace_event_get_state(TRACE_MONITOR_QMP_CMD_IN_BAND)) { From patchwork Tue Oct 19 14:08:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB31DC433FE for ; Tue, 19 Oct 2021 15:42:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 84D85610C7 for ; Tue, 19 Oct 2021 15:42:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 84D85610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:37834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrGB-0000PK-Jc for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:42:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqCu-0003u0-Qe; Tue, 19 Oct 2021 10:35:13 -0400 Received: from mail-bn8nam12on2075.outbound.protection.outlook.com ([40.107.237.75]:28896 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqCs-0006b5-Hi; Tue, 19 Oct 2021 10:35:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FXFhkLkofC2yJZjYOdfioqjikFsgVNUjMLz7oPO2K6KSexM1qDDZZWerb2qFg3QzsCBZDOGNgnE8FrLPBGdE+HhpXtLEVy+sGuNsTgIzdj/GNPNQOXvXopnphBWLJZcuB87aEPoAat8VhBXgcQH1UZbvlXbuZo6efYGaWeSfaywyBgbMZIlxmgbmg5laChgbRKyZO7lvG3fxBunqle4kepD53C1VG7rHBBxLhDaj0prl+C0IRcyaogVaK/YOFXWpO5lWSnY1YenmFGM4VReSAfbNaIU02VPWjG1LZwwdcImAEV6Kj8ZoqqgYUjppDpM39vOC54d04JddUMb9q9j3YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EXBoQji/cwR4N4wlKIVc0awS2g6AFaRsHzulX5Z4u4I=; b=IkrKCSnLexheKBxnZJlOCYCLlpn9B+O4JcerFJyRGTEPyUwxdIQcClrOp+M9lA8AKgsbC9FgVplWYf1cVz9FrV/5CzsrIYCxe4AkEkqgxe6SQGwhZKw7sEDt9CZ4Cl52s+pBUkKIVI1sbHZf9goNnyMPgPSHtSeneq7jyisxS1E8VOJgI25LFz1EfKevpdeCevPRFXHSqKrCilsobvIK52zvsWFhb5yMEIya4xtyc/A+hv5g5ukJkfDCUbFLMqrMn0ZRHbQorzQYwKYiMgCKygbYsCz2ZaJsBNHuB38o/H0WO0Z7leG574nDUoWWvFxWxYqGfGrhuBLQxjlcNRjANA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EXBoQji/cwR4N4wlKIVc0awS2g6AFaRsHzulX5Z4u4I=; b=D0+npL7kMn7NTkLlmJUl0tIbC0v3U9+26LefYvH9HoQ6nunOHkGo9j6lsNnulk31A2dvZvt28OoQK594hCx2fxWTYsAv7scd+eqeGDVPDccinx5zyYpxon9AC1knfFeTI4l4+q/NvV4iHSY61gFb3UM2vjcQe/D7Y3SXv+r5n+Y= Received: from DM5PR21CA0033.namprd21.prod.outlook.com (2603:10b6:3:ed::19) by BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Tue, 19 Oct 2021 14:35:07 +0000 Received: from DM6NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ed:cafe::89) by DM5PR21CA0033.outlook.office365.com (2603:10b6:3:ed::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.1 via Frontend Transport; Tue, 19 Oct 2021 14:35:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT022.mail.protection.outlook.com (10.13.172.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:35:07 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:35:04 -0500 From: Michael Roth To: CC: , Li Zhijian , "Dr . David Alan Gilbert" Subject: [PATCH 05/64] migration/rdma: Fix cm_event used before being initialized Date: Tue, 19 Oct 2021 09:08:45 -0500 Message-ID: <20211019140944.152419-6-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c409fe7-bfa7-447a-18a6-08d9930da5c3 X-MS-TrafficTypeDiagnostic: BL0PR12MB5506: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:590; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8rRpxU33FDqisD9P+rVtc3sd+/F2zUwBeZV65B7fz6dS7+TgHDdaL6f/xQDEKxU1hkOMR2q2ZFnZ1wBY5cE8habmL7mqwDfyneoO5s4k3akZbbwujk/FXgWYsDslXSygF2H85cJXx44QT2JhUwSE+PiVmGQ1u9t2sqAFjvXhi/jKEvoQtfzGRBVxD843y6zYR8YNNtYZU5ER2oV3/TB5yQASoew2TQ8AYh8cxqr/cXGwGU9y2sxAAV+YPb1Ih3O0/Gpk1pTsySqc/FEAbMsWMXlIVofRVtls92ZUVxaT9WtGQ3A+vKtRAs/CJ+0xL2GvKvGpFPr4JeuAZUu7nP4ZOq0OJkYxHwEb5Rw6nWWa/WAQHzRwUtmufSKj9LDwG4ND2yBsHYoCnGaSEOC9b2pmfpVqD3nuag/puVDUJh1BjWRZf4la5yB16jqo2zcLhdsmwG2Dqsr/hulDGocBm7U72VhoQBFC2i+PQ0Iobk+ZgiBzI7siC4ikzxlnsJIk6LFyRkPaV+c4T+40sQzcUqhxaAbAfdzf77N0q3fmAkzw2YcNiTsIXlJYkLb1KsBaUtFdE/d3+ZSGIF1iSoJ2oYzUqPvhdDFwcQxC29PGfBZUoBtIK6OqR52Pu6sKRjmvsUYQhlFon6FTY+4dwlowVgD4iFITM/NpV/FLVNNv8Em14brebAKZfNLLynjRJUZEp3CBnt8KKBtP7wKSL0Llj+YdViJSG1WcXTtrC+niwl2eqP4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(44832011)(4326008)(36860700001)(186003)(16526019)(47076005)(508600001)(356005)(81166007)(83380400001)(70586007)(70206006)(2906002)(316002)(86362001)(8936002)(36756003)(6916009)(82310400003)(426003)(2616005)(1076003)(6666004)(26005)(5660300002)(54906003)(8676002)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:35:07.3770 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c409fe7-bfa7-447a-18a6-08d9930da5c3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB5506 Received-SPF: softfail client-ip=40.107.237.75; envelope-from=Michael.Roth@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Li Zhijian A segmentation fault was triggered when i try to abort a postcopy + rdma migration. since rdma_ack_cm_event releases a uninitialized cm_event in these case. like below: 2496 ret = rdma_get_cm_event(rdma->channel, &cm_event); 2497 if (ret) { 2498 perror("rdma_get_cm_event after rdma_connect"); 2499 ERROR(errp, "connecting to destination!"); 2500 rdma_ack_cm_event(cm_event); <<<< cause segmentation fault 2501 goto err_rdma_source_connect; 2502 } Refer to the rdma_get_cm_event() code, cm_event will be updated/changed only if rdma_get_cm_event() returns 0. So it's okey to remove the ack in error patch. Signed-off-by: Li Zhijian Message-Id: <20210519064740.10828-1-lizhijian@cn.fujitsu.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert (cherry picked from commit efb208dc9c3f1e881aecff21fb1c7a7b6b869480) Signed-off-by: Michael Roth --- migration/rdma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 00eac34232..41726cc74a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2497,7 +2497,6 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp) if (ret) { perror("rdma_get_cm_event after rdma_connect"); ERROR(errp, "connecting to destination!"); - rdma_ack_cm_event(cm_event); goto err_rdma_source_connect; } From patchwork Tue Oct 19 14:08:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9BBBC433EF for ; Tue, 19 Oct 2021 15:48:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 91395610C7 for ; Tue, 19 Oct 2021 15:48:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 91395610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrMH-0008AP-JQ for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:48:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqEf-0006m6-5T; Tue, 19 Oct 2021 10:37:01 -0400 Received: from mail-bn8nam11on2078.outbound.protection.outlook.com ([40.107.236.78]:44512 helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqEc-00005f-Q1; Tue, 19 Oct 2021 10:37:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CSlR4Nzr1QitUUqBEN4OM6h9xMdOway57t0YsZ9naYfupYezvrFeVwJDqD5v1R+/xrD959vfbCJ7YcgahX5sbErYzp/9VL3gfiUV4+DU2fmgqLk5ofQO3c4hsiAyIHs71Kfz+snqc3QtmHG+M+ClNp3DQXCZwVytQECztX9zBaGlB7xDgACXpID1Y4xVP9UFsxjSxZENwhRsVZDovwzuAfPzu7g8JTnYCTzZRkaBy9Kn7JvZSQSvW8czKnFoBTgchZtCdIXqtHYC55Na9H+2Z06jLBvg0lO7kis802Aofg9wH+6kDgXUnhY+SPuzDdf6MgxVouHV+dXu19Av/wNqUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3dbmu41gzExlIBkRVbHuUTC3dUS0rIqJ126RuElBaMs=; b=j2EUjWCUumIlXLzAD2Yap3roBhmp4qHm85mLaFSheovx9ZbYC+hbwa68ugbpB3Sv/XB7xI74OcIQ0VNBAlOtoRuWv3l6iegr/ND0wY5v1HwGK2Gw237n7RVk5F2STM3jfv5hQ6DRYUBGXuOa2NzM7JX4ObdKsydjwgXAFlklu93K5/RvORPoCNfQtbpQhic0RyWvXLK7tvmSu85QnBT3KpP1bSYWOZBQHQvUxZdyaZdlCUTDRvqyP0w8RHEVSTR0W2lrRC0z/4NXLo4MyausgopWhrCKY/5VW3q1KwaZeSkYViKfWKXoLCzZh1VvThqDfJUiK3YdIycpqsRgpRsQ1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3dbmu41gzExlIBkRVbHuUTC3dUS0rIqJ126RuElBaMs=; b=DOMHrJzTbuN7B2yN27DgmGbsdpgk4xwu+J/daNlBPGemMuGKBR6lJIsgS3kPN30CWovmIu/YhKX0uVHN6jMtZPaq1J0Bq4Z4kxb9sQw0HdZOMU6j5lXwGB3+4f1BuNz0nEaNxOmdx1g+T69kVJyU4lA0z0qLka9wqW0omlj12Rw= Received: from DM6PR07CA0102.namprd07.prod.outlook.com (2603:10b6:5:337::35) by BL1PR12MB5379.namprd12.prod.outlook.com (2603:10b6:208:317::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:36:53 +0000 Received: from DM6NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:5:337:cafe::50) by DM6PR07CA0102.outlook.office365.com (2603:10b6:5:337::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:36:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT023.mail.protection.outlook.com (10.13.173.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:36:52 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:36:51 -0500 From: Michael Roth To: CC: , Richard Henderson , Paolo Bonzini Subject: [PATCH 06/64] target/i386: Exit tb after wrmsr Date: Tue, 19 Oct 2021 09:08:46 -0500 Message-ID: <20211019140944.152419-7-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4665dac9-0811-4f15-c8fa-08d9930de48d X-MS-TrafficTypeDiagnostic: BL1PR12MB5379: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:15; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: piUR9Myq4egTV7lTQ0YoPwvXFvDFV6HjmDQCDcV62+pjqbZ2Y2JQdDEDjw70D6nND2qbq9lLX2ULXm3M9Eil8n4GY3cqkHwgVO1MA/Fcfaqqq8hWWBRWYWWopYZG+3m3WXkkkfAkan13GoNSM2ZA77JyAfPAfmtcl5gbMHLKElqLRFNOGMsaZZDunP204IwVFMTHYe8J1Gp1zKaxrFMhx4FRPHVoVOpCrRUbM/mECgOzw6/M5f1oixcKYWnFWckw0jRxqNqqd/IS4eypufmhG+au+ySuj0AJJhYuIrJdOrdmpph56dc24uLF9JzodAGUfZZUv1Y1ePD2qlU+n/eDEujx1xcogja58tAsh2dP/O6xcY8pVQ4eq5xCTpp58lDySl/awU3nSF99G8rnpLFxx9jUyIvMrP6XaoP7yaItwnPGxWgW0K37xwXe5nYEDXFlJibRRYCYvF8tYYyfqVRoGTFhLe0mUqijhSHimxbCD1W/bsAmv439q1cDFJDqb81NiC/Wp96DvQ6o0aJyAjW+pSC4qxsDmfB3AGQOEFYnLzbX4myPObJ+wHjYcR7K8F1AEaDf7tmbkjJGkYOpHbxv0fe5Z5A1XZ7Hz+QQ1TQ5lG8kG69UWSeCuFwBQom+O/kduFfhFxsP9q/HfQicEZEMHL3mvpn9w+Soi314YlZ2TQ01NZQJEvy3Sdja/Ql+epNVoYVnh5BIK9pxA00e/m/jPQar7oyiR0Kd3HLAk2Xe/pfqW3DaJSleaAF5C6erIpJY X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(36860700001)(5660300002)(186003)(16526019)(6666004)(83380400001)(4326008)(316002)(47076005)(8936002)(36756003)(81166007)(356005)(1076003)(508600001)(26005)(8676002)(70586007)(70206006)(2616005)(44832011)(54906003)(4744005)(336012)(6916009)(82310400003)(86362001)(426003)(2906002)(17423001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:36:52.7131 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4665dac9-0811-4f15-c8fa-08d9930de48d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5379 Received-SPF: softfail client-ip=40.107.236.78; envelope-from=Michael.Roth@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson At minimum, wrmsr can change efer, which affects HF_LMA. Cc: qemu-stable@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Paolo Bonzini Message-Id: <20210514151342.384376-46-richard.henderson@linaro.org> (cherry picked from commit 244843b757220c432e0e9ae8d2210218c034730d) Signed-off-by: Michael Roth --- target/i386/tcg/translate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 880bc45561..6b713b4fff 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -7198,6 +7198,8 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) gen_helper_rdmsr(cpu_env); } else { gen_helper_wrmsr(cpu_env); + gen_jmp_im(s, s->pc - s->cs_base); + gen_eob(s); } } break; From patchwork Tue Oct 19 14:08:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82DFBC433EF for ; Tue, 19 Oct 2021 15:20:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 063B860F9F for ; Tue, 19 Oct 2021 15:20:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 063B860F9F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcquu-0004M5-Ty for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:20:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqEx-0007OJ-6C; Tue, 19 Oct 2021 10:37:19 -0400 Received: from mail-bn8nam08on2054.outbound.protection.outlook.com ([40.107.100.54]:4192 helo=NAM04-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqEu-0000NN-VK; Tue, 19 Oct 2021 10:37:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KeytaudWFNlBZnWUXvEYwQLXs8uqeWDcOvzHGMrmOIh+brvbaOOf7bJ6gYukM6I8mdKLJxybZkR8lV2hkSVwcYep4SoZivcYlCDADyTIyuDIcOmzB92K9kt4OSvzPhaeyHmapQoouA2vIbqyw4nSeWEy4MEDna1hyV93DcBBON2VgKfQHnF2NkzfoQQWz/JAnuwurDF7J4Tz+QGudTR/Y3xW/4NipH0GTR9T7/EykpMIkF+6PjXgq08Qd11+I3aFwmvimUbwwU5JYpUjHzknMpl9vQh7j7RmYItCtcITw51nGNfZrEr37+vatAQAs+4o7BQBZC+Aj2r5CWP4Jg7Otw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vhGRItzSZTnZtRJBCly4eur/9lpsEtrNELZhzoFP+lo=; b=HxdhH2hKhRtBIEPGomCh7E8huh8WVtjqwGM0svl/v5RfKpGTLfeksoQ4s/rHuTqTL4ZU07nY04kl0QMlPg8zdAD31yKEI8PQScnSurMvjNiVZw+4BHcGH7GV+SE4seHhr3A/hJqYXWGlUlCwwNmsTHT1harkgHXW4mcXQPcVyTckSXYuxur00P5/aZYbmUUondGGVen5Zhkwt6xe7i65k4srgAIrAJhCkZqWr23VkxR6PduDfMxROLUJIqxzpAn+Sybl89XhugNvpyg8oSv9mY7+a7rh0MbEFXG3my3yAWnmkJUpfKG3TEaL+N5H6CxntfKSgosRwm4RITVsbcAN5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vhGRItzSZTnZtRJBCly4eur/9lpsEtrNELZhzoFP+lo=; b=f7pyGf668u/27jw8ag9Glig4B7KGdj7nOVEApgx1i/O4wvuz2IIL3el6y0K8muBK2Mb0gbOH0AaIl8oFHIi8wYsGeTYxAWaBSqDr/vPybHQIRH3eNuy9sJm/HvzwAXWtDVFCOd6h1g3oxOF/rrr+272hGXTx4l2wHye5rR5NI2s= Received: from DM5PR06CA0031.namprd06.prod.outlook.com (2603:10b6:3:5d::17) by BY5PR12MB4936.namprd12.prod.outlook.com (2603:10b6:a03:1d4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:37:13 +0000 Received: from DM6NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:3:5d:cafe::2a) by DM5PR06CA0031.outlook.office365.com (2603:10b6:3:5d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:37:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT014.mail.protection.outlook.com (10.13.173.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:37:13 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:37:12 -0500 From: Michael Roth To: CC: , Giuseppe Musacchio , "Paul A . Clarke" , David Gibson Subject: [PATCH 07/64] target/ppc: Fix load endianness for lxvwsx/lxvdsx Date: Tue, 19 Oct 2021 09:08:47 -0500 Message-ID: <20211019140944.152419-8-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 90711c85-f55a-4306-9781-08d9930df0cb X-MS-TrafficTypeDiagnostic: BY5PR12MB4936: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:153; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gYTCM2PvV+E6XVi+3A7L9hYxOr76po/rZQIniDnmk+V0zrtUnuoIkVMj4s77DvevQTPF1RNIunjd48Rg7x64jGqg07Y4XBKZRhkvZfJqmCuC1R9aONX2C5jBxF9DdKlxo0QLt/wW9D8VqWoESWwM6+cqqjurCkqJQCHRflfZ1l42yOrhiZkKx45xHEt4qfalV+z1oNtVg1iJWafBUT1dPMGDNNLYGKh/wzdaUxV54dahkgrN2eh90HzFGxGF3h3UM6q2O8KbEiC62xVZMg8tCsf9bvCVVaOJ8UkiYtgZHBFWdnwPG1tYiTAvjHaCOJ8S0ug0hN+GkdywjMgAgq4ahvEJOMgyo3GgzOxP2f5wK4bERt6c7bWvxsYshPvFF3q2w/PpzxD9AzzRuILW6Z04YEBZxNWqqDBx06b4xXU75ApWEJ8Xinc/FAiVPwKF+Cbzad6aTYSoxqGCk/AX6AuLiOpKry0ItuJSscXGlde6l83ZLpoSMNuDT7QTuhzhONnfMxY2LF+DkZJJlzIJxxIPHmthAjoVGZnHrhurK79B8DptYCcp0Q/ZQSYywJldIpw5w96a9jpburk/+NoSVr+fkvLFVcgoqjBwnovDv2BoncdHAHxVf6F3qO4TU/Shg6pVrvtuJpPzklHvf8w+eYp1rUBnUwbX5vPBypyccpoyk1YlLKX9lZoCbmxEeXpRoLC5voA0d9V/mZ0A2GAqB+uf+AFouFKZMAavHJ1BxOYJYFMbGdjmcnzAA75eYSDhu/E6eRyq5EK1scFlob0Rbeflm42GHAfWOGQEKuvCInTO92EE3m2apvB7uuE0afkXpMxa X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(186003)(5660300002)(36756003)(8676002)(47076005)(6666004)(36860700001)(1076003)(966005)(82310400003)(16526019)(26005)(8936002)(86362001)(70586007)(356005)(70206006)(336012)(44832011)(4326008)(2616005)(83380400001)(2906002)(508600001)(81166007)(316002)(6916009)(54906003)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:37:13.2564 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90711c85-f55a-4306-9781-08d9930df0cb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4936 Received-SPF: softfail client-ip=40.107.100.54; envelope-from=Michael.Roth@amd.com; helo=NAM04-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Giuseppe Musacchio TARGET_WORDS_BIGENDIAN may not match the machine endianness if that's a runtime-configurable parameter. Fixes: bcb0b7b1a1c05707304f80ca6f523d557816f85c Fixes: afae37d98ae991c0792c867dbd9f32f988044318 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/212 Signed-off-by: Giuseppe Musacchio Message-Id: <20210518133020.58927-1-thatlemon@gmail.com> Tested-by: Paul A. Clarke Signed-off-by: David Gibson (cherry picked from commit 861f10fd528263a507476b8c4dda93a9588dfa5c) Signed-off-by: Michael Roth --- target/ppc/translate/vsx-impl.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/ppc/translate/vsx-impl.c.inc b/target/ppc/translate/vsx-impl.c.inc index b817d31260..57a7f73bba 100644 --- a/target/ppc/translate/vsx-impl.c.inc +++ b/target/ppc/translate/vsx-impl.c.inc @@ -139,7 +139,7 @@ static void gen_lxvwsx(DisasContext *ctx) gen_addr_reg_index(ctx, EA); data = tcg_temp_new_i32(); - tcg_gen_qemu_ld_i32(data, EA, ctx->mem_idx, MO_TEUL); + tcg_gen_qemu_ld_i32(data, EA, ctx->mem_idx, DEF_MEMOP(MO_UL)); tcg_gen_gvec_dup_i32(MO_UL, vsr_full_offset(xT(ctx->opcode)), 16, 16, data); tcg_temp_free(EA); @@ -162,7 +162,7 @@ static void gen_lxvdsx(DisasContext *ctx) gen_addr_reg_index(ctx, EA); data = tcg_temp_new_i64(); - tcg_gen_qemu_ld_i64(data, EA, ctx->mem_idx, MO_TEQ); + tcg_gen_qemu_ld_i64(data, EA, ctx->mem_idx, DEF_MEMOP(MO_Q)); tcg_gen_gvec_dup_i64(MO_Q, vsr_full_offset(xT(ctx->opcode)), 16, 16, data); tcg_temp_free(EA); From patchwork Tue Oct 19 14:08:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE5AEC433EF for ; Tue, 19 Oct 2021 15:53:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 767466113D for ; Tue, 19 Oct 2021 15:53:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 767466113D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrQH-0006Nu-F4 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:53:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqFJ-0008Fg-0s; Tue, 19 Oct 2021 10:37:42 -0400 Received: from mail-bn8nam08on2058.outbound.protection.outlook.com ([40.107.100.58]:14368 helo=NAM04-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqFH-0000hc-7u; Tue, 19 Oct 2021 10:37:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bok5bCbAwG2jG8dRBbX2EjDl/P83jpcYyuwuHsYI4zrBpHIzRCg/t7Xrcw2podyThJ2SdVEwETyZbz7lLltk/nEMm+Dzbt6usiRhzhZiISaJylbatlV4ivNNquNPLkPsE6u/eCSP+Zxck7PcwJpRhMQxveHIRd7Jm8meHc7o44JX8doL0WoYJIH7iSgxLiFvuRjNQRj7GfHWjK30hvH4xVJd5aa8hlkDJhX4ENhlFy4vdEHitFXbNsBOUnqfkgyMJzabk3EXI8vLWxrBgsiokNysS/Mh6JD/gM0p+3q6XQHd/nV2qr/iUaxhv9421Sp5W1gAxuxYfKPwD7yhArAjpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RX13z+ipEsqqblZelRkWBKWNfiSFy0kyoSmkqtASusw=; b=e0fyrVsG6BT7TYL3teMZ4/ScRif2nVbcEyR7yysDzwsOVseNiPTKurnkKfw8z/XGnJ5tBetFqINOJig6YvPHlWanI+tQ649wJqXjEPjtolAJiycgSe4w83N4FB2w2aD3l5HtR3BdTYjJsAQGWOeQMxTlAmuo+oVu/mKPyEM4D51Ph0pqHjqbKvFCP9DDnAZZ0s5AIcwKCYxgCVaXurdYFScpo8WGG4L+Imy95y/bqsYQFntmfUNOhntJ/8YughrbENBZ8ny3vjRq6lFTTvE7IhOwkjIjY2kVJtZ8tvBGaJQUHRvvZcpiS5ZFmA2m5H62f6caj1kVVlUoumhwy5MRMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RX13z+ipEsqqblZelRkWBKWNfiSFy0kyoSmkqtASusw=; b=j87i8/9oNkZ7IWs1uwuKhd6rFyNL2Rx9uXsujRGNnXF8pk92x0Jz1wvO2xexXIfeBNIjSHOTEzZ+cCm7+ouavrQT7a12BLKNYfGFzBw9ATuSoSy9wFLzttrDK3FnD8TLS0anc7Uhbr1eGnDHHlgr26RUmUEuYpG5uahtlY6LbCw= Received: from DM5PR21CA0043.namprd21.prod.outlook.com (2603:10b6:3:ed::29) by BN6PR1201MB0178.namprd12.prod.outlook.com (2603:10b6:405:55::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:37:35 +0000 Received: from DM6NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ed:cafe::68) by DM5PR21CA0043.outlook.office365.com (2603:10b6:3:ed::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.2 via Frontend Transport; Tue, 19 Oct 2021 14:37:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT060.mail.protection.outlook.com (10.13.173.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:37:35 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:37:34 -0500 From: Michael Roth To: CC: , Paolo Bonzini Subject: [PATCH 08/64] vl: allow not specifying size in -m when using -M memory-backend Date: Tue, 19 Oct 2021 09:08:48 -0500 Message-ID: <20211019140944.152419-9-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2d0b98f-1628-4556-1a89-08d9930dfdf2 X-MS-TrafficTypeDiagnostic: BN6PR1201MB0178: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1360; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UzuDjaLNxch4QN6B9hZl3kit5dyXhufjUdaWQ2S6RhuvxvfXYfng+5oKzoa/PSgKmRaKNUf0ivcUAvy4aMmtC4RmdF2Wzb0zm3NeHm60JdQgo98T6KeTzZCGZrnVZXfN8tAu9xseF3N90FR+5V/petal/e8t4FldYpUAzafL6OSacTX6mQag+uKXomgWWlnRzeTZgPRX26/odJBvF3UgfgU7JKOzio5EWqXkWn5gjG6YQdugLDkdqy15rexnhkpQvb9AkizqWg+dixTncuimUb1VDb4NGL2ztTX4xV5AR0ty1EaQ1gE32sEA0BMqq/zw+mlSt8vHdXc+iwJ5/nA8SSxfoE+xBhR+zVkk/dbkm2dA5UdYd+MFDmj14t4fSVYtDxndD25aNP830naM6FaRcxbbuiyHQhyBxd3zU1KHXQTEyQtVa8BaASHZLZWE5cSyrLg7SdEgBp6KHruuk4slqaO+JVkfNiccWDTzhmc22wKPsX2tRnQo3lLE5jJnhMmbXdt20X/lkni+CTaeajCVsXIbMthmchkaZT5u9QvsRrqr/buiYEOgHrlw7zbKcB0HX3OOViLwvMwloF2SV/lPaYliLzwkleS7OPzaqTF3hZ2uo1yTpG+/lQADvpZxOdu3aa4uF4ehIX2WS0OyZfCErI2Xge6I9UFi/ZzSwbm1yQf8BlvePiAkBhmT5YpkkYrN4VV+duVWf5wJQygm41kruOECP5sACXZOsf/vXtIXLbk= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(83380400001)(4326008)(54906003)(5660300002)(36860700001)(316002)(16526019)(26005)(82310400003)(1076003)(47076005)(36756003)(356005)(81166007)(4001150100001)(2616005)(2906002)(336012)(426003)(86362001)(6916009)(8676002)(44832011)(508600001)(8936002)(186003)(70586007)(6666004)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:37:35.3246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2d0b98f-1628-4556-1a89-08d9930dfdf2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0178 Received-SPF: softfail client-ip=40.107.100.58; envelope-from=Michael.Roth@amd.com; helo=NAM04-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Starting in QEMU 6.0's commit f5c9fcb82d ("vl: separate qemu_create_machine", 2020-12-10), a function have_custom_ram_size() replaced the return value of set_memory_options(). The purpose of the return value was to record the presence of "-m size", and if it was not there, change the default RAM size to the size of the memory backend passed with "-M memory-backend". With that commit, however, have_custom_ram_size() is now queried only after set_memory_options has stored the fixed-up RAM size in QemuOpts for "future use". This was actually the only future use of the fixed-up RAM size, so remove that code and fix the bug. Cc: qemu-stable@nongnu.org Fixes: f5c9fcb82d ("vl: separate qemu_create_machine", 2020-12-10) Signed-off-by: Paolo Bonzini (cherry picked from commit d349f92f78d26db2805ca39a7745cc70affea021) Signed-off-by: Michael Roth --- softmmu/vl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index aadb526138..29d6415d5c 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2025,8 +2025,6 @@ static void set_memory_options(MachineClass *mc) exit(EXIT_FAILURE); } - /* store value for the future use */ - qemu_opt_set_number(opts, "size", ram_size, &error_abort); maxram_size = ram_size; if (qemu_opt_get(opts, "maxmem")) { From patchwork Tue Oct 19 14:08:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 072E6C433F5 for ; Tue, 19 Oct 2021 14:25:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8CE1661029 for ; Tue, 19 Oct 2021 14:25:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8CE1661029 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:45022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcq3G-0005O3-HK for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:25:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpql-0004Rc-NA; Tue, 19 Oct 2021 10:12:19 -0400 Received: from mail-co1nam11on2073.outbound.protection.outlook.com ([40.107.220.73]:46337 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpqj-0004F5-7B; Tue, 19 Oct 2021 10:12:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nNEk3gv808+iWebQsUa8d0nOAjBoLjv7AG5WzhmkD0mSSJW3UPNUB8LSyO2C1Rp81E3CpP5foXt5gSRJhi+mJL2zEF4jTWMtmCglM7bvikLL6xSiPGwdUMgTKEEXBlvR+SpsllPIjBQpmuy7QwZdEZDOeorCNl9ON3s/kvurl7gFDN8wWXGyTDngCdiLY2xYreZDNS32MMzlxnyFYCzc3EfsGNMkBoqEK7KZmc/EZwFBKzb9yZwYp4/rCBYUs1DAWYqvGgsHzJckycpb9NOIm9GW3AgfSee4y3MyyPo0NlA5LYOCF6Mw8Ma2Lp7IVzXYhMy3J4GJ3BZiAyAVu2Umng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rpHV6SblamuH9pRvxIeBV2ts8xEuCx/gKb1Pd6OPiVg=; b=ISVGfm2km5Ns0sGaogS4OIR9IurSGrmxisLyBjmyf7zsRJPDvWarnIS0Yj8d4cVBGbWNFihGdVSy+PrwWQ1VirPKbhpOrciKnxZoef5xN3piRPBX/ovcROh4aRyKWLhc+BvbwY3Qm3xz3HDlBlbYT9xhWGAidw3goNpPzXOU6prtHQX5rDcX582ixB/pG7Xv3V+JyPjvoZE7efZejPWkeI7TJEeLXErFKKL01BhTPDDdJP3f4jfP6pKIN6ZQSa3CCyCKwdc1lMePXreHN3/JfwekhVZU5Kk25h429Yu2ywbMgOeJ0Dv5qjy9BLNemHbyjlX6KrPFJz0Jzgco5zec/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rpHV6SblamuH9pRvxIeBV2ts8xEuCx/gKb1Pd6OPiVg=; b=0IHDLVURU1j87uXOhG7Xm+9N6PihQQjz/FZCydjFgB/+COgAZBxZWWX3A5PJsMF3vB1iO8ro+4l21ZcMhB6Wuf2DyvEn9UWFoOR0mOT2FNgUVrETVBs9tleZlbI4r8fnBbv94suub9V6qX3IRgGylVBnJibsY0sg4ZlLBbrdvcA= Received: from DS7PR03CA0251.namprd03.prod.outlook.com (2603:10b6:5:3b3::16) by BYAPR12MB4760.namprd12.prod.outlook.com (2603:10b6:a03:9c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15; Tue, 19 Oct 2021 14:12:12 +0000 Received: from DM6NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b3:cafe::8c) by DS7PR03CA0251.outlook.office365.com (2603:10b6:5:3b3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:12:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT034.mail.protection.outlook.com (10.13.173.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:12:09 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:12:04 -0500 From: Michael Roth To: CC: , Max Filippov , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 09/64] target/xtensa: fix access ring in l32ex Date: Tue, 19 Oct 2021 09:08:49 -0500 Message-ID: <20211019140944.152419-10-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8d3445b-0884-4223-f2b5-08d9930a70b9 X-MS-TrafficTypeDiagnostic: BYAPR12MB4760: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RZ/56qZ8C2uS2uAZA1QKcdb5p8LPuh2PcjIlnbwYs0fdXvqMVntAiBH86bO5yHcPL7SzFVTFgmKwOnJGaKlGCNkwWgoK/Aa38PAZ+eRyo2neOcebZ5KIzAQMAb54nIB2TYnhqOqicnWIPXhpyr3YpckULs+LnV+yYJPMQsBcXFcedA6aB2hSAEmHwTfsSL/WAdWK6OizznwD39qBWPymJgT0OMdsRbmVBulqH7bd4x08hsJh7fdwX0fbTiVGICt/okm0RNUIlc8Dcdp8YfAM3PrSa1/XPUZR6pD8JXJbrTrlMl/omKA+rFpyJz0CDR2bnym/k8sObelqOr6imzco1Xm/E1wNA4w4wcE9a1PWiBuGu9nUxsIyDrVjf1NGcJQ6oaIxl3THjl/53OGuQF9akg7174ozHCZQRL7wF+Y1eHP/WMdPiRMJ67icvNXN1OqSM9U+Ap3CHP0OUdMV8Uht26hdiQF3Fari/M2q5GeSytUOlSD9dOoYKzkE0YT0tjDF/snIvu7z+/QbYxfvTOeipyEMOLLZH4ng7rgUcP3W2RZQtUqA0rhRv36ofnFjGfUe0pQmD3ChYAZuNE26wIbJ3TES/QhEqa5ruMWSU6V5h1owdrA2I53acrmnMkLoYqMBITN8VNvz+4kFvJHvuJiolt6VASffNQJ5vYay7S40mgGokyEioygFPHz5RYhqY/dWCRqmoYS9b75HwJut0gupOFrpOt/AG0lGRJ5J72DpCmE= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(47076005)(356005)(86362001)(81166007)(2906002)(1076003)(4326008)(26005)(36860700001)(6916009)(6666004)(508600001)(44832011)(82310400003)(83380400001)(70206006)(5660300002)(336012)(36756003)(426003)(54906003)(316002)(2616005)(8936002)(70586007)(16526019)(8676002)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:12:09.1760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8d3445b-0884-4223-f2b5-08d9930a70b9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB4760 Received-SPF: softfail client-ip=40.107.220.73; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Max Filippov l32ex does memory access as all regular load/store operations at CRING level. Fix apparent pasto from l32e that caused it to use RING instead. This is a correctness issue, not a security issue, because in the worst case the privilege level of memory access may be lowered, resulting in an exception when the correct implementation would've succeeded. In no case it would allow memory access that would've raised an exception in the correct implementation. Cc: qemu-stable@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Max Filippov (cherry picked from commit 735aa900e4bf57b777ac620bed7c88234ec4b601) Signed-off-by: Michael Roth --- target/xtensa/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 0ae4efc48a..1678b65607 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1817,7 +1817,7 @@ static void translate_l32ex(DisasContext *dc, const OpcodeArg arg[], tcg_gen_mov_i32(addr, arg[1].in); gen_load_store_alignment(dc, 2, addr, true); gen_check_exclusive(dc, addr, false); - tcg_gen_qemu_ld_i32(arg[0].out, addr, dc->ring, MO_TEUL); + tcg_gen_qemu_ld_i32(arg[0].out, addr, dc->cring, MO_TEUL); tcg_gen_mov_i32(cpu_exclusive_addr, addr); tcg_gen_mov_i32(cpu_exclusive_val, arg[0].out); tcg_temp_free(addr); From patchwork Tue Oct 19 14:08:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDC7BC433F5 for ; Tue, 19 Oct 2021 14:17:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 708A660F9E for ; Tue, 19 Oct 2021 14:17:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 708A660F9E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:55838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcpvy-0001qw-EP for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:17:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpt5-0007Gv-72; Tue, 19 Oct 2021 10:14:43 -0400 Received: from mail-bn1nam07on2053.outbound.protection.outlook.com ([40.107.212.53]:54553 helo=NAM02-BN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpt3-0006Gr-7T; Tue, 19 Oct 2021 10:14:42 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gyrr7lAgc1TFUSSdXg4+doboeEroIvd+TSTpik7FIL1ilcRi0xF3vLUIHIva9EKEMGUJe9qu/c23V966d0SCuB9OEAMa6z2frfeRc/PouxNYO2Dd/ebqGsdA1T+IEdLwSMjRxz/xm91vWesRXKkPBz2/6oPfZbBfyeEOvJhvci/OB9MGjAyWzJjbK9FxE0cZyP9fqQsW4whVOXwX5rIPhNGVjQceaK4a+4c72TDjVWZXxiQS2TiR5ByuDGzD51VTFl2Pg9oAS8bwXasuUjILuwWiT+y8FleVDfDNuNMOVdwN/dvoWzmF/UQQQ4Jt87BdvsdsX+qgTISoZ3ZBK9s01Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CDMIuFwe2bQWetjAmiu0FRdO6bsMrNc6jbT71mf618Y=; b=dM5ZpOYYrfPPonaUuy2ndKAAMKkfm+kQo+XN4vptBJseSMzvxMGM3gplSltQiO50Rbn57mPkJa6v4CNfV8vF3L+IHprxKPHgwg4wGZClbbKkajS9IO/9HwKvCpQnuDTRXlPwAwdm57qyEY4qhQ7p3dVjO/gdR5YGmsH5dRWoxGtw2K9ViKqkrMGfX9hUKZy8BG7kXQB9dpqBHvK056mbeRcGG+5DaR194Xp0z11Qe/8FdhiNpYqx8tf2JpS+HxCqotUqqQQuMy6MCerKprw8zQt6J0f3CC7EuHxxJa/s0JmiEaHXK/noVbUUf9DPI+1x/m+XOnXhnwJc5duBVEAlig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CDMIuFwe2bQWetjAmiu0FRdO6bsMrNc6jbT71mf618Y=; b=e5g1yV3yqNQ6B8cbKfG/tAN6QALLzsXwMcFj3mCwtJqN8FDinUkW1xxlXErqYZfpun1xBKK1eAwFWmnA1RkyBqkdHvMbAcO6N7mmmbko4uEC4ETrPi8G/JWCfROVlWJEOOmL95G4PU1szthLLP8u1iObNgunasYTtDAL9OyD1Ho= Received: from DM5PR16CA0042.namprd16.prod.outlook.com (2603:10b6:4:15::28) by MN2PR12MB4423.namprd12.prod.outlook.com (2603:10b6:208:24f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Tue, 19 Oct 2021 14:14:34 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:4:15:cafe::46) by DM5PR16CA0042.outlook.office365.com (2603:10b6:4:15::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:14:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:14:33 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:14:33 -0500 From: Michael Roth To: CC: , Paolo Bonzini Subject: [PATCH 10/64] qemu-option: support accept-any QemuOptsList in qemu_opts_absorb_qdict Date: Tue, 19 Oct 2021 09:08:50 -0500 Message-ID: <20211019140944.152419-11-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6e55978-4ab0-49ca-ff7c-08d9930ac68d X-MS-TrafficTypeDiagnostic: MN2PR12MB4423: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:88; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jILgjUMTR1wBkgGFo8dKMgILbMTXofuhQTQQkPjIKIU3aGIz9VzV1Dv8UZ64KTYp9R0lIGjctBT4it9gsuYeGYZg0j2QYjRBg0Z08EGuSKCq18TpiXzRxHuxENryV0UTq1rPsl3z/U0D5WnDkRRbcKE7F8gSj9qIOhdNWI0ex4PfiTSpWSx7sKgTnSs4o81hTKMu3J5F2nvINU8iq3RYMuseDkbY86zT6GoCsV+yn5/ndgfaOxvHSbulPzyL4a/B2UayqnZrRpHV5R5gau01EFUYSHIsLmdDxW3PogI93rV5QcnjSCH4St9kmzNM9xTXiX4Hnt8JyS2xK4mHY/DxFxSSgpz2HV1xekibVdwBrX9NbW2vZRq48oBjq89dyHvguvutYDvbFdwcSexzTYrwpQ0d1PUMIAkP36/T9iZO3qRDjzwNCsM6b7z40wwAp2ahobnlxHsENKq+UlYCCZQbKfOCljGkUpqhowGcq4Pv0a8z+R5JDgQG9jaMuGUoGgCjz1w/WkvYNXiWz58iwmnX8r1WFbHEAF6nSWi8cDafZaBHRRKbWIkTLjeieHMiJH7ItcSQ8OcWktOiPnpNwMPQJihHcq71veONS0zQh00jAmigWfm/SLtJVGk0cXyU91AUkNgNuXaJXYwYpHBwKRra9u4Swrp2LvE5WG61VDHXCXk1AvtaiF4eHzPhsY21WOGfivQsRERbn8XQkCRCIymL/jHGu/dKoNSoiBflRYC6+Hc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(186003)(8676002)(16526019)(336012)(8936002)(26005)(4326008)(70586007)(44832011)(70206006)(5660300002)(2616005)(426003)(508600001)(2906002)(316002)(54906003)(6916009)(82310400003)(81166007)(356005)(36860700001)(36756003)(83380400001)(86362001)(6666004)(1076003)(47076005)(4744005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:14:33.8988 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6e55978-4ab0-49ca-ff7c-08d9930ac68d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4423 Received-SPF: softfail client-ip=40.107.212.53; envelope-from=Michael.Roth@amd.com; helo=NAM02-BN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Signed-off-by: Paolo Bonzini (cherry picked from commit 941a4736d2b465be1d6429415f8b1f26e2167585) Signed-off-by: Michael Roth --- util/qemu-option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index 9678d5b682..4944015a25 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -1056,7 +1056,8 @@ bool qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, Error **errp) while (entry != NULL) { next = qdict_next(qdict, entry); - if (find_desc_by_name(opts->list->desc, entry->key)) { + if (opts_accepts_any(opts->list) || + find_desc_by_name(opts->list->desc, entry->key)) { if (!qemu_opts_from_qdict_entry(opts, entry, errp)) { return false; } From patchwork Tue Oct 19 14:08:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 464D3C433F5 for ; Tue, 19 Oct 2021 14:37:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B45F9610E7 for ; Tue, 19 Oct 2021 14:37:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B45F9610E7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqFT-0007Qz-NI for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:37:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpto-0008TL-4e; Tue, 19 Oct 2021 10:15:31 -0400 Received: from mail-sn1anam02on2044.outbound.protection.outlook.com ([40.107.96.44]:17029 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpti-0007gG-M1; Tue, 19 Oct 2021 10:15:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nMu2ZBJ7mMe6cHZ5P+rhhXdFYpU52ZgmAGdbGeihzVMzPQwcea40L2Q6pKzujHbU5CFn01cVWXIr6/poWuBovdXadEGQFh7x3cRu7si6LoDrC4E+Bi79txRiHf+teQFghB/H+dtPxm2JakQUAABwu/2eEmqGpmcGLr6nJxJ8ClcTSosrFlhp1BQ958FqFaDMb5G0WxIk+/GrLuvqJ44eEwEJRvsk76lcSInoEv7J85NLVwg5I2iw+sJW/SVhmJP7zZwKCrVC9c3HfuLdhSmxdL7L8hRRB4B5GYPxafkvKCd2AfJK6cDKGDlanKLh58j/0OHynK6EARSUYRClZE6kZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OvR90lhKuYGGLVI4Lj6wlw1wI7Mceww7cQs0lkEJzBw=; b=jXeyJAr3r975b/CFpwLu6jEvntfKZxCgaEGQAXSvbGe40gmPQkOci4jFrPtD/MgvosdNEUPA3NDfr+ih9Pd5is9ZiZBf4NCFnI0aVeWbfcknwOT2HsX5OCgH41vo0WsSRwYi334cqeFjR4oyFRCo5Q0QPw123GQaFSkbOgiTOEMtoVrppuKX2CHjIpDbawojjWHg6dVT9OmymWGc1HuBLqegFSkcBDcmZnPVAQ+/1fA2D7hd/6FSWeYeXNLVu1NS70OS4iBj7BmcOaYjQMQjRQpNRPa7jBFwks+7V+EHlg0wF5FBNsd4EFRKBB34er49VQtm6JTk2AZCMNcEP8qJOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OvR90lhKuYGGLVI4Lj6wlw1wI7Mceww7cQs0lkEJzBw=; b=KcdiQOScJBWvjoY0wcvdLGGsscGAXh0PUIlq8el7ydH+YplrXKyZLlNBdFZKtcnh7jcBz1ctiJt4lgv0anWiHFEmnjgqzEzsnvlFthBhuDeHBSVDb1RUJDSm43+JyPUH5IHnORf6QseB/tC9Qmw7PGh5/IvcygjNvWcu9sTRkXc= Received: from DM3PR12CA0103.namprd12.prod.outlook.com (2603:10b6:0:55::23) by BYAPR12MB3350.namprd12.prod.outlook.com (2603:10b6:a03:ab::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:15:17 +0000 Received: from DM6NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:0:55:cafe::be) by DM3PR12CA0103.outlook.office365.com (2603:10b6:0:55::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:15:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT058.mail.protection.outlook.com (10.13.172.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:15:17 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:15:16 -0500 From: Michael Roth To: CC: , Paolo Bonzini Subject: [PATCH 11/64] qemu-config: load modules when instantiating option groups Date: Tue, 19 Oct 2021 09:08:51 -0500 Message-ID: <20211019140944.152419-12-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ae80c242-0717-4f82-485d-08d9930ae042 X-MS-TrafficTypeDiagnostic: BYAPR12MB3350: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:949; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uvDcJZhT8Z0ZNXOmruG7p4oIzpNnnDVJ1fm0OHQgW1xkL/BpzIg6kRUKWalv3zdTnk7zMkty06AT0Zl02DGpKO9PWPDtsJbrz9WbbY+qvzAEo/e4ImKHnPXC2tBVHt4R7LLdobpep9ONF73p5bk/RRtJ6060k23FKwQAC7iBgw4XyYQVitPjzetPP9shezWafVsWJy/HyZODoq6W+E2YtpuHSUhIbAgrrlmdLcK8At2bs6MKfJgKq2PSV9xcknDLcfk5yTd6ekEIkTED7lziy95XLOEH+4CKcL2HSWtZtdZ+xSwasZ6DG41keRuuKM3Mpr7j5A49PZF+uSfojVoc5ZB62b05B2fgmit6bp7Qb4C109Gwiu2BRCSYIrIBRMTLI500Y2YxuYNLXcyjEzZEtj1PgRI0ZyiABMK121yNuGpWa2Lf6MjkSiOyP+SwJHMStrm+bUnWyeX9cV4H/VhNhs5yaQ7WcieXUk9MHML0nNU8iW5Wjf1t2WW8xH6Uc/3ZYuvntiZcQUDhqItYNXV20THBdsYuu/RHVjK8fqO3xQk8hSf4rChVkOlwOMMIAdjmHPOPctJwI+CGfwticfgxDlGK2I8k3xKT9gT96mRVVUIQmFcwpL3VYfdcnkrs/MfqRFU5Ck7gfM83CRhy18MvRr35hhls3s8D4odB4h5eSH0PYIhktD6YoJTxLQhn2TBvP9u+jTKLWwELBqYf98lxmOBYSxzGX0Zg2eeaB8is/x2mZc6GXE4ZNeP3DI/E78yNWSIWsW14KvrYyKBhjfSqzMnbea3EDPjhFxtGHA2/F8sLoC89YeF0Rvp65JOjWk5D X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(44832011)(16526019)(186003)(426003)(2906002)(81166007)(2616005)(336012)(70586007)(70206006)(356005)(6916009)(316002)(6666004)(36756003)(5660300002)(508600001)(4326008)(47076005)(82310400003)(1076003)(8936002)(8676002)(966005)(83380400001)(86362001)(36860700001)(26005)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:15:17.0182 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae80c242-0717-4f82-485d-08d9930ae042 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3350 Received-SPF: softfail client-ip=40.107.96.44; envelope-from=Michael.Roth@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Right now the SPICE module is special cased to be loaded when processing of the -spice command line option. However, the spice option group can also be brought in via -readconfig, in which case the module is not loaded. Add a generic hook to load modules that provide a QemuOpts group, and use it for the "spice" and "iscsi" groups. Fixes: #194 Fixes: https://bugs.launchpad.net/qemu/+bug/1910696 Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini (cherry picked from commit 632a8873500d27022c584256afc11e57e2418b94) Signed-off-by: Michael Roth --- include/qemu/config-file.h | 2 +- softmmu/vl.c | 21 +++++++++++++++++---- stubs/meson.build | 1 + stubs/module-opts.c | 6 ++++++ util/qemu-config.c | 1 + 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 stubs/module-opts.c diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index 8d3e53ae4d..0500b3668d 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -1,7 +1,7 @@ #ifndef QEMU_CONFIG_FILE_H #define QEMU_CONFIG_FILE_H - +void qemu_load_module_for_opts(const char *group); QemuOptsList *qemu_find_opts(const char *group); QemuOptsList *qemu_find_opts_err(const char *group, Error **errp); QemuOpts *qemu_find_opts_singleton(const char *group); diff --git a/softmmu/vl.c b/softmmu/vl.c index 29d6415d5c..70b68ec7c4 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2613,6 +2613,23 @@ void qmp_x_exit_preconfig(Error **errp) } } +#ifdef CONFIG_MODULES +void qemu_load_module_for_opts(const char *group) +{ + static bool spice_tried; + if (g_str_equal(group, "spice") && !spice_tried) { + ui_module_load_one("spice-core"); + spice_tried = true; + } + + static bool iscsi_tried; + if (g_str_equal(group, "iscsi") && !iscsi_tried) { + block_module_load_one("iscsi"); + iscsi_tried = true; + } +} +#endif + void qemu_init(int argc, char **argv, char **envp) { QemuOpts *opts; @@ -3372,10 +3389,6 @@ void qemu_init(int argc, char **argv, char **envp) break; case QEMU_OPTION_spice: olist = qemu_find_opts_err("spice", NULL); - if (!olist) { - ui_module_load_one("spice-core"); - olist = qemu_find_opts("spice"); - } if (!olist) { error_report("spice support is disabled"); exit(1); diff --git a/stubs/meson.build b/stubs/meson.build index be6f6d609e..5555b69103 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -22,6 +22,7 @@ stub_ss.add(files('isa-bus.c')) stub_ss.add(files('is-daemonized.c')) stub_ss.add(when: 'CONFIG_LINUX_AIO', if_true: files('linux-aio.c')) stub_ss.add(files('migr-blocker.c')) +stub_ss.add(files('module-opts.c')) stub_ss.add(files('monitor.c')) stub_ss.add(files('monitor-core.c')) stub_ss.add(files('pci-bus.c')) diff --git a/stubs/module-opts.c b/stubs/module-opts.c new file mode 100644 index 0000000000..a7d0e4ad6e --- /dev/null +++ b/stubs/module-opts.c @@ -0,0 +1,6 @@ +#include "qemu/osdep.h" +#include "qemu/config-file.h" + +void qemu_load_module_for_opts(const char *group) +{ +} diff --git a/util/qemu-config.c b/util/qemu-config.c index 670bd6ebca..34974c4b47 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -16,6 +16,7 @@ static QemuOptsList *find_list(QemuOptsList **lists, const char *group, { int i; + qemu_load_module_for_opts(group); for (i = 0; lists[i] != NULL; i++) { if (strcmp(lists[i]->name, group) == 0) break; From patchwork Tue Oct 19 14:08:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58A04C433F5 for ; Tue, 19 Oct 2021 14:20:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CDF4E610C7 for ; Tue, 19 Oct 2021 14:20:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CDF4E610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:35670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcpyg-0007KV-KM for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:20:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpu9-0000E5-VZ; Tue, 19 Oct 2021 10:15:50 -0400 Received: from mail-mw2nam10on2058.outbound.protection.outlook.com ([40.107.94.58]:15169 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpu7-0000ls-8o; Tue, 19 Oct 2021 10:15:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N8iyQBoUhUKZIj0FewDtO7JeSEl4SftHFdOI3HrO37vUQ8PmknGRoxocHKXyQLkymzneeVneUw2Wi8Si5nBPWEaEjrrtqZ5S84KNS8LN4jeuGWlJKO8mRk+WIr6u1R/aAOlRFpw/oTwqxdJUI1tj64RCjx1/I12RK85ONAi8ruv5rRTny0wTME038JTo9sKuv5YVDwgDPUXgPOswJXfbLazYti6hxUSJYT2Rj5CohVeMyeiN/9r3vusSLGbIKw2MkSRtkGZB25FVT+2z7/TwT9K7mPA0I3IilccrgzaCLIb5MxvcutFm+WPmr8zB8fZKtJWsWcI2O+hENE1wdRUTjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=alyu/i2TwkR8S079eslNyZl6jtkkgtY3RvJk+MKDVP8=; b=nkZsW1xNVjpZyEh5TwnrGoFjAcP7rYHnb99lh2FAQDLQIrKeXOTquJofX/FL4AExqinQRV+of5hULBXdKLcSGupZOqy5VlnQCm+w7ZZuAx7r9dpCT31WPCbcovT5w1/9cfabzkDz2yH8iVvJod9Kblxc8IAefijp3jrzWxWnSySy/F5J0T1/y06ZoTswogtvce/35vI1grX1heSIZbCbZxJTSd2PjLKDEP9IBwXQy6QgOaepspqmLeIRdFzR2HnXBz8bkXCt3qcO4VgMxqrI3K9sCUO0pt5ImC/dx12o8ER6beZz/5pVnQ2NfXCuvRJUhnNoIj9duDa3JN5UrrXzSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=alyu/i2TwkR8S079eslNyZl6jtkkgtY3RvJk+MKDVP8=; b=J7xxOxaffGOMPtt+WWNysHzTdv8aYJZqQvSqWEfCNN1mD4/248nTOhKyTgtmAATpR0SfIIKmGSAOSOg8VRehe9KvGis21qBgF3+ZEpoJrsDcUm3iDr7gR7/AY0az2JRZk/pPbbahfn1d2X8uhux+DDcikawQB6gT+y+/mCS0OcY= Received: from DM3PR11CA0018.namprd11.prod.outlook.com (2603:10b6:0:54::28) by BN8PR12MB3364.namprd12.prod.outlook.com (2603:10b6:408:40::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:15:42 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:0:54:cafe::70) by DM3PR11CA0018.outlook.office365.com (2603:10b6:0:54::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:15:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:15:41 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:15:38 -0500 From: Michael Roth To: CC: , Paolo Bonzini , Kevin Wolf , Markus Armbruster Subject: [PATCH 12/64] qemu-config: parse configuration files to a QDict Date: Tue, 19 Oct 2021 09:08:52 -0500 Message-ID: <20211019140944.152419-13-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69a9f0e5-6bfd-451a-be17-08d9930aeefe X-MS-TrafficTypeDiagnostic: BN8PR12MB3364: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1468; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AjxcvIq3wG8+BZGiXFalxG0/opK9n5U/lZ829ZJK8HHTVfDZsoOXzB7ju1+bc0qsde/63+8rBvml9UEV2OUCtRVO7EtgF1nzOc83vY8mhPKgkKukGygwKgKeZLMdsPnC+wqFuojDZUDD9imnyMShBgNN3bBwyJXOi10Wi4m04ueWq1uhiNSozUdSa/fgAoaloL3hoQtja5vBtQeblQ646Xf1I7o0bOQ3/WsVxQcghUy9U4cZnRwSgGABVl9YRtYZ9Xfxj9UTeXLHEDqxA1kwToNV71qAvDuJzf43nl8548tieImpP9zr+7hFk4wu+cVL6DmtLLbhy47F7VkIeBNnjJ+itboiyosD/tcQzqmMvmZL0tz5D0TAJgxyLEzfZsESmehQLBCbkDQXkTPZ2XYLUns8vtvUTPOoc59vHZcpekXxr/6KYVIoUQAGm2sCcWg+ALJQ7nNPNBnrPqL7S0QjTJZEHbKPuKWNXhRM99ryN1hfMhB9u/UdkpT31PZjpErkgsASeowPXsadEixktgcip+qb6DabXunw6SVcbNSdmAPevUf8kQlWiPdiWPh+I5HkIkC5WFSmYNJNx7uqErCxIg+2rlcswK5ummKWkSlHiztFOBcoZWbLnJtXVOF6J5ZbgPZK8S72pILeo2ASNuIh8ac/diXVkYWLsAXPB2cPML/T3koegWfevOCux1gUTEuDGx4QIgcTnMmV1wpXLAeuOuW4gPHGdPp4qVTsdT6v6RE= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(70586007)(1076003)(70206006)(26005)(36756003)(81166007)(8676002)(6666004)(54906003)(2906002)(16526019)(2616005)(426003)(316002)(82310400003)(356005)(508600001)(44832011)(8936002)(83380400001)(4326008)(47076005)(36860700001)(6916009)(336012)(86362001)(186003)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:15:41.7524 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69a9f0e5-6bfd-451a-be17-08d9930aeefe X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3364 Received-SPF: softfail client-ip=40.107.94.58; envelope-from=Michael.Roth@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Change the parser to put the values into a QDict and pass them to a callback. qemu_config_parse's QemuOpts creation is itself turned into a callback function. This is useful for -readconfig to support keyval-based options; getting a QDict from the parser removes a roundtrip from QDict to QemuOpts and then back to QDict. Unfortunately there is a disadvantage in that semantic errors will point to the last line of the group, because the entries of the QDict do not have a location attached. Cc: Kevin Wolf Cc: Markus Armbruster Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini Message-Id: <20210524105752.3318299-2-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini (cherry picked from commit 37701411397c7b7d709ae92abd347cc593940ee5) Signed-off-by: Michael Roth --- include/qemu/config-file.h | 7 ++- softmmu/vl.c | 4 +- util/qemu-config.c | 98 ++++++++++++++++++++++++++------------ 3 files changed, 76 insertions(+), 33 deletions(-) diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index 0500b3668d..f605423321 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -1,6 +1,8 @@ #ifndef QEMU_CONFIG_FILE_H #define QEMU_CONFIG_FILE_H +typedef void QEMUConfigCB(const char *group, QDict *qdict, void *opaque, Error **errp); + void qemu_load_module_for_opts(const char *group); QemuOptsList *qemu_find_opts(const char *group); QemuOptsList *qemu_find_opts_err(const char *group, Error **errp); @@ -14,7 +16,10 @@ void qemu_config_write(FILE *fp); int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname, Error **errp); -int qemu_read_config_file(const char *filename, Error **errp); +/* A default callback for qemu_read_config_file(). */ +void qemu_config_do_parse(const char *group, QDict *qdict, void *opaque, Error **errp); + +int qemu_read_config_file(const char *filename, QEMUConfigCB *f, Error **errp); /* Parse QDict options as a replacement for a config file (allowing multiple enumerated (0..(n-1)) configuration "sections") */ diff --git a/softmmu/vl.c b/softmmu/vl.c index 70b68ec7c4..00fde923bc 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2119,7 +2119,7 @@ static void qemu_read_default_config_file(Error **errp) int ret; g_autofree char *file = get_relocated_path(CONFIG_QEMU_CONFDIR "/qemu.conf"); - ret = qemu_read_config_file(file, errp); + ret = qemu_read_config_file(file, qemu_config_do_parse, errp); if (ret < 0) { if (ret == -ENOENT) { error_free(*errp); @@ -3385,7 +3385,7 @@ void qemu_init(int argc, char **argv, char **envp) qemu_plugin_opt_parse(optarg, &plugin_list); break; case QEMU_OPTION_readconfig: - qemu_read_config_file(optarg, &error_fatal); + qemu_read_config_file(optarg, qemu_config_do_parse, &error_fatal); break; case QEMU_OPTION_spice: olist = qemu_find_opts_err("spice", NULL); diff --git a/util/qemu-config.c b/util/qemu-config.c index 34974c4b47..374f3bc460 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -2,6 +2,7 @@ #include "block/qdict.h" /* for qdict_extract_subqdict() */ #include "qapi/error.h" #include "qapi/qapi-commands-misc.h" +#include "qapi/qmp/qerror.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" #include "qemu/error-report.h" @@ -351,19 +352,19 @@ void qemu_config_write(FILE *fp) } /* Returns number of config groups on success, -errno on error */ -int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname, Error **errp) +static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque, + const char *fname, Error **errp) { - char line[1024], group[64], id[64], arg[64], value[1024]; + char line[1024], prev_group[64], group[64], arg[64], value[1024]; Location loc; - QemuOptsList *list = NULL; Error *local_err = NULL; - QemuOpts *opts = NULL; + QDict *qdict = NULL; int res = -EINVAL, lno = 0; int count = 0; loc_push_none(&loc); while (fgets(line, sizeof(line), fp) != NULL) { - loc_set_file(fname, ++lno); + ++lno; if (line[0] == '\n') { /* skip empty lines */ continue; @@ -372,39 +373,39 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname, Error * /* comment */ continue; } - if (sscanf(line, "[%63s \"%63[^\"]\"]", group, id) == 2) { - /* group with id */ - list = find_list(lists, group, &local_err); - if (local_err) { - error_propagate(errp, local_err); - goto out; + if (line[0] == '[') { + QDict *prev = qdict; + if (sscanf(line, "[%63s \"%63[^\"]\"]", group, value) == 2) { + qdict = qdict_new(); + qdict_put_str(qdict, "id", value); + count++; + } else if (sscanf(line, "[%63[^]]]", group) == 1) { + qdict = qdict_new(); + count++; } - opts = qemu_opts_create(list, id, 1, NULL); - count++; - continue; - } - if (sscanf(line, "[%63[^]]]", group) == 1) { - /* group without id */ - list = find_list(lists, group, &local_err); - if (local_err) { - error_propagate(errp, local_err); - goto out; + if (qdict != prev) { + if (prev) { + cb(prev_group, prev, opaque, &local_err); + qobject_unref(prev); + if (local_err) { + error_propagate(errp, local_err); + goto out; + } + } + strcpy(prev_group, group); + continue; } - opts = qemu_opts_create(list, NULL, 0, &error_abort); - count++; - continue; } + loc_set_file(fname, lno); value[0] = '\0'; if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2 || sscanf(line, " %63s = \"\"", arg) == 1) { /* arg = value */ - if (opts == NULL) { + if (qdict == NULL) { error_setg(errp, "no group defined"); goto out; } - if (!qemu_opt_set(opts, arg, value, errp)) { - goto out; - } + qdict_put_str(qdict, arg, value); continue; } error_setg(errp, "parse error"); @@ -417,11 +418,48 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname, Error * } res = count; out: + if (qdict) { + cb(group, qdict, opaque, errp); + qobject_unref(qdict); + } loc_pop(&loc); return res; } -int qemu_read_config_file(const char *filename, Error **errp) +void qemu_config_do_parse(const char *group, QDict *qdict, void *opaque, Error **errp) +{ + QemuOptsList **lists = opaque; + const char *id = qdict_get_try_str(qdict, "id"); + QemuOptsList *list; + QemuOpts *opts; + const QDictEntry *unrecognized; + + list = find_list(lists, group, errp); + if (!list) { + return; + } + + opts = qemu_opts_create(list, id, 1, errp); + if (!opts) { + return; + } + if (!qemu_opts_absorb_qdict(opts, qdict, errp)) { + qemu_opts_del(opts); + return; + } + unrecognized = qdict_first(qdict); + if (unrecognized) { + error_setg(errp, QERR_INVALID_PARAMETER, unrecognized->key); + qemu_opts_del(opts); + } +} + +int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname, Error **errp) +{ + return qemu_config_foreach(fp, qemu_config_do_parse, lists, fname, errp); +} + +int qemu_read_config_file(const char *filename, QEMUConfigCB *cb, Error **errp) { FILE *f = fopen(filename, "r"); int ret; @@ -431,7 +469,7 @@ int qemu_read_config_file(const char *filename, Error **errp) return -errno; } - ret = qemu_config_parse(f, vm_config_groups, filename, errp); + ret = qemu_config_foreach(f, cb, vm_config_groups, filename, errp); fclose(f); return ret; } From patchwork Tue Oct 19 14:08:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 659C2C433F5 for ; Tue, 19 Oct 2021 14:19:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C54A8610C7 for ; Tue, 19 Oct 2021 14:19:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C54A8610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:32944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcpxb-0005SX-Qc for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:19:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpuR-0000yx-8r; Tue, 19 Oct 2021 10:16:07 -0400 Received: from mail-bn8nam11on2057.outbound.protection.outlook.com ([40.107.236.57]:12352 helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpuN-0001bM-RH; Tue, 19 Oct 2021 10:16:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cLbqKhggsLd8CLLeWXdUW/mdUiC2ylExtu0EwBMpiCYl1MMKl5afQ6L8RtxW0fUfpekXchWlhQM9sHftYvsCdbt1K1JAkkxBuS0Q+aTYEkBXCzw2Kclkg4nq3/Vfhcx5giVAIXgjjkCjRjtk8dVjaOT2lPzTjn/ZWTxWNIZ1QxMFCQ3k4QIgnUjH8R0oIpjNCf8sOIZXsUrOt5hft4qnOTgHvQEouYAwG7QSQlBiQ/i2gAPH9DMU+NPdTLwwxWJzUBljvweyOFA4k8O0mrXkhnudZ92HSLHJ5ZRq8bAfeA3AiCqer+HjfhOZRdEnHsUZwCr9gLaZfoQ/zHVecuW1vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tWb34RM8h/XM2+fsGDw2wKhtloEpJ1gAhAf7pnlN9p8=; b=DoUW6/Va3zsP3GBt3Ha5DMwCgCRVNrUt8SxEtKm3b0Ah5LZj0jy38CjkRv/ieJhJE7SeZDG8A4yCu/dsm6GqAvvLODl/XAFv70eM6G0U29GKSumUGA0axCf1hIqiheemeeQipWvPSELIxqr70nSXPBjAVcI4/s8O1ENEAUx82Ft8kv/f7bWBzvdGrRpUTJUpDSEbHzsmeVGlsVGBo4nw/06AcdK4B3Ascd1eBIaSL6swcdn1SZ8Amhy3TyClwH2exIetkjOUvNuFiSSnSto26FXIEwvmpPQlgdgNa+/auFUJ7CmncR6qMpBeO3IVaacbmpl6udLXT7ZhgAnxCnHALA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tWb34RM8h/XM2+fsGDw2wKhtloEpJ1gAhAf7pnlN9p8=; b=Da+BPGoOI3mGqxKvBzOZZ0gj8hHHr5MO4dWtls9C3EYRfNjJfj1oXyvN9noofz9yQJ2MMMyLHl0b7dnv2pJSxUgzY8yJTQa+b6LLfoUfzgdArvoqMVTfPCIU0SBf5qUz8rOEzbNFlI9Uw6T0aZlrkaSo3FjR41N+qHrh6+5ZZTY= Received: from BN8PR04CA0056.namprd04.prod.outlook.com (2603:10b6:408:d4::30) by BN9PR12MB5164.namprd12.prod.outlook.com (2603:10b6:408:11d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:16:00 +0000 Received: from BN8NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:408:d4:cafe::da) by BN8PR04CA0056.outlook.office365.com (2603:10b6:408:d4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:16:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT063.mail.protection.outlook.com (10.13.177.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:16:00 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:15:59 -0500 From: Michael Roth To: CC: , Paolo Bonzini , Markus Armbruster , Kevin Wolf Subject: [PATCH 13/64] vl: plumb keyval-based options into -readconfig Date: Tue, 19 Oct 2021 09:08:53 -0500 Message-ID: <20211019140944.152419-14-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1794ede1-7775-43eb-a35d-08d9930afa45 X-MS-TrafficTypeDiagnostic: BN9PR12MB5164: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:252; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TzEtPywLli5WOzCNp+vnR7EyizUtOa/dEnYlOsBB/YZCeMjHNHJPQps9qQug2OPHVSSmlViAaqZyD1gyKAP5VYPgy/Irs9ukmdbw/P/SWgJFKerxtVnghndG7fLmawauI1/sQ2AFbQVJOTMl1eXm4n+JYiFuS5MyQ/06h+26+mcxmjnLBkiSdLsOj/QDDiBqkfy2ypwkm8fvjq/tcab5EsTWxOuCh2tjrJHTF/CmitScj5FKmj6s8lp16mDK3NBoW5i8gfRGPURekWSFIcPWDSGgAis/QThJBNnESAX4f1jV/f8MOZI7YkAMB09IGdcLEP0lM9BWuKdiP75N9rP9qTigLnP0CMHuF85iKMi1/Xrs+OetaqGW6xiiIIkiV7RQVwbA3qc+Cb17+xahiyvXspI0Qwd3I6jUY5fJLsuV+Dyou5s5KzoA0W7Vaqyefd4ZWWVCi19a44YNKMpuPYpUcex6RKFZY2Ie2l/aM8J9Bp2RFNitreRxDF6HCAgbdaNYuIvvCufLmx/pDG2kr0EofRDsNzgoIkH4GFpda/sTnDAP0+1UmDtA4udxkMoGFrF+I4Zzr26+PI2nzjb54MwOKIBbLc0QDyJQIHcuPvXHN8K6mQohJZZ9Pj9xydu38XjaZXwZy8SIL9Qv/WswJSKVRlhmY/kO31f7y1b8MSCQ02vM53rgd0YrJOpjnX714Us9Ue26s+NGbc4o5IqdLTsjfFQ/aBtTE56hPUAX2/h7Vyc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(86362001)(336012)(70586007)(6916009)(426003)(82310400003)(4326008)(36756003)(16526019)(2616005)(83380400001)(44832011)(81166007)(186003)(36860700001)(2906002)(1076003)(8936002)(47076005)(26005)(316002)(70206006)(5660300002)(508600001)(54906003)(8676002)(6666004)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:16:00.7030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1794ede1-7775-43eb-a35d-08d9930afa45 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5164 Received-SPF: softfail client-ip=40.107.236.57; envelope-from=Michael.Roth@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Let -readconfig support parsing command line options into QDict or QemuOpts. This will be used to add back support for objects in -readconfig. Cc: Markus Armbruster Cc: qemu-stable@nongnu.org Reviewed-by: Kevin Wolf Signed-off-by: Paolo Bonzini Message-Id: <20210524105752.3318299-3-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini (cherry picked from commit c0d4aa82f895af67cbf7772324e05605e22b4162) Signed-off-by: Michael Roth --- include/block/qdict.h | 2 - include/qapi/qmp/qdict.h | 3 ++ softmmu/vl.c | 83 ++++++++++++++++++++++++++++------------ 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/include/block/qdict.h b/include/block/qdict.h index d8cb502d7d..ced2acfb92 100644 --- a/include/block/qdict.h +++ b/include/block/qdict.h @@ -20,8 +20,6 @@ void qdict_join(QDict *dest, QDict *src, bool overwrite); void qdict_extract_subqdict(QDict *src, QDict **dst, const char *start); void qdict_array_split(QDict *src, QList **dst); int qdict_array_entries(QDict *src, const char *subqdict); -QObject *qdict_crumple(const QDict *src, Error **errp); -void qdict_flatten(QDict *qdict); typedef struct QDictRenames { const char *from; diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h index 9934539c1b..d5b5430e21 100644 --- a/include/qapi/qmp/qdict.h +++ b/include/qapi/qmp/qdict.h @@ -64,4 +64,7 @@ const char *qdict_get_try_str(const QDict *qdict, const char *key); QDict *qdict_clone_shallow(const QDict *src); +QObject *qdict_crumple(const QDict *src, Error **errp); +void qdict_flatten(QDict *qdict); + #endif /* QDICT_H */ diff --git a/softmmu/vl.c b/softmmu/vl.c index 00fde923bc..8f18f506d9 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -122,6 +122,7 @@ #include "qapi/qapi-commands-misc.h" #include "qapi/qapi-visit-qom.h" #include "qapi/qapi-commands-ui.h" +#include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "sysemu/iothread.h" #include "qemu/guest-random.h" @@ -2113,13 +2114,53 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp) return 0; } +/* + * Return whether configuration group @group is stored in QemuOpts, or + * recorded as one or more QDicts by qemu_record_config_group. + */ +static bool is_qemuopts_group(const char *group) +{ + return true; +} + +static void qemu_record_config_group(const char *group, QDict *dict, + bool from_json, Error **errp) +{ + abort(); +} + +/* + * Parse non-QemuOpts config file groups, pass the rest to + * qemu_config_do_parse. + */ +static void qemu_parse_config_group(const char *group, QDict *qdict, + void *opaque, Error **errp) +{ + QObject *crumpled; + if (is_qemuopts_group(group)) { + qemu_config_do_parse(group, qdict, opaque, errp); + return; + } + + crumpled = qdict_crumple(qdict, errp); + if (!crumpled) { + return; + } + if (qobject_type(crumpled) != QTYPE_QDICT) { + assert(qobject_type(crumpled) == QTYPE_QLIST); + error_setg(errp, "Lists cannot be at top level of a configuration section"); + return; + } + qemu_record_config_group(group, qobject_to(QDict, crumpled), false, errp); +} + static void qemu_read_default_config_file(Error **errp) { ERRP_GUARD(); int ret; g_autofree char *file = get_relocated_path(CONFIG_QEMU_CONFDIR "/qemu.conf"); - ret = qemu_read_config_file(file, qemu_config_do_parse, errp); + ret = qemu_read_config_file(file, qemu_parse_config_group, errp); if (ret < 0) { if (ret == -ENOENT) { error_free(*errp); @@ -2128,9 +2169,8 @@ static void qemu_read_default_config_file(Error **errp) } } -static int qemu_set_option(const char *str) +static void qemu_set_option(const char *str, Error **errp) { - Error *local_err = NULL; char group[64], id[64], arg[64]; QemuOptsList *list; QemuOpts *opts; @@ -2138,27 +2178,23 @@ static int qemu_set_option(const char *str) rc = sscanf(str, "%63[^.].%63[^.].%63[^=]%n", group, id, arg, &offset); if (rc < 3 || str[offset] != '=') { - error_report("can't parse: \"%s\"", str); - return -1; - } - - list = qemu_find_opts(group); - if (list == NULL) { - return -1; - } - - opts = qemu_opts_find(list, id); - if (!opts) { - error_report("there is no %s \"%s\" defined", - list->name, id); - return -1; + error_setg(errp, "can't parse: \"%s\"", str); + return; } - if (!qemu_opt_set(opts, arg, str + offset + 1, &local_err)) { - error_report_err(local_err); - return -1; + if (!is_qemuopts_group(group)) { + error_setg(errp, "-set is not supported with %s", group); + } else { + list = qemu_find_opts_err(group, errp); + if (list) { + opts = qemu_opts_find(list, id); + if (!opts) { + error_setg(errp, "there is no %s \"%s\" defined", group, id); + return; + } + qemu_opt_set(opts, arg, str + offset + 1, errp); + } } - return 0; } static void user_register_global_props(void) @@ -2752,8 +2788,7 @@ void qemu_init(int argc, char **argv, char **envp) } break; case QEMU_OPTION_set: - if (qemu_set_option(optarg) != 0) - exit(1); + qemu_set_option(optarg, &error_fatal); break; case QEMU_OPTION_global: if (qemu_global_option(optarg) != 0) @@ -3385,7 +3420,7 @@ void qemu_init(int argc, char **argv, char **envp) qemu_plugin_opt_parse(optarg, &plugin_list); break; case QEMU_OPTION_readconfig: - qemu_read_config_file(optarg, qemu_config_do_parse, &error_fatal); + qemu_read_config_file(optarg, qemu_parse_config_group, &error_fatal); break; case QEMU_OPTION_spice: olist = qemu_find_opts_err("spice", NULL); From patchwork Tue Oct 19 14:08:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 421FFC433F5 for ; Tue, 19 Oct 2021 14:23:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1C3560F9E for ; Tue, 19 Oct 2021 14:23:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C1C3560F9E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:42748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcq1q-0003rh-Kl for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:23:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpuo-0001YR-DL; Tue, 19 Oct 2021 10:16:32 -0400 Received: from mail-bn8nam12on2054.outbound.protection.outlook.com ([40.107.237.54]:50166 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpul-0002Eb-1X; Tue, 19 Oct 2021 10:16:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TzFrUTO+YYtIio7m6v7PUhf8N3/8O0lE5WzYJu8wrwM6VLyBNc9a4VDKgOTN7Uf0PPVNTTt0E7yL4rgn9S6IfywbkNgH1YgXlPu4goOpTlC0/KV4ZhdyALuEpor4yGtNOdTM3e98SdCbTphdlskSEnBoDQ1AkxAeTXcanF0sCQpMeugdHHzAYv7nLhIxrzqTVmtp/ZRyWlatP0E6zm3faRr/ddtmfdbHrxAe/xraRdI7XDATOlK0GBI0cIRGtppsFy00/dzScXzvHQ/0+EHQliD/RwxqSlZqmfuGjtnL3KZaD3uKxyDT/x1KDEwgIA4/pBc2OTZQGx7d4iBuks3Y8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WpH/4Ndqi9AnAoh2mOIgHoQHj6dgTt4PW1etohWQL4Y=; b=n2FcGG8wdxlSp76p6p4PQJDy+aT4J+4an2/u8yNAHgVPOcPOIRhC1ULe7kZpeCZF7ImWHldy9KG3PbbxC4t8Z7oPutJB0NyeSbQZy6STvej8GU27TKEfAYry5drAi/IHRGSH/T22koejUvUy2QkdxPDEttTkQhpkIW6AC796xKxMiSlX9RvEM5OhoIMUJilx3Mk5F1ic00Jx+iPCTmb0VCEB4a66PJRw25h3OGIbmz28ch9/Zs1A0FCUMJsfEJTDTSpyfn1Gge3zf1FgQyyjistM6932Pv4oZbqEqt9yS3Ep4nubB3KxKHlBrZU7/Vl1xAhhQE7EC1cLB27O5pOyQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WpH/4Ndqi9AnAoh2mOIgHoQHj6dgTt4PW1etohWQL4Y=; b=ETq1vcgXgcrF4LChG1kXGEZnvuR7e4TH6YPZD8qnW+6oL6NdYTrv5tnAf14MWR4ACpUEFG5+h+KSsnbLP26KLrpM5Qpm/WSwPOS8Fpw76yM4F8rQ0uZX/QHJNys3BUN5owOd9aNnKnwhyJglXXd4ZOjzbV/TopVXdBa4SKBe05U= Received: from BN8PR03CA0033.namprd03.prod.outlook.com (2603:10b6:408:94::46) by MWHPR1201MB0222.namprd12.prod.outlook.com (2603:10b6:301:54::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:16:22 +0000 Received: from BN8NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::fd) by BN8PR03CA0033.outlook.office365.com (2603:10b6:408:94::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:16:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT067.mail.protection.outlook.com (10.13.177.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:16:21 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:16:21 -0500 From: Michael Roth To: CC: , Paolo Bonzini , Markus Armbruster , Kevin Wolf Subject: [PATCH 14/64] vl: plug -object back into -readconfig Date: Tue, 19 Oct 2021 09:08:54 -0500 Message-ID: <20211019140944.152419-15-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 85531e13-9c3b-4edf-e5a5-08d9930b06e5 X-MS-TrafficTypeDiagnostic: MWHPR1201MB0222: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:949; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xf0bFFps8S9fUaNK3Pla5pA10CXmT/W0JfPEUWGKwfcmrIpoT/fOu3svjysHm19ATXXWcv5CczwfDLPwhQSpxouna3hPJqiEVEzSJ7vwrS2bdesk3M9VUeqMa9PSWNZxfa499om8hqWe/e3R3yJNTFD9AFuK8MET0JTatQ7/j8NUQBwxHKYAmxjv8zah703ilckOwp1N0euVFqeHo2v4MFir2y3ymIf4rxdVwRj8ehQOGJ/MuhgoT2PzAdKEWn0ECjKS+yGA/Q3kA4Yfo4aYVz2G3Pud4QXkYZ5SovqZ3fZWArKGpCEMQXfLNdzHPies2cBWfDpTXJpgUls6ran+8sNQJOUgV1i7pCTgcPEeGb9Dc0w+5zVBLrZMijiNB8SuuEX/z8ijZ0SM4FTj+kiNQmgIfSKd0lZuo4VIZJzwAewuxWKEbyR5tueVFaEPwe0frziIMncZh7Y5z2s4Cy9hzB61WKjormVLwZn14mULPpTTEshtCRuPO9XzjuXKEqZhSI7/ZofZoCHqzHUFe+w7p9dcJh4lqxo9hd2T7U7+YBmRwN7k7FyoN6Brf4rgS91DeB1hzWd+99i2nf1V3qi8EqLzL8Zr1BAfTJozRvBhmUK2FPnWNJuLmbxovfhPQe96gYufH1m/zj+B9C1WW0ZkLjt5dO9lU4H4KhHLYVsFhEJuoBgcq3fpHEvvFL8kL0p2xYuHrL9rluvzTAL570kSoDHxLjsV6UCcnTM4F6LKECo= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(2616005)(8676002)(6666004)(1076003)(36756003)(83380400001)(336012)(70586007)(356005)(81166007)(426003)(36860700001)(54906003)(2906002)(6916009)(508600001)(82310400003)(70206006)(4326008)(26005)(16526019)(44832011)(8936002)(47076005)(5660300002)(186003)(86362001)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:16:21.8849 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85531e13-9c3b-4edf-e5a5-08d9930b06e5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0222 Received-SPF: softfail client-ip=40.107.237.54; envelope-from=Michael.Roth@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Commit bc2f4fcb1d ("qom: move user_creatable_add_opts logic to vl.c and QAPIfy it", 2021-03-19) switched the creation of objects from qemu_opts_foreach to a bespoke QTAILQ in preparation for supporting JSON syntax in -object. Unfortunately in doing so it lost support for [object] stanzas in configuration files and also for "-set object.ID.KEY=VAL". The latter is hard to re-establish and probably best solved by deprecating -set. This patch uses the infrastructure introduced by the previous two patches in order to parse QOM objects correctly from configuration files. Cc: Markus Armbruster Cc: qemu-stable@nongnu.org Reviewed-by: Kevin Wolf Signed-off-by: Paolo Bonzini Message-Id: <20210524105752.3318299-4-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini (cherry picked from commit 49e987695a1873a769a823604f9065aa88e00c55) Signed-off-by: Michael Roth --- softmmu/vl.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 8f18f506d9..6be510b035 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -1709,9 +1709,15 @@ static void object_option_foreach_add(bool (*type_opt_predicate)(const char *)) } } +static void object_option_add_visitor(Visitor *v) +{ + ObjectOption *opt = g_new0(ObjectOption, 1); + visit_type_ObjectOptions(v, NULL, &opt->opts, &error_fatal); + QTAILQ_INSERT_TAIL(&object_opts, opt, next); +} + static void object_option_parse(const char *optarg) { - ObjectOption *opt; QemuOpts *opts; const char *type; Visitor *v; @@ -1739,11 +1745,8 @@ static void object_option_parse(const char *optarg) v = opts_visitor_new(opts); } - opt = g_new0(ObjectOption, 1); - visit_type_ObjectOptions(v, NULL, &opt->opts, &error_fatal); + object_option_add_visitor(v); visit_free(v); - - QTAILQ_INSERT_TAIL(&object_opts, opt, next); } /* @@ -2120,13 +2123,22 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp) */ static bool is_qemuopts_group(const char *group) { + if (g_str_equal(group, "object")) { + return false; + } return true; } static void qemu_record_config_group(const char *group, QDict *dict, bool from_json, Error **errp) { - abort(); + if (g_str_equal(group, "object")) { + Visitor *v = qobject_input_visitor_new_keyval(QOBJECT(dict)); + object_option_add_visitor(v); + visit_free(v); + } else { + abort(); + } } /* From patchwork Tue Oct 19 14:08:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACD8BC433F5 for ; Tue, 19 Oct 2021 14:27:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0AA6660F8F for ; Tue, 19 Oct 2021 14:27:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0AA6660F8F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:47594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcq5B-0007HZ-2m for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpv8-0001t5-RZ; Tue, 19 Oct 2021 10:16:50 -0400 Received: from mail-dm6nam10on2081.outbound.protection.outlook.com ([40.107.93.81]:45567 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpv5-0002TS-O8; Tue, 19 Oct 2021 10:16:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jh3SyKYSsqsFl3BFVVg99alqjIZs6aOT+FVsqBy8y2e3ZpuEEN3C4owqjNru/ECaHaZz572mF+XgRp8ySrGsLOGoecfzobG94Cwkvc1fQOv1Cdz1cMRsb+9Cq91XCRKBfAb2drh+L8WB2+qaCW/l7ZgpyCT3lBgPmguYxAgTNLz+QLQY+Exq1neBT7msTuBYgh28RSqHyIE4jDEG166vbtV1aW1RsGteVjWSmgusSYGNb0ps2hYlVdmZlNK17scVkbBD/Yn0afPWAu+i8GYQGXOFVLtM9GlKtQUrweUAALBxpp2FmFzcimpNQ4n4YDeoHjLx0+XW/epfGc4DZP4xUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4QQVl2sF84AD/afziiThjimoT3tUaIkXEN0U8QEguOY=; b=ihUFyb4kj+DIeSwNlqd1UuXF7GN/DYtH7HblVIpj4ydnW32lh7ieFX8agUyx3T8LKFPc3daaDF1lb8HIhCMr3Vxb+wDBknU46gTlSj7NCyA4XdQXqvumyY1qiWQ6jbOumrzabI5GvxfEs8faB15W5tFnXjVaJWVS/AX4n0FZilBEwnTBRO6QFE/7iWWoCfY3usFgwVaGi/aLyKoXFpk1hSOSXIeVXOQOGVuMjAKvXbFNLu/q0iC8K/NQi8j8KdHhHBBElnXRSSBPDqvmp3rQptCXQnPnIFLPTIGPxZxzLJoVHWHaANqUAPiC+62BRzNVANT0ejb26wDyX2KoggQ5Vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4QQVl2sF84AD/afziiThjimoT3tUaIkXEN0U8QEguOY=; b=Rxyt1K511xwtXdgB4FT2w76ITbfFNVDT0ZpFgwnuofeKPCApDm8WGX4Ic0FVF3gjiv8oJwgd5+ORZQ66XBYDhZDwFeCXrIP3xFT8ik3ZN3vewSv4GOpFrBQAuD4omAeIoSaOAj6Zq79PO9mU+l4l3fQGoReR06eXNEUzi8645Kg= Received: from BN1PR12CA0012.namprd12.prod.outlook.com (2603:10b6:408:e1::17) by BY5PR12MB3860.namprd12.prod.outlook.com (2603:10b6:a03:1ac::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:16:43 +0000 Received: from BN8NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e1:cafe::14) by BN1PR12CA0012.outlook.office365.com (2603:10b6:408:e1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:16:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT011.mail.protection.outlook.com (10.13.176.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:16:43 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:16:42 -0500 From: Michael Roth To: CC: , Stefan Hajnoczi , "Richard W . M . Jones" , Juan Quintela , Eric Blake , Stefano Garzarella Subject: [PATCH 15/64] sockets: update SOCKET_ADDRESS_TYPE_FD listen(2) backlog Date: Tue, 19 Oct 2021 09:08:55 -0500 Message-ID: <20211019140944.152419-16-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87a56609-6df9-42bf-cf48-08d9930b1387 X-MS-TrafficTypeDiagnostic: BY5PR12MB3860: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:849; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i9LJNDFMdjDfSmItbbp9bygcD6GE5LYyFNBP+wTyYGkmmDSTJWHhGqW/ckfK/kTCftEb90lQKWXUVls1Y40sjlPnTKOZK9s8AWHwtWyQCuJESbAx24X8UbS7OOwTxRGtglMwQ+ACPMMydfEFCIsffaLpfygB88iivNoaRan3/Lb3vqnrZb0qNplh8j/ouKnSyyw5Y2uP38hl65S2TSNngs2nV/KY2FfYJ6xbhgsbNFvXtX+q7u4yxkWrewtxVCKTfZSbxw8973dn3GVlhcnovNoBHsC8fbWxlU9RsShdzq0HdaenWK9F5sp8EbmGXc96uGUNelq/mxnKdpahF76eLmCBUajWFmGGnY4QSqw7aorPxjIThegTEJYRnVizPuiXCRBzZmhK+6YcTE69Ay6tE7CHUq73foAdXRn93OH573E9fZ4Gs0VhKYVouDcweOiCE+A6ggthyRt3cwKX6W13vkZzcqoIn8VorBzVjOeSo0MOuPBHC4IrLyKNRmykXi78+MI3uWywCF/E2y5RJu2mEIC9LZ4NWPIJjW8+k3OKTV4Rx34fh7AWEgZtdPrinU5L0S5nLlcccRZY4Rb0Myx6IxK6CjvKiR+SP5xJofa9dRskcgMX+I52ZHRJ0yu8D54AZGD4hbOhfHj+oNnzm8PnQrjK/k0XBhI3h36OEoCL5d19ZAdY26LHO66T8UvZelUdkW/v9P0wnAohII+NHNeyifVY2RsQD3DR7u0eMo9rIOA= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(2616005)(1076003)(70586007)(36860700001)(44832011)(426003)(81166007)(54906003)(336012)(82310400003)(16526019)(8676002)(2906002)(47076005)(5660300002)(26005)(356005)(8936002)(36756003)(83380400001)(6666004)(186003)(4326008)(6916009)(316002)(508600001)(86362001)(15650500001)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:16:43.0796 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87a56609-6df9-42bf-cf48-08d9930b1387 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3860 Received-SPF: softfail client-ip=40.107.93.81; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi socket_get_fd() fails with the error "socket_get_fd: too many connections" if the given listen backlog value is not 1. Not all callers set the backlog to 1. For example, commit 582d4210eb2f2ab5baac328fe4b479cd86da1647 ("qemu-nbd: Use SOMAXCONN for socket listen() backlog") uses SOMAXCONN. This will always fail with in socket_get_fd(). This patch calls listen(2) on the fd to update the backlog value. The socket may already be in the listen state. I have tested that this works on Linux 5.10 and macOS Catalina. As a bonus this allows us to detect when the fd cannot listen. Now we'll be able to catch unbound or connected fds in socket_listen(). Drop the num argument from socket_get_fd() since this function is also called by socket_connect() where a listen backlog value does not make sense. Fixes: e5b6353cf25c99c3f08bf51e29933352f7140e8f ("socket: Add backlog parameter to socket_listen") Reported-by: Richard W.M. Jones Cc: Juan Quintela Cc: Eric Blake Signed-off-by: Stefan Hajnoczi Message-Id: <20210310173004.420190-1-stefanha@redhat.com> Tested-by: Richard W.M. Jones Reviewed-by: Eric Blake Reviewed-by: Stefano Garzarella Signed-off-by: Eric Blake (cherry picked from commit 37179e9ea45d6428b29ae789209c119ac18c1d39) Signed-off-by: Michael Roth --- util/qemu-sockets.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 8af0278f15..2463c49773 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -1116,14 +1116,10 @@ fail: return NULL; } -static int socket_get_fd(const char *fdstr, int num, Error **errp) +static int socket_get_fd(const char *fdstr, Error **errp) { Monitor *cur_mon = monitor_cur(); int fd; - if (num != 1) { - error_setg_errno(errp, EINVAL, "socket_get_fd: too many connections"); - return -1; - } if (cur_mon) { fd = monitor_get_fd(cur_mon, fdstr, errp); if (fd < 0) { @@ -1159,7 +1155,7 @@ int socket_connect(SocketAddress *addr, Error **errp) break; case SOCKET_ADDRESS_TYPE_FD: - fd = socket_get_fd(addr->u.fd.str, 1, errp); + fd = socket_get_fd(addr->u.fd.str, errp); break; case SOCKET_ADDRESS_TYPE_VSOCK: @@ -1187,7 +1183,26 @@ int socket_listen(SocketAddress *addr, int num, Error **errp) break; case SOCKET_ADDRESS_TYPE_FD: - fd = socket_get_fd(addr->u.fd.str, num, errp); + fd = socket_get_fd(addr->u.fd.str, errp); + if (fd < 0) { + return -1; + } + + /* + * If the socket is not yet in the listen state, then transition it to + * the listen state now. + * + * If it's already listening then this updates the backlog value as + * requested. + * + * If this socket cannot listen because it's already in another state + * (e.g. unbound or connected) then we'll catch the error here. + */ + if (listen(fd, num) != 0) { + error_setg_errno(errp, errno, "Failed to listen on fd socket"); + closesocket(fd); + return -1; + } break; case SOCKET_ADDRESS_TYPE_VSOCK: From patchwork Tue Oct 19 14:08:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D219C433FE for ; Tue, 19 Oct 2021 14:28:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B30D0610D0 for ; Tue, 19 Oct 2021 14:28:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B30D0610D0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:52478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcq6U-0002AL-ND for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:28:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpvU-0002Fo-7v; Tue, 19 Oct 2021 10:17:12 -0400 Received: from mail-dm6nam12on2050.outbound.protection.outlook.com ([40.107.243.50]:52064 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpvR-0002i9-6T; Tue, 19 Oct 2021 10:17:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=miK/QNaJANum0BtxRS7qvwVcw6HGqIHoX4nHM/eg7ezFHS2YRBI0XKXhCaBTzs5vuWYPB7/mxYk+JmBjYpjFI0oiP/L6adLgYZJdAUxxhZmh15K9k4XwJm3gWx+o65jvSEC+u34AItf5uzDPCJdKlT4mYW6Z2cycUZyvymhSUjJInrZvKuyUsh9youFXtkNBJtFNXjPKdeqpxxa9qJzMxti+DtXh5PDXaY7YbROrywxhuhUQPW8L7oL5bFLyoAkb0C+1m9QK18BGg3qjbbrruQ/pjv+ckYd4P7ZpmC3f7cImhYzBHAJp4f5ZXDSTdkuKBPrLqiRyU4KkHCK6S/WBIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IN/8C9/co98L5Ube2j+iRDc/uFKYem4+llU8MT754sk=; b=BrTmSbScKN+YYXp9YAPmDhnUs5JUe0BCzwa8fyGssuY2A0k6pRROWYyGDvbqCeeHBvD1H8EsFJESwya/8tH8AislepxI314fXgZYlbMW06Ze5s5hbrRVCrQovbUwide4z36xN5/Ig/UCXDDa7jbDF1gZtH7WhDd7WBm9k4KT16uIlWe892JYTRpBoj9OW3v7zdQiYxYZMU07sTLraQT5Wkpk0WPpPWnKYbFsoMPPWj/er203W5ks9Lohseg6IbsHTMu6QhIU+5NSrkGja83BkFqWjvzeE4WolMWMc3b69lXKyffIvAmcsC2KwYxYNcXsOQfV/nW23xtwqCAIhZ8dRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IN/8C9/co98L5Ube2j+iRDc/uFKYem4+llU8MT754sk=; b=aL8Ej4PLQnEGPUkkOp//Ub3Ep93Yk5D3jud7RKFXhqPpEpt8bI7EMkMjaQGUThGOJHejqunWYU0/C5oz7xoloplDaqRLtfYJOz+6o3L8wsFMYvdP71RT98cdyuUUZ0wb0qfBSZarx4xfLhAeEx7KtdTWeQMLxH1xqGVgcdDkaPs= Received: from BN8PR03CA0015.namprd03.prod.outlook.com (2603:10b6:408:94::28) by SA0PR12MB4415.namprd12.prod.outlook.com (2603:10b6:806:70::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:17:06 +0000 Received: from BN8NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:408:94:cafe::65) by BN8PR03CA0015.outlook.office365.com (2603:10b6:408:94::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:17:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT035.mail.protection.outlook.com (10.13.177.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:17:04 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:17:03 -0500 From: Michael Roth To: CC: , Kevin Wolf , Yanhui Ma , "Dr . David Alan Gilbert" Subject: [PATCH 16/64] hmp: Fix loadvm to resume the VM on success instead of failure Date: Tue, 19 Oct 2021 09:08:56 -0500 Message-ID: <20211019140944.152419-17-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72ac4018-5e6f-4c5a-c506-08d9930b206a X-MS-TrafficTypeDiagnostic: SA0PR12MB4415: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:185; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4FRWPb6R9WxjB+bBfIBMP+pzxh3w+epOPOk94148qxPXuRJo6WMviUFjMI2drIrw/BFN6WdCNWleaDC43MimeL7MJuSsfUAgaaCFLyqpM2R54j05uTE7lKgZkH2NQiO3/8LXdA51lasH/3BeDo2+atlV2Gv7NIpi2YQlv8nN9HBpTL9CJ6hd+wESiTIPt+MS6v39KDIG3BdPbr8QK05qO1cF+oEUQ2KESa8w50zg01LLmVdIxr+w5Vx44SX9tnq5sCdfXxzd1xVA1zjZmWaz16tci7STmOSG6Mrax9YbGo5H1aH6+WIIZnodh+7cNZ3jFZYZAC/HsUfhwcuj357CH7rY1CovDmiqn88rEkDOg8oKMuq4Xrzsef/wEt7/kij5dAtjw5BxyvhI+HLt+UCSVVgHV2FmCTjZDL6uhrKcPpy/0dTeQEvl0aiD9msJULbZjr7wq5zErA3w/XC5+oZvMkRqnK2Xy8CIy2QtuykzGZrdbjI4OE4msWv9KITuO7VKL5T3s8SXXuvjo67AJ+TsQFhEYUeGMNr5wUlDOJd0QMMbUlpZM0WFr7//AEn5f3C4XLWOmnbE+5yvNaeBjP0aghWYiOASiyUTzdDWnedEvJqqdKXp84qwbbtA81StMXkRMHQnw/+h9a7FNt360pqcOuyEr/OtIViN62+fBH/LH83T+m05CsJqy+2iI00zADoOwD/qdBBLPrguqKYB8eD2BSlsXw933xKgWblf/BWebtk= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(336012)(86362001)(426003)(70206006)(36756003)(6916009)(82310400003)(2616005)(26005)(316002)(16526019)(81166007)(4326008)(1076003)(2906002)(8936002)(36860700001)(47076005)(186003)(356005)(70586007)(83380400001)(6666004)(5660300002)(508600001)(8676002)(54906003)(44832011)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:17:04.6987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72ac4018-5e6f-4c5a-c506-08d9930b206a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4415 Received-SPF: softfail client-ip=40.107.243.50; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Kevin Wolf Commit f61fe11aa6f broke hmp_loadvm() by adding an incorrect negation when converting from 0/-errno return values to a bool value. The result is that loadvm resumes the VM now if it failed and keeps it stopped if it failed. Fix it to restore the old behaviour and do it the other way around. Fixes: f61fe11aa6f7f8f0ffe4ddaa56a8108f3ab57854 Cc: qemu-stable@nongnu.org Reported-by: Yanhui Ma Signed-off-by: Kevin Wolf Message-Id: <20210511163151.45167-1-kwolf@redhat.com> Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Dr. David Alan Gilbert (cherry picked from commit c53cd04e70641fdf9410aac40c617d074047b3e1) Signed-off-by: Michael Roth --- monitor/hmp-cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 0ad5b77477..cc15d9b6ee 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1133,7 +1133,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict) vm_stop(RUN_STATE_RESTORE_VM); - if (!load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) { + if (load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) { vm_start(); } hmp_handle_error(mon, err); From patchwork Tue Oct 19 14:08:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E12EC433F5 for ; Tue, 19 Oct 2021 14:33:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2EEA6115A for ; Tue, 19 Oct 2021 14:33:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B2EEA6115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqAl-0008E6-Ok for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:32:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpvn-0002lz-DF; Tue, 19 Oct 2021 10:17:31 -0400 Received: from mail-dm6nam12on2063.outbound.protection.outlook.com ([40.107.243.63]:31745 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpvl-0002vd-1v; Tue, 19 Oct 2021 10:17:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IBzseZcyrwNdFEZC7wdv1KYraMQXkA2nrtxLFSuY/mVeIKPfIQP88uQRAHAwx2Fv3nyzjOtIqKwUZPiRNyxgpu5uQzyKJ8ifzZMFTRiNf1IiXe2ckz+k+d7tUD4U4c7s0A0/CvPgiWXGbB7paLyFjSXmWFqys/knGtqX8+Yo/GVNyv7+iW9mMtLkFWIfB54wDXO7t+iDAAllNi3fSGd9QogxouewcIqPPzk2hDfTzTXgP77gtg/ymH+B910Arj4it4vKbWoVHkF4vwAaGWAqJJaIlkO7OFA35j9xPzBVVsbcUOCX3ffa2hD1PcGKzwu9tfmcsMrl2rKNPBKcWL8Z0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jY09/SatjM0SFjBkgU0qtNTjL0xLtEfXlZXdX7/JqUI=; b=QP6VZo335ohm0ihFo3eV7AfPdwvjnNZtu6/EqaHAgO558YWgT4OsFpMsN3tdy9VHnQZgE+V9SNuzw3ROs7Id1FVDHkTzyhh/TYGjfZljAdoOQk6jxyuG8oUD8AssHNqD1DMRjjf+QwCfzvq4QSgnvo0Pqz4lP6hoPWVrWuaC54d60S78uZMybggnn+SkAiOqXLtIChl2ZeGp1X9pxbrkD0dYfiWhA/2T/LJcNCui/K4hVgJuC0Wgrx3TrLrAdS69p/Dr4CcRYATnMctPIY8TIca7pfGQxYJ40zhyqUpUb0Q0cyQO6K6OXcYI4YettYynWobgawFTzZUDu5/kB4d1QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jY09/SatjM0SFjBkgU0qtNTjL0xLtEfXlZXdX7/JqUI=; b=1D//neUfGDLBj346Aj6WkzROHEPgmvkkiIv9DiZIJxAF8W8PTDTEd4S5O/4hGwtc1yAx8BjxQdp52weycg+4XGx9BGFUbbNUQgNRGBfXVnvb5FKPR4811Z8Et4zzweVW5ld1mYGfZ3zGyLqL8bp1/mH34NgKXzsJCzIMRpaoNkc= Received: from BN9PR03CA0392.namprd03.prod.outlook.com (2603:10b6:408:111::7) by BN8PR12MB2867.namprd12.prod.outlook.com (2603:10b6:408:99::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:17:25 +0000 Received: from BN8NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::89) by BN9PR03CA0392.outlook.office365.com (2603:10b6:408:111::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:17:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT065.mail.protection.outlook.com (10.13.177.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:17:25 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:17:25 -0500 From: Michael Roth To: CC: , Paolo Bonzini , Sebastian Mitterle Subject: [PATCH 17/64] configure: fix detection of gdbus-codegen Date: Tue, 19 Oct 2021 09:08:57 -0500 Message-ID: <20211019140944.152419-18-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ed6e2179-68a8-40cd-1a22-08d9930b2cea X-MS-TrafficTypeDiagnostic: BN8PR12MB2867: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:595; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ukJmwAONs6V+hlHn7SBetlc9TyF0DP+6jNe6kRaUZCZynSDswCJ33BrCgAUBAV7wJKaAbYveOtzsrSqegZp8nAuL1scyvaYPfcDIhfr4aZ6DicipSV8tWCUwHRC5ve7abUbZ82LeiV2LzbLik533XpsgWAtQsqKnlqszQW6cr+2f+9vMyc3id5jfeE4G4tzFQ0WMU7CpG0Sp04VeyOD+/2/3EJp471si6pBmUbP3qnyHVU9xdsMqbIZVKiHuhBySRldW5Bhcfnqn3MSXZi1Lpg3CNZM9pQ+g/OFrLnomuN8KoJtql/BNyn9ie3N21GgSXbY4Ix77yfQm5Zv3ERp+ZNwZwkCtUMFPL4KcpAq9/NE3zCfCGiiERJ5k3+p6IoShnbI/PS9Mhqc83uLJESld15zJve87d03tlqtiNHMGcxEp2k4FE02uGs9Qg1RYcNORYlclEiXlHZLc6tpHUSbC2p/KZVi/ugNn7ys2qE+EP4FZTsfV4SNmQnSnRw059jlHj1VCt73jORMFkMT5dtVM3s03OKKY4lCgV2xykIqvP/hnF6yf6QzcNmZdIk6QWeaBjGMxavWcP7KmwMShmmd3SzL4aBE60MvYrIP+YgpFIqQ1D8bVM2Kbn1BtgF2BqDzP9c6NCfZ6Szt+7ZWRza7zeLE+n7r1ZRSPRGJDOjfPKW8EQx0M8wdFqMdEc+4u964tjoYrIKa3CjsRFtWMQB1qbKB/cJ8l/7QCjyMm2zEOcbo= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6916009)(54906003)(82310400003)(44832011)(6666004)(316002)(70206006)(4326008)(36860700001)(2906002)(47076005)(1076003)(36756003)(5660300002)(16526019)(186003)(426003)(508600001)(336012)(70586007)(8936002)(86362001)(81166007)(2616005)(8676002)(356005)(26005)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:17:25.6669 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed6e2179-68a8-40cd-1a22-08d9930b2cea X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2867 Received-SPF: softfail client-ip=40.107.243.63; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini "pkg-config --variable=gdbus_codegen gio-2.0" returns "gdbus-codegen", and it does not pass test -x (which does not walk the path). Meson 0.58.0 notices that something is iffy, as the dbus_vmstate1 assignment in tests/qtest/meson.build uses an empty string as the command, and fails very eloquently: ../tests/qtest/meson.build:92:2: ERROR: No program name specified. Use the "has" function instead of test -x, and fix the generation of config-host.mak since meson.build expects that GDBUS_CODEGEN is absent, rather than empty, if the tool is unavailable. Reported-by: Sebastian Mitterle Fixes: #178 Signed-off-by: Paolo Bonzini (cherry picked from commit 5ecfb76ccc056eb6127e44268e475827ae73b9e0) Signed-off-by: Michael Roth --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 4f374b4889..7c321662ca 100755 --- a/configure +++ b/configure @@ -3331,7 +3331,7 @@ if ! test "$gio" = "no"; then gio_cflags=$($pkg_config --cflags gio-2.0) gio_libs=$($pkg_config --libs gio-2.0) gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0) - if [ ! -x "$gdbus_codegen" ]; then + if ! has "$gdbus_codegen"; then gdbus_codegen= fi # Check that the libraries actually work -- Ubuntu 18.04 ships @@ -5678,6 +5678,8 @@ if test "$gio" = "yes" ; then echo "CONFIG_GIO=y" >> $config_host_mak echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak echo "GIO_LIBS=$gio_libs" >> $config_host_mak +fi +if test "$gdbus_codegen" != "" ; then echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak fi echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak From patchwork Tue Oct 19 14:08:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C295C433EF for ; Tue, 19 Oct 2021 14:49:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B63C46113B for ; Tue, 19 Oct 2021 14:49:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B63C46113B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqQR-00087Q-G1 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:49:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpw9-0003ZY-9M; Tue, 19 Oct 2021 10:17:53 -0400 Received: from mail-bn8nam11on2076.outbound.protection.outlook.com ([40.107.236.76]:56417 helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpw7-0003BA-9e; Tue, 19 Oct 2021 10:17:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VaPg4+VW6zGj4aNLeYxQ6XBdA73f/Onf3++gyDNxCpE04wtw/j9rJ4r4g7uITzGRbgFMQysQORouenehOE2LmwhUjLpFy3hobz1AAaaYlzWulnr4ilVEPnn3M2zXHOd9EfJblP7ZvzQsvcRQqs2lzkfOqfL63DMu3cOHlQxXS+9VQl8v4aeKxeLg5BM15SYjPSZewC1CcVOQSN3UlUgkzdyKfblJZDLWm2t+2It+NZbDB2999pAYevIVKcu53cjy3BDs0pu2qFWeEV6w2lNAFfvffv91+D6WOUFMZcZjYiWHGYdf22eohkUj2A8Oh+VcFSaOFNT3AuyhFwkJbt5cfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=htGEvWbasilvoRt12RFxDzOrXFyN+aQLftzYMOsAAEU=; b=dqwc//whsurQ3B1AZHzIs+07YM7P35zoCPQblheheBwZcAR0veIBob4tCioBoP8HMwuazucyb+QcpdHwP0l01LCL+plP0BIXf5hn229J2DdtOP6s96+0vBmsuo1IXvhITpC/2yzVILiABfDpeg034Yu0coBTx/jUM4m5cCDzzwqZd9RnRZQRWQ5WrF6Ow+JF4IrTZR6CTZXun7TSvnd0tC27VWZboFhDWPIYUhFmv25+4JCQ1l/cMHr2B6tq4knBikXiI8/41ASj5xs7jaPf+4KIgyHiv+qk8HPQtNDv6FyKfeeWl8qG7XqRoBRTxLr6G55Uf+JbMaExuGK7o1ehkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=htGEvWbasilvoRt12RFxDzOrXFyN+aQLftzYMOsAAEU=; b=k8miiqExVG/D5c73B3VmdS/+hqxkmGRjwxop1lL+NUHDOXbK6alor0F77eSDEA1YrydvZMey9h6lYtyCM/+F7hXGsp66kx+R2AnYKoJvKC1d30C1REBj7wVt2smZ+Ahym0yOTeutpkcKU9rSOrA7KXsfHPuziZwHb6ZvrnjbPu0= Received: from BN0PR04CA0056.namprd04.prod.outlook.com (2603:10b6:408:e8::31) by DM5PR12MB4678.namprd12.prod.outlook.com (2603:10b6:4:a9::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:17:48 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e8:cafe::9d) by BN0PR04CA0056.outlook.office365.com (2603:10b6:408:e8::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:17:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:17:47 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:17:46 -0500 From: Michael Roth To: CC: , Jason Wang , Gautam Dawar Subject: [PATCH 18/64] vhost-vdpa: don't initialize backend_features Date: Tue, 19 Oct 2021 09:08:58 -0500 Message-ID: <20211019140944.152419-19-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8f489061-edce-4d74-38ba-08d9930b3a02 X-MS-TrafficTypeDiagnostic: DM5PR12MB4678: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:161; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yC/q4Y1pKgeAGAvneS9fTcV+ja14vs1Jk9+k4PfVCxsHdfhC5BZ35C59GQ0Y3LyleWxAPU7pt0+giyq1mjNaNLZnasnSgY7CB6R87ZE0b7cIabIkwdEhUC5D3UkPDhgujumtDoqx8YP0PmNV/dLJZNhChp1IgAofMzsJaQsDfWJCie3pRm1WZT62zkrjheLSRQ4rUvk3SAM2owNWC7PH3I/Kn013MXNLmR/1vwKLsm604niYgNm2Ghz6TR5/Xyi40DGGUh+StQWTShFkMX2i3x5VQHof5nSY+80+JV0/lD4EH7lTALaVMo0x85GWF8jAeaQ6GuySnjNsNXrKwxrxZrjzAaBrLowVUGxBGhPSQKGno4KqDp6FDBPaEaSAd1OCA0d7RIGPP/QDYavMDP/R3XbCga/w/U6y8ZP6iy/n7s/j9Q3GDlSnYwfND9R9IzyPkx54pv8Q1M2OGFYXDwbGmZD9CMXCx34ZOkAZwC4HO+QBfSgXUr4mbaWIS233Ft8oDFEweM0ZVb9fjFp1ninlnLHMOarFgTvX+eoOxV8gEl03OUlm59CEo3auN+cXNdhISU4oT5GGDKCpyfNWyuwSlYv1Rve+0rFl2Cfclc0A/kyd+25h6UsCv0LQOCM1nGjT2usRgZQCvBR/L1HD2QoKFKUzRbITa4dBqitDsQcLouvxeIksCxPSs/bhsWoUE1HMTeTXyGucxq9FwslsyCpWTL/U9ynE9B9nuNVcxpslH2c= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(26005)(16526019)(82310400003)(1076003)(336012)(186003)(44832011)(47076005)(6666004)(86362001)(316002)(508600001)(426003)(70586007)(356005)(2616005)(36860700001)(83380400001)(54906003)(2906002)(36756003)(8936002)(81166007)(4326008)(5660300002)(70206006)(6916009)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:17:47.6343 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f489061-edce-4d74-38ba-08d9930b3a02 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB4678 Received-SPF: softfail client-ip=40.107.236.76; envelope-from=Michael.Roth@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang We used to initialize backend_features during vhost_vdpa_init() regardless whether or not it was supported by vhost. This will lead the unsupported features like VIRTIO_F_IN_ORDER to be included and set to the vhost-vdpa during vhost_dev_start. Because the VIRTIO_F_IN_ORDER is not supported by vhost-vdpa so it won't be advertised to guest which will break the datapath. Fix this by not initializing the backend_features, so the acked_features could be built only from guest features via vhost_net_ack_features(). Fixes: 108a64818e69b ("vhost-vdpa: introduce vhost-vdpa backend") Cc: qemu-stable@nongnu.org Cc: Gautam Dawar Signed-off-by: Jason Wang (cherry picked from commit c33f23a419f95da16ab4faaf08be635c89b96ff0) Signed-off-by: Michael Roth --- hw/virtio/vhost-vdpa.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 01d2101d09..5fe43a4eb5 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -275,15 +275,12 @@ static void vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status) static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque) { struct vhost_vdpa *v; - uint64_t features; assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_VDPA); trace_vhost_vdpa_init(dev, opaque); v = opaque; v->dev = dev; dev->opaque = opaque ; - vhost_vdpa_call(dev, VHOST_GET_FEATURES, &features); - dev->backend_features = features; v->listener = vhost_vdpa_memory_listener; v->msg_type = VHOST_IOTLB_MSG_V2; From patchwork Tue Oct 19 14:08:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78F2EC433EF for ; Tue, 19 Oct 2021 14:52:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 131BA6137D for ; Tue, 19 Oct 2021 14:52:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 131BA6137D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqTn-0005ci-6R for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:52:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpwV-0004ZO-Uu; Tue, 19 Oct 2021 10:18:15 -0400 Received: from mail-co1nam11on2084.outbound.protection.outlook.com ([40.107.220.84]:65504 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpwU-0003Oz-3G; Tue, 19 Oct 2021 10:18:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HZjS5e5P9YYM3NutgiFTi8o7Pg59SMoHXYXWLFsqeSqx1gvvQ7A9/TE9dH3RUialBpdozUo93Y6PXXIr/lXCzNvCrnroQeF8Etd/hi0TuJcUp2W6yuYPAkQ5D1U1j5+JY7svEP/p+oxQE36yic+cV2+CtfigsKgu0TtQ0BO5DGJ/ovajwEjo91GJNVdQohVaBILyDTgpzwCoVg1vtB7RILcKfNhtGVKxuk71mC53lcwJkpW7DXPPfNxVg7h2Bv4g3frSujPG+KZHvgFFDRUJxkHkkhltuZw+biG0iCAWtpBkCQcA3+864ygw3lUajajtQd+zFdtsNCZ66CB8V0E2Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FxX+XCVj8u3x0NeUYhSTfYkoc3vQdZ+21NIskXmUjGY=; b=fibj+f1khLHrdrO9rHO5vlwk3FOAhAr38OtLxQCJ7Pr9timTzR6a19loiOTyPBL/2vmv5sRH1uOSMEUPulUSuQze3zohkfjbkzpPwE7ofnNsR5KOYPhMS5DSA6Aw7h1kVXOi4+A+MN+tT0LOAA8De+BhscgEQDI4hYMn8MJO0KJU4xOh5OzELlyhkTszBE0uMH5fXjF/6dEATH0kqxV5Pjq45HJshqfbmeZkZYk8rAmlaRBjKwS9kx8//GxgltKEOjcJ54ShJ3tfmG0gc0U9CA9bXNicWsB8S0yw8kRUPPptrfIBbF3jaLnEVcgEEcBuzNsHP0P+d2NQndKMcQGzhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FxX+XCVj8u3x0NeUYhSTfYkoc3vQdZ+21NIskXmUjGY=; b=kCHie/v0rAcThBMQ+F3jgMAbfij6yl+kofRBt5MHbKBePkxa7GYxRMASetho2wwkYfOgV/9qnj3EXVC4BjJVI4IBD6fjXtphxkTiduG6whHYU6t9vzZCEjAOnqZjesLdyLEHB6bvXJy/C527GdoGQhOq9zSd045UvOWaWqVVPbs= Received: from BN9PR03CA0606.namprd03.prod.outlook.com (2603:10b6:408:106::11) by MN2PR12MB4583.namprd12.prod.outlook.com (2603:10b6:208:26e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Tue, 19 Oct 2021 14:18:10 +0000 Received: from BN8NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::fb) by BN9PR03CA0606.outlook.office365.com (2603:10b6:408:106::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Tue, 19 Oct 2021 14:18:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT006.mail.protection.outlook.com (10.13.177.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:18:10 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:18:09 -0500 From: Michael Roth To: CC: , Mark Cave-Ayland , Paolo Bonzini Subject: [PATCH 19/64] esp: only assert INTR_DC interrupt flag if selection fails Date: Tue, 19 Oct 2021 09:08:59 -0500 Message-ID: <20211019140944.152419-20-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1242a516-1103-43ab-7cf0-08d9930b4798 X-MS-TrafficTypeDiagnostic: MN2PR12MB4583: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:82; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KYQwgjFZOgF6Zb+dQdZ5IVyen7vrFvwj/2JgqUfbqxHGTFrzrvh2PYyGxN+vRMn+uXJ8RmcJ+kkOhhD0eWxVeBHA5cEV3JdNx5Txa0Qon9BdwSymmREyiMpFWp81B3GEiEcNmRUtGnr5DUI/raLHtWz3dm/YxfYVEG2fK0LW1FGLjNNOKHhyCsy8Q2gdzbWpDyKab0Lj50mhEfjoQAFbLeIhyIGeD/W39jYEMrhWicKn0x8uju5xdPX3sMfDszpYiStRx2q7OpTn5F0UiXlXW1A7L2RF7szK5L0EK9/m5n3NCKD7qUkUUoWjHyXnjpdp850P/tsnPPAqnLoCB8LCRIrJDSZD4J2Eghq0PRgT7cxnTrlzT9xvFJtYmgCWekjPPqL2KzfuCJmpMXffIHkNcKnjuZOsCNQQjSbVV0Nd+UlHuGgZNfWVrkPGXjN3COYssOaZw2FPtT4LmOdPKhfuSySrFoLdFcJNpI04NQCNI5IkJAY8gKWpybZ0Mk+ARTHdVnBnUgUPG7ixZH8UdGqLCOghibbejIuyAVGHXDEUMEzN9JNsFJG+SB6wFhOLFlb850iNwn/iBNViLDwiGlRRGffhvVHJ2XeLxOZ1lp1JoCMB4ovI2/fhTCOkvmeK64Y/r5tQuoQcY8ADC9q/pf2rttMs+z8FIJa76B9vFhB8PTZ8EI6yWt33Zk5m0kM+LfZgQozWOYlYzIXQvg+a0Kp5A0vd6PPPOQXV4VnoY52Lozw= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(356005)(186003)(16526019)(54906003)(26005)(44832011)(70586007)(70206006)(336012)(2616005)(83380400001)(316002)(508600001)(47076005)(81166007)(36860700001)(426003)(5660300002)(4326008)(4744005)(2906002)(8936002)(86362001)(8676002)(6666004)(36756003)(6916009)(82310400003)(1076003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:18:10.4310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1242a516-1103-43ab-7cf0-08d9930b4798 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4583 Received-SPF: softfail client-ip=40.107.220.84; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland The datasheet sequence tables confirm that when a target selection fails, only the INTR_DC interrupt flag should be asserted. Signed-off-by: Mark Cave-Ayland Fixes: cf47a41e05 ("esp: latch individual bits in ESP_RINTR register") Message-Id: <20210518212511.21688-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini (cherry picked from commit cf1a7a9b3721544aaa3e43d111eb383c30d71a62) Signed-off-by: Michael Roth --- hw/scsi/esp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index b668acef82..000e45a624 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -213,7 +213,7 @@ static int esp_select(ESPState *s) if (!s->current_dev) { /* No such drive */ s->rregs[ESP_RSTAT] = 0; - s->rregs[ESP_RINTR] |= INTR_DC; + s->rregs[ESP_RINTR] = INTR_DC; s->rregs[ESP_RSEQ] = SEQ_0; esp_raise_irq(s); return -1; From patchwork Tue Oct 19 14:09:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D635C433EF for ; Tue, 19 Oct 2021 14:55:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7D1E6137F for ; Tue, 19 Oct 2021 14:55:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A7D1E6137F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqW6-0002pI-QO for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:55:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpwr-0005fJ-GE; Tue, 19 Oct 2021 10:18:38 -0400 Received: from mail-bn8nam12on2052.outbound.protection.outlook.com ([40.107.237.52]:16832 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpwp-0004Kl-Kl; Tue, 19 Oct 2021 10:18:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TLXLvt+Qu0WZTHVVyKAVe1GBFzAp9W+6A3XlkK9so8Q8PCRZfWjpeoddMDlvHy1YjV6yPyJuhrG68lcYKtiLo9hNLUv4L2JIkJocl/Nxqv2ewwgYyq8re8RrDbfKKrgV1L/DJFJPSGjKFWaNLSDgQpFh86MekF1aSWjpI6/PJHwDWeqjhaAXtGqZyI931pmSUYIYy9hHB3Heg9UH3SilwRxvkFDLG/fsyg89MkKY0xepJtK/BRdf2auS2fGIZoBRbQ9Zn+uUJKztm8SpLqxYSMsFlsyR+rL1zXBk1HKn+hyOoo1X7oyybwSLJIJ+WoW0I1/JBcTbZNNzPdLYwjpFww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EaQ0/BBSpxduWqYnTZ27k28+dTANkTw5nOEptjxvD+g=; b=JQLkWZQUr0rBKTPLPF1Tfw5unqSlh8ibncTzCCKekT53qFeONlqZn5X1JEWtxfMWPEYvmz0eU9yqoGACm91WXBEWDlFx0pQLe1LUqj8roD04AMsfg4oVkE1DWonCzHQnXqPo8P4GzDb3cVjyzV7bStaQ8/3tRDzc6ozj1VyjHcsGcYvPd7W4YBjmeneM+7NybuQ+E8Y8VyaOYVqxt5Qfb2RL4aq5OXoov0NZOW7Tctd1CLEMxIJs2WLV3V8z1MmzS/3OLTejYoHKreIhqDYJDMI3Cp9wiTFRZq4NTiY/oEgrUS84iXGby9vnOfnfvKsdIilq+UfYTWhQHJlW5rNCGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EaQ0/BBSpxduWqYnTZ27k28+dTANkTw5nOEptjxvD+g=; b=JMeOk6au3yPam0004pG+Z4We9kf1s/a6EHjtcgqQorLE8W2Euaj1t6hGxuEmIFoAyRx6bnZBoicBY2LHuel56WXfDXN7GbrrGvjPvusn2ORuUoSIV+AJvR8lJ+iNjk1/nF65dH7reVo+i8Q+tvULqITdyHBeOE60HLtLlTPl+No= Received: from BN1PR12CA0019.namprd12.prod.outlook.com (2603:10b6:408:e1::24) by BL0PR12MB2530.namprd12.prod.outlook.com (2603:10b6:207:43::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Tue, 19 Oct 2021 14:18:32 +0000 Received: from BN8NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e1:cafe::aa) by BN1PR12CA0019.outlook.office365.com (2603:10b6:408:e1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:18:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT046.mail.protection.outlook.com (10.13.177.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:18:32 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:18:31 -0500 From: Michael Roth To: CC: , Mark Cave-Ayland , Paolo Bonzini Subject: [PATCH 20/64] esp: only set ESP_RSEQ at the start of the select sequence Date: Tue, 19 Oct 2021 09:09:00 -0500 Message-ID: <20211019140944.152419-21-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dfa417cc-516d-40c7-df0e-08d9930b549c X-MS-TrafficTypeDiagnostic: BL0PR12MB2530: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:466; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jsM5G7ZYhYuctPr5CEOCziM/iXfR/gW3xwJYNkP/biygrXu854z04C85YkQCfdVV4wLpxUESG/5UYSXv7SgqOE7a3vXjgLGAR7fN/xz16Ou6C6LdL4j/KACFMlpxvP9SCl809Y3oPjWuvaqyMZShL0Z8SBNMHDMYw2r5AKeJWJ14ygYqieqqrkhvQFPhZwKJG/hxqmy0213zHNcOR3nP90j9ZEb76ORaFWzVTtma83zVddnw/VEujoJiyFvZkKBpZ5AnDpLTHvR4CsbDz9cu8hVfVeMyl/BVpauBL+Q+96MEkpt9Rsn9KCRrkfwhFv4GQN2voisbr1MYzfKYyTLBbWaWPiKEfWkwkwGmFFN7KZzYaLYxInK5u82tL94oeXzfzDJxVnpwpIHYrr2H1bnzlcfqKD2jWXberpXmmNdvEphXhKZOlGZZxtjiWrOzfZMayuax3BbZAITet+DfYgB9n0YP8ocoSU/PIJNgw4zVJ0KVxot17xfAT2Dfw2/mA7Zz0BCZGf3KEH48zybdT0xT/3XfviVo+/ynQ+4bskkr/cgQVbRs6i9ihTbaHJPwaKs5SumKBBVN6iFnV4ypOISsq1hTWGWjpjRxP40kFXBfln7td1jkqEORHCzul6ApkL9Mw4aMWz/6ga+CGMi+Td+WAS1VDGyXs+dH4iDYP2p0sd5pwG0TygsYmQWyzFeFWPV03A1plAr2QI5oIoRhey2CLq6qYYNsiwoSwI8/goUFlR8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(36756003)(83380400001)(82310400003)(36860700001)(81166007)(356005)(47076005)(86362001)(1076003)(6666004)(70586007)(2616005)(426003)(44832011)(70206006)(5660300002)(336012)(186003)(8676002)(16526019)(8936002)(4326008)(26005)(54906003)(6916009)(508600001)(316002)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:18:32.2706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dfa417cc-516d-40c7-df0e-08d9930b549c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB2530 Received-SPF: softfail client-ip=40.107.237.52; envelope-from=Michael.Roth@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland When processing a command to select a target and send a CDB, the ESP device maintains a sequence step register so that if an error occurs the host can determine which part of the selection/CDB submission sequence failed. The old Linux 2.6 driver is really pedantic here: it checks the sequence step register even if a command succeeds and complains loudly on the console if the sequence step register doesn't match the expected bus phase and interrupt flags. This reason this mismatch occurs is because the ESP emulation currently doesn't update the bus phase until the next TI (Transfer Information) command and so the cleared sequence step register is considered invalid for the stale bus phase. Normally this isn't an issue as the host only checks the sequence step register if an error occurs but the old Linux 2.6 driver does this in several places causing a large stream of "esp0: STEP_ASEL for tgt 0" messages to appear on the console during the boot process. Fix this by not clearing the sequence step register when reading the interrupt register and clearing the DMA status, so the guest sees a valid sequence step and bus phase combination at the end of the command phase. No other change is required since the sequence step register is correctly updated throughout the selection/CDB submission sequence once one of the select commands is issued. Signed-off-by: Mark Cave-Ayland Fixes: 1b9e48a5bd ("esp: implement non-DMA transfers in PDMA mode") Message-Id: <20210518212511.21688-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini (cherry picked from commit af947a3d853a235943681a00f07f3081f5143cc3) Signed-off-by: Michael Roth --- hw/scsi/esp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 000e45a624..18d4d56392 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -481,7 +481,6 @@ static void esp_dma_done(ESPState *s) { s->rregs[ESP_RSTAT] |= STAT_TC; s->rregs[ESP_RINTR] |= INTR_BS; - s->rregs[ESP_RSEQ] = 0; s->rregs[ESP_RFLAGS] = 0; esp_set_tc(s, 0); esp_raise_irq(s); @@ -917,7 +916,15 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr) val = s->rregs[ESP_RINTR]; s->rregs[ESP_RINTR] = 0; s->rregs[ESP_RSTAT] &= ~STAT_TC; - s->rregs[ESP_RSEQ] = SEQ_0; + /* + * According to the datasheet ESP_RSEQ should be cleared, but as the + * emulation currently defers information transfers to the next TI + * command leave it for now so that pedantic guests such as the old + * Linux 2.6 driver see the correct flags before the next SCSI phase + * transition. + * + * s->rregs[ESP_RSEQ] = SEQ_0; + */ esp_lower_irq(s); break; case ESP_TCHI: From patchwork Tue Oct 19 14:09:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AA47C433F5 for ; Tue, 19 Oct 2021 14:39:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E6BFB61175 for ; Tue, 19 Oct 2021 14:39:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E6BFB61175 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:51802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqHS-00045T-04 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:39:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpxb-0006Vl-JC; Tue, 19 Oct 2021 10:19:23 -0400 Received: from mail-co1nam11on2078.outbound.protection.outlook.com ([40.107.220.78]:31111 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpxZ-0007Iv-QI; Tue, 19 Oct 2021 10:19:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bu0UFXAKeRyu6Fzg1y0YkXbhgYeI7NI+j8Qek+EB6RXfEfcSB2NuhIsvSM+sQK8kkia2nPVFXllFuDn3VO6XO5/E1oSqDXm0SOb8/6Xe9ULS9RpL3JuDUQP+x67WZX7m+Cr1FXeHzrCUax40d1xyzHQS0b4wnukyoMbu0rGNNsksFhX9R7cWKbjbe1cRfp4Upn2+efwhyyzECaxhmOfb5RtuVEGCuJt162mWr/9b6J835e322GIvTT5camsyw3erLgFqollTyF5edhQdsTELUAgt5rPY9aYYf7rB5lU8V/d5zlZp3C/UxtSg0C2Pz74++tepWILqqAtIpUY1JDo8iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qvm+WTZxBklVEpa3EcdNOEoK1luKUzTamkmYTZ0bRTI=; b=L8WCzGxQrQs8XAzX04kFx+QixjGsHmdAzmnAC6cGgn8cwjNbUbEbAJT9/UYO+YZW6/wOlRJzJrfBj5uAKhnpbsiFKvGmRcdneWjW/uQaoUdc8R/qFVMO0v1MHhnCF46MV7hOuOsUpQ2g8QltldLSz5sRfMoRGgoPCReWjZOgKx1b4ni69co33vMO3HISQM2+HklqowEiwqO1nZTVfKTdpzkr/Onwp/jak/a7n44G2bcOVW6LsK4YW93PDpkoKL0iGbUOmEGwi8bV91Eq2aFgf2/pM9o2SZA/bxK7hFqVVb4XO7J6X03ACb2XaDy/d0s/sZovKQmbTJ/L6TtEH9TyFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=temperror action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qvm+WTZxBklVEpa3EcdNOEoK1luKUzTamkmYTZ0bRTI=; b=1wFUYjLRs//hdzWj0iIGYlTQJede16dDCHhClJo3el/mQ8grPhtr5u5m+GxTiSR6kQsnnsRpvmFpfaol5+lpJ0+fR3tZT4+Yks39aLyNnv3uKj2Tnu0NLZ8bq0YlpbfLBotXcnT+S/igj04iJWoOG5Ke/CesZQfQr1IFHqHSMhs= Received: from BN9PR03CA0185.namprd03.prod.outlook.com (2603:10b6:408:f9::10) by DM6PR12MB3273.namprd12.prod.outlook.com (2603:10b6:5:188::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:19:17 +0000 Received: from BN8NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f9:cafe::e9) by BN9PR03CA0185.outlook.office365.com (2603:10b6:408:f9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17 via Frontend Transport; Tue, 19 Oct 2021 14:19:17 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=temperror action=none header.from=amd.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of amd.com: DNS Timeout) Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT039.mail.protection.outlook.com (10.13.177.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:19:15 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:19:15 -0500 From: Michael Roth To: CC: , Peng Liang , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Paolo Bonzini Subject: [PATCH 21/64] runstate: Initialize Error * to NULL Date: Tue, 19 Oct 2021 09:09:01 -0500 Message-ID: <20211019140944.152419-22-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 39654c23-5816-40c8-9c73-08d9930b6e8e X-MS-TrafficTypeDiagnostic: DM6PR12MB3273: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:549; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cecWAaXx1VTO4FGTRzuNidC2bb1gFLI0WwChyuHkniWjmjfhev9A/9m7EbFt6YeamA1SpfpoQHAEBOa8L2mHAKcCkFuH4yBJELPMjRo5+rOhGHej5YTLr/Ox6CaTQiKV1eQwUV/GYvUhtrR66MPN7dUIdOIu1Kkfgw2iuoHefn5sYlaNiv6bWqgWXd9zSWQC74vc3vD+QbDnUBwt1s5QGfzdgm1zpEaCtlsyv6hgI5oCK3o4zC0Qb5/tV317hPOa62mIaP6EPEtcKZuzUPpPGCIJKnaa3a+Crv4ZstElB8U5bQ7gwUsyXIZnnm9qfizHQ/zbW+yXBLj0uvyViCb8SP/vyl7AGIuVn5oEfz59ltWnQngP8eR/CBAiQS9Ncz0vnZiKaZPLITsru8OM5ODrVUDn+jVr2YluSP9IC9ky+4uiwVcUZCtBHBzELRMaqZGxBc47GUQwGPKdAxXYuILvb3EZfkofGwjA+6vuK+EbCGk4xhCiUvq296+zNBLhSda/Xt7OzHDee4tCWnPeW+Grwge7ns7eVt0k6vx3ejyDqXZS9uuUdr5bQGB86uA0yIwP1U7XwT6zhdTQ4UCJC8ElCPqKN2tnNRLpRxoyPpcLg5BOOnZHRlQ+nrKE6a2iFyLuPOVpjMpZHNNT2IuIrPPAG/ACSmOaECuALwZGWSQjZGsud7ELSR21xoFIC2ZqBOnKjEruKYn8qJunHbLnLdngFK+DWfiVCSAgwXPS2HNhL7w= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(4326008)(86362001)(4744005)(83380400001)(16526019)(81166007)(82310400003)(186003)(36860700001)(6666004)(508600001)(44832011)(8936002)(70586007)(356005)(8676002)(63370400001)(63350400001)(54906003)(426003)(336012)(5660300002)(6916009)(2906002)(316002)(47076005)(70206006)(1076003)(2616005)(36756003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:19:15.7969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39654c23-5816-40c8-9c73-08d9930b6e8e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3273 Received-SPF: softfail client-ip=40.107.220.78; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peng Liang Based on the description of error_setg(), the local variable err in qemu_init_subsystems() should be initialized to NULL. Fixes: efd7ab22fb ("vl: extract qemu_init_subsystems") Cc: qemu-stable@nongnu.org Signed-off-by: Peng Liang Message-Id: <20210610131729.3906565-1-liangpeng10@huawei.com> Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini (cherry picked from commit 6e1da3d305499d3907f3c7f6638243e2e09b5085) Signed-off-by: Michael Roth --- softmmu/runstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/softmmu/runstate.c b/softmmu/runstate.c index ce8977c6a2..54713100c2 100644 --- a/softmmu/runstate.c +++ b/softmmu/runstate.c @@ -746,7 +746,7 @@ static void qemu_run_exit_notifiers(void) void qemu_init_subsystems(void) { - Error *err; + Error *err = NULL; os_set_line_buffering(); From patchwork Tue Oct 19 14:09:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91100C433EF for ; Tue, 19 Oct 2021 14:32:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 140536115A for ; Tue, 19 Oct 2021 14:32:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 140536115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqA1-00072Y-1i for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:32:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpxx-0007Z2-SR; Tue, 19 Oct 2021 10:19:46 -0400 Received: from mail-mw2nam08on2086.outbound.protection.outlook.com ([40.107.101.86]:50657 helo=NAM04-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpxv-0007XG-Ua; Tue, 19 Oct 2021 10:19:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HKXAMoeT/8jU6fIn8OHJxwPjvMCd7pyE+LY4aGct0wUToOk38wxndIwxPm9M9Sawed4LYS2xqGNsNN/a18UkMr0pgAQuKE0Q7bCW4OP0/MvsZ0STo/fD5DET4YX1nuPyYg6VeRH+L9FbKZgl6iVaMaVrW6jsI8+bc4s6N8f4JqRamECDaQuAAWI6qXE/GHxXn1PjoiP3cqY8ZiR3nC8Dfbj7fQ9suz5UJg1nPrlBr259k4EYDzwWWClk0FbcPKSCl65PQpmePTzZxAGCw6oGYsXtfdn1zpXzan6BOL3E+jzeJqv/RAWz+RZUYFPBCyhch8V1Oa5RoilrkPHMTDqcuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ksEOSlW8SkYmYmeyXACdJBK0uUYEopxk+VljEfnck7U=; b=cgeRDcpEpUZQRo4c7btQD+aHq6n3+72J2puKBa2Zvv8LvAK/CqZt19X6JYwKDq7Gu+Ql5BPHAOl3g/nodZ27WhlutADrc5Rhm8X9wxiQ7aqVWJIqoVIWwvg6NVrv6tvvXN1juBdepvBflezMgGgj4WGGZCYz6lir/WwwZrQScAlRX/0rUteZA2jKaVZqu2RW5A3qAV0V2iVpGoIX/8aNKg+rJH0H/oq04BS340oK/m2y0+m697YzWrJgzHGk+Wr9NnXKj+1JGumksNH1HwHO2ipjdvki0LxmOfcRw/AJ7Xo8P44AelpnQhi/FRZnPX7FtV2F5guESnPW2EuYc6m/nA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ksEOSlW8SkYmYmeyXACdJBK0uUYEopxk+VljEfnck7U=; b=yt7gC+dM/R4s8AOngAVG+vDVZaqlGf59BmYg2D8C9Af+phXcM4AqJ93EkykTMPNzL/yqMGEK2JBMqcPzycH3ypnxVUplQnl42rwmCCN/zWqUIXwWzvr9FTH3SOmyAZeptFu3+zCcxVHWgbydAZ4vGqEcJXsYDPI3erSYgLugSEM= Received: from BN9PR03CA0953.namprd03.prod.outlook.com (2603:10b6:408:108::28) by MW3PR12MB4409.namprd12.prod.outlook.com (2603:10b6:303:2d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:19:39 +0000 Received: from BN8NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:408:108:cafe::d3) by BN9PR03CA0953.outlook.office365.com (2603:10b6:408:108::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:19:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT052.mail.protection.outlook.com (10.13.177.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:19:39 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:19:37 -0500 From: Michael Roth To: CC: , Kunkun Jiang , Qixin Gan , Alex Williamson Subject: [PATCH 22/64] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize Date: Tue, 19 Oct 2021 09:09:02 -0500 Message-ID: <20211019140944.152419-23-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b12c456-2b64-4abf-7256-08d9930b7c81 X-MS-TrafficTypeDiagnostic: MW3PR12MB4409: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:514; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4dS6zLACaGWjwwZeWWsWrOPn81/OByEbpjun5TnuE1lDjKhn8/zqc/xzRhXcLPSo7TxxvNicWHKoQcfT/lv4drXMK7Oyl0LyEjjffGKl+8/Ogw//0ybVNhC319AOW6Z6ryBjG52lw3NV4QabV1dLV5Ne9w+VQOtFq3P0MVkXsorBZJz1zaf4Qqq6i0SpDWsoXzbnVjl+wQprgZzdMCsoYMtiC66Pvl0b6mps3GHIm81M3oLU66Ml1AayxMoy/42wmoOurCqZdRzWcEEwNmEOln83T51qNt5Fvx/Hkh64tk18zwgHFJXmfPgd8T4QoZF/jD5SXneBy11chzETKEs12zbIedyYqPJ1QAOrcJEpdAVsi0JbHsVoMcdwZAMajp654acp853RS//tTOP+VcGijtb73hMR1QOGW1ZbmJ9/QYQ9LorQ/joQkgjVQ5i0vs0dd/Ru49X6buZSugnASxLa9E8eB4RNOuQj4whNaEAzcgnACgU0ruOtzUFwBON1OHYcP69OSykTfMeQGMCWPzpBVGB1ckaWaqRP2JFURM2yBaS+Ep7PDGwo/O23VzowvAGtFKFYtN5du7XCQwHHqNhUKWmt1e9yJ8U4tnggNgNud/Nm4VavXEnxDvIEfH/Q5jVLNY3etz90xxJSQ8trnEk9UntGutnJzQ/bS97vJh1TZJtUCqSpj/K4O+JycLdB5mK32bzYLCkZ1tGbImieik+HqG+h7E2dNHoG2L3xQa2QcgY= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(336012)(316002)(47076005)(82310400003)(4326008)(83380400001)(2616005)(70586007)(70206006)(6666004)(81166007)(426003)(26005)(186003)(5660300002)(36756003)(8936002)(36860700001)(8676002)(54906003)(16526019)(2906002)(1076003)(86362001)(6916009)(44832011)(356005)(508600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:19:39.1977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b12c456-2b64-4abf-7256-08d9930b7c81 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4409 Received-SPF: softfail client-ip=40.107.101.86; envelope-from=Michael.Roth@amd.com; helo=NAM04-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Kunkun Jiang In the vfio_migration_init(), the SaveVMHandler is registered for VFIO device. But it lacks the operation of 'unregister'. It will lead to 'Segmentation fault (core dumped)' in qemu_savevm_state_setup(), if performing live migration after a VFIO device is hot deleted. Fixes: 7c2f5f75f94 (vfio: Register SaveVMHandlers for VFIO device) Reported-by: Qixin Gan Signed-off-by: Kunkun Jiang Message-Id: <20210527123101.289-1-jiangkunkun@huawei.com> Reviewed by: Kirti Wankhede Signed-off-by: Alex Williamson (cherry picked from commit 22fca190e25b10761925bb1eeadeda07aabf3c26) Signed-off-by: Michael Roth --- hw/vfio/migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 384576cfc0..3ed3d595b8 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -893,6 +893,7 @@ void vfio_migration_finalize(VFIODevice *vbasedev) remove_migration_state_change_notifier(&migration->migration_state); qemu_del_vm_change_state_handler(migration->vm_state); + unregister_savevm(VMSTATE_IF(vbasedev->dev), "vfio", vbasedev); vfio_migration_exit(vbasedev); } From patchwork Tue Oct 19 14:09:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E8B6C433F5 for ; Tue, 19 Oct 2021 14:43:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08DA661175 for ; Tue, 19 Oct 2021 14:43:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 08DA661175 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqKa-0001MH-1f for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:43:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpyH-0007wB-PR; Tue, 19 Oct 2021 10:20:05 -0400 Received: from mail-sn1anam02on2044.outbound.protection.outlook.com ([40.107.96.44]:46248 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpyF-0007kE-GP; Tue, 19 Oct 2021 10:20:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ry8PDeMDcnsiMin0JpKJuMY2S8duWO4JoelL33DcD6hNnAEjhO3xnGRakSpZDX5ETevwFu36OJ69NX9mbJc5RosH97b0QN4QhKYWO+2IydMsrLk+sSt73+MfViytNkVtrA3odtWWbCmFmXfy5txC25OlPmLEjCwuGlZZ2dFNa2rypzpbZpJPuCINHHJzSavGjM9M0B89N0qt5AKauP5njO8brfJYV9A+N/NXeIsCtc9r/NidWVqqMMM88exQD4yjGKXapcgmu2Ng8HODv9ywyul6ltU4qj6CUAuqgqCyRVUJq884lUQiXZFHEZVzVoGGhaPrEnrcpZfF+2H/w63nFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lQswjtRPTwJL8Nv7i4tKKD1IU1m/bQO/urZtle86sqg=; b=UCkP7qf7Ur+3UgIMHL9GAM0Lu8d3tdpttnAZ4ow1X6vgtlxgGroiEZ3ViYb7SMSJwbVxkErMnqDCib2IbDD3vhTVGRGndZpIjIaLeww4yEgxekrT0D9Jngl3OnI9hNuvOhiY93zc/RRhBWQ30PYSKtrmych4d15Zw8apSWrRyS7CMPAsTBaDqraIwZ18ywZ7IQ/QdAhlaH7s8JtdzzdPn5ILYt0HPFFckRVohhj8jdmKLkO2lPlw2oUCSCrury9jxWApMZbZFiIq7e4ESLdwduFbNZtG/Obz6eKupzweyn345L9ZjZ4CYdywyuXo7qtvzycMReYH0845yq82nS9VZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lQswjtRPTwJL8Nv7i4tKKD1IU1m/bQO/urZtle86sqg=; b=IKilvhjkz2WtO9BsZFZpqrm3+Ji6oGmzvXtWLEcyVQMV1jfNQrJv+Y49Tka3fOSYadqMLjw6KGSsYJZPQRfDjINDrqV/JA7Nu6QTfnGC+xXPvBoLmcR+euHjz/T9wCGwjGPuS0z/UAXVMn1Qqk5KnjTBVxqGkHxmWEt5c2SNo6A= Received: from BN9P220CA0028.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::33) by BN6PR1201MB0225.namprd12.prod.outlook.com (2603:10b6:405:5a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:19:59 +0000 Received: from BN8NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13e:cafe::f) by BN9P220CA0028.outlook.office365.com (2603:10b6:408:13e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Tue, 19 Oct 2021 14:19:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT025.mail.protection.outlook.com (10.13.177.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:19:59 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:19:58 -0500 From: Michael Roth To: CC: , Zhenzhong Duan , Paolo Bonzini Subject: [PATCH 23/64] vl: Fix an assert failure in error path Date: Tue, 19 Oct 2021 09:09:03 -0500 Message-ID: <20211019140944.152419-24-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba5106af-dcfd-4ed0-c39b-08d9930b8856 X-MS-TrafficTypeDiagnostic: BN6PR1201MB0225: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:632; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OdnmCGS6/w1u7oC8wrzdVORAbGYNXmvsJxgOhk/cCyvkg8nN52YyIxOR9MDeV0Z39xmOtECnXRL9ZSVTVUK3QVZaSkCEfj/qij2EQp5VzF3p0Xe1mDa+NJhoELoMaLQ6xVc0lfG5Ya0NJK9n+oVZaXYg5GRDfT/2eL9IhmvUi5InjgrrSdj02bLz8O1UvI8c4pOzfW86w9qE5As8oTfb0zzr4/IIuZ5nrl5NsmTgbF3tWhI6PNAVrIWT988MnVnJTBXe63sw9f31Rc1j83HzOBL9i5RNuE5YJ8C4w2oLp7Nj4Hzew8XBjTS3FM8zSFUjMXtUt1xlud8D1GCZiMbfJEqgSc9OOS1Nl7gs6NU19Ds6NMTj0voL7VPTdkECo8SXHLKmtxqVxXRbR0BC6EFzeR6mxSK5M3OZWAokwEz9YtpzeL6g0mggpcDn4ES6yW15LJmm4W4LU6MTmmnrADfGPsiwXwpERnfBqu1QbmFEBHzJApN6P90k8TI6WrUKS3/hpBSaZfG0ChySxqwWuaoMX6ZgZgD/o4SG1ZEbl9ioA4hoj0qqjYVSHpZA4vumJ2yMHPekB6R9NIoV9CiX1EGGzPHcmRT1DN4Qu1Y08j49CbWEHLZ2Y8EtFbOBkay9Wf6xGZyyf6jD+RcGiQkOda5djJF0qOKuRK68dJzeFquXebG0TBJa3B7EqHDYRHphG/MWnxOoHkQIT1gJL8A54LnsUKN+zy5gQqOBnKo4cbilWGk= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(1076003)(26005)(356005)(5660300002)(82310400003)(81166007)(36756003)(44832011)(4326008)(86362001)(336012)(16526019)(83380400001)(426003)(316002)(2616005)(186003)(47076005)(70586007)(6666004)(70206006)(8676002)(508600001)(36860700001)(6916009)(2906002)(54906003)(8936002)(4001150100001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:19:59.0506 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba5106af-dcfd-4ed0-c39b-08d9930b8856 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0225 Received-SPF: softfail client-ip=40.107.96.44; envelope-from=Michael.Roth@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Zhenzhong Duan Based on the description of error_setg(), the local variable err in qemu_maybe_daemonize() should be initialized to NULL. Without fix, the uninitialized *errp triggers assert failure which doesn't show much valuable information. Before the fix: qemu-system-x86_64: ../util/error.c:59: error_setv: Assertion `*errp == NULL' failed. After fix: qemu-system-x86_64: cannot create PID file: Cannot open pid file: Permission denied Signed-off-by: Zhenzhong Duan Message-Id: <20210610084741.456260-1-zhenzhong.duan@intel.com> Cc: qemu-stable@nongnu.org Fixes: 0546c0609c ("vl: split various early command line options to a separate function", 2020-12-10) Signed-off-by: Paolo Bonzini (cherry picked from commit 38f71349c7c4969bc14da4da1c70b8cc4078d596) Signed-off-by: Michael Roth --- softmmu/vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 6be510b035..848b98851c 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2508,7 +2508,7 @@ static void qemu_process_help_options(void) static void qemu_maybe_daemonize(const char *pid_file) { - Error *err; + Error *err = NULL; os_daemonize(); rcu_disable_atfork(); From patchwork Tue Oct 19 14:09:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570255 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0993AC433EF for ; Tue, 19 Oct 2021 15:03:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5DD6160F46 for ; Tue, 19 Oct 2021 15:03:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5DD6160F46 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:48480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqe1-0006bS-Cl for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:03:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpye-0008Fx-PA; Tue, 19 Oct 2021 10:20:28 -0400 Received: from mail-dm6nam10on2083.outbound.protection.outlook.com ([40.107.93.83]:29965 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpyc-00083V-RT; Tue, 19 Oct 2021 10:20:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MY3YgZCTA4UZ2PyC3QznGV8QFUZYFl4+osyPCnw8AQqMILezWGV1LUS89Acdv6fhJYUBnrnguv8Ex7HpKa9IioNQUqn8yncWvoCTZFfWFDCETBMtsRxhiNtCHTnu194o3jfAFeQoOG8GrzTgQdZ+esk/m296F5FnKl1em4v7pNhDwxQCC2kxlI1fDZehrvK2vfLIV23GYV6tQduYEudmgpPSb8eusXq8fXrRcy4ZlSX43gcPx1dsDJ8VzLJKIuuaotmJuhg95EHdlHGoz8oLgfMFcD5udioc7KTl9iknHaBG/Wbf8zfeDjdlJWrdCGJcIBlyjfeghp0TgixC9KAOtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZneDv9v/wgTpdLKFiCQyDzLIEnp4jb7OieCyJfWdLYU=; b=ed8x8/d+JpChQDfmUc3dvew8F3pkj5l2Y6muX7O+OJs7DqAsKt8hz19skVEa/pzaXrxLu0sP/JafsD12deGwrYjid6vvcsWYIcOIsk9mKcOmbJrG79iBLI4akFIBL0Rz6R/afH0i5tuZ28MhfXaohkG9r1W0cSq1KQqohZwOqVyM0s7gHx/ppPN1LYOlzLDr9uInMlZ7SvzZzBEOSO+RyjsSlcyhYAdwy5uYsFTqqyF3Pb5h3f+Vn+eFyZRQeVggiIR/gHgk3sVFkh94EhB7NyAuBHwS8ngZx6Gwshy26jfMixO7ghHPNX87ktq1oriT/TBVRLE8fHz1u6I5+UgKpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZneDv9v/wgTpdLKFiCQyDzLIEnp4jb7OieCyJfWdLYU=; b=DkCPEFzSV+c7Al0Dwo3s/U1PIZ9+sCfz7lo/wcEWIEGJ85ghGuopIn19FTNzejNY2ZFbGvV1qljN7C5PKe+m0WopA5G0YJynW8Q+jfQ5lgtLqjZh2ZH3aGp+LwKBNV8HIWRANkyyh7bPGEhhqd8aCdojHNPGtAkoQWYbe966fL4= Received: from BN9PR03CA0936.namprd03.prod.outlook.com (2603:10b6:408:108::11) by MWHPR12MB1199.namprd12.prod.outlook.com (2603:10b6:300:10::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:20:20 +0000 Received: from BN8NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:408:108:cafe::9a) by BN9PR03CA0936.outlook.office365.com (2603:10b6:408:108::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:20:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT038.mail.protection.outlook.com (10.13.176.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:20:20 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:20:19 -0500 From: Michael Roth To: CC: , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 24/64] tcg/sparc: Fix temp_allocate_frame vs sparc stack bias Date: Tue, 19 Oct 2021 09:09:04 -0500 Message-ID: <20211019140944.152419-25-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a0c0e23-d304-4e5a-602e-08d9930b953e X-MS-TrafficTypeDiagnostic: MWHPR12MB1199: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:227; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t5tlf4I8wV0fJ1z+JH68boV+RWeqXWz/RiUt8WYbZoY+KHAT5dahATxDI+aMFmyW11JlUAN0K8zhsR37qDfYFUkBJAxn8H8uVl27wWPVcFl080oJxn7GCYaFe7w5kwiaUhqWZ4iml5hd+gbaupu/PctUr0zwO0ASvprEdFOZGgbOH9IVkETXSXiKwPPJSvJ8x08xmdNEXPV3K58emKsyOYhQk7f7RkywBw1+SK1OqKZFAfLqMoabXyjaCMj7vWIaPGK1MKh1WFJkmFvdqhrdygP5z3Jzd5+BvLr27YSHgmTNKEAmBmRGk4xwe7VRgcmJA1tVa+zN0Ip16TjS/Lhdn3+9apVizlkOfqW8qShEpierlfV92Iue0X9kwxiVyNIPs9/gRBM+ur+qPqPblnxXP5WqwbWXPKNJ7kzn7SnQOf6571jAUkasdQsHFml+t3OJfIZ3SLlnTmjKi405guIOuvT733jC6/jL57tQncioaYhFO5wOz8KW3+0mSWYNQcDzU41Yr/+bnbQPUaArUzg38MDTTr7J5am9A1yUXF6oWbEWW9bAl9nsAgx33z+s88jdg0IHBFrgOb0/8/XDjYK5xmO7kvKQxCYbbkpfiDOuX2PdipGzgFL3zHQdGr1EiV46Mfq/k9GvbrBZVVlHb/dvx6BSUCPIK5oHMp2AmUFNJgtGkOivpHGo5YwcSY9zq6vYlBP2QH5KIWQ9zPIIZWsSzgUa7i/nNIRAvkiN5IdBCIw= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(426003)(26005)(336012)(47076005)(36860700001)(16526019)(8676002)(36756003)(82310400003)(186003)(316002)(2616005)(5660300002)(4326008)(1076003)(8936002)(83380400001)(70206006)(6666004)(70586007)(2906002)(356005)(44832011)(508600001)(6916009)(86362001)(54906003)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:20:20.6993 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a0c0e23-d304-4e5a-602e-08d9930b953e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1199 Received-SPF: softfail client-ip=40.107.93.83; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We should not be aligning the offset in temp_allocate_frame, because the odd offset produces an aligned address in the end. Instead, pass the logical offset into tcg_set_frame and add the stack bias last. Cc: qemu-stable@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson (cherry picked from commit 9defd1bdfb0f2ddb3ca9863e39577f3a9929d58c) Signed-off-by: Michael Roth --- tcg/sparc/tcg-target.c.inc | 16 ++++++++++------ tcg/tcg.c | 9 +++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc index 3d50f985c6..c046d1cc60 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -987,14 +987,18 @@ static void tcg_target_qemu_prologue(TCGContext *s) { int tmp_buf_size, frame_size; - /* The TCG temp buffer is at the top of the frame, immediately - below the frame pointer. */ + /* + * The TCG temp buffer is at the top of the frame, immediately + * below the frame pointer. Use the logical (aligned) offset here; + * the stack bias is applied in temp_allocate_frame(). + */ tmp_buf_size = CPU_TEMP_BUF_NLONGS * (int)sizeof(long); - tcg_set_frame(s, TCG_REG_I6, TCG_TARGET_STACK_BIAS - tmp_buf_size, - tmp_buf_size); + tcg_set_frame(s, TCG_REG_I6, -tmp_buf_size, tmp_buf_size); - /* TCG_TARGET_CALL_STACK_OFFSET includes the stack bias, but is - otherwise the minimal frame usable by callees. */ + /* + * TCG_TARGET_CALL_STACK_OFFSET includes the stack bias, but is + * otherwise the minimal frame usable by callees. + */ frame_size = TCG_TARGET_CALL_STACK_OFFSET - TCG_TARGET_STACK_BIAS; frame_size += TCG_STATIC_CALL_ARGS_SIZE + tmp_buf_size; frame_size += TCG_TARGET_STACK_ALIGN - 1; diff --git a/tcg/tcg.c b/tcg/tcg.c index 1fbe0b686d..a9cf55531e 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3489,17 +3489,14 @@ static void check_regs(TCGContext *s) static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { -#if !(defined(__sparc__) && TCG_TARGET_REG_BITS == 64) - /* Sparc64 stack is accessed with offset of 2047 */ - s->current_frame_offset = (s->current_frame_offset + - (tcg_target_long)sizeof(tcg_target_long) - 1) & - ~(sizeof(tcg_target_long) - 1); -#endif if (s->current_frame_offset + (tcg_target_long)sizeof(tcg_target_long) > s->frame_end) { tcg_abort(); } ts->mem_offset = s->current_frame_offset; +#if defined(__sparc__) + ts->mem_offset += TCG_TARGET_STACK_BIAS; +#endif ts->mem_base = s->frame_temp; ts->mem_allocated = 1; s->current_frame_offset += sizeof(tcg_target_long); From patchwork Tue Oct 19 14:09:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18396C433FE for ; Tue, 19 Oct 2021 15:06:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B643E61175 for ; Tue, 19 Oct 2021 15:06:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B643E61175 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:56938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqhG-0003pB-RY for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:06:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpyw-00007C-Rx; Tue, 19 Oct 2021 10:20:46 -0400 Received: from mail-bn8nam12on2061.outbound.protection.outlook.com ([40.107.237.61]:29519 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpyu-0008Le-QH; Tue, 19 Oct 2021 10:20:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hJIuSrjm/hPOzEWs71XGktwCBQ3J1DMtZcnkj/ENUDx43gTX62dp7Bz0PKn0IJDEjsmgyJVvRiAIGm7yw1sWJIl5ayfxV67zohdVI/XSw1o4vicrlCkkFGx/6/g6BWdn4L3yvRUDebu1Sz2f4FgEsxFghmpGiY5DqrmPUiUhieCATV+jT3+/doBTM7o/Unuqx4Wr/yWdo00r/Xht6N1qOefuTjzHjmcW/a1gMtoZNWx+nbq+l6x2+ACY85Kh2e+TbAkP0tzBOoE5m9GBV6GrgIe8WYhhPZBkDUvK/zUpTtMxEU30Qnx8C6moxkD0alNG83BHZtEnO55CDnxJaRmvAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=04Eb/0pxQsQAj0lMej8dK82MEmvta54bVAU9g7aKanw=; b=iJh0aCqKkaw7pIgjAHCPeEEEY8ppEeLf8IxKWZgQBBPwF4FQHVtVZk43SqCBWJfCKp21MvMM95DrS4QdTIASLAPdDDocf3MwHoEbBJ0VBeiMImEvr30MEDQZbVmAoZIQcnk3fNAUQjY6FE3aPVBtY8AivahaNO+lE9mhhf0qcZpaiT55vVtbyKasjm8frVnc0ZC/2n7+yqwuqf613pvzA29DDcBESqBpSLTftqzIko3O7lSAm14K5q7i9gjbXg+zhyg4Z4mXrq30K0/bHoRJS7EBb3Gd90kpRlzL+7Md34DohRmprFLFmNVPsVFk5+91pRWLg60RI/2Mb/E2BrpvGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=04Eb/0pxQsQAj0lMej8dK82MEmvta54bVAU9g7aKanw=; b=zamlsLOE8hjgviPUg/FPCBUkk3jGGMb55ULF8sU/mJwZU3ZabI/d7dp0YI/JW0l7UqTBIfTMw2zVl6lRukMvzBXwWExzJv5eBrvsOoNIcQYd8o3B3P/XF8qlHjDcsNL9QVaq1vPFVPsldddjtDBB6ghWuEpZNHBKMhaYRDvIXMk= Received: from BN0PR04CA0085.namprd04.prod.outlook.com (2603:10b6:408:ea::30) by DM6PR12MB4926.namprd12.prod.outlook.com (2603:10b6:5:1bb::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:20:41 +0000 Received: from BN8NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ea:cafe::c6) by BN0PR04CA0085.outlook.office365.com (2603:10b6:408:ea::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:20:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT045.mail.protection.outlook.com (10.13.177.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:20:41 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:20:41 -0500 From: Michael Roth To: CC: , Richard Henderson , Stefan Weil , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 25/64] tcg: Allocate sufficient storage in temp_allocate_frame Date: Tue, 19 Oct 2021 09:09:05 -0500 Message-ID: <20211019140944.152419-26-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 869de57a-4a65-4bcd-28d8-08d9930ba1aa X-MS-TrafficTypeDiagnostic: DM6PR12MB4926: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:46; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1ElWBNNGRkKF6JHGT3TKqe1VgMdz3ABWF45S6PEL9c+cJvNSxAQRoBDZxg1/UHuZpA91wn13xiJta+Flxo11moJaLJvhUWuSTH85iMlIYa+v/YYgI3m256daP2lrGNQVuK+xuoyTIG8B0J0zFrMaB8TQH6vZT8NjgOjFkstovkGMNk91dTLikhK+Ykmu0wLA4bKxorZYb+FpPPsAoK6hBivTw7EN7u11Da1AElg+q0NOomov8lVZWfsL5S6dzmh2mFpOY/nO2hLA041/PiQ33u/emX6XtedhzWf5rMHxZk/IhfZ39ZmTj9aWFxERfjDWd/7JOp28uQIz0GaMIQcd20kQFZ7Ce1vx4Ppl0YPannijtaSCIKB5AFMGK/6yfLJpAuTkYTYHTNdJ9XktcaexdIT2vSlvhp6Q/fyYzj6B81XfzdBwR5RUD+T5LxSF9k95TWcbiHIre9Rr1SQNOXKuYcYbB7PvwMEWQH23C8Oqx/w5/M4TtQ7i9czjeIMghvDbbJXCCd5rVBZKjtvHM4aFIaA3f/vG99f5NrpaD8ylorQXpDgUxvb2qGHu8bP0olfMZbKKPhg+jFYrQcAagM+O8aWNNFfKbNYuyGRcrNcJOOTsEcybhQSK4E9Az9HrY2fxjXyV6bhnqCRTv8znvHxCgOFm5KnXB7bKpRGdGaSiBvUzWePI8sCuHGhmERxNVPOzI3Wn2wvLQFPuspNBoexr/WIcYAS+HANow9mpHlTJffPlnSE/9hoUVKn8in16hzRBdRvZX/RfL943Rh2m3Qtm1pSMbIhAOWIYmji7aaALITVq65M1Wb0VGm/9GFO/HrtB X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(16526019)(186003)(6666004)(2616005)(1076003)(8676002)(426003)(316002)(4326008)(47076005)(82310400003)(36756003)(83380400001)(8936002)(70206006)(44832011)(86362001)(6916009)(356005)(36860700001)(2906002)(70586007)(54906003)(26005)(5660300002)(508600001)(336012)(966005)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:20:41.5412 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 869de57a-4a65-4bcd-28d8-08d9930ba1aa X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4926 Received-SPF: softfail client-ip=40.107.237.61; envelope-from=Michael.Roth@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This function should have been updated for vector types when they were introduced. Fixes: d2fd745fe8b Resolves: https://gitlab.com/qemu-project/qemu/-/issues/367 Cc: qemu-stable@nongnu.org Tested-by: Stefan Weil Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson (cherry picked from commit c1c091948ae4a73c1a80b5005f6204d0e665ce52) Signed-off-by: Michael Roth --- tcg/tcg.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index a9cf55531e..21d65969be 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3489,17 +3489,38 @@ static void check_regs(TCGContext *s) static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { - if (s->current_frame_offset + (tcg_target_long)sizeof(tcg_target_long) > - s->frame_end) { - tcg_abort(); + intptr_t off, size, align; + + switch (ts->type) { + case TCG_TYPE_I32: + size = align = 4; + break; + case TCG_TYPE_I64: + case TCG_TYPE_V64: + size = align = 8; + break; + case TCG_TYPE_V128: + size = align = 16; + break; + case TCG_TYPE_V256: + /* Note that we do not require aligned storage for V256. */ + size = 32, align = 16; + break; + default: + g_assert_not_reached(); } - ts->mem_offset = s->current_frame_offset; + + assert(align <= TCG_TARGET_STACK_ALIGN); + off = ROUND_UP(s->current_frame_offset, align); + assert(off + size <= s->frame_end); + s->current_frame_offset = off + size; + + ts->mem_offset = off; #if defined(__sparc__) ts->mem_offset += TCG_TARGET_STACK_BIAS; #endif ts->mem_base = s->frame_temp; ts->mem_allocated = 1; - s->current_frame_offset += sizeof(tcg_target_long); } static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, TCGRegSet, TCGRegSet); From patchwork Tue Oct 19 14:09:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570079 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B708C433EF for ; Tue, 19 Oct 2021 14:33:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1CE86115A for ; Tue, 19 Oct 2021 14:33:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E1CE86115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqBN-0000nf-U4 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:33:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpzJ-0000W6-Uh; Tue, 19 Oct 2021 10:21:09 -0400 Received: from mail-dm6nam12on2074.outbound.protection.outlook.com ([40.107.243.74]:30304 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpzH-00007t-VX; Tue, 19 Oct 2021 10:21:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1rRRA7HhRWQbQ0C4B0HGdY9SI3uR8Ak/5ztSm71AKLOX7++vwj3Gs4GXHExKaxREk+g3bgFH+jXZxLaBfr8j5WmSojcjQ1iu1aTexivdMBDKiUsKmRwc7/eLYZkvhI52oYrxd+kp37T7E/J4IQuVaA08UW+t39uEEauLAAZVCEsIS9mFbjxeenXUAZ8agnEjOEpC1VT/GySIxogMVGehkCiXlNezZ3X1yARdx1IIdZb2Vr8zsxj2Y4Ny/0fGYxU5QnADgXqiHMRpbHrpEBfE12inAcRWO3A83678bcVNhRQotPIO9WtopqqUqQVMkMCI7EWTjRBb+IVD7g3hBD6UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cPHuPyhOL+1rptkqXujKFWLoNcReUCPL/TH+vw3w1lU=; b=K9hCCHlUgOUIxjQrgdvHb62Vaw1yQgAkECq4xNV/wIzmgfU+c0ZUketeTZ5vHrKD6TnRxXqzfDzA6FOdpX8fpGfZ2qnIOgaIp76xrlA6bvzQaaKvV5tAOlx7Tj/NamxYdUivRD/JgnNNsJeKa596G8RJITNKPhINdpvF80iEWE/DqT2evnUhvWkrxriFdKuB29xjLtW1wBwFq3oa4whsGtNbw977m9ZiyfPYq4I49lb+83PxVpr43gMTohMBZMKZIE24nGjhYGB1uqLMVgILToVi9aKfq/OyUeyo+0qGwB4VV5gnURKj9OBUnuBRfAIIs/vnqsi0EdWmwcwm9srdaw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cPHuPyhOL+1rptkqXujKFWLoNcReUCPL/TH+vw3w1lU=; b=1WAs9TdyF5g5MOQ5sRfE+TZ1TBj7qHX3qIBg4fq+kA1ccZ87932jkeoPLWpzUZnpQj+scaQAb8ZMNAA3PvzxKvdX+KDxAkOc8CM+lh99EO9C7dLJwMXmMn9mTIe0joUjV9TevVlDzJUboRHgoijoJ5Er9zs41UU2vZfJbLR72QU= Received: from DM5PR19CA0030.namprd19.prod.outlook.com (2603:10b6:3:9a::16) by DM6PR12MB4339.namprd12.prod.outlook.com (2603:10b6:5:2af::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:21:03 +0000 Received: from DM6NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:3:9a:cafe::6c) by DM5PR19CA0030.outlook.office365.com (2603:10b6:3:9a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:21:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT024.mail.protection.outlook.com (10.13.172.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:21:03 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:21:02 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alexander Bulekov , Richard Henderson , "Michael S . Tsirkin" Subject: [PATCH 26/64] hw/pci-host/q35: Ignore write of reserved PCIEXBAR LENGTH field Date: Tue, 19 Oct 2021 09:09:06 -0500 Message-ID: <20211019140944.152419-27-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 127d0520-4e94-4318-8f50-08d9930baeca X-MS-TrafficTypeDiagnostic: DM6PR12MB4339: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:197; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5MiBg5i7OPgyZhw5CGthQ/JkCT6z9l9HERzpPoo6gxDoP1uI51yLdT/jbR/RjV4n3/tIAl95f4sRlKxH260ZrAy9EDTYpkKr3pkWY4O1OSNGFY9sFDi88Bgdtq97SfsOBKvwTlBP6aKSRWIo9C6zWc4kXHFzNNa77oAazL2XES2Rq8HTS3nJXQkFAuKuN7LA8Uw7t1MkhPctYF87wWG+fevfIYvA5IChSfSNh39IYvQn7lmUt6j5zBWQ7jbzMTO15fGHUxmGUXVdKprrPyaM3MHEaTV+jBwQihnzVbs4TivsUMDi7mlOwzij1FbSfxxS+dOBiB1A2AaKaW3Rm/P3aMLT3MaKNofiY+MRDM7qWDDnPdN3HVFk9GEflQ/vdAZsQmmduhdrFHwGymiev8Xlasl0M20RdZ1n1kp5iQwLTkZFNWeNmvcBr9PCnI+gn2Afkeob8kjNGmsE5hYbYsp34SnPMXattrNWfXa2fGxT3DggoaBRvwV0Cn3DLOPAPhFjY6NxWlOUCXU7Z1vdZpFJs6iL4AGFpOVgfxZBjBD9PB1PAGASOawMCMssjapzD4UE0CgfgSG9PfBefw59n6i5XSgDIQiSNbXzrI2G4Ls4droLtJ8qRe6qTR0wArzNy0xuUC4IFQE1aqnE5WBkRCE0eUnGfC8qDvUQqNmulV9EK3CBkhD2PHWsSWHzyoTBlUyadkzssqOTDSffKpWMwlZCVlJ527QDFOvsQ8Ph990afqxdTtIGioCDvIllzi7xKnijTVMgxoec3DhANldKj6FYr/G2+6L7u9lbItVKZW0fd9EV3U2UYX4ykEFfDDF9beeS X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(336012)(508600001)(356005)(1076003)(47076005)(16526019)(6916009)(966005)(2616005)(81166007)(36756003)(4326008)(86362001)(82310400003)(316002)(83380400001)(36860700001)(54906003)(70586007)(5660300002)(186003)(8936002)(426003)(70206006)(26005)(8676002)(44832011)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:21:03.5310 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 127d0520-4e94-4318-8f50-08d9930baeca X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4339 Received-SPF: softfail client-ip=40.107.243.74; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé libFuzzer triggered the following assertion: cat << EOF | qemu-system-i386 -M pc-q35-5.0 \ -nographic -monitor none -serial none \ -qtest stdio -d guest_errors -trace pci\* outl 0xcf8 0xf2000060 outl 0xcfc 0x8400056e EOF pci_cfg_write mch 00:0 @0x60 <- 0x8400056e Aborted (core dumped) This is because guest wrote MCH_HOST_BRIDGE_PCIEXBAR_LENGTH_RVD (reserved value) to the PCIE XBAR register. There is no indication on the datasheet about what occurs when this value is written. Simply ignore it on QEMU (and report an guest error): pci_cfg_write mch 00:0 @0x60 <- 0x8400056e Q35: Reserved PCIEXBAR LENGTH pci_cfg_read mch 00:0 @0x0 -> 0x8086 pci_cfg_read mch 00:0 @0x0 -> 0x29c08086 ... Cc: qemu-stable@nongnu.org Reported-by: Alexander Bulekov BugLink: https://bugs.launchpad.net/qemu/+bug/1878641 Fixes: df2d8b3ed4 ("q35: Introduce q35 pc based chipset emulator") Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210526142438.281477-1-f4bug@amsat.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Alexander Bulekov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 9b0ca75e0196a72523232063db1e07ae36a5077a) Signed-off-by: Michael Roth --- hw/pci-host/q35.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 2eb729dff5..0f37cf056a 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -29,6 +29,7 @@ */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "hw/i386/pc.h" #include "hw/pci-host/q35.h" #include "hw/qdev-properties.h" @@ -318,6 +319,8 @@ static void mch_update_pciexbar(MCHPCIState *mch) addr_mask |= MCH_HOST_BRIDGE_PCIEXBAR_64ADMSK; break; case MCH_HOST_BRIDGE_PCIEXBAR_LENGTH_RVD: + qemu_log_mask(LOG_GUEST_ERROR, "Q35: Reserved PCIEXBAR LENGTH\n"); + return; default: abort(); } From patchwork Tue Oct 19 14:09:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72450C433F5 for ; Tue, 19 Oct 2021 14:49:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 130366113B for ; Tue, 19 Oct 2021 14:49:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 130366113B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqQV-0008Kw-2N for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:49:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpzh-0000vN-9I; Tue, 19 Oct 2021 10:21:33 -0400 Received: from mail-bn7nam10on2087.outbound.protection.outlook.com ([40.107.92.87]:59866 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpzd-0000Nm-LP; Tue, 19 Oct 2021 10:21:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HwOIJsiiaa9h8TyLebUFFUu9gh0TGZ6LpG3MQthPfgOk+Da0s3O7Rc48PFUl9/tGvdU2eWe0H3w1hOEtD8RFORpvDxkjTX0sBK0K9MCQcLmJBiMqEgSEmWllRv8FlsD73g4mc6epyIZXvdUr6Hw9Yl3b7zip629XZ7IUMwmWUHWNaCpHn8c1FKq6hXorkYR18fwUexi9YFuirio4HWzOXaWBbixsDaF9owoJCyk8iJZHXYKI8Ec39IxMbt+USX/RF5nrmrpJFyVQ3nE+QD/O032yyBJxBhtl8draX+Fgn/7Yn7ToBMXRJX2do8DLkmnt+T+A5ELDBFCN0YJyVjm9Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oq47jCFkM7nmodGDlsgIICzRgNdpTJfQuG4AUjEk+CI=; b=ZvkRVh++ZdCIYvOJLCx36asqmoVWzUJ6Ic+Uq2Eu5gS3mokk+34J8suYXMD9I3f6aal12bC2fE9HWezuxJyU6vyCvBwphamb7FcW7PzK//IP0u8p0+77ObyWZPFhjxbk8eEsAsn5ihfKKd04fS/kwEmWfLTLntu1PViS9XrFSV7rDITIsRybhSN+tGfdYfI6AT1ILKTmeECGPNdXDNRkpigJOJJ3oTNWmU79pYoyTfYR4CltSAC4ie3DNqQNGnCZsC/vI4Pl+SxcwxWdJeRMqxKhubiZpAHf3iY/3oTQVekRYjNEUHzoachO/RdHGvr/qg5325J2242DR3aSL8ltdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oq47jCFkM7nmodGDlsgIICzRgNdpTJfQuG4AUjEk+CI=; b=cjAaoo8XiaSHzuI0vu5cqgRWeHBeFn2j1lXVc8+kE1MDcetWdnzaGYWL03rD9G5WglpdA2RLvY0aPs2MUVnyw1sSawrnU6CZnX7lDfsWUpWsOHETm1nZRpjX/dv9k26PS3T+WP+nw9wcP7a5Lz45kSDCC0Mk9mNzAyUJs+kIPTc= Received: from DM5PR12CA0022.namprd12.prod.outlook.com (2603:10b6:4:1::32) by MN2PR12MB3087.namprd12.prod.outlook.com (2603:10b6:208:d2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:21:25 +0000 Received: from DM6NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:4:1:cafe::78) by DM5PR12CA0022.outlook.office365.com (2603:10b6:4:1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:21:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT038.mail.protection.outlook.com (10.13.173.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:21:25 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:21:24 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Fam Zheng , Maxim Levitsky , Alex Williamson , =?utf-8?b?TWljaGFsIFByw612?= =?utf-8?b?b3puw61r?= , Stefan Hajnoczi Subject: [PATCH 27/64] block/nvme: Fix VFIO_MAP_DMA failed: No space left on device Date: Tue, 19 Oct 2021 09:09:07 -0500 Message-ID: <20211019140944.152419-28-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93ea81d2-d3ea-453d-0c84-08d9930bbbbb X-MS-TrafficTypeDiagnostic: MN2PR12MB3087: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:151; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ovJB/Bf97UFv3Be3ag6zwnqk5f++QWwUzs2yoaH+KqDJUDpg57/wj2mY1iRNymfTmkmxb2QLaBL34vptiPd49fntzMPzIF9g6okn3Z0qDFRh4gg3bafMYa1elnk7YhxNfDo4UeXTV2ZCLik1ce+YJ1489PxQvQ94eQPmbOdfgmp5ajsWKoRQW5NwRHcjM4TuClR7LY2YKEe6eu5nuZl6ygqDUq6sdxdCEmf10dCATgj/0iF6nPaGwvULMH4QQ2mmpD7dLVaF6x+pyFRF/y3vgbhviIjqgTUTVZEBrYxvMYqDrhBuPVFppknqzAQYwiBNDMN2jOdhKylFC1q/C87gh6GAyb/DAUw5dLgDNDGXAQvETmj1T8e3CFBGCgamBbkJWz7fLNXN9XXFb/Ndr2Y1OKG0/RLRMMaYVVsggmZSdWihzmzaShxv+MpYewSKbX/hDChkpuJcfTDd+Ow3UjQEfc6cMjwrI8f4AYWeyLlNYWKcrX89OYOWbs4rzsEQgzOiFYFtvHFw/ik3QZCZ0bSTrioUVIViA+pr+XjMFMupdPfozARHw7MnIxZ/DSm3oef/6ysr+bQZlguZa1e7hToq0FckMnlZB0h5Ft4xJRUiWakXBzzTUM5ZWC4oXVt5UznH7SFDqtwK87O+eVetmIgCqtzXSBxQ7/U5fRscYBj6jRqLi9fjFWXDid6Os8NVcMZrmlfTiNxvweFt5TC1wg8EhRTz5+tIzHcC54UjojFulF2+5p/u0dm427kyaHX5Osf/KzKr3mMFB+jD+DUvR2mES2mlQdRohHuEkqvj/8YBy6HbZra3MCs2iEMNkNSZ61S/ND0rXBP5p9jzQ6zLh3QJ3zBhWyxzdOUhS6OZTeRdCW0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(81166007)(66574015)(2616005)(6666004)(356005)(47076005)(6916009)(4326008)(83380400001)(426003)(5660300002)(966005)(8676002)(508600001)(36756003)(86362001)(16526019)(336012)(26005)(186003)(44832011)(36860700001)(54906003)(1076003)(2906002)(70206006)(82310400003)(8936002)(316002)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:21:25.2347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93ea81d2-d3ea-453d-0c84-08d9930bbbbb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3087 Received-SPF: softfail client-ip=40.107.92.87; envelope-from=Michael.Roth@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé When the NVMe block driver was introduced (see commit bdd6a90a9e5, January 2018), Linux VFIO_IOMMU_MAP_DMA ioctl was only returning -ENOMEM in case of error. The driver was correctly handling the error path to recycle its volatile IOVA mappings. To fix CVE-2019-3882, Linux commit 492855939bdb ("vfio/type1: Limit DMA mappings per container", April 2019) added the -ENOSPC error to signal the user exhausted the DMA mappings available for a container. The block driver started to mis-behave: qemu-system-x86_64: VFIO_MAP_DMA failed: No space left on device (qemu) (qemu) info status VM status: paused (io-error) (qemu) c VFIO_MAP_DMA failed: No space left on device (qemu) c VFIO_MAP_DMA failed: No space left on device (The VM is not resumable from here, hence stuck.) Fix by handling the new -ENOSPC error (when DMA mappings are exhausted) without any distinction to the current -ENOMEM error, so we don't change the behavior on old kernels where the CVE-2019-3882 fix is not present. An easy way to reproduce this bug is to restrict the DMA mapping limit (65535 by default) when loading the VFIO IOMMU module: # modprobe vfio_iommu_type1 dma_entry_limit=666 Cc: qemu-stable@nongnu.org Cc: Fam Zheng Cc: Maxim Levitsky Cc: Alex Williamson Reported-by: Michal Prívozník Signed-off-by: Philippe Mathieu-Daudé Message-id: 20210723195843.1032825-1-philmd@redhat.com Fixes: bdd6a90a9e5 ("block: Add VFIO based NVMe driver") Buglink: https://bugs.launchpad.net/qemu/+bug/1863333 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/65 Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Stefan Hajnoczi (cherry picked from commit 15a730e7a3aaac180df72cd5730e0617bcf44a5a) Signed-off-by: Michael Roth --- block/nvme.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/block/nvme.c b/block/nvme.c index 2b5421e7aa..e8dbbc2317 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -1030,7 +1030,29 @@ try_map: r = qemu_vfio_dma_map(s->vfio, qiov->iov[i].iov_base, len, true, &iova); + if (r == -ENOSPC) { + /* + * In addition to the -ENOMEM error, the VFIO_IOMMU_MAP_DMA + * ioctl returns -ENOSPC to signal the user exhausted the DMA + * mappings available for a container since Linux kernel commit + * 492855939bdb ("vfio/type1: Limit DMA mappings per container", + * April 2019, see CVE-2019-3882). + * + * This block driver already handles this error path by checking + * for the -ENOMEM error, so we directly replace -ENOSPC by + * -ENOMEM. Beside, -ENOSPC has a specific meaning for blockdev + * coroutines: it triggers BLOCKDEV_ON_ERROR_ENOSPC and + * BLOCK_ERROR_ACTION_STOP which stops the VM, asking the operator + * to add more storage to the blockdev. Not something we can do + * easily with an IOMMU :) + */ + r = -ENOMEM; + } if (r == -ENOMEM && retry) { + /* + * We exhausted the DMA mappings available for our container: + * recycle the volatile IOVA mappings. + */ retry = false; trace_nvme_dma_flush_queue_wait(s); if (s->dma_map_count) { From patchwork Tue Oct 19 14:09:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A077AC433F5 for ; Tue, 19 Oct 2021 14:52:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 476E66137D for ; Tue, 19 Oct 2021 14:52:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 476E66137D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqTt-0005y5-Bk for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:52:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpzz-0001Rx-TH; Tue, 19 Oct 2021 10:21:51 -0400 Received: from mail-bn8nam12on2074.outbound.protection.outlook.com ([40.107.237.74]:11744 helo=NAM12-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcpzy-0000aG-1Q; Tue, 19 Oct 2021 10:21:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jAhDcsdj4oaLyiqzQdHSu9INRi8tDdO7lAMLvHNGImrEMXNzBp/147ovyE/voBNMFmJDfPES3YfHvaz6I/wG34pTxJCqVPe+/YcIFDKBlHYehMha1yOlM5Sj/MKpOGv3AJWtXcPRMSQA1u//FhA54+rTQt4zdCfSHGI5sO2XD2tLy1K8/NWlpKe4ohCbe6ygnQf+ayDtTDiIWaTEHMrJIFgu7Cp8FmIsqCYhNnhR5BuicS04+S7ci9PXfHotoUXLrTrStUWN3tfVYkiQl1e1OOknumZuFdU/10NHnzWRmoRnvdA1uqiYi3Hh4OnXIphMMPAfYurQVy6M5+Eb2cF5KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pj2prL90NpPq53YJ15s5rCp3sc3uLgr3Dr2QWfOkf3U=; b=N+b0D+XWcaO09IuK9z75w/d966QGcWkJEQd5FFzlBb30ngndFPCCpkyGv8sIcNGS6UBBWGBMf8e2uaSmB9MFOWKAbbFSInWXIubK+uEyd4eCvNhCo1UevkzKukAlpoFXsIfzWnFSVSFfjqfNNfvrf+Ep8owowScip+ZupzyEJZJxBHyyVLaAtUU9qygfxtzY6AoekpORrpd+c0WO7Ptmkx3DT3qYHhz5NqRRzVUd2sV+am9B2IPZkVYlRaaYaiLXLUhfla3txr6Eo+krXOurY0dPG+eWBsmot7Sk0+B6tZSo6hvcjiM+q0Fj1mBekhq5QR0Pg2Wj0a0/cg38pKz80g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pj2prL90NpPq53YJ15s5rCp3sc3uLgr3Dr2QWfOkf3U=; b=MPSBWw35zBQVrHqeMRf34TbvFCb19cBYx5cfl4ePYLOaI2r0tn29yn3q71BPJZ3K5cwlIpvMlx9oMGDbEwjjv05IJ5poOMtKQMT2pnMxLV20g6KAkkBDGlpITwW3dcIMtavTYQqR4CQScBgQLpX1ZhTeLrwRuxUybWOoCMDh0aU= Received: from DM6PR03CA0084.namprd03.prod.outlook.com (2603:10b6:5:333::17) by DM6PR12MB2937.namprd12.prod.outlook.com (2603:10b6:5:181::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:21:46 +0000 Received: from DM6NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::7f) by DM6PR03CA0084.outlook.office365.com (2603:10b6:5:333::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:21:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT011.mail.protection.outlook.com (10.13.172.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:21:46 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:21:46 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Daniel_P_=2E_Be?= =?utf-8?q?rrang=C3=A9?= Subject: [PATCH 28/64] crypto/tlscreds: Introduce qcrypto_tls_creds_check_endpoint() helper Date: Tue, 19 Oct 2021 09:09:08 -0500 Message-ID: <20211019140944.152419-29-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30eee8a4-b1c1-4add-5e26-08d9930bc890 X-MS-TrafficTypeDiagnostic: DM6PR12MB2937: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OKuVXkTGyYTmw7lQQnD8ebSiBjjhrfLQ+NqdZwb+Kkms6bcLK3/Afpklo/kwdxIUmDJBi7xi3AsxBHIeaMgteUS06BvEZ3uDx8v2lIsCgAQfxaHWm8swJIMDZXL6iPh2r7NldVQFOlj/WaYI+V0lm2tAwf63fakBXBXLWyyFIuASvHUuelQURTXwSd3rwul1HR69y06adSNQq2AGwZSD1AzI2rt6J8fwkx/bhtZN8IhxN+UR6iKtyI4sb01F1avLxUBoGWgWeHFA5Waml/L1b7FbynM1+2Ez2kFJdhGSZ7WvXLa2Shq0EwoMptI62FzojCEO2ZngoUkLx3pXcojhHcVzXL3bSJ/59rLLPbns/lUiEYiyaCfOPwDEgWLjRHcfwhGAlG1K+p3oOMIXjDIeO96Kj6vWZrusYhrsIoxBdzpOsOns+kGOoatRu/Nf3RxJxKk7TOIvvwnZYuwYexlGfJqRigGQcs4Lnt1kLgPoJ1ZvQKAJI5C8QYh0mWd3LCEMFU+Yc2Sca7TSWwCEmZ5t5c9NdQEPwHqRl/hZvIVRS/CgzaT8A8YoQlZdvLd9B+bNAJWkWER4LCmv+RoyPo8qIyle4jj1EH+7C4Y653G8drSW9uOiKMLhhFuqJ5e16NShiEKKkxhgVALdomEhxsuUtaybc+hFy0+crsunRXv0OBCUnLVDLXaqG6spvZprJ3xMoZZwxhD3a/61Dq0X7i32jWU2qt/7pk076EbAAJTp1qc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(2906002)(8936002)(6916009)(70586007)(1076003)(81166007)(47076005)(54906003)(356005)(336012)(2616005)(316002)(83380400001)(36756003)(4326008)(36860700001)(86362001)(82310400003)(44832011)(8676002)(5660300002)(70206006)(186003)(6666004)(426003)(16526019)(26005)(508600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:21:46.7730 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30eee8a4-b1c1-4add-5e26-08d9930bc890 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2937 Received-SPF: softfail client-ip=40.107.237.74; envelope-from=Michael.Roth@amd.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Introduce the qcrypto_tls_creds_check_endpoint() helper to access QCryptoTLSCreds internal 'endpoint' field. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé (cherry picked from commit e9ac68083f26759b85ef0d871ca2bbe897218f64) Signed-off-by: Michael Roth --- crypto/tlscreds.c | 12 ++++++++++++ include/crypto/tlscreds.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c index b68735f06f..084ce0d51a 100644 --- a/crypto/tlscreds.c +++ b/crypto/tlscreds.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi-types-crypto.h" #include "qemu/module.h" #include "tlscredspriv.h" #include "trace.h" @@ -259,6 +260,17 @@ qcrypto_tls_creds_finalize(Object *obj) g_free(creds->priority); } +bool qcrypto_tls_creds_check_endpoint(QCryptoTLSCreds *creds, + QCryptoTLSCredsEndpoint endpoint, + Error **errp) +{ + if (creds->endpoint != endpoint) { + error_setg(errp, "Expected TLS credentials for a %s endpoint", + QCryptoTLSCredsEndpoint_str(endpoint)); + return false; + } + return true; +} static const TypeInfo qcrypto_tls_creds_info = { .parent = TYPE_OBJECT, diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h index d0808e391e..a14e44fac1 100644 --- a/include/crypto/tlscreds.h +++ b/include/crypto/tlscreds.h @@ -65,5 +65,19 @@ struct QCryptoTLSCredsClass { CryptoTLSCredsReload reload; }; +/** + * qcrypto_tls_creds_check_endpoint: + * @creds: pointer to a TLS credentials object + * @endpoint: type of network endpoint that will be using the credentials + * @errp: pointer to a NULL-initialized error object + * + * Check whether the credentials is setup according to + * the type of @endpoint argument. + * + * Returns true if the credentials is setup for the endpoint, false otherwise + */ +bool qcrypto_tls_creds_check_endpoint(QCryptoTLSCreds *creds, + QCryptoTLSCredsEndpoint endpoint, + Error **errp); #endif /* QCRYPTO_TLSCREDS_H */ From patchwork Tue Oct 19 14:09:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47051C433F5 for ; Tue, 19 Oct 2021 14:37:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C183160EBD for ; Tue, 19 Oct 2021 14:37:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C183160EBD Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:42258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqEr-00069u-OR for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:37:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq0X-0002l2-J8; Tue, 19 Oct 2021 10:22:25 -0400 Received: from mail-dm3nam07on2072.outbound.protection.outlook.com ([40.107.95.72]:41217 helo=NAM02-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq0L-0000qc-Ni; Tue, 19 Oct 2021 10:22:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y85qad6BQHA7g6UKL5Ta2LDO76+zbhl0ymWhVMH1OPu/TCTobh4FqUwEaw4rjQeJU3ooL7Qfx+k4qozOzV2dhbPKUd+9qoKS28vdfGp7Ji/W0lVATGSwEiug1NE/m/Bd8TQXnCgb+ggCzHNqk3sfyaJoj483EN8VifwTEq3NqZGmeMsC3Kcc58NeEfpPbjALkwLSq6jYYma0wkRQBZT9jF+E1i/OntCOkKqOoVcfwiAYS2ygamJmE86SBQ5Gx5/Fvpj+31m6LYKizAJ7k+n50fmg5qMoQpKeiZys5vo9W1NCYUSkqBEGpNKGgBs1dheQPRe393wtIDpmsvSBsDwvqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OPFkekI1d33+mx59VbBy1biwfoHeqncFhlOBER66vKY=; b=UoiYtBBrdhnNkARyYjtPRueDsoa+tYNZolgKpF+IznP4BEu2nZhAxKdge7IXwmbcTva4qUX4DA3kVxXCrywA135OZxETNri68V3qeeJIbRh5aL+gaHZozCJn/okn9MFoWtVbtZYb/WvChilrO8ggUxPcYU3p2BpM89eq5jEAxo9UslUtZeJAzyuMG0E5G4yr3oLMsulNUVElWtI5/MAd7k3vDwbxmkdwnLdErL7jBkv9W7w5Mvy5cMmwe/34HnVjLuy3qEdhpZeJrWgimPNw4/7f0SXdRCZRAfhZqJwI0bva5wzzgY/Zr/AfyzdM4hzDzwrRdtwm4nPS2kWhrVDPWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OPFkekI1d33+mx59VbBy1biwfoHeqncFhlOBER66vKY=; b=uqPlG51Y7CykSs6ND0MiPK/+tpCNk0klrh/S1vRBET8pRvfrGtYYSjUnHlNKuJ77DdrxMUwKDP2PVFH+mmC+D1hTxAHkIaUZLXnO7g8OSrvpIoaISn6/fvGRD2KNFV/8Jl9WjRL0htyfTr0QVQ6jQWlJMgdeRHvlon5hxtSbpQk= Received: from DM3PR12CA0069.namprd12.prod.outlook.com (2603:10b6:0:57::13) by DM5PR12MB1146.namprd12.prod.outlook.com (2603:10b6:3:73::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:22:10 +0000 Received: from DM6NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:0:57:cafe::df) by DM3PR12CA0069.outlook.office365.com (2603:10b6:0:57::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:22:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT032.mail.protection.outlook.com (10.13.173.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:22:09 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:22:08 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Daniel_P_=2E_Be?= =?utf-8?q?rrang=C3=A9?= Subject: [PATCH 29/64] block/nbd: Use qcrypto_tls_creds_check_endpoint() Date: Tue, 19 Oct 2021 09:09:09 -0500 Message-ID: <20211019140944.152419-30-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b07deb5-379f-4a1f-4187-08d9930bd605 X-MS-TrafficTypeDiagnostic: DM5PR12MB1146: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:113; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ewR3kMqL2iknDSEpR18iMrvU27DgLwiEc5T8EsN0LLrxOpCuDRfRL4aaWJh1gwI1sA/FL4WWJ6qTKWqoEeoZSigk8X2XVf0l8bGMs1/GQlQDatAUs+f8qh6LL2D4SqhlzbU/GNMPSPtqU3XRCjsgxqiFaP4b78Fzr6MLPoJbLKExi8J3aYujykznzBjYZw4UVT0jCiTVd5cdvMKzOPzUT79a3isRreUd1uziYyb4nUpuZzJej4NP3vt3ukVyBwRKObMFvgEgH3puD70j5D+CKBN4T+CbWrDp/kLcWzd6rZnrXVUwUMXq6czroy2x7mqLHO2d7I8+eB1118C8fMs4Cq7aLlSE1At4M0wrVsZg7xYPw7F8rM6OpT86mk5G+cnOoe8cQdgfae3yP2mYUY4SYCVUfXyJJY2desQxM1qt/giJzM3YXAtOTyOC87EsUalf7c/IShrlO/SctuvVFNE4CEgNIfjeLF83uJDpjgu02mMMhYViODwQzNKGU2Ol3Z7f5CXkTL1rAZTxT+1XOTDrRd7ncBa54xqH0b8lGlJBVQP+K/2QQ34oEMyUrDIWWuk947nht368QrEcQBKrvBEzvtWBfjocqWCx1X8J+Fn5A9442aRb0yuLg/F+txk+DobHKGCYU9lPzJ2GZV5dt/Rp+3SPUhtqJTVoNQEzEJxqKsNvOHLU/0UGDEFnT0/Hn49qHRxs9nD/71CBRBJNB7Zw2GP29H1hO/q1vbFS3Z5Wf0s= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(8676002)(54906003)(336012)(426003)(8936002)(70586007)(356005)(1076003)(70206006)(26005)(2616005)(36756003)(6916009)(5660300002)(2906002)(316002)(47076005)(86362001)(83380400001)(81166007)(16526019)(4326008)(508600001)(44832011)(36860700001)(82310400003)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:22:09.3488 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b07deb5-379f-4a1f-4187-08d9930bd605 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1146 Received-SPF: softfail client-ip=40.107.95.72; envelope-from=Michael.Roth@amd.com; helo=NAM02-DM3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Avoid accessing QCryptoTLSCreds internals by using the qcrypto_tls_creds_check_endpoint() helper. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé (cherry picked from commit 7b3b616838c30830c004b746e7b1209297118318) Signed-off-by: Michael Roth --- block/nbd.c | 6 +++--- blockdev-nbd.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index 1d4668d42d..add03cfa03 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -2163,9 +2163,9 @@ static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, Error **errp) return NULL; } - if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) { - error_setg(errp, - "Expecting TLS credentials with a client endpoint"); + if (!qcrypto_tls_creds_check_endpoint(creds, + QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, + errp)) { return NULL; } object_ref(obj); diff --git a/blockdev-nbd.c b/blockdev-nbd.c index b264620b98..bdfa7ed3a5 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -108,9 +108,9 @@ static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, Error **errp) return NULL; } - if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { - error_setg(errp, - "Expecting TLS credentials with a server endpoint"); + if (!qcrypto_tls_creds_check_endpoint(creds, + QCRYPTO_TLS_CREDS_ENDPOINT_SERVER, + errp)) { return NULL; } object_ref(obj); From patchwork Tue Oct 19 14:09:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E0D0C433EF for ; Tue, 19 Oct 2021 15:11:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A85DB61175 for ; Tue, 19 Oct 2021 15:11:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A85DB61175 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqlk-0003ML-QE for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:11:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq0l-00036M-E4; Tue, 19 Oct 2021 10:22:41 -0400 Received: from mail-bn1nam07on2056.outbound.protection.outlook.com ([40.107.212.56]:1422 helo=NAM02-BN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq0j-00016F-HK; Tue, 19 Oct 2021 10:22:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IpF/gKtkU4AccdTyXKFnajpA93iUIc2/RkcPKGQQNP56ys4vY2Yv/f7EFojblul4+gEohXIYzMeJ2em9OuTr7cTbWENF7ZzxP3CldfFNbnzlew8YpSIQ5LESWX63zTxs0Ed+G1i+RDiNCDNnBHWaOEr4m/usoqItylmddvhh3wa0nG6xxGeft9lu8omkrYvWiafA73bDK5gKOP8rEGbIXBJ4hvrM8GfEhkTeTU/uHubCnjMjfbIF3NJ75sEb/5NZQEK+Q9K7+hWCDyu5Xzyve9j7790ifcNpHB6QPfPevOdWiFfWXCIkRgoJ9Fqi27uHJ64yV92g83CUTQzctRPqwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YVsrf+YQi1RxxflvWqI7pgqQyzGLXC6WzdhwC3P64nc=; b=LohPkGLRJU2va8PpFADuRxlUFeDQH46Jec6vk+vqfAbPGoG2+41YdNatWWRdcXJg7oGC6TcM9Ic0M4ou52S1hQbo1nyFSI8giogMmZB7pVt0JjmZKj2tnZJtibfBXf2NxMtqI+eRPCdI0u/HuSypH7W0WPorTgj7/avWcSnZod89iLuQ4Mc7ixfvrCvjzPQOhwRGKiRlqTVOyskjBW9V5wcWVi1bK9lzH867D8TXHMZnMBqIjActOv9eSzIgCnryW++MhfGQm/oNlEZCelr0HPDUPa7OHUKXsyxCZh0cxz1H3iK2FNDXCjmaqD1GyBgXOi0zH5XquZY0rtrSuX+g+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YVsrf+YQi1RxxflvWqI7pgqQyzGLXC6WzdhwC3P64nc=; b=VNKm/+CnFlD9jrg034HVOeZDpuLprpDGu832UWwScVD8EOVQY5FG5/RQR+5WoXpj3fwvUe2nc2CPim7phkjvu3ZYH2j/taZogZr/0l9mNU5A7TOKuR9ovjNb2UMM5fnfen5NUNrdoBKcIka74sZ15DXy2SEJK+FvvfRIE+5Qy/I= Received: from DS7PR05CA0001.namprd05.prod.outlook.com (2603:10b6:5:3b9::6) by DM5PR1201MB2553.namprd12.prod.outlook.com (2603:10b6:3:eb::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:22:33 +0000 Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::58) by DS7PR05CA0001.outlook.office365.com (2603:10b6:5:3b9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.11 via Frontend Transport; Tue, 19 Oct 2021 14:22:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT059.mail.protection.outlook.com (10.13.172.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:22:32 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:22:30 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Akihiko Odaki , Eric Blake , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PATCH 30/64] qemu-nbd: Use qcrypto_tls_creds_check_endpoint() Date: Tue, 19 Oct 2021 09:09:10 -0500 Message-ID: <20211019140944.152419-31-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9fa36a38-65a5-43db-6753-08d9930be3f6 X-MS-TrafficTypeDiagnostic: DM5PR1201MB2553: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:132; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r9OSj9Ny2mMx3oScGGqidUvm1j6Tpfa+8UfsRKHywr/Y4Hq5idMIB18wbCSlYX0nvf9NTQjpHcw/KOI+g01g4Z9Xkz+Jc+h/FcJL97Aw2DTP9u7p8EaMHYeCU7ozW/wMnSK/A/aZbnVlExWzJ1xUWwWaOqWpX7EAuPznzl/Iv8jcaCuxjhwVFR+ro0nrpOsCCz1GststI2GM5mMo0RmHpZbAMlJPYgR1mM3l9djqA7JjwkXyAo0nQ6liSp8nrNi81hisSryHUtPGQ0epC8+xbTNWKzmYrbnd/S+ApEEEQK/XAw+E03BeUZ/2BFa+e0B0tXWnzNxroaRpn+a+mYodaPPmLdukG5EmqsqtKyeFxRmIjp1HTwLecfQeQCnPi7bnTjnyCmAIyrER5y+ZcyMbQgt3uHPfaN56MP3EyFaGr2PhaPtEGHkF3qeoedxgQtL1vRSvwnvGoj6ttZlV00FXNb9ALMhube8zkjrahl9Kfic2PBkZTdpxnz8fdUeHnbRKf0a/HpCbOKzVhcEfpi66UxxwnYhAnBLo/9PMMw1PCnLIR5QjCGp/I+Jbj2Fw5p9s2d10ubbLbLEPm6LmHH0zSBFka4UeiZOQK5PYiPgCdjqUejgljGUzcweCg7LYac3jVQgmsUDwyWOR0fdAw5BD3wOYdIc53eAavUsp1VJikA4w6eHJGPLK6KUoKik0ohr6J3LTphBbiVrPfR97BKpfFqNdgC9FKOLVXGfuLYxEqhg= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(16526019)(186003)(6666004)(356005)(336012)(26005)(2616005)(83380400001)(508600001)(70206006)(70586007)(36756003)(54906003)(6916009)(8676002)(44832011)(36860700001)(2906002)(4326008)(82310400003)(86362001)(5660300002)(1076003)(426003)(316002)(47076005)(8936002)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:22:32.7385 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fa36a38-65a5-43db-6753-08d9930be3f6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB2553 Received-SPF: softfail client-ip=40.107.212.56; envelope-from=Michael.Roth@amd.com; helo=NAM02-BN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Avoid accessing QCryptoTLSCreds internals by using the qcrypto_tls_creds_check_endpoint() helper. Tested-by: Akihiko Odaki Reviewed-by: Eric Blake Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé (cherry picked from commit 0279cd9535283cf5711768ab6401b204e5697a81) Signed-off-by: Michael Roth --- qemu-nbd.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index 93ef4e288f..26ffbf15af 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -43,6 +43,7 @@ #include "io/channel-socket.h" #include "io/net-listener.h" #include "crypto/init.h" +#include "crypto/tlscreds.h" #include "trace/control.h" #include "qemu-version.h" @@ -422,18 +423,12 @@ static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, bool list, return NULL; } - if (list) { - if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) { - error_setg(errp, - "Expecting TLS credentials with a client endpoint"); - return NULL; - } - } else { - if (creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { - error_setg(errp, - "Expecting TLS credentials with a server endpoint"); - return NULL; - } + if (!qcrypto_tls_creds_check_endpoint(creds, + list + ? QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT + : QCRYPTO_TLS_CREDS_ENDPOINT_SERVER, + errp)) { + return NULL; } object_ref(obj); return creds; From patchwork Tue Oct 19 14:09:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570187 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 627BEC433EF for ; Tue, 19 Oct 2021 14:55:15 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDF0A6137F for ; Tue, 19 Oct 2021 14:55:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DDF0A6137F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqWH-0003KW-Oz for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:55:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq1e-0004R2-HP; Tue, 19 Oct 2021 10:23:38 -0400 Received: from mail-co1nam11on2066.outbound.protection.outlook.com ([40.107.220.66]:27696 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq1Q-0001YZ-SK; Tue, 19 Oct 2021 10:23:34 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MRYc7WeadYtBw3ysXH9unBlHnlLdYN9bdO0P5N8ipWik76unmH/xIrOZzCfXrIKAVDTEGkLNFc/K3t+1lGNGzNRGJaQrqpZjfU9ORyMZh9HCKvC0gWuYITogSmeYB/xuRCzWchJ28T535pm21d5zMSkcjRHQZS3M2YDxY/L04Ex82m2+GbLP5j1EBLB50dWEFj7E69I/qv3jKI+rAidG/SC8aiJmc3ZOByRDSzPbo/y7eFYRo5RILFEU0i0fRDJbjDJqibUedp1K2hHqL7V6FwhykICJBrbXkm41Dc1ZFzQQ00WkZvIrc7/th7a/Cll0WERm+CzuRYqFjAM6wNPR7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wLUQxpaVSjd5uQPUJktQq9LPZvNg4IN5wr2knhaJ84c=; b=SCR87cQjTsYZIrg6ixCqhcr8UcZ46til6uC2MizvMBac+MSqo+xKY+U/a4Vi4ggPgXPgyigxKH0xx4alYCHnLtePgIDQZtTUfzCEmxab/kH/xUXZhZ0WPLQblDE9nZXxJxMXSg0uB2rzXmQIr7OFh70EnW5yXglpFbe1NGh+x20ar2yqeZ1HjfHpS15EoIb70kzBr743Ia+biM7bl3Ie/yn7GSMTOVP0Ez6hC+5Gu+dZTv4Et07h4VcDUDkOadzxIQnze8ANNLmON+aQAvJwuARWLhGlF3MZAv7+SpAKtZuYb1JqGA5a41p2LYilPvZyJSP5j290bYnlIRvgkDfvrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wLUQxpaVSjd5uQPUJktQq9LPZvNg4IN5wr2knhaJ84c=; b=pEWY2qe1R8tM3CWGTZ+4dkI9I5wgjVKoOO80Igq4X26uFpb/EC4tPg+/1II8ZnJzzS1sr8hRZHyUno03W8M5VcUS9t5qI/oJeW9IBLdjW/mfCPbJT3aWhATu5D14p+xgchYr87y9Ygh/1HopOtbiviZf66+51vtQG2pHzv3kZio= Received: from DM6PR13CA0021.namprd13.prod.outlook.com (2603:10b6:5:bc::34) by BL1PR12MB5287.namprd12.prod.outlook.com (2603:10b6:208:317::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:23:16 +0000 Received: from DM6NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:5:bc:cafe::c0) by DM6PR13CA0021.outlook.office365.com (2603:10b6:5:bc::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.10 via Frontend Transport; Tue, 19 Oct 2021 14:23:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT012.mail.protection.outlook.com (10.13.173.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:23:15 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:23:14 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Daniel_P_=2E_Be?= =?utf-8?q?rrang=C3=A9?= Subject: [PATCH 31/64] chardev/socket: Use qcrypto_tls_creds_check_endpoint() Date: Tue, 19 Oct 2021 09:09:11 -0500 Message-ID: <20211019140944.152419-32-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 290cae30-3f56-4b47-bdfd-08d9930bfd76 X-MS-TrafficTypeDiagnostic: BL1PR12MB5287: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:65; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ORmz/sgBUR6F0vcfgzfOHCYfF3dPxQS/NwBv4aY6s655ngL/+PxRXs1tFeEI1yelnGKwoG6TbP5FI05ILYRL4DvNNsyFw1hv7t3D6NvuB8VceWzC/OLwwzS35HNBA0OkX9CF/QcR3JUb4S+wWAS1FyMEdq6CiZEGPJxlSy/HPUFW6XzXQCdQSh+DLNyLtn+B6Ka+Ijat0VBawQbVag7knIFAlgKh8EbrjWa9waFxoeWvIpnampwO+nMgojB3AexH/EmNRK5MgLb+SnpYRJuYebKLXe2kTSwACMaR0o+CFjWuBDO8JuArbQBceDwlckxLG0kmxf59BdqeMDBtGYBMwC1dzH+qwBMFf1M0cO7qOi6QC3RnhVHg0Q39OiPMcEUjaieQzuMkRue5+ep6JjcUJTaB3+EKwxhs8tg4ogYMzWK7RfLk5AMcMlC5qHgek8OS+7jOk7RoPQ7gxpkTG6j6IMteBmeXxL+wh1Tl3iQOcpOLKXfPycCAVhCgdpPvaJbK5u9lq8yOdolWdxXv1+58ORX9Mdfv/Opbv0DBbTow/omLLjzsuN9begDWzRRqjzQCUUBzjQLVKpUiq4zlrKC9xuKzTSL1/ukeRVtXHgk8oHLAduSIar/8+RPFXADqKtRjw8a4GrEaLgWSE7GkXIu3ABOOXuCNHfvbF37SUdN+d7NrfaThjw66gYSY97UZESklyENn5pUVCsnKbaiEnczUIOLpO4zfqUhgHq+sh14uQW8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(336012)(8676002)(36860700001)(316002)(2906002)(81166007)(8936002)(83380400001)(1076003)(6666004)(6916009)(70206006)(86362001)(2616005)(186003)(426003)(508600001)(5660300002)(70586007)(26005)(44832011)(16526019)(82310400003)(47076005)(356005)(36756003)(54906003)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:23:15.5227 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 290cae30-3f56-4b47-bdfd-08d9930bfd76 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5287 Received-SPF: softfail client-ip=40.107.220.66; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Avoid accessing QCryptoTLSCreds internals by using the qcrypto_tls_creds_check_endpoint() helper. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé (cherry picked from commit 8612df2ebef9ff1f880fe76d223a3369b9c98db2) Signed-off-by: Michael Roth --- chardev/char-socket.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index daa89fe5d1..d0fb545963 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -1402,18 +1402,12 @@ static void qmp_chardev_open_socket(Chardev *chr, return; } object_ref(OBJECT(s->tls_creds)); - if (is_listen) { - if (s->tls_creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { - error_setg(errp, "%s", - "Expected TLS credentials for server endpoint"); - return; - } - } else { - if (s->tls_creds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT) { - error_setg(errp, "%s", - "Expected TLS credentials for client endpoint"); - return; - } + if (!qcrypto_tls_creds_check_endpoint(s->tls_creds, + is_listen + ? QCRYPTO_TLS_CREDS_ENDPOINT_SERVER + : QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, + errp)) { + return; } } s->tls_authz = g_strdup(sock->tls_authz); From patchwork Tue Oct 19 14:09:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570097 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3DD1C433F5 for ; Tue, 19 Oct 2021 14:41:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4F669610E7 for ; Tue, 19 Oct 2021 14:41:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4F669610E7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:55684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqJ1-0006fZ-Do for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:41:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq1p-0004nn-Dn; Tue, 19 Oct 2021 10:23:45 -0400 Received: from mail-bn7nam10on2041.outbound.protection.outlook.com ([40.107.92.41]:62497 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq1m-0001m1-UY; Tue, 19 Oct 2021 10:23:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N+I5/pBBCJchbeMhsG6FXwEgdpG93skUkyYI55OOb3cP2o0bZkQuoxcaE+2Marwi07rP6VhherNK9hQbSv9DYFlPAAENXhIowYZ/GOrGfv5XAx8cZUOxInOrYJZ9jcvLaI0We21flQzzaSc6aBf7PA6TOXM0/aZNZAjMupKdusSUZ0RXiCHoogATvReNOUfbMQVifdqJxAmBfGdNm7hDAXXls3/J4+XCntnFaWGu4z1ZaBO4/Fgx2IwGOpflOJB7zK0PT9ztqdCiRusHffD6mF8wjFkJbxy3kghLsD5fPOBQIMy87NUPODfUyPjPZe5jisw5jO6cLrL2lmazH02lMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XgPuhkB71lDQhel0VWuXd7+42Nll4m71v30uuNkeseU=; b=CbfYx8w2c4UjHfi0vXSJX4IurXYmUzfWJJXWd13ObZ7cT/cW4cuepDv3DMHK+JGMfxAjlxZg/ojCNZyMc8j1P8Py8sVSsYh1nCAAEZifoCISiyZRrYyKWXWl/c4iGG3up+9oa7CUWVIsf6bPNfvFQs7ab2MZU8OJEdtqcllDEDOv5DEO4dYdPdlVHYA2MecNsx+T8pIrWUNOPSjr3vQVdeo1tQP/Bc+sBg52lpNqy9mEc3dIKDYyV36I2e9MMoEyQkgVTC03o9eeVP7pHCb8ap55/GgsOuuXHLtn2Hg5Id2cXozOgWh4qDcaPRcoiB46MqVQBxvz3Z5Q3w5qTAPZEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XgPuhkB71lDQhel0VWuXd7+42Nll4m71v30uuNkeseU=; b=FNJJpR6U6rd31m3McPZJC9DeMFuYrI3sd4vSOnqpWIccr7abKURc/zeKPwudLbHse84xaAmt1FgH5pDaX218sfWl4YvDpYmYnTAoHxR6d6dk+w27Thk77LPKDu6PI3mloN3QZ2579Qgd++dCsZXncEciH6W+pQDd+sQOB7075M0= Received: from DS7PR03CA0196.namprd03.prod.outlook.com (2603:10b6:5:3b6::21) by SN6PR12MB4751.namprd12.prod.outlook.com (2603:10b6:805:df::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:23:38 +0000 Received: from DM6NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::89) by DS7PR03CA0196.outlook.office365.com (2603:10b6:5:3b6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:23:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT044.mail.protection.outlook.com (10.13.173.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:23:38 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:23:37 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Daniel_P_=2E_Be?= =?utf-8?q?rrang=C3=A9?= Subject: [PATCH 32/64] migration/tls: Use qcrypto_tls_creds_check_endpoint() Date: Tue, 19 Oct 2021 09:09:12 -0500 Message-ID: <20211019140944.152419-33-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b501d785-7721-4a8e-4793-08d9930c0b42 X-MS-TrafficTypeDiagnostic: SN6PR12MB4751: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:65; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sO02JWEKU8VvGvRcFq9Gslyjg0BiMlovSyzROunD73MeHGy8HvdeOrRaSDjHxSkpkwP1ZETeoyylOaR3EsXrkuUoNgsGmTg+yPZ/07RExBI82O6ihaZJZwjQ4WRgxbp/faBHzs7DW64uVKXMcyz1iBhYAY+Yv2/W8CpCULAl1NuhLJoQAYoJQM3cj7U2GGINWG3RahnDisVNecwMtjMhLjvDQdIODgcIhxHAYtNNRmXTHA9/38pOrtl//FulWS6wJKwxfuIS6t7SyI6Rd0tUJlXZCtzT6Iy1jyaUfvB/6TGr6xyJI6pQGfH7caST+/VpXaiOOIPn9ZFDoz/LZJz7FDesWitFgzXFaZrpQA7LMIbZgxlholZZbdGOB0mjScfhe8YLPbskBH0UIThi44OoSokCLobMzNEMMOWHbmrKtHUjWyy+eVjNXu0JXMhw1pW+Qs/fiAQnoQrZTm2kRkRug3RytguGq3VDvx7mXN+9ExxQuJYjh3yKSM49G40KX+sk8Lf3fIEXlr3xoee8g8IBptgS0mhN3YD1dh5z4GCe8+OU15IEZS0lieE2qGdi7b12F0rl3xG7VLWqUGoUbM8RN9IuIvtga1vNyncTgGc8/mruuydmSmspKXJWkUqlpeFUtmYgzDcyv/bd0wwoemHg3ozWvbzqIirMy+jKOyodxPSD4cYH8Wktglt09DRjsBERWEI0zpQk4Iu/8ayrqDerRhW89icKeKGwJvWvd4EX4Zc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(2906002)(6666004)(8936002)(316002)(36756003)(4326008)(186003)(36860700001)(70206006)(70586007)(54906003)(2616005)(5660300002)(26005)(508600001)(1076003)(83380400001)(44832011)(81166007)(16526019)(426003)(356005)(8676002)(6916009)(47076005)(86362001)(336012)(82310400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:23:38.6640 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b501d785-7721-4a8e-4793-08d9930c0b42 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4751 Received-SPF: softfail client-ip=40.107.92.41; envelope-from=Michael.Roth@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Avoid accessing QCryptoTLSCreds internals by using the qcrypto_tls_creds_check_endpoint() helper. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé (cherry picked from commit 5590f65facc508fbc38575f19a0ab2fdcdcf18a4) Signed-off-by: Michael Roth --- migration/tls.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/migration/tls.c b/migration/tls.c index abb149d832..ca1ea3bbdd 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -49,11 +49,7 @@ migration_tls_get_creds(MigrationState *s, s->parameters.tls_creds); return NULL; } - if (ret->endpoint != endpoint) { - error_setg(errp, - "Expected TLS credentials for a %s endpoint", - endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT ? - "client" : "server"); + if (!qcrypto_tls_creds_check_endpoint(ret, endpoint, errp)) { return NULL; } From patchwork Tue Oct 19 14:09:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B527AC433EF for ; Tue, 19 Oct 2021 14:43:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B6A8600CC for ; Tue, 19 Oct 2021 14:43:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2B6A8600CC Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqKc-0001RS-Av for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:43:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq2G-0005VZ-KQ; Tue, 19 Oct 2021 10:24:19 -0400 Received: from mail-dm6nam12on2070.outbound.protection.outlook.com ([40.107.243.70]:11186 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq2E-00021B-W6; Tue, 19 Oct 2021 10:24:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VR+DwZ4gOfe9OqPJO3x1O/Gr4KrDbBkXZomjNa7XUK7JqFLRrq8JdN9xcoTIPbzB/TqY8cckju0xtLu9sn4vAGdHA3UFKVQicew7FQZZ35Xl4/UG5w77WBk8JLwoORU8A1UMk+loA392NXp7X8Enhc5icerTJPbGf3KmUluoB5qYV5VirQBt9lvdsu4OfJaOYM/EEqA+iRaXkBTbeq6//J7Rw0HwJdOe8O3ozUU/TsaSCFgS971e9YVGY2Y4qpgIO0kd1s8E3+HQnvcAyHVxQ/HY9TaH5z1AmusP9yZjpYXAdoSCFMXiryavs59nUoyuBRlQLdZ+1yU4luEKTHZloA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WcFjAoOoEG1GphI3Oy83reiuqUd6FcmJ6fcUF6RiG/8=; b=j+XTo9qB3LeSkVuk4UWT3hUrM1gRMRu8gNOf13CUS+chz9chOFwtcWNl5wsAfw5G7SV6NvjFAQSYzs9a917PHk3QY9Jl9l/rBmEWkao3mQRkx8BNIAjp2PvLudIxy1xva3ilK220Bivh97bzxekF+TaBgjgZkm/prb/ExFO6AfvYJHj2bGl/qiulhl5i+cDtKSKXfw1vLrQnESvscKllg7jMzBVYersjdgIKRfGufewqriVHYxgkVAwb88wSY0FWohjCmKH/dWaw0ZQRYQ8YiTIqzhiPKVh8UML6YYqUlA0TEFPIHl2PN1GXgsh/cwvNcJ5q2zP3GsBd7iNoqybJAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WcFjAoOoEG1GphI3Oy83reiuqUd6FcmJ6fcUF6RiG/8=; b=5B/7HS394wzpQwd9/h0il+JwYUqF1JV5dTaFwcBdbm9IEsJ24bbhoW1i3n0BatyO8FFMnuZ81SWMv/RLhsBq5dew/Wr4BQofAw1ZRKFu1MDmHU+Z44c8yMMeaUBHaK5yF3L/IFJhpNaEHgd+jasRebNCCCH3FHblNM2uc/HfP+s= Received: from DM6PR08CA0031.namprd08.prod.outlook.com (2603:10b6:5:80::44) by CH2PR12MB3829.namprd12.prod.outlook.com (2603:10b6:610:2c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:24:04 +0000 Received: from DM6NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:5:80:cafe::48) by DM6PR08CA0031.outlook.office365.com (2603:10b6:5:80::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Tue, 19 Oct 2021 14:24:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT068.mail.protection.outlook.com (10.13.173.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:24:03 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:24:00 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Dani?= =?utf-8?q?el_P_=2E_Berrang=C3=A9?= Subject: [PATCH 33/64] ui/vnc: Use qcrypto_tls_creds_check_endpoint() Date: Tue, 19 Oct 2021 09:09:13 -0500 Message-ID: <20211019140944.152419-34-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78956799-f3c3-4a05-4d4b-08d9930c1a4c X-MS-TrafficTypeDiagnostic: CH2PR12MB3829: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:132; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ozriMX8Obzvnu0dlsCwapqDCEoKm17tfK+QFydqBRisOI13CRK2HxRh+23g9catD5xqnkXm5ieOdUTY8v6wj5yVAAHV91kR5TFfyXzpeHp8/j/xl7DBMFwnEMFEQIjwkozUyqbA17dCLZgtqopmAUYn7/JCLp21pAY/HUW+X1JtWzTO+yfWjYKGJ4cpUVZfCqFouHILVidKfif7awf0MOO/81REReJMOZlWhpIg0oHbU8o+ptE/yrCq6c0lsaj6LDZ84Cr5SWfoohpcYFO7gCgNAUY5+cszXC/4fZmW5+w0c9KXxfttdhK5yX62mOYwnRMh3rMQO5t5+zQ+wnqbmZ4jdP7IY6UYxluvq1kRuJUkXHaX+/CAs/4OxhL8wqR15fZiEuI1J7JrJKaFOW2yi1BDUD0UMYDh6LuqBsGBNGFIgKrVbxopiNpXg+fajtOyp49S5dCyFRycENjD8lvTHqZVSHo9lYpURvvDtOn7cIbcNt/XdC0FrecE4hvJm0Bvb9irLvp/m+rfx/3rJQ1DbWCp4ZH8pHe2Sj0FfhA9q4yHXurM8kSS2E9x8peRDMCpxOtVoJHxxiCrXunRCCTygD+gTYFdSIAq1X0fxaXXEFyl/hNgDmP6V9Cs6Lpiok0uJViOeSxwp3lR9UXFNpHk8Zlg8/gTzutV+r++yRucvmld2iicZ2auPOJVzq7G0CbuzMwjVDhi8vzu37eY7IDoMG4E3uXteed4R+02no08CtvE= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(4326008)(8676002)(47076005)(186003)(316002)(16526019)(5660300002)(36860700001)(6666004)(426003)(26005)(83380400001)(54906003)(8936002)(2906002)(36756003)(86362001)(1076003)(508600001)(356005)(44832011)(70206006)(2616005)(336012)(82310400003)(6916009)(70586007)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:24:03.9005 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78956799-f3c3-4a05-4d4b-08d9930c1a4c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3829 Received-SPF: softfail client-ip=40.107.243.70; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Avoid accessing QCryptoTLSCreds internals by using the qcrypto_tls_creds_check_endpoint() helper. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé (cherry picked from commit 3c52bf0c608419d7892fea95f2a0af8f2e99633e) Signed-off-by: Michael Roth --- ui/vnc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 456db47d71..36fe1ff412 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -45,6 +45,7 @@ #include "qapi/qapi-commands-ui.h" #include "ui/input.h" #include "crypto/hash.h" +#include "crypto/tlscreds.h" #include "crypto/tlscredsanon.h" #include "crypto/tlscredsx509.h" #include "crypto/random.h" @@ -4071,9 +4072,9 @@ void vnc_display_open(const char *id, Error **errp) } object_ref(OBJECT(vd->tlscreds)); - if (vd->tlscreds->endpoint != QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { - error_setg(errp, - "Expecting TLS credentials with a server endpoint"); + if (!qcrypto_tls_creds_check_endpoint(vd->tlscreds, + QCRYPTO_TLS_CREDS_ENDPOINT_SERVER, + errp)) { goto fail; } } From patchwork Tue Oct 19 14:09:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBE78C433EF for ; Tue, 19 Oct 2021 14:58:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5D3CD60F9F for ; Tue, 19 Oct 2021 14:58:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5D3CD60F9F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqZf-0001Og-Ga for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:58:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq2j-0005uH-Jh; Tue, 19 Oct 2021 10:24:42 -0400 Received: from mail-co1nam11on2076.outbound.protection.outlook.com ([40.107.220.76]:40448 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq2W-0002EI-QP; Tue, 19 Oct 2021 10:24:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oZerSVIQTTnAm45ZNgSqNqw/BhSbsOmOCQwLVe0wBHMhm43AQiGpYWKzq/0XjqB7m/1beAUyiiWqUzm2L6CdZuve0bpovxi5FdPivmuAHR92yACXgBKHnRRK3diHfWL2c+LF/2ywuythetMl3gIUNDihzaJL8jJXq4Z/ACrRC2XUMESLmz9+vLdyp/VC6DLYcr8BaYJwfTJObfGk6d7HS/hSnYp4J/eIzMJiPRYMpTSi6F/USnIf0o+56YC2YD0qhadMJ3dPYH1difFSgexHgqtv/G/QlOPAXQGi0lFfQAbH64wwPDnzq5g19QMA0V1L2j3csTvACgMJw2OXLIr0/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Au4JseQIzhEWjEGJqVKAYPKIG2saGQSEilfiwZlhDbw=; b=eaNx1QsdhXNYGoxkAupS/OxzZdnIC0DyJjm6dLiv2jci0TCH9GN9buWQwrkg5+6ZDdzgtqYMsMvk/Z2zQTIq8CKs2xzKcxzXUyoexrXZfTp5RDvy+Ws6v3sTbtg6KnCGwY9XDzbJTGosCbv67laFXbJJjYNkLpOe9gmZa3nGd3Oif/5gFcZMSNx2rgEhX5weTqXr2/mwMUGMpeX3BoLh3ToYRXUAGum3SYV4tKCwAc3R8BGcdN4xdiHXx6ORbDpd0EvHEdlVlaaXUAXWwMLB+S5Mp40F7fMSlhYsVcb4/TW8NnXMOwzxjJN+kUpf65UEV9hnPZdtdOhFYUI+UvH+nA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Au4JseQIzhEWjEGJqVKAYPKIG2saGQSEilfiwZlhDbw=; b=MxItoGFMDIJEJ0c0ye8PTOFJpftu3KyWnLXtJyKwu1gJW+2jhly3EV1MpQxepSAiwl15jTH73AycHgMikJhHNTEINLYfnwZdfSjBAmQyhWv/8NHaoJUo55vTPWcUZ6/uGDU5PsY2KCl0csAgA2lNSZ/Xmd/noqFJ29OtBci9QVM= Received: from DM6PR13CA0023.namprd13.prod.outlook.com (2603:10b6:5:bc::36) by SN1PR12MB2573.namprd12.prod.outlook.com (2603:10b6:802:2b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:24:23 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:5:bc:cafe::f2) by DM6PR13CA0023.outlook.office365.com (2603:10b6:5:bc::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.10 via Frontend Transport; Tue, 19 Oct 2021 14:24:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:24:22 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:24:21 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Weil , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PATCH 34/64] crypto: Make QCryptoTLSCreds* structures private Date: Tue, 19 Oct 2021 09:09:14 -0500 Message-ID: <20211019140944.152419-35-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 749e10d2-e80d-4b46-4401-08d9930c25a6 X-MS-TrafficTypeDiagnostic: SN1PR12MB2573: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1227; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fqv2QqweNZXfyQtYAnrKdNNnd4P743nVLgDNX9J4a/2nSofTH2Nk0xoC7TgV13Tw/YT5c2tttalPMEz9kjsIaApyianr/ebJTRRQGk+fVO+nMeN9QdCzFeC1cg+50r0AEQ6a2EQi2310ZBBCFa5O+kYvbBnS27MngAjkObF42pXWzhxUOT9ill8KSIAOziTGiQFG/LlHdHAkn7YZ0KRVeAwIKCPW3lj/TQBULSmq+oWufcE7/ydREWh7WigPvCYhvErvz+UlsqORqemz71faqcHWA+8Yiglewn/wSZjsReGDT1k/OENqFWmlHlFeMRivaXgI/Gfkg8fYzZZN2uOJzB1Sle5+5NPmMr/i6vh70j/4csEd5ietXpU/9JFrLahEZyAouFFa806v+oD+GkomGM6B7wUULCFB9+aLjovD3vZHlR0hVLNqyZOlwuA0vYQVZ0e4Z9+QZSAGUXx2ia3oDtwR+FJP4A2S4jASqjM5ovtgeHRPxvclObMeceBQe2dQX1UQ+Helnl1h+UUfODTvSQbKgGZUYNYcCl8/j1ACqmjozN4YHqUHl7J3TfGugxp8c8QAgYao8lrvJAkYE7kYyQ8HgQv88f7QiTqucg0QPkoPmT5hLi487No5obOXrYQS/nsKb122hWL/D2oLSi8njUEOxS8WT8Mush9D58fk6TmgWQ5Hfit/8O1WMd26Cz5E+LFmmoiUM5719s96w+3DH123XFk+Rx85M8id5LNLiAn6YslpYlv7RK+jgBxNFc4BEax8etgDRGP9mUYnOZvGyHf91iWyixEsd+GyCjpoKamfuUYjk7V/NlFy5V6EOqpB X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(44832011)(966005)(2616005)(70206006)(508600001)(70586007)(316002)(54906003)(82310400003)(2906002)(86362001)(356005)(81166007)(47076005)(36860700001)(36756003)(19627235002)(83380400001)(6666004)(8676002)(5660300002)(186003)(336012)(1076003)(16526019)(8936002)(4326008)(6916009)(426003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:24:22.9320 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 749e10d2-e80d-4b46-4401-08d9930c25a6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2573 Received-SPF: softfail client-ip=40.107.220.76; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Code consuming the "crypto/tlscreds*.h" APIs doesn't need to access its internals. Move the structure definitions to the "tlscredspriv.h" private header (only accessible by implementations). The public headers (in include/) still forward-declare the structures typedef. Note, tlscreds.c and 3 of the 5 modified source files already include "tlscredspriv.h", so only add it to tls-cipher-suites.c and tlssession.c. Removing the internals from the public header solves a bug introduced by commit 7de2e856533 ("yank: Unregister function when using TLS migration") which made migration/qemu-file-channel.c include "io/channel-tls.h", itself sometime depends on GNUTLS, leading to a build failure on OSX: [2/35] Compiling C object libmigration.fa.p/migration_qemu-file-channel.c.o FAILED: libmigration.fa.p/migration_qemu-file-channel.c.o cc -Ilibmigration.fa.p -I. -I.. -Iqapi [ ... ] -o libmigration.fa.p/migration_qemu-file-channel.c.o -c ../migration/qemu-file-channel.c In file included from ../migration/qemu-file-channel.c:29: In file included from include/io/channel-tls.h:26: In file included from include/crypto/tlssession.h:24: include/crypto/tlscreds.h:28:10: fatal error: 'gnutls/gnutls.h' file not found #include ^~~~~~~~~~~~~~~~~ 1 error generated. Reported-by: Stefan Weil Suggested-by: Daniel P. Berrangé Resolves: https://gitlab.com/qemu-project/qemu/-/issues/407 Fixes: 7de2e856533 ("yank: Unregister function when using TLS migration") Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Daniel P. Berrangé (cherry picked from commit 678bcc3c2cf22262d0a72b52da57737c4a40e040) Signed-off-by: Michael Roth --- crypto/tls-cipher-suites.c | 7 +++++ crypto/tlscredsanon.c | 2 ++ crypto/tlscredspriv.h | 45 ++++++++++++++++++++++++++++++ crypto/tlscredspsk.c | 2 ++ crypto/tlscredsx509.c | 1 + crypto/tlssession.c | 1 + include/crypto/tls-cipher-suites.h | 6 ---- include/crypto/tlscreds.h | 16 ----------- include/crypto/tlscredsanon.h | 12 -------- include/crypto/tlscredspsk.h | 12 -------- include/crypto/tlscredsx509.h | 10 ------- 11 files changed, 58 insertions(+), 56 deletions(-) diff --git a/crypto/tls-cipher-suites.c b/crypto/tls-cipher-suites.c index 55fb5f7c19..5e4f597464 100644 --- a/crypto/tls-cipher-suites.c +++ b/crypto/tls-cipher-suites.c @@ -14,8 +14,15 @@ #include "crypto/tlscreds.h" #include "crypto/tls-cipher-suites.h" #include "hw/nvram/fw_cfg.h" +#include "tlscredspriv.h" #include "trace.h" +struct QCryptoTLSCipherSuites { + /* */ + QCryptoTLSCreds parent_obj; + /* */ +}; + /* * IANA registered TLS ciphers: * https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4 diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c index bea5f76c55..6fb83639ec 100644 --- a/crypto/tlscredsanon.c +++ b/crypto/tlscredsanon.c @@ -29,6 +29,8 @@ #ifdef CONFIG_GNUTLS +#include + static int qcrypto_tls_creds_anon_load(QCryptoTLSCredsAnon *creds, diff --git a/crypto/tlscredspriv.h b/crypto/tlscredspriv.h index 39f1a91c41..df9815a286 100644 --- a/crypto/tlscredspriv.h +++ b/crypto/tlscredspriv.h @@ -23,6 +23,51 @@ #include "crypto/tlscreds.h" +#ifdef CONFIG_GNUTLS +#include +#endif + +struct QCryptoTLSCreds { + Object parent_obj; + char *dir; + QCryptoTLSCredsEndpoint endpoint; +#ifdef CONFIG_GNUTLS + gnutls_dh_params_t dh_params; +#endif + bool verifyPeer; + char *priority; +}; + +struct QCryptoTLSCredsAnon { + QCryptoTLSCreds parent_obj; +#ifdef CONFIG_GNUTLS + union { + gnutls_anon_server_credentials_t server; + gnutls_anon_client_credentials_t client; + } data; +#endif +}; + +struct QCryptoTLSCredsPSK { + QCryptoTLSCreds parent_obj; + char *username; +#ifdef CONFIG_GNUTLS + union { + gnutls_psk_server_credentials_t server; + gnutls_psk_client_credentials_t client; + } data; +#endif +}; + +struct QCryptoTLSCredsX509 { + QCryptoTLSCreds parent_obj; +#ifdef CONFIG_GNUTLS + gnutls_certificate_credentials_t data; +#endif + bool sanityCheck; + char *passwordid; +}; + #ifdef CONFIG_GNUTLS int qcrypto_tls_creds_get_path(QCryptoTLSCreds *creds, diff --git a/crypto/tlscredspsk.c b/crypto/tlscredspsk.c index f5a31108d1..752f2d92be 100644 --- a/crypto/tlscredspsk.c +++ b/crypto/tlscredspsk.c @@ -29,6 +29,8 @@ #ifdef CONFIG_GNUTLS +#include + static int lookup_key(const char *pskfile, const char *username, gnutls_datum_t *key, Error **errp) diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c index bc503bab55..6dd0d14d29 100644 --- a/crypto/tlscredsx509.c +++ b/crypto/tlscredsx509.c @@ -30,6 +30,7 @@ #ifdef CONFIG_GNUTLS +#include #include diff --git a/crypto/tlssession.c b/crypto/tlssession.c index 33203e8ca7..a8db8c76d1 100644 --- a/crypto/tlssession.c +++ b/crypto/tlssession.c @@ -25,6 +25,7 @@ #include "crypto/tlscredsx509.h" #include "qapi/error.h" #include "authz/base.h" +#include "tlscredspriv.h" #include "trace.h" #ifdef CONFIG_GNUTLS diff --git a/include/crypto/tls-cipher-suites.h b/include/crypto/tls-cipher-suites.h index bb9ee53e03..7eb1b76122 100644 --- a/include/crypto/tls-cipher-suites.h +++ b/include/crypto/tls-cipher-suites.h @@ -19,12 +19,6 @@ typedef struct QCryptoTLSCipherSuites QCryptoTLSCipherSuites; DECLARE_INSTANCE_CHECKER(QCryptoTLSCipherSuites, QCRYPTO_TLS_CIPHER_SUITES, TYPE_QCRYPTO_TLS_CIPHER_SUITES) -struct QCryptoTLSCipherSuites { - /* */ - QCryptoTLSCreds parent_obj; - /* */ -}; - /** * qcrypto_tls_cipher_suites_get_data: * @obj: pointer to a TLS cipher suites object diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h index a14e44fac1..2a8a857010 100644 --- a/include/crypto/tlscreds.h +++ b/include/crypto/tlscreds.h @@ -24,10 +24,6 @@ #include "qapi/qapi-types-crypto.h" #include "qom/object.h" -#ifdef CONFIG_GNUTLS -#include -#endif - #define TYPE_QCRYPTO_TLS_CREDS "tls-creds" typedef struct QCryptoTLSCreds QCryptoTLSCreds; typedef struct QCryptoTLSCredsClass QCryptoTLSCredsClass; @@ -48,18 +44,6 @@ typedef bool (*CryptoTLSCredsReload)(QCryptoTLSCreds *, Error **); * certificate credentials. */ -struct QCryptoTLSCreds { - Object parent_obj; - char *dir; - QCryptoTLSCredsEndpoint endpoint; -#ifdef CONFIG_GNUTLS - gnutls_dh_params_t dh_params; -#endif - bool verifyPeer; - char *priority; -}; - - struct QCryptoTLSCredsClass { ObjectClass parent_class; CryptoTLSCredsReload reload; diff --git a/include/crypto/tlscredsanon.h b/include/crypto/tlscredsanon.h index 3f464a3809..bd3023f9ea 100644 --- a/include/crypto/tlscredsanon.h +++ b/include/crypto/tlscredsanon.h @@ -92,18 +92,6 @@ typedef struct QCryptoTLSCredsAnonClass QCryptoTLSCredsAnonClass; * */ - -struct QCryptoTLSCredsAnon { - QCryptoTLSCreds parent_obj; -#ifdef CONFIG_GNUTLS - union { - gnutls_anon_server_credentials_t server; - gnutls_anon_client_credentials_t client; - } data; -#endif -}; - - struct QCryptoTLSCredsAnonClass { QCryptoTLSCredsClass parent_class; }; diff --git a/include/crypto/tlscredspsk.h b/include/crypto/tlscredspsk.h index d7e6bdb5ed..bcd07dc4f6 100644 --- a/include/crypto/tlscredspsk.h +++ b/include/crypto/tlscredspsk.h @@ -87,18 +87,6 @@ typedef struct QCryptoTLSCredsPSKClass QCryptoTLSCredsPSKClass; * The PSK file can be created and managed using psktool. */ -struct QCryptoTLSCredsPSK { - QCryptoTLSCreds parent_obj; - char *username; -#ifdef CONFIG_GNUTLS - union { - gnutls_psk_server_credentials_t server; - gnutls_psk_client_credentials_t client; - } data; -#endif -}; - - struct QCryptoTLSCredsPSKClass { QCryptoTLSCredsClass parent_class; }; diff --git a/include/crypto/tlscredsx509.h b/include/crypto/tlscredsx509.h index c6d89b7881..c4daba21a6 100644 --- a/include/crypto/tlscredsx509.h +++ b/include/crypto/tlscredsx509.h @@ -96,16 +96,6 @@ typedef struct QCryptoTLSCredsX509Class QCryptoTLSCredsX509Class; * */ -struct QCryptoTLSCredsX509 { - QCryptoTLSCreds parent_obj; -#ifdef CONFIG_GNUTLS - gnutls_certificate_credentials_t data; -#endif - bool sanityCheck; - char *passwordid; -}; - - struct QCryptoTLSCredsX509Class { QCryptoTLSCredsClass parent_class; }; From patchwork Tue Oct 19 14:09:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C4B7C433EF for ; Tue, 19 Oct 2021 15:03:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BDD496115A for ; Tue, 19 Oct 2021 15:03:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BDD496115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqeE-0007Fh-TB for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:03:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq2x-0006Mi-7e; Tue, 19 Oct 2021 10:24:59 -0400 Received: from mail-dm6nam11on2080.outbound.protection.outlook.com ([40.107.223.80]:21760 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq2u-0002Sg-4q; Tue, 19 Oct 2021 10:24:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HWEH5pkPgC7ib8TITomMjhz8zp40H0x4UXzAWtL69QkdRPyyMLEtXe3DHMuj9KQbmasUgRrg43Ox96fxSGZrq03xYk15611LZYARYz6AHXd0uGXcN3EQSxIrP0mDd6xRVyW9NWPrUAsbuABtXGQ9Aemnlo/a6SXzX4eBxTV5FBqhgn/ewRIOAMyhf75bX6QcR86PqKDYuiJL51uyRaANX1GDvLEtBaoMjXrlUtgXG3ihmAu5O9ufvEh8mb5R3wmOYvHjYhxOyQhDpIZwmNH028MHXq27lVTDVMUpWCopgQyPDZTMKdy9dWCnA61HCir/J2U6WgqUqClr0Ca1vozXgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3XoirFGDlPODTVsUIqnb/GA2XQ7bf4fHhSK/eNk0KW0=; b=TuFDV/lWJ5DW9X3yqbG0f0bI9q4sjEeoId8x1QJDz2zLmkK/OoOJBd9Mml9Q0p4UoTDtf8sjYlMbIxV6T8ndxGuQsbNLIJcAVetAEkNP/CGv5oXcLtlYk5E1LOi0fZOin1MV1Gsx53KayIE8slkymJggkURaDB/TG4gBYLXcuC6cKIT/jZxWZBaoj8FeFw7XAAlEKvRAM/t51i0iR1Nm7uETiKWkVnPRuR1x69IjOp4wNiNM1YZhGF3ikekPtacjM8b9lv33Cxe1h4B78ohVa995vAF2X6YmtWKaCEh28PdWMOlJ1fSYSogocWzttz+jaba/dLAub1YoQVZyqdtzfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3XoirFGDlPODTVsUIqnb/GA2XQ7bf4fHhSK/eNk0KW0=; b=NQFwPeAveaJPjXidaA7G+iwhG3auca9eQKA9SqGoDxm9lgDtD4JW0hEP4R0IGFgs6vkY8ahOplEWzFuiaV8LYM+viV0cDVjcmwByr2hIF+Joaq5FtO8C/1tTnj+VbRlXukv0eJTKlPXCBt4/IDPSvsUr455UeWzR87jETxnMjT0= Received: from DM5PR10CA0018.namprd10.prod.outlook.com (2603:10b6:4:2::28) by MN2PR12MB2912.namprd12.prod.outlook.com (2603:10b6:208:ac::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:24:45 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:4:2:cafe::db) by DM5PR10CA0018.outlook.office365.com (2603:10b6:4:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:24:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:24:45 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:24:44 -0500 From: Michael Roth To: CC: , Leonardo Bras , Lukas Straub , Peter Xu , "Dr . David Alan Gilbert" Subject: [PATCH 35/64] yank: Unregister function when using TLS migration Date: Tue, 19 Oct 2021 09:09:15 -0500 Message-ID: <20211019140944.152419-36-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f302acea-fb1d-45a0-dc57-08d9930c3319 X-MS-TrafficTypeDiagnostic: MN2PR12MB2912: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:111; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sZsINbdZKhy+kSm1fFea6u7lZMfFMcRIYW1YTwbpH5BlGp0RkcLkz79UXoqify/TfL8g+JgTUArCNWmrwkrrkBKy6vU8SwVSk85hyIZs7ArJo/5HiC0dlPjr/dDAN6YnxBvXgBNDhuvLUBsejMCC11DTh4sQ8Of5NA5vMRA8dKt96ALtm7F+ekXlCIFlY917KmiZCp2UWz3TJtBtMkbUGv+m9RWDLnHf/lG0dwkIH9NILwzuGbxOr73LfFPpfmqoAYuf13wannC4D7rOmLCdxO1RJSTryq777JkUFbc0SEyiE+B+HGpf8eTAdMtX+lp1lDJfzi3QqggDUAedxwwmAI/KIg3rgjXhImk3POLvJnlVrq0V0nKRmtmxL69xR38NnPrEwSiaiZhWkhzkr8EktzuKVwuRiruF2tub7ab/94+3gpx2smMvTg0A8VW2WBBxdTNgdlw6BtcK3rLenA8DVS1mNFdntuJ9XNG+Tt55NIMdR0h09j1Aajm2pdRqo7UFBsAzBX68e4jCt4UmUhe3QIE5UnIg85/XOwa6SKMbULZdz7Wz58v0i1CQ9ctCrou85+SCmgFtwf4nOCw5lAdceKL6+BjmVyCq76/Dk+zAp+Of78LhtNbMi42spU9pjdcvmCLumKyRWVOOhi17vmDNDr/Zks7H00VTQteTfyL/kesPGb6ZbBkzze+GmCrZlagnKYJHVxbCp9j5ad1RM8773NyAuCT/G3P4Ud9w3FZU4iZ3bDkoRUkRbyplO28hIyBztyloCtltIjJwcMlE8+e7XKkRA3Rz+IkY5CoUfFtFht+ndCRotlkGGWQIon7u5pvx X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(508600001)(16526019)(186003)(6666004)(82310400003)(86362001)(4326008)(966005)(47076005)(1076003)(26005)(36756003)(356005)(2616005)(8936002)(426003)(36860700001)(54906003)(44832011)(2906002)(316002)(5660300002)(8676002)(70586007)(70206006)(6916009)(336012)(81166007)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:24:45.5059 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f302acea-fb1d-45a0-dc57-08d9930c3319 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2912 Received-SPF: softfail client-ip=40.107.223.80; envelope-from=Michael.Roth@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Leonardo Bras After yank feature was introduced in migration, whenever migration is started using TLS, the following error happens in both source and destination hosts: (qemu) qemu-kvm: ../util/yank.c:107: yank_unregister_instance: Assertion `QLIST_EMPTY(&entry->yankfns)' failed. This happens because of a missing yank_unregister_function() when using qio-channel-tls. Fix this by also allowing TYPE_QIO_CHANNEL_TLS object type to perform yank_unregister_function() in channel_close() and multifd_load_cleanup(). Also, inside migration_channel_connect() and migration_channel_process_incoming() move yank_register_function() so it only runs once on a TLS migration. Fixes: b5eea99ec2f ("migration: Add yank feature", 2021-01-13) Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1964326 Signed-off-by: Leonardo Bras Reviewed-by: Lukas Straub Reviewed-by: Peter Xu --- Changes since v2: - Dropped all references to ioc->master - yank_register_function() and yank_unregister_function() now only run once in a TLS migration. Changes since v1: - Cast p->c to QIOChannelTLS into multifd_load_cleanup() Message-Id: <20210601054030.1153249-1-leobras.c@gmail.com> Signed-off-by: Dr. David Alan Gilbert (cherry picked from commit 7de2e8565335c13fb3516cddbe2e40e366cce273) Signed-off-by: Michael Roth --- migration/channel.c | 26 ++++++++++++++------------ migration/multifd.c | 3 ++- migration/qemu-file-channel.c | 4 +++- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/migration/channel.c b/migration/channel.c index c9ee902021..01275a9162 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -38,18 +38,19 @@ void migration_channel_process_incoming(QIOChannel *ioc) trace_migration_set_incoming_channel( ioc, object_get_typename(OBJECT(ioc))); - if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) { - yank_register_function(MIGRATION_YANK_INSTANCE, - migration_yank_iochannel, - QIO_CHANNEL(ioc)); - } - if (s->parameters.tls_creds && *s->parameters.tls_creds && !object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) { migration_tls_channel_process_incoming(s, ioc, &local_err); } else { + if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) || + object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) { + yank_register_function(MIGRATION_YANK_INSTANCE, + migration_yank_iochannel, + QIO_CHANNEL(ioc)); + } + migration_ioc_process_incoming(ioc, &local_err); } @@ -76,12 +77,6 @@ void migration_channel_connect(MigrationState *s, ioc, object_get_typename(OBJECT(ioc)), hostname, error); if (!error) { - if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) { - yank_register_function(MIGRATION_YANK_INSTANCE, - migration_yank_iochannel, - QIO_CHANNEL(ioc)); - } - if (s->parameters.tls_creds && *s->parameters.tls_creds && !object_dynamic_cast(OBJECT(ioc), @@ -99,6 +94,13 @@ void migration_channel_connect(MigrationState *s, } else { QEMUFile *f = qemu_fopen_channel_output(ioc); + if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) || + object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) { + yank_register_function(MIGRATION_YANK_INSTANCE, + migration_yank_iochannel, + QIO_CHANNEL(ioc)); + } + qemu_mutex_lock(&s->qemu_file_lock); s->to_dst_file = f; qemu_mutex_unlock(&s->qemu_file_lock); diff --git a/migration/multifd.c b/migration/multifd.c index a6677c45c8..a8dedcf822 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -987,7 +987,8 @@ int multifd_load_cleanup(Error **errp) for (i = 0; i < migrate_multifd_channels(); i++) { MultiFDRecvParams *p = &multifd_recv_state->params[i]; - if (object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_SOCKET) + if ((object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_SOCKET) || + object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_TLS)) && OBJECT(p->c)->ref == 1) { yank_unregister_function(MIGRATION_YANK_INSTANCE, migration_yank_iochannel, diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c index 876d05a540..fad340ea7a 100644 --- a/migration/qemu-file-channel.c +++ b/migration/qemu-file-channel.c @@ -26,6 +26,7 @@ #include "qemu-file-channel.h" #include "qemu-file.h" #include "io/channel-socket.h" +#include "io/channel-tls.h" #include "qemu/iov.h" #include "qemu/yank.h" #include "yank_functions.h" @@ -106,7 +107,8 @@ static int channel_close(void *opaque, Error **errp) int ret; QIOChannel *ioc = QIO_CHANNEL(opaque); ret = qio_channel_close(ioc, errp); - if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) + if ((object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) || + object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS)) && OBJECT(ioc)->ref == 1) { yank_unregister_function(MIGRATION_YANK_INSTANCE, migration_yank_iochannel, From patchwork Tue Oct 19 14:09:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78963C433F5 for ; Tue, 19 Oct 2021 14:52:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D62A6137D for ; Tue, 19 Oct 2021 14:52:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0D62A6137D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqTK-00053N-GI for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:52:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq3I-0006Ry-3m; Tue, 19 Oct 2021 10:25:16 -0400 Received: from mail-bn7nam10on2045.outbound.protection.outlook.com ([40.107.92.45]:16096 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq3G-0002i1-Cy; Tue, 19 Oct 2021 10:25:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HIF/uBdDnWMnd2CFngNU2cEdXSCsXCTTMbnJtOYWCcVDZ3GoEcHkMhdjWedEtME04WikccvQ8FMDbg7mCc8EZUUcyba24Se8ldwYH6s/q43Fag8yIwo89oNROCI0U8Lu4+PeLMrlwvIbXYLiiF5W2gEF8AYTE9YeWpf4M4c7evvcaAvwobt+LcJp3JuUGzvDQPpMEbi1w5y34K4ssq4RKLnwkCRux9kiBEv1mb3mtyAxfINsGKKYLzzD/72MYqrBKcLu0icS73Dqf6E8XcBa4euwKr/ELB1582XbmPyPuE8Ik/22HWwQgadZ7zJPKZZmPT6+MWEGDWLwqYrCGQjioQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UIvv0UcLg8QtsSCobir40WPlv5hSQ0nTASRNdrpPyCI=; b=NgPTrylXAIlMA25pSNWTaG1M7K37pXpWUUgcgz1fOL0cpxHNCV0YTHULa7h303kpM96x16EqWcv9owjzKCexS4gnZCjsiw36fdV2SJZBu3C8eTcdk2e8dEJKq4ekr1EjWCnQjfAe+9XkqOaFAkbE9aGXG2Fp/bN8C50JtxoB+Fqy7/9gB8T5rlrYfEFZXldpwTMMy028BETj8Rwhl3W0pHaNTZ9NagFhRmGn+t4qmXWstX5aJTdaxCvxLT9r77IjJIsdH32SqaQVTJ+OoQX481slfG7LvzYppvCvGbbHggHAVvXHqWQb2FO6tAEoVLy0eZVM9XqZ5NCZMI6JG2p6kQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UIvv0UcLg8QtsSCobir40WPlv5hSQ0nTASRNdrpPyCI=; b=fZmqsFjE0htoxhDKOhXRK14BFf2WfXjpsQTE+G0cCcPIObkCADBdCsB+fZ3tAhOuLG/BylY0nc5D3RPhywT2nlGisx2fPnRnX1bSbJJA2tdsEYNiG4zLElH4OHNxqa5kqB9tHPzGkPTvkQwV0ookAe0FVoOKGxBB9TqBgXtPazo= Received: from DM3PR08CA0024.namprd08.prod.outlook.com (2603:10b6:0:52::34) by BL0PR12MB4884.namprd12.prod.outlook.com (2603:10b6:208:1ca::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:25:10 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:0:52:cafe::e3) by DM3PR08CA0024.outlook.office365.com (2603:10b6:0:52::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:25:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:25:10 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:25:08 -0500 From: Michael Roth To: CC: , Igor Mammedov , Stefan Hajnoczi , John Sucaet , "Michael S . Tsirkin" Subject: [PATCH 36/64] tests: acpi: prepare for changing DSDT tables Date: Tue, 19 Oct 2021 09:09:16 -0500 Message-ID: <20211019140944.152419-37-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44c51576-9723-4193-f97e-08d9930c41bb X-MS-TrafficTypeDiagnostic: BL0PR12MB4884: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:85; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c3mGJ37hXKWRiTWoMevIUAtIgNKowW8k396XgyJyc8tuPYMG1qdDA6XgiHJ3HNk5m3Kvu8+pwAdEf16zRFp7668ZZG5avxQAJsJAVroLiY4Nlxckn0lOxuJ8jtPqJCqYKrO+T4J0DI7KNbl2AiYWOuRKemuHTgl1SceQs3aOHneGiX7hF9VI82AdxBgGFqyG8CWNxpWjsOudC0T3Of63GEGuSg4Tf5NarFGobVN77JkRguI+CBStKXsPd0PFiWoOufpDXNt9jxDqV9vMsg8yuDc8rgBbrvx9KjRUDq7ogTTpGsRjQNO5tX0GGiy8mxIZLvP1LtTqUn+wd430ZURr3zPluZLhQ4V1YXRtyO+UEldj7o4aw90xZlFKF22RZcy2O4DXBNOL6M14YiX7+xJdDpva77dXOLOmWlmHJob1gI2B/KMyr0ttyHP2wDMFwUp6x23FhRpsetPw79+1YMznIgH6MRP15i5PSRqF5xflI48sim4B3NbQH1OD9B3OM6GTt+BHN5sgG341VSYsrsFu49VsW1zbhsr0X+OEQjgjnI8QTBlfu9kz0NlvMw8aODTBNXzY76piAAztbtkmn8IbXSAl6H3+tjYW6DvPgQOGhLME/1QJ5ag0h7SmXHiSGdRFElUA9UQYkesCJAHYyYJqcSNRA/MttxJLPu6OrDNU02KhZLH1qzI3P/1K1j9m0sFELaPiBuf5oGQzm5PDL3dit9ZnMiMIDEIvAnNxDmf7fT4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(36756003)(6916009)(26005)(508600001)(426003)(16526019)(5660300002)(81166007)(186003)(356005)(70206006)(6666004)(2616005)(70586007)(86362001)(8936002)(4326008)(44832011)(47076005)(8676002)(336012)(82310400003)(36860700001)(316002)(2906002)(83380400001)(1076003)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:25:10.0585 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44c51576-9723-4193-f97e-08d9930c41bb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4884 Received-SPF: softfail client-ip=40.107.92.45; envelope-from=Michael.Roth@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20210624204229.998824-2-imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi Tested-by: John Sucaet Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit a4344574fd47336b6d8fc85ce1f66d4262e7dafd) Signed-off-by: Michael Roth --- tests/qtest/bios-tables-test-allowed-diff.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..6c83a3ef76 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,11 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT", +"tests/data/acpi/pc/DSDT.bridge", +"tests/data/acpi/pc/DSDT.ipmikcs", +"tests/data/acpi/pc/DSDT.cphp", +"tests/data/acpi/pc/DSDT.memhp", +"tests/data/acpi/pc/DSDT.numamem", +"tests/data/acpi/pc/DSDT.nohpet", +"tests/data/acpi/pc/DSDT.dimmpxm", +"tests/data/acpi/pc/DSDT.acpihmat", +"tests/data/acpi/pc/DSDT.hpbridge", From patchwork Tue Oct 19 14:09:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A094C433EF for ; Tue, 19 Oct 2021 15:06:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 720F66115A for ; Tue, 19 Oct 2021 15:06:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 720F66115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqhZ-0004ad-ND for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:06:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq3g-0006xs-7Y; Tue, 19 Oct 2021 10:25:41 -0400 Received: from mail-bn1nam07on2074.outbound.protection.outlook.com ([40.107.212.74]:59377 helo=NAM02-BN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq3e-0002xw-2Q; Tue, 19 Oct 2021 10:25:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M6pqPWnnBxXfpgLFbo9jWjSYG7m7sDNYqAs7zM5H+zxyzyL4OYyzhDHYzn0IDVq1a4dZPdUOBVaZw6HueG3WDqb3//nJeR/BcGlFZu0j/sg51YL3afi5hWtU/E/ZJQ25SgJmWFj+E81hP7kE1+2nnkNyBl9fHCqcHYG9Ul/+oPJiOdzOIrRYUWvZ8hD/FWZwqpI1W43Sq2NoaEoX4mTA+jebNSUMn8bemU2x+6mZtcZW5UoBCrMDnw6fdQjjlxjTbii8Ss6juVJFysn2asb1YtEnh8vCgoXzJA00A6oVLahvFkfc7Cx6HFMgh6wCLLEzWmZAcIbqfhaoV1CcqqppzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ks2xmH+gO/I08xoK/XmZGS0ss4XC7UeUgJzs0OE/Bco=; b=Adq158dB5PT8s0xy0xIKDLxTNmXtO6Gx6W0H1G76QyVX8MLybvn6zAMkdpqc9lWoBVQQ25Y7mfOSwc6hEwjazUUTmAVhh/JGmPNDA6Oydh6Nb0wbJqlCKL7xa0dYl9lXlHkD01MVdla6AGgVgwckQR7nVEuKWNZ9LXhhxRNnIvhiRJePWd2IRw+M4rFqHqkHiqKtdfxvJ3wTMyQjeYN2aQOX7wvlYWtnPrmn+ychEnmDMB9ham7SrU2hi/UQ7iEzlcdY59aSCnJt2Ygji3rScu1tPopXYq2ukmIkEsSIo4ENGdwn0d0UC6q+6UVyDDLT6+lc/Iw4WpzdVVE414+6mA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ks2xmH+gO/I08xoK/XmZGS0ss4XC7UeUgJzs0OE/Bco=; b=MOiltIqK3ug8Y90rqNYmHSWtHHOzbWtUUkpegBX4AQQXTP6VI2BiRpojOxFZ6rc1ZEyNOwgxR3AStsOYxFK6hCAvQC3HCNTzLEAe61sMENRlmJ2mJKv0Pd5WeWlN8KfgoKKaaRnCo24zZ7xRwjudZBNWii0KCGtkDx5krW0KDmM= Received: from DM6PR04CA0014.namprd04.prod.outlook.com (2603:10b6:5:334::19) by DM4PR12MB5120.namprd12.prod.outlook.com (2603:10b6:5:393::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:25:34 +0000 Received: from DM6NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::d5) by DM6PR04CA0014.outlook.office365.com (2603:10b6:5:334::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:25:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT058.mail.protection.outlook.com (10.13.172.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:25:34 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:25:33 -0500 From: Michael Roth To: CC: , Igor Mammedov , Stefan Hajnoczi , John Sucaet , "Michael S . Tsirkin" Subject: [PATCH 37/64] acpi: pc: revert back to v5.2 PCI slot enumeration Date: Tue, 19 Oct 2021 09:09:17 -0500 Message-ID: <20211019140944.152419-38-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48838fc3-7064-4b2a-ef91-08d9930c5011 X-MS-TrafficTypeDiagnostic: DM4PR12MB5120: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YN+mLE4dyu6IBOD7d7a2gVgG8zBYA9HENIYxGNfjBrbTqIlCGAOcfBcpkFWVD9KltWFsoz/8tfrphfvgerHDyD0uZRMUA40MkRik+A6qvhEeST75IDOfi+5ZTkQq3JCQnPPjB/tbu1IpZjZFBzjMJXR9T6cYV9/Y3IwR0rmhNFoRAkmxNYgDorZxOw2q2KalSYhrd9QbO3sryHgqzpO8jkfT78T0YNAbuK1qJ5X6rcNGputYpE0af0VvhiUIVECrb8LJoSpEKGa/7BET91xCfZZQ3THKlmHc1JVBCFX0EdGCqhjj3CnlYcd6/rB9G/PquyfQufdzR2KU1o09ogwPECgiE6fy12egKYkKjhqVwWHg0k70yMHYzdNXTvGya67MfuwIp0DF81NsGeDZCfZzyt8sScVCKYR+1wNqK8rMbxZoXDyPnU9qMadtgE3jTaRE+tCIXZmWjaEMREDRb+TfwXPmejy8dVvkDBygJK7tYm+CB6HX4K8Rlj0kP2p6w4whDwwjQbuTFr8d2WUjgOx0T58CKlisk5n/ZVXppQGrKytPM9JxyyeHN0eHHU3g8N16L1SetFaGQbZhdVWR0HQK13q9L0bUYmXxWkMfImyc1O+r85Seojrx5M5GvcPb9TPbqDYTVCSq8j0t8bNwBKjyStkBD6qsG+R2z1staovt1ybE19fsF2MmSzl6oKlqZWf4qkqcTHqlhyPXrdMMcqhnso9EAhKUs4GXsw2Jeg4bz0o= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(4326008)(6916009)(316002)(36756003)(8936002)(426003)(356005)(508600001)(1076003)(47076005)(6666004)(54906003)(86362001)(81166007)(16526019)(83380400001)(2616005)(2906002)(70586007)(5660300002)(44832011)(336012)(70206006)(82310400003)(26005)(8676002)(186003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:25:34.1079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48838fc3-7064-4b2a-ef91-08d9930c5011 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5120 Received-SPF: softfail client-ip=40.107.212.74; envelope-from=Michael.Roth@amd.com; helo=NAM02-BN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Commit [1] moved _SUN variable from only hot-pluggable to all devices. This made linux kernel enumerate extra slots that weren't present before. If extra slot happens to be be enumerated first and there is a device in th same slot but on other bridge, linux kernel will add -N suffix to slot name of the later, thus changing NIC name compared to QEMU 5.2. This in some case confuses systemd, if it is using SLOT NIC naming scheme and interface name becomes not the same as it was under QEMU-5.2. Reproducer QEMU CLI: -M pc-i440fx-5.2 -nodefaults \ -device pci-bridge,chassis_nr=1,id=pci.1,bus=pci.0,addr=0x3 \ -device virtio-net-pci,id=nic1,bus=pci.1,addr=0x1 \ -device virtio-net-pci,id=nic2,bus=pci.1,addr=0x2 \ -device virtio-net-pci,id=nic3,bus=pci.1,addr=0x3 with RHEL8 guest produces following results: v5.2: kernel: virtio_net virtio0 ens1: renamed from eth0 kernel: virtio_net virtio2 ens3: renamed from eth2 kernel: virtio_net virtio1 enp1s2: renamed from eth1 (slot 2 is assigned to empty bus 0 slot and virtio1 is assigned to 2-2 slot, and renaming falls back, for some reason, to path based naming scheme) v6.0: kernel: virtio_net virtio0 ens1: renamed from eth0 kernel: virtio_net virtio2 ens3: renamed from eth2 systemd-udevd[299]: Error changing net interface name 'eth1' to 'ens3': File exists systemd-udevd[299]: could not rename interface '3' from 'eth1' to 'ens3': File exists (with commit [1] kernel assigns virtio2 to 3-2 slot since bridge advertises _SUN=0x3 and kernel assigns slot 3 to bridge. Still it manages to rename virtio2 correctly to ens3, however systemd gets confused with virtio1 where slot allocation exactly the same (2-2) as in 5.2 case and tries to rename it to ens3 which is rightfully taken by virtio2) I'm not sure what breaks in systemd interface renaming (it probably should be investigated), but on QEMU side we can safely revert _SUN to 5.2 behavior (i.e. avoid cold-plugged bridges and non hot-pluggable device classes), without breaking acpi-index, which uses slot numbers but it doesn't have to use _SUN, it could use an arbitrary variable name that has the same slot value). It will help existing VMs to keep networking with non trivial configs in working order since systemd will do its interface renaming magic as it used to do. 1) Fixes: b7f23f62e40 (pci: acpi: add _DSM method to PCI devices) Signed-off-by: Igor Mammedov Message-Id: <20210624204229.998824-3-imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi Tested-by: John Sucaet Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 7193d7cdd93e50f0e5f09803b98d27d3f9b147ac) Signed-off-by: Michael Roth --- hw/i386/acpi-build.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index de98750aef..dbee0cd3bc 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -432,11 +432,15 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16))); if (bsel) { - aml_append(dev, aml_name_decl("_SUN", aml_int(slot))); + /* + * Can't declare _SUN here for every device as it changes 'slot' + * enumeration order in linux kernel, so use another variable for it + */ + aml_append(dev, aml_name_decl("ASUN", aml_int(slot))); method = aml_method("_DSM", 4, AML_SERIALIZED); aml_append(method, aml_return( aml_call6("PDSM", aml_arg(0), aml_arg(1), aml_arg(2), - aml_arg(3), aml_name("BSEL"), aml_name("_SUN")) + aml_arg(3), aml_name("BSEL"), aml_name("ASUN")) )); aml_append(dev, method); } @@ -463,6 +467,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, aml_append(method, aml_return(aml_int(s3d))); aml_append(dev, method); } else if (hotplug_enabled_dev) { + aml_append(dev, aml_name_decl("_SUN", aml_int(slot))); /* add _EJ0 to make slot hotpluggable */ method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); aml_append(method, From patchwork Tue Oct 19 14:09:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5270C433EF for ; Tue, 19 Oct 2021 15:09:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6CC1C6103D for ; Tue, 19 Oct 2021 15:09:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6CC1C6103D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqkI-0001qr-GY for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:09:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq47-0007Dj-7b; Tue, 19 Oct 2021 10:26:07 -0400 Received: from mail-mw2nam12on2072.outbound.protection.outlook.com ([40.107.244.72]:12224 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq43-0003HS-7B; Tue, 19 Oct 2021 10:26:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bcxs37UZeme8co4FRxXyzH7J1A48ux+mRFApRlk27lFxBLJ/xxi9nTgi/WHtJ/AEB9u36wmflikUePn00chtsTU14LuIiZal8aGk/FDvyHEpk+rrv1amjBJ8qEkFO9XhxbOv//pxWkAO7FDkZLDRyXGc2wHxPPjZHLbWVG3OpgPi6an/D1JcCxY/ZkNIdKtFBHRgRai9/06BixIXSUc8e/87xQaUI3nGwl/E0i9GM3PUP0AHsIV7TCTjMRODlkfXgui8GwYXpJsHQvt0qp2RyHNTbIZXf394kbyErit3LsR5A3/l2BSH24MpCCk+fG6WoPCFuJatiIFAuokiBLLxGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fhWt7tNuSrejOvZcy9qkdPspCjUiO+8CallbDCs6Hl4=; b=ZNqfUnHA2SlOg9m9SIuZKrxVpZtR8VHn9KwdqqAHCfX+I0tZQMiuMvoCgcWREmyMAqWOoxHOotFCHSlBBsj/t0+fmg8ZHeNFnh/Hxp9RqFDLxPdnAJ9GPqBylXofkLZooKFgVrHJIfofXiYXErnq6YB8FxsBgHAs9kS5IYclMG7XOkcNyF8LfGoLZFeoleIZPg1ruyNWINyHOvFk6GYKeAEtBETCCXtqD+R7UbUlqhPxRvyhumyKwFDMiNZ7wxPRjmmmexZoM5HhIvbuOFHix+K6emk8o+1gc0pogPVt7zixt66yHir5NyIyS/mxbmVS1e+g+C1Vkw7l/5qBQ9Lj1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fhWt7tNuSrejOvZcy9qkdPspCjUiO+8CallbDCs6Hl4=; b=pXvQY/APeUgmJnilNN3L7PRO966vzo66YevCcLCdkUtdcbv2D51wQ5r3cWjbIQWdNn5DStw+HQiBVCGAu8wKbc4YAKNQvaFyGuwofzUaxmhc6L46BofMjX8Xly3ortoFD5Vexm6zWl9M8kTfQeo7SQ4CgO4rAx4QQnt6RROGROg= Received: from DM5PR06CA0065.namprd06.prod.outlook.com (2603:10b6:3:37::27) by CY4PR12MB1270.namprd12.prod.outlook.com (2603:10b6:903:43::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:25:58 +0000 Received: from DM6NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:3:37:cafe::98) by DM5PR06CA0065.outlook.office365.com (2603:10b6:3:37::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:25:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT022.mail.protection.outlook.com (10.13.172.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:25:58 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:25:56 -0500 From: Michael Roth To: CC: , Igor Mammedov , Stefan Hajnoczi , John Sucaet , "Michael S . Tsirkin" Subject: [PATCH 38/64] tests: acpi: pc: update expected DSDT blobs Date: Tue, 19 Oct 2021 09:09:18 -0500 Message-ID: <20211019140944.152419-39-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69231292-93b0-40a6-9f9d-08d9930c5e70 X-MS-TrafficTypeDiagnostic: CY4PR12MB1270: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HQOlwIkTcOzMAzP5cVsrhP3j53ZUtPFtfVj/UwydUnmb7nbV577GwET+jR5+wdsPTTgJa/XPiRTEF1Vd0JG1cwGrmmkOZ3YUdfmhlC/RJKJkYXuckuhN+k+rWz4v6mKeXSfCkd9Vf0wHoejbfkM7S1ILl/GUA1PJbMvvHceU28Bxvr94KYywryFztLLxWWzXGCTJbg4/NqteSQv4DG4d9uB7gNe06EvUDIRu6Y8TFD3BJsCQrXAP1e/McEK3VPDm5gjZ/uanBG/eaGqDjmIC7RFdq2mSV+yzAKe5cDkfQzUDA3uxedVvOePkZ7JDVG3DIs8OchCo62JdYndosFsuOZNr10g7IxpqXrPBcvJ8t71xEjMDBm+zF3u6WzJdEIvlqUq0atptUdxVCQtkHc1gUHzumxDBz96B4By4qod3vztCF6jdEWcoC/BVG7REC2xzQpQGmBF2GHugu46TMTxkr4WZrb2DUtfywr6/Jt7bAN4EEekJZ9uXZxG83hdhhdBeLraPNGVWgAS6PS74Y419I8m/V/2B39gERLE3ukczCrsV3Rq0ZtV8Q4yt3Hf0SPlMAvsEoK5R7WLD6sW+dKccUSLeAJ+fUZS7LMhG4LPHECzCsk23dU7QSgSWaPrL3oXHj8KXKo5rVcMzdr9wKPS34ihYWfMAtN2zovuf2Ey4whfVDXae49tw40ee3nrYT0u2A2e491O9wsX9CJESb8UeUWfNrayBl5s8RbhJvzGnvnE= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(5660300002)(2616005)(83380400001)(4326008)(6666004)(81166007)(70206006)(47076005)(36860700001)(2906002)(1076003)(70586007)(316002)(8676002)(6916009)(508600001)(86362001)(426003)(15650500001)(82310400003)(16526019)(336012)(8936002)(36756003)(356005)(26005)(54906003)(44832011)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:25:58.2176 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69231292-93b0-40a6-9f9d-08d9930c5e70 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1270 Received-SPF: softfail client-ip=40.107.244.72; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov @@ -930,20 +930,20 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) Device (S00) { Name (_ADR, Zero) // _ADR: Address - Name (_SUN, Zero) // _SUN: Slot User Number + Name (ASUN, Zero) Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { - Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, ASUN)) } } Device (S10) { Name (_ADR, 0x00020000) // _ADR: Address - Name (_SUN, 0x02) // _SUN: Slot User Number + Name (ASUN, 0x02) Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { - Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, ASUN)) } Method (_S1D, 0, NotSerialized) // _S1D: S1 Device State with a hank per bridge: @@ -965,10 +965,10 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) Device (S18) { Name (_ADR, 0x00030000) // _ADR: Address - Name (_SUN, 0x03) // _SUN: Slot User Number + Name (ASUN, 0x03) Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { - Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, ASUN)) } } Signed-off-by: Igor Mammedov Message-Id: <20210624204229.998824-4-imammedo@redhat.com> Reviewed-by: Stefan Hajnoczi Tested-by: John Sucaet Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit 40f23e4e52f6188036062abea432560e5cdd239a) Signed-off-by: Michael Roth --- tests/data/acpi/pc/DSDT | Bin 6002 -> 6002 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 7327 -> 7327 bytes tests/data/acpi/pc/DSDT.bridge | Bin 8668 -> 8668 bytes tests/data/acpi/pc/DSDT.cphp | Bin 6466 -> 6466 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 7656 -> 7656 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 5969 -> 5969 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 6074 -> 6074 bytes tests/data/acpi/pc/DSDT.memhp | Bin 7361 -> 7361 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 5860 -> 5860 bytes tests/data/acpi/pc/DSDT.numamem | Bin 6008 -> 6008 bytes tests/qtest/bios-tables-test-allowed-diff.h | 10 ---------- 11 files changed, 10 deletions(-) diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT index b9dd9b38e4ef720636ba19ccbdf262de8a6439d5..cc1223773e9c459a8d2f20666c051a74338d40b7 100644 GIT binary patch delta 61 zcmeyQ_eqb-CD&USu&WP9BD%?o fCD_m)o+IATC5VTCfr)_wB+SKxRm0{lLaR9eXLTFp delta 62 zcmbPlIp31YCDgG8yduO#5=kK@h~tjF>rvS QxR@rdlak#0LuffC015RFTL1t6 diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/pc/DSDT.bridge index a9b4d5659457f6de30b993962bce673c9413d81d..77778c3a69946efd501e7eff0a73af309b553f13 100644 GIT binary patch delta 73 zcmccPe8-u~CD3CG}2zvw0}mS97Jc#e2SmmnSn1||j$ R$H}$)l8la3>@*3 PYxyM^<2O&|U(E>s%3KcC diff --git a/tests/data/acpi/pc/DSDT.dimmpxm b/tests/data/acpi/pc/DSDT.dimmpxm index e00a447f92b27f9a91be802eb11fe89dc0457e20..b56b2e089017f933f8a3089c4fd2389fb8ef1e40 100644 GIT binary patch delta 100 zcmaE1{lc2dCDwlr;t!7i diff --git a/tests/data/acpi/pc/DSDT.hpbridge b/tests/data/acpi/pc/DSDT.hpbridge index 5d8ba195055f2eda74223323baeb88390ea36739..bb0593eeb8730d51a6f0fe51a00a00df9c83c419 100644 GIT binary patch delta 78 zcmcbpcTtbaCD@v8 delta 74 zcmcbpcTtbaCD|UB3{<`;7~t?$&P$dLS8Jvh6eE*@s2J*JPZs>3>@*3 b*YZj-#!o)ZYrqCl#>EU&C%0Le&x{iQ&x;Zm diff --git a/tests/data/acpi/pc/DSDT.ipmikcs b/tests/data/acpi/pc/DSDT.ipmikcs index 01e53bd436698db6f6adfff584ec56cb99074a5f..2e618e49d357ae1d0ac20d822f71d676ea90f2fc 100644 GIT binary patch delta 53 zcmdm`ze}IXCDYt>y#( Dp7{>n delta 49 zcmdm`ze}IXCD T3>=P={|HGkI&KydUd;&rQ4bK$ delta 65 zcmX?TdC-!}CDwF!J&Q(lNp6YCOe3*33;&u8yduO#5=kK@h~tj UF>u6B{v#v_lw#Q|DZGLc04$Uc4*&oF diff --git a/tests/data/acpi/pc/DSDT.nohpet b/tests/data/acpi/pc/DSDT.nohpet index d4f0050533f970128774f825274177096a46c3b8..623f06a900d12500d2197d101f76f6875e92ed64 100644 GIT binary patch delta 61 zcmaE&`$U(^CD>0$#B;Y{|Qt696|m5IX<> delta 59 zcmaE&`$U(^CDnU(Dn?CJxOh;H&? f2{tr{=ZJT73F2X3U}E3^33D-F)v)<2?`lo}e)Jpa delta 62 zcmeyN_d}1%CD X-Patchwork-Id: 12570223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B486C433FE for ; Tue, 19 Oct 2021 14:58:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B591360F22 for ; Tue, 19 Oct 2021 14:58:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B591360F22 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqZD-0008HW-LU for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:58:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq4U-0007jI-5D; Tue, 19 Oct 2021 10:26:31 -0400 Received: from mail-dm6nam11on2050.outbound.protection.outlook.com ([40.107.223.50]:6080 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq4R-0003Uw-J8; Tue, 19 Oct 2021 10:26:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mfTUhgyPBQvKw1fSm/HQjGHp5AKMltOZUIWiou4HwEKdZ6f0QBwY8KoVwByjRqq9ehNHrDcMWCZ7q7355CRi2S/NB7K0V4h1MrCOl14GlXiuT2xHve15IdCGcXuBedwFK9vj8e48N+lMumpoApvTWtXlI6hxeWiYhZ/NGdghkTecMM+9SndX0+jU39zYoMVuI8oOdusKFZVwE4mZQ7I7al1qz84JQn7Fz+sTDmaW7QM15MvUrcwGTvODmt8gNvnn+0J+EU23yMaCGuR7QUJxiqyymFO/IDQ10+zWSukzuT17kBuz4DBFRBY4HnLaU2hmSXO9PfnIxntMQZJPNJUPXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VhbE1+ogRBrZ2nwEg5/Iy3iWBahfTdUFfxdmU30+kz8=; b=fdlhchyLJSxtJrnp3kqmU6h04jKQ7dfeUhB6h5ekeInpu89mkY+oX2GEf4Ya/Z7Q6hJL2PhL4OvBPLUwfynjq65p/HhXSgsf+L6nFNiq8w7thbYBwr70qzOPMAZv63OzOw1tELKZ/J/fDFLBgsFTpm1fFxqu1s7XLAeks/sNCGlY2yl2CV3N9aP4y7M8rzchSLtYUFm38uYrggGaMErRtSaCwpw5lotyKI6VQmIsuRZjqYxzLPVwInYttCaKMdj8XA+7ZeVjFV0i5rU4syyJEXV+ZATCR8cxwelQHKUCwtMuAp8qoyHnqFKM3CduDV8KwFNnfozg/ITjqsz0LXDOUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VhbE1+ogRBrZ2nwEg5/Iy3iWBahfTdUFfxdmU30+kz8=; b=EaPZiEEx4lryPR463MJdppQfF9mXO5w0zVLYRmFnfFUnpo/cYv8cM+HHBfwARRhcM+QHPCQg2cObXlOtK3HWTK4J6VxhM484vwKHyEqx2SF7Ls3YSwAzUyRH+/Oj4Bg+rwiaIBTJfQ0wH9lpZMjxyV0koU0eUS7yB/QOkVQ9jTk= Received: from DM5PR19CA0066.namprd19.prod.outlook.com (2603:10b6:3:116::28) by MN2PR12MB3871.namprd12.prod.outlook.com (2603:10b6:208:16a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:26:21 +0000 Received: from DM6NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:3:116:cafe::b1) by DM5PR19CA0066.outlook.office365.com (2603:10b6:3:116::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:26:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT005.mail.protection.outlook.com (10.13.172.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:26:20 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:26:19 -0500 From: Michael Roth To: CC: , Gollu Appalanaidu , Klaus Jensen Subject: [PATCH 39/64] hw/block/nvme: align with existing style Date: Tue, 19 Oct 2021 09:09:19 -0500 Message-ID: <20211019140944.152419-40-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 061bdd90-d895-448e-22d2-08d9930c6bcc X-MS-TrafficTypeDiagnostic: MN2PR12MB3871: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OIoK/fAtr1wuEa3qeZf16E3vWdlmP68nZvt3eEC8ITprPPlO+1jjuBq7LtVCVjmY9tD92ZnIEYkmsC2EnyeaNmoUFngJvz9jTeyuSghJT2HgYGwiuFPPAQ9CiuZy2jD0zGoYiZnx07qEDITrYxe7n6E67ONcqqwkt3bYRhGD0JLMTrEh389aNpddUpfNQsqIKRgrP21S5bf9NJ4x78wgnaPoQKSBA9txN8HR741U8x2eJdetIzGtTn1mGFOkAK6alPttzJmW5Zb2u60IFOyuPxfqrezAvaioQYB+C7NUFnJiRaJgWsr79bK9QZJ/7jcMEu5UWrmNaSjYFEq29jH82/CLbRK86qAz4FqSvgYZGh+B3HaFTT+cynEB7c1Ff3A5vNCo5ihAq+vx/7MQjzK2WgsEpE465C2ljI6H9D+1SgBkDpsWl2QWbaBRSM0ZaNA5605mkfDyRFwPH766qX1wzCJOYb/+cISYcNd8f9iavdbMb6Hqhbn6eOzt95U1kTYajlsd8G0ZLQpY1iK9T9ZALflECLTOvRKm/tduOYuQ4NkS9pMIDwWrYjJ4i3T6SvPxvhYpBYHg/odGSik9fsReyFDvW1r1/2itifjXk55oZ7esFqQSy4Q6o2oQpp0Ua4SEE03txfg+knafzShDisbyZ4nlQSP4icx5wP+pAwinTkZQdjt0cRYg3VymY5fbTl9X9/OTtNpJxh8NMp24kgVvyPuwQ2H+0jUrmY30PVczkmqazvgZjPk+9UJpKrUPC2feU1nIMyajDVtW2ebTX5HfIz3Hj6XtEAch75zliC833IopZ520k4yA4O3kTSSOhlxT X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(336012)(2616005)(2906002)(6916009)(426003)(86362001)(36756003)(356005)(81166007)(70206006)(70586007)(44832011)(8676002)(186003)(8936002)(508600001)(4326008)(54906003)(316002)(16526019)(36860700001)(5660300002)(966005)(83380400001)(47076005)(1076003)(82310400003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:26:20.6277 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 061bdd90-d895-448e-22d2-08d9930c6bcc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3871 Received-SPF: softfail client-ip=40.107.223.50; envelope-from=Michael.Roth@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gollu Appalanaidu While QEMU coding style prefers lowercase hexadecimals in constants, the NVMe subsystem uses the format from the NVMe specifications in comments, i.e. 'h' suffix instead of '0x' prefix. Fix this up across the code base. Signed-off-by: Gollu Appalanaidu [k.jensen: updated message; added conversion in a couple of missing comments] Signed-off-by: Klaus Jensen (cherry picked from commit 312c3531bba416e589f106db8c8241fc6e7e6332) *context dependency for 2b02aabc9d Signed-off-by: Michael Roth --- hw/block/nvme-ns.c | 2 +- hw/block/nvme.c | 67 +++++++++++++++++++++++++------------------- include/block/nvme.h | 10 +++---- 3 files changed, 44 insertions(+), 35 deletions(-) diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index 7bb618f182..a0895614d9 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block/nvme-ns.c @@ -303,7 +303,7 @@ static void nvme_ns_init_zoned(NvmeNamespace *ns) id_ns_z = g_malloc0(sizeof(NvmeIdNsZoned)); - /* MAR/MOR are zeroes-based, 0xffffffff means no limit */ + /* MAR/MOR are zeroes-based, FFFFFFFFFh means no limit */ id_ns_z->mar = cpu_to_le32(ns->params.max_active_zones - 1); id_ns_z->mor = cpu_to_le32(ns->params.max_open_zones - 1); id_ns_z->zoc = 0; diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 5fe082ec34..2c7ca587c5 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -12,10 +12,19 @@ * Reference Specs: http://www.nvmexpress.org, 1.4, 1.3, 1.2, 1.1, 1.0e * * https://nvmexpress.org/developers/nvme-specification/ - */ - -/** - * Usage: add options: + * + * + * Notes on coding style + * --------------------- + * While QEMU coding style prefers lowercase hexadecimals in constants, the + * NVMe subsystem use thes format from the NVMe specifications in the comments + * (i.e. 'h' suffix instead of '0x' prefix). + * + * Usage + * ----- + * See docs/system/nvme.rst for extensive documentation. + * + * Add options: * -drive file=,if=none,id= * -device nvme-subsys,id=,nqn= * -device nvme,serial=,id=, \ @@ -3607,18 +3616,18 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req) /* * In the base NVM command set, Flush may apply to all namespaces - * (indicated by NSID being set to 0xFFFFFFFF). But if that feature is used + * (indicated by NSID being set to FFFFFFFFh). But if that feature is used * along with TP 4056 (Namespace Types), it may be pretty screwed up. * - * If NSID is indeed set to 0xFFFFFFFF, we simply cannot associate the + * If NSID is indeed set to FFFFFFFFh, we simply cannot associate the * opcode with a specific command since we cannot determine a unique I/O - * command set. Opcode 0x0 could have any other meaning than something + * command set. Opcode 0h could have any other meaning than something * equivalent to flushing and say it DOES have completely different - * semantics in some other command set - does an NSID of 0xFFFFFFFF then + * semantics in some other command set - does an NSID of FFFFFFFFh then * mean "for all namespaces, apply whatever command set specific command - * that uses the 0x0 opcode?" Or does it mean "for all namespaces, apply - * whatever command that uses the 0x0 opcode if, and only if, it allows - * NSID to be 0xFFFFFFFF"? + * that uses the 0h opcode?" Or does it mean "for all namespaces, apply + * whatever command that uses the 0h opcode if, and only if, it allows NSID + * to be FFFFFFFFh"? * * Anyway (and luckily), for now, we do not care about this since the * device only supports namespace types that includes the NVM Flush command @@ -3934,7 +3943,7 @@ static uint16_t nvme_changed_nslist(NvmeCtrl *n, uint8_t rae, uint32_t buf_len, NVME_CHANGED_NSID_SIZE) { /* * If more than 1024 namespaces, the first entry in the log page should - * be set to 0xffffffff and the others to 0 as spec. + * be set to FFFFFFFFh and the others to 0 as spec. */ if (i == ARRAY_SIZE(nslist)) { memset(nslist, 0x0, sizeof(nslist)); @@ -4332,7 +4341,7 @@ static uint16_t nvme_identify_nslist(NvmeCtrl *n, NvmeRequest *req, trace_pci_nvme_identify_nslist(min_nsid); /* - * Both 0xffffffff (NVME_NSID_BROADCAST) and 0xfffffffe are invalid values + * Both FFFFFFFFh (NVME_NSID_BROADCAST) and FFFFFFFFEh are invalid values * since the Active Namespace ID List should return namespaces with ids * *higher* than the NSID specified in the command. This is also specified * in the spec (NVM Express v1.3d, Section 5.15.4). @@ -4379,7 +4388,7 @@ static uint16_t nvme_identify_nslist_csi(NvmeCtrl *n, NvmeRequest *req, trace_pci_nvme_identify_nslist_csi(min_nsid, c->csi); /* - * Same as in nvme_identify_nslist(), 0xffffffff/0xfffffffe are invalid. + * Same as in nvme_identify_nslist(), FFFFFFFFh/FFFFFFFFEh are invalid. */ if (min_nsid >= NVME_NSID_BROADCAST - 1) { return NVME_INVALID_NSID | NVME_DNR; @@ -4446,7 +4455,7 @@ static uint16_t nvme_identify_ns_descr_list(NvmeCtrl *n, NvmeRequest *req) /* * Because the NGUID and EUI64 fields are 0 in the Identify Namespace data - * structure, a Namespace UUID (nidt = 0x3) must be reported in the + * structure, a Namespace UUID (nidt = 3h) must be reported in the * Namespace Identification Descriptor. Add the namespace UUID here. */ ns_descrs->uuid.hdr.nidt = NVME_NIDT_UUID; @@ -4595,7 +4604,7 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeRequest *req) /* * The Reservation Notification Mask and Reservation Persistence * features require a status code of Invalid Field in Command when - * NSID is 0xFFFFFFFF. Since the device does not support those + * NSID is FFFFFFFFh. Since the device does not support those * features we can always return Invalid Namespace or Format as we * should do for all other features. */ @@ -4847,15 +4856,15 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req) } /* - * NVMe v1.3, Section 5.21.1.7: 0xffff is not an allowed value for NCQR + * NVMe v1.3, Section 5.21.1.7: FFFFh is not an allowed value for NCQR * and NSQR. */ if ((dw11 & 0xffff) == 0xffff || ((dw11 >> 16) & 0xffff) == 0xffff) { return NVME_INVALID_FIELD | NVME_DNR; } - trace_pci_nvme_setfeat_numq((dw11 & 0xFFFF) + 1, - ((dw11 >> 16) & 0xFFFF) + 1, + trace_pci_nvme_setfeat_numq((dw11 & 0xffff) + 1, + ((dw11 >> 16) & 0xffff) + 1, n->params.max_ioqpairs, n->params.max_ioqpairs); req->cqe.result = cpu_to_le32((n->params.max_ioqpairs - 1) | @@ -5493,7 +5502,7 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data, n->bar.cc = data; } break; - case 0x1C: /* CSTS */ + case 0x1c: /* CSTS */ if (data & (1 << 4)) { NVME_GUEST_ERR(pci_nvme_ub_mmiowr_ssreset_w1c_unsupported, "attempted to W1C CSTS.NSSRO" @@ -5505,7 +5514,7 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data, } break; case 0x20: /* NSSR */ - if (data == 0x4E564D65) { + if (data == 0x4e564d65) { trace_pci_nvme_ub_mmiowr_ssreset_unsupported(); } else { /* The spec says that writes of other values have no effect */ @@ -5575,11 +5584,11 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data, n->bar.cmbmsc = (n->bar.cmbmsc & 0xffffffff) | (data << 32); return; - case 0xE00: /* PMRCAP */ + case 0xe00: /* PMRCAP */ NVME_GUEST_ERR(pci_nvme_ub_mmiowr_pmrcap_readonly, "invalid write to PMRCAP register, ignored"); return; - case 0xE04: /* PMRCTL */ + case 0xe04: /* PMRCTL */ n->bar.pmrctl = data; if (NVME_PMRCTL_EN(data)) { memory_region_set_enabled(&n->pmr.dev->mr, true); @@ -5590,19 +5599,19 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data, n->pmr.cmse = false; } return; - case 0xE08: /* PMRSTS */ + case 0xe08: /* PMRSTS */ NVME_GUEST_ERR(pci_nvme_ub_mmiowr_pmrsts_readonly, "invalid write to PMRSTS register, ignored"); return; - case 0xE0C: /* PMREBS */ + case 0xe0C: /* PMREBS */ NVME_GUEST_ERR(pci_nvme_ub_mmiowr_pmrebs_readonly, "invalid write to PMREBS register, ignored"); return; - case 0xE10: /* PMRSWTP */ + case 0xe10: /* PMRSWTP */ NVME_GUEST_ERR(pci_nvme_ub_mmiowr_pmrswtp_readonly, "invalid write to PMRSWTP register, ignored"); return; - case 0xE14: /* PMRMSCL */ + case 0xe14: /* PMRMSCL */ if (!NVME_CAP_PMRS(n->bar.cap)) { return; } @@ -5622,7 +5631,7 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data, } return; - case 0xE18: /* PMRMSCU */ + case 0xe18: /* PMRMSCU */ if (!NVME_CAP_PMRS(n->bar.cap)) { return; } @@ -5664,7 +5673,7 @@ static uint64_t nvme_mmio_read(void *opaque, hwaddr addr, unsigned size) * from PMRSTS should ensure prior writes * made it to persistent media */ - if (addr == 0xE08 && + if (addr == 0xe08 && (NVME_PMRCAP_PMRWBM(n->bar.pmrcap) & 0x02)) { memory_region_msync(&n->pmr.dev->mr, 0, n->pmr.dev->size); } diff --git a/include/block/nvme.h b/include/block/nvme.h index 4ac926fbc6..0739e0d665 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -848,8 +848,8 @@ enum NvmeStatusCodes { NVME_FW_REQ_SUSYSTEM_RESET = 0x0110, NVME_NS_ALREADY_ATTACHED = 0x0118, NVME_NS_PRIVATE = 0x0119, - NVME_NS_NOT_ATTACHED = 0x011A, - NVME_NS_CTRL_LIST_INVALID = 0x011C, + NVME_NS_NOT_ATTACHED = 0x011a, + NVME_NS_CTRL_LIST_INVALID = 0x011c, NVME_CONFLICTING_ATTRS = 0x0180, NVME_INVALID_PROT_INFO = 0x0181, NVME_WRITE_TO_RO = 0x0182, @@ -1409,9 +1409,9 @@ typedef enum NvmeZoneState { NVME_ZONE_STATE_IMPLICITLY_OPEN = 0x02, NVME_ZONE_STATE_EXPLICITLY_OPEN = 0x03, NVME_ZONE_STATE_CLOSED = 0x04, - NVME_ZONE_STATE_READ_ONLY = 0x0D, - NVME_ZONE_STATE_FULL = 0x0E, - NVME_ZONE_STATE_OFFLINE = 0x0F, + NVME_ZONE_STATE_READ_ONLY = 0x0d, + NVME_ZONE_STATE_FULL = 0x0e, + NVME_ZONE_STATE_OFFLINE = 0x0f, } NvmeZoneState; static inline void _nvme_check_size(void) From patchwork Tue Oct 19 14:09:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1899CC433EF for ; Tue, 19 Oct 2021 15:15:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 96AD76134F for ; Tue, 19 Oct 2021 15:15:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 96AD76134F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:54276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqqF-00048f-Ie for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:15:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq4o-0007vD-B9; Tue, 19 Oct 2021 10:26:50 -0400 Received: from mail-dm6nam12on2050.outbound.protection.outlook.com ([40.107.243.50]:44748 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq4m-0003oR-AA; Tue, 19 Oct 2021 10:26:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TrMKETpuaHuwRE8u1TAuiAXVQYO0LMJWKQbL4ktlHg3NJkWVQ9UyWhfQcGxqWLjwHLeiS/AdzTJ3TXmbREQvKAHai3hkxBipGVDvK4ktWTZ8euP5dP6NxA+pAexGzAO+VC2cL01wD//QNvtrVXjrdH82NqH8EYenWFU9GEBXWG1zgq3m4Eqe8Azo+WxrSIggJMud359rUr4+hq7zTJlwRzeiKYAzMwJ+XscmQToOsNVlvwIbG5MiEydK1S9cAOhTQqNLyvfrbpccKcoFUuJQRARcEhQ22xd1UsPf4iVWxKDNUYmegYN3nwedc0GAgR7qzku3U+5Bdobspn0vR6rIUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CmYSX/vXEq0cVlWcOAHycoQSqqyL7NN/0z+2b3k+tkw=; b=TetMGiy4AE6kdJGFTRzm6CAYsvv4uuR7fBHchT2C26Nc4jrHt77yF0G8+N1evwoVkFUgVIKLufVN1UMDoJvxKxlVKMXmTflUc1jhraHRsLJICLAXcwwqbzTslK0iTww5s3DOWmKN3cSGgCtbcRQ0B2IkQhvroch2U8ztG6U9M32GRKw8saxiaSuonifb1v9xsRzQ5VA7G6vzwGFiqLiowP6M4ybrvw/vLBpW60/u3VUMMYxaDWqaFIq3cQaVwX9GSIxN6RT40jNm50+NhYAEbIOO/2DFiwWuLcibcE9rH4NlnQHgHUvvyaLYoDfmzfMyWFsoJN3ztbu758kBqAj6jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CmYSX/vXEq0cVlWcOAHycoQSqqyL7NN/0z+2b3k+tkw=; b=MWhPk9u9z6rtR9AXJpU7+UDXI+DakFRWFuKPDFeTV05+UaIpuLwVXfAFSqiSavZRMcWBrwNsqf1TP978MD2rXnxbuJBFE5oHX8D79tL5EUlWSWtO17RlXKtF9lbCk4CRUkygSwhZms6WUaqH42F4qxd4qp1IC+8IFsrEH6rDf3Y= Received: from DM6PR11CA0020.namprd11.prod.outlook.com (2603:10b6:5:190::33) by DM5PR1201MB2537.namprd12.prod.outlook.com (2603:10b6:3:eb::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:26:44 +0000 Received: from DM6NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:5:190:cafe::8e) by DM6PR11CA0020.outlook.office365.com (2603:10b6:5:190::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:26:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT012.mail.protection.outlook.com (10.13.173.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:26:44 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:26:41 -0500 From: Michael Roth To: CC: , Klaus Jensen , Keith Busch Subject: [PATCH 40/64] hw/nvme: fix missing check for PMR capability Date: Tue, 19 Oct 2021 09:09:20 -0500 Message-ID: <20211019140944.152419-41-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 42da104b-16fb-404f-379f-08d9930c7a18 X-MS-TrafficTypeDiagnostic: DM5PR1201MB2537: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:415; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k5D+VmpBgs4dyTesdbEHiotN3HAfMbHZsI5SMGEepQbQw4qAo5bUJyNTpvoDwlCqmx8cxH5eCgls4JMybQpX16vDEAiezYZIWQtrY+L6mCIsPFl9Bmm0hSC+WOnl1i/9th/Q2SxE/ueuwT5rRUB8RZxXPKQZ19NN8Ihex/wSlCoalXNDL51+MEvIlOAvo34I1V1E6Vfyf8CLxXcZNjmAQ8x5tGwuHrfn96nNjILkFqEbl7dyEmFBtmBiLRYJfQ4L4NM0NZgPIPnK6KinV9m+ZKOrvc95Dlaqt2DwJF/qYDlBdyekmWl+KtnvNX7zSRjfWCxwBJjJ+bHUVocn0nO5RIWrHmMd0rGY+4VJ+QCqziycqQIIQA77dBBELTfl/+Kno/zlj5OLypjoqZmbQ9dMFQRDYun+YFYJr1ig8q+jTR+hWUFmzXe7WSvcV9sL1vtArjatd7yPd3jdL6MhNYnHQ3UKe5lRND5ox0TGSmPAZBXleerZ9A9nimTrBZtakwJN2gUC7ohlpwWLk109mv3sCilCOAiDaJ17kP+O394hd6aEbtp37556HuawSqFOiLMpALkIiAkHL9HPBNI2gkGkzYSYmJQSmOwXmRTWCZ7+30pOJA1T3v/Dq3X1XV8C2A/sMRRKrtUzB2TYAG80hQQn4LB1yQ1mBvCWCAVH+PMRhhF/DRxkB6xSJAYSs5WUfLTBtEfCA/oGM6uigbBKgMfj2FIwlCpXgaj25DKc4b1RZ5zaUr/CJWVR7e6Zxrp0rJ9kveMjjIUZkCfst4Wl28iaLyFSbgGp/YTvLJ7CQyrZUDByV4xRufARcu7A2K3L6l8O X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(70586007)(6916009)(70206006)(16526019)(36860700001)(5660300002)(44832011)(83380400001)(82310400003)(54906003)(6666004)(336012)(36756003)(356005)(426003)(4326008)(26005)(508600001)(2906002)(2616005)(8936002)(1076003)(86362001)(47076005)(966005)(8676002)(186003)(316002)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:26:44.6144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42da104b-16fb-404f-379f-08d9930c7a18 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB2537 Received-SPF: softfail client-ip=40.107.243.50; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Klaus Jensen Qiang Liu reported that an access on an unknown address is triggered in memory_region_set_enabled because a check on CAP.PMRS is missing for the PMRCTL register write when no PMR is configured. Cc: qemu-stable@nongnu.org Fixes: 75c3c9de961d ("hw/block/nvme: disable PMR at boot up") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/362 Signed-off-by: Klaus Jensen Reviewed-by: Keith Busch (cherry picked from commit 2b02aabc9d02f9e95946cf639f546bb61f1721b7) Signed-off-by: Michael Roth --- hw/block/nvme.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 2c7ca587c5..8f4e1fc3ac 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -5589,6 +5589,10 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offset, uint64_t data, "invalid write to PMRCAP register, ignored"); return; case 0xe04: /* PMRCTL */ + if (!NVME_CAP_PMRS(n->bar.cap)) { + return; + } + n->bar.pmrctl = data; if (NVME_PMRCTL_EN(data)) { memory_region_set_enabled(&n->pmr.dev->mr, true); From patchwork Tue Oct 19 14:09:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A638CC433F5 for ; Tue, 19 Oct 2021 15:03:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3BA9F6113B for ; Tue, 19 Oct 2021 15:03:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3BA9F6113B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:48188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqdo-0006PR-9b for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:03:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq5j-0001Q1-VT; Tue, 19 Oct 2021 10:27:47 -0400 Received: from mail-dm6nam10on2060.outbound.protection.outlook.com ([40.107.93.60]:7185 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq5U-0004IJ-HF; Tue, 19 Oct 2021 10:27:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h3l77zCSIyK6/eRf6RibEZv3oYjVGzoCx3eKlsEAtZRCUmocvTf/gOv7TYconYxNyEQbeD4TLmv/qsf1I+ugBtzNH22I27xXsjEAavYLE5hVJt0AnRUxCW10eyHQrc0rZQxc43MdGtZwZvNGQiCQDCsz/4xVsTYhMeqWqba41aDRiUwWjisleZ94crz6qz2TLomekq4I+/iexyCXaATBb5UsS7tkABN2AxlwSufGElWGs60TymMw6hA4doLF5H7eAnFsdXP39IcSlCjiFgqhMoPCxeEaV8lKqbI5S7q560/OzNodB+3PrAo3uNVECaWwp0TeZZcTUbFofbFta9i9lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1KBBfXbiPsWcRz8deCaALibCPd0HznJ0C2CpC7ml0YE=; b=AUziCGuF9xM4tAlTu1Lh8/9ap7C8gilZOS3QGrt9pumnjuwys126ikCy5qvEyEuhJnHmoCUWrYg53vpzwcEpib7c1Of+uRxFyfCrBzx/fhaNN3nYylt4kG1X9txiW6q441cqacu2iDJdkUA4R1XZxU+Pb4q/KzgAtDDS0q9B9Npxs5ORsGx8zyV9ILf8kFaZSRFC/9worS/gr+5CZdyyWq2u1b8zJ80RaWYY46pM7sxFoKWce43jOu905kVvO0nMj5P14JES37n1X7WZAlTv4tIl5bVCM3sNzfNqPocIyat4XewijWbW7qTzYjE/dokYE1CL0txMk9eVF/MrcKezTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1KBBfXbiPsWcRz8deCaALibCPd0HznJ0C2CpC7ml0YE=; b=rAESbnQRcSn7NZ4Id5c2oRHUZPNasamywCBX9rQwjgIQYrYg65YNfJrXAtCzL4oAoJCd5pDf+N05e0R2gZbNp6JsVddmnNq5NHMVjCxdjqFltUxgi6y28WH83bYO+usERx8SC6ADVmZPYPGPpXA1V5oYX7/XTOf5LeR/RewED90= Received: from DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) by CY4PR1201MB0168.namprd12.prod.outlook.com (2603:10b6:910:1d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:27:28 +0000 Received: from DM6NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:3:115:cafe::6b) by DM5PR11CA0002.outlook.office365.com (2603:10b6:3:115::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:27:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT025.mail.protection.outlook.com (10.13.172.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:27:28 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:27:27 -0500 From: Michael Roth To: CC: , Klaus Jensen , =?utf-8?b?SmFrdWIgSmVybcOhxZk=?= , Keith Busch Subject: [PATCH 41/64] hw/nvme: fix pin-based interrupt behavior (again) Date: Tue, 19 Oct 2021 09:09:21 -0500 Message-ID: <20211019140944.152419-42-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: adae406e-2b92-4c23-8282-08d9930c9415 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0168: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:324; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M4b76BopGc3WnbV8GakCHrvQYil8uo/SbwDgHvrl094D2qlH9RF4RRzqMq4b0f7w6CFydfp6JOeiX2NkV2sovXENRgO8lj56CqRw3I95xqAXfVyDJ2HpAEprlpgn7SlkKdt5jh1xED1iDeShZhy+bAex4aqHGN22jOB1UPH9jxHl2XpLuu1eVm4tV4ZSl5btWc3uR/QJSL0IJXcScrGakQKb/jeghww5n9UAT+LRfA+puyurAEu4CDlJVswfKuXqrOwmTTZ0AYg1/DAWdW2WHnBPH9JYwjcfE5XtEUHEOtr4exQlflpfRP+N/revQFc9miXNTn95fWhb2NTJmDre/ELZsAO8UhYFiPURLscn9UK9HQVpW1ELzFMOmLuvosI36HwG+j2ZuIi2ga95blN3PwQWZWOgC1cIOQXal07qKClmhDGk8Fflr35DMXf7kU0R9d+T1YL0CUUR0kTvyhL5Fy95tDIEDcEb/EpUOTdQD/B6spBEpTgBC006C9XfbgGRc/T08hZmBt4WNWjRCG1mIixxiJeeCbNTqWkN58sn0gn/qnFMcbqqIHhglwdLXKfDdia4dgEWkOBt+LC8/uPRYM7Z8gfe6YVKmPqItKULKKutzrPtiUY2+2PtubDgTni3V7RKGk3CAu8NAM3de1vQRiQwTPe9b/Ord9vBvYj2DAX+z9e/asqaoiiDKbeai9WG8Jg7DRgc/w6MubOqY493QaCG9MBGDBEK2f9X0+8/S9o= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(54906003)(426003)(36860700001)(70586007)(81166007)(8676002)(5660300002)(70206006)(2616005)(1076003)(83380400001)(336012)(2906002)(86362001)(47076005)(82310400003)(6916009)(356005)(8936002)(44832011)(6666004)(316002)(508600001)(186003)(4326008)(36756003)(26005)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:27:28.2165 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: adae406e-2b92-4c23-8282-08d9930c9415 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0168 Received-SPF: softfail client-ip=40.107.93.60; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Klaus Jensen Jakub noticed[1] that, when using pin-based interrupts, the device will unconditionally deasssert when any CQEs are acknowledged. However, the pin should not be deasserted if other completion queues still holds unacknowledged CQEs. The bug is an artifact of commit ca247d35098d ("hw/block/nvme: fix pin-based interrupt behavior") which fixed one bug but introduced another. This is the third time someone tries to fix pin-based interrupts (see commit 5e9aa92eb1a5 ("hw/block: Fix pin-based interrupt behaviour of NVMe"))... Third time's the charm, so fix it, again, by keeping track of how many CQs have unacknowledged CQEs and only deassert when all are cleared. [1]: <20210610114624.304681-1-jakub.jermar@kernkonzept.com> Cc: qemu-stable@nongnu.org Fixes: ca247d35098d ("hw/block/nvme: fix pin-based interrupt behavior") Reported-by: Jakub Jermář Signed-off-by: Klaus Jensen Reviewed-by: Keith Busch (cherry picked from commit 83d7ed5c570d4c1d5163951b3057cac2ae7da4ff) *avoid dependency on 88eea45c ("hw/nvme: move nvme emulation out of hw/block") Signed-off-by: Michael Roth --- hw/block/nvme.c | 18 +++++++++++++++++- hw/block/nvme.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 8f4e1fc3ac..5b4892489e 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -469,7 +469,9 @@ static void nvme_irq_deassert(NvmeCtrl *n, NvmeCQueue *cq) return; } else { assert(cq->vector < 32); - n->irq_status &= ~(1 << cq->vector); + if (!n->cq_pending) { + n->irq_status &= ~(1 << cq->vector); + } nvme_irq_check(n); } } @@ -1262,6 +1264,7 @@ static void nvme_post_cqes(void *opaque) NvmeCQueue *cq = opaque; NvmeCtrl *n = cq->ctrl; NvmeRequest *req, *next; + bool pending = cq->head != cq->tail; int ret; QTAILQ_FOREACH_SAFE(req, &cq->req_list, entry, next) { @@ -1291,6 +1294,10 @@ static void nvme_post_cqes(void *opaque) QTAILQ_INSERT_TAIL(&sq->req_list, req, entry); } if (cq->tail != cq->head) { + if (cq->irq_enabled && !pending) { + n->cq_pending++; + } + nvme_irq_assert(n, cq); } } @@ -4091,6 +4098,11 @@ static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeRequest *req) trace_pci_nvme_err_invalid_del_cq_notempty(qid); return NVME_INVALID_QUEUE_DEL; } + + if (cq->irq_enabled && cq->tail != cq->head) { + n->cq_pending--; + } + nvme_irq_deassert(n, cq); trace_pci_nvme_del_cq(qid); nvme_free_cq(cq, n); @@ -5768,6 +5780,10 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr, int val) } if (cq->tail == cq->head) { + if (cq->irq_enabled) { + n->cq_pending--; + } + nvme_irq_deassert(n, cq); } } else { diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 5d05ec368f..d216e5674d 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -171,6 +171,7 @@ typedef struct NvmeCtrl { uint32_t max_q_ents; uint8_t outstanding_aers; uint32_t irq_status; + int cq_pending; uint64_t host_timestamp; /* Timestamp sent by the host */ uint64_t timestamp_set_qemu_clock_ms; /* QEMU clock time */ uint64_t starttime_ms; From patchwork Tue Oct 19 14:09:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED8CBC433EF for ; Tue, 19 Oct 2021 14:53:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C61E6137F for ; Tue, 19 Oct 2021 14:53:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8C61E6137F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:53164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqUc-0007cM-Lu for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:53:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq5w-0001ya-O7; Tue, 19 Oct 2021 10:28:02 -0400 Received: from mail-mw2nam10on2072.outbound.protection.outlook.com ([40.107.94.72]:10629 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq5u-0004Xp-If; Tue, 19 Oct 2021 10:28:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mQzOBLJbdaXs1E84ZboutW6vAFhYfWk1f+ynQi23eotUMstSw87Xrh3Pd7fm0YK4d+i9Z/F9CoqRINukjicq7AlpqYRLvqWolMy817WWzfrqooPTpYu4TNkPL65nTwuGog/lTDVMOSCRy/cd1y+s9yR+4ZSjGHGW2bqQnJUWUkJXa2+xfmlHW2t9C+zR5ij9oORLnGLi2c5fULjWcLcE6ULzJcQ2sqyuHrIXHRL8tTmkuxGi3Bb3XYpTsU7XAjsXCTjMBHoIqNHb4fJltRI8TMyRt5J5y+ZNNqQXMMJTFOF3N6nf8iOoenw169Hq1Iz7EXG5DL9dxWaxua0TzzY1Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v+6V18KVCgMKY4WRYQbW8MAcpyOLvV0o+utT7DouAQ4=; b=jHvJqfT7K+zSmvsvAuCeifgYe4U03DJpyUI69w0NG83p6bAs0/Gl3xvwto/gzHe7gebyQ1RtNUnAWFrXDF+ZWFbx5XCMA09aSO2kA2IP9kcEhFTzabGza+KskEunhmuTChMCaFcI8zyMnvTyCGYlLdBIN1iF/iqDGSJaiGB8xdtxQkxsqvo8aF0t1DAID4mKOlRvCiQB2r9iRVCw+NQhZFsGn4o+0lmB0LSxS97sDyAyu6u2LHR5VUTLVJNPkUSmFpsN8K16eB/t/y5KTjNTX125wrSSKUowBDTURpu4crSYI1A7TuH9KkRaqnH7zzG7Djt58GOMQMimKPXM2mqinA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v+6V18KVCgMKY4WRYQbW8MAcpyOLvV0o+utT7DouAQ4=; b=OwT5GvBj5nGKY5TiP30OKrkYnhov7icXYkxgiofFyloM76MWdeDovoBSDKKzgJDEH3qnTWQ3djdBW4i4+dcHBsywoARckMOLuNUC9XGtovXH3UHxVirzoPv4Mel3CqRkzVjHqPh2uRFiq7WKUEk6n7oBNGLx+X5IOs24R5kA60k= Received: from DS7PR03CA0354.namprd03.prod.outlook.com (2603:10b6:8:55::12) by DM5PR1201MB0108.namprd12.prod.outlook.com (2603:10b6:4:58::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:27:53 +0000 Received: from DM6NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::32) by DS7PR03CA0354.outlook.office365.com (2603:10b6:8:55::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:27:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT031.mail.protection.outlook.com (10.13.172.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:27:52 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:27:49 -0500 From: Michael Roth To: CC: , David Hildenbrand , Wei Wang , "Michael S . Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alexander Duyck , Juan Quintela , "Dr. David Alan Gilbert" , Peter Xu Subject: [PATCH 42/64] virtio-balloon: don't start free page hinting if postcopy is possible Date: Tue, 19 Oct 2021 09:09:22 -0500 Message-ID: <20211019140944.152419-43-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aebaed1d-b277-4e80-9ac7-08d9930ca29f X-MS-TrafficTypeDiagnostic: DM5PR1201MB0108: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fxec5QXoV48VkNnyscd8001cg5b+AtSRtLECHB/scIcUyGar2Jb6IF7v/lz7X9ZlNlk8NRzirSlCNR6ddmqVxgUNthjNKdSB0lAdBa71SGvHcKkvnx2kQx6/DZNFUdZm9s/7qAwmHKWCNr93NkdjBnUKI3t3WscuoiyLadDNo+ruKU1FVo3m88ZPVt4RG9/jBBGZ7SZdgJscWb7jVFnUj4C+P/RwTcWEfSfqtVFdGX0YhweWqXwSigh8+ua1S6+ITrDfTAv9OOWMDWMt4txr07rPFJs5Ihx8K0eS8R8LOu+Mr8IMrT26gvOe4Ght8BG5rY/mzVcIMPdFbQzMgEtxWLDFVBQ2lY5u0dWmgBw7wVsx6bw5XmOXg+rLgFUaphfX80NtmWFfci06LL25QgP7cWQeJFI5YelqM4eDA9plpbjfo8msro0n4ZWiA6fCG+HM+LZuTzwSNeI81NuxWzfD+MlMjJf3JdWTT7DyBWvXFIg3YcEs6WCXnAyL1hphu8YohyKTwkTUCGxel8zfp/OXZNxAsX0g1eN/wDP3vlrSjzP8zmYg51/+OwDVlLOC32kV61/GtltjZXyVqSSs0q2ILI2mHL8c1lTgasdeqBmWLz8HvVpVdPejLsvB0owIc3IaHBfJD9KmbKb5U1OehPwwJddeQ6TiWz+pabbd1lKXv3EdHlZMqDoXpitK6slaxolbRHeGD0S0Svd+rrERtCPofPM77qguOIMz8Rn9x/Kez3qzounObCSUBFeevCUob4iUdEbHljN6/yD0tGMql2FsSceO2apsSRLxczZ3bvBVw/PqfrzCmCgwQ4aSahTIlla5 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(2616005)(2906002)(36756003)(83380400001)(81166007)(70206006)(336012)(508600001)(6916009)(16526019)(426003)(44832011)(186003)(8936002)(82310400003)(6666004)(966005)(36860700001)(4326008)(5660300002)(356005)(8676002)(54906003)(7416002)(70586007)(1076003)(26005)(47076005)(86362001)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:27:52.6095 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aebaed1d-b277-4e80-9ac7-08d9930ca29f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0108 Received-SPF: softfail client-ip=40.107.94.72; envelope-from=Michael.Roth@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Postcopy never worked properly with 'free-page-hint=on', as there are at least two issues: 1) With postcopy, the guest will never receive a VIRTIO_BALLOON_CMD_ID_DONE and consequently won't release free pages back to the OS once migration finishes. The issue is that for postcopy, we won't do a final bitmap sync while the guest is stopped on the source and virtio_balloon_free_page_hint_notify() will only call virtio_balloon_free_page_done() on the source during PRECOPY_NOTIFY_CLEANUP, after the VM state was already migrated to the destination. 2) Once the VM touches a page on the destination that has been excluded from migration on the source via qemu_guest_free_page_hint() while postcopy is active, that thread will stall until postcopy finishes and all threads are woken up. (with older Linux kernels that won't retry faults when woken up via userfaultfd, we might actually get a SEGFAULT) The issue is that the source will refuse to migrate any pages that are not marked as dirty in the dirty bmap -- for example, because the page might just have been sent. Consequently, the faulting thread will stall, waiting for the page to be migrated -- which could take quite a while and result in guest OS issues. While we could fix 1) comparatively easily, 2) is harder to get right and might require more involved RAM migration changes on source and destination [1]. As it never worked properly, let's not start free page hinting in the precopy notifier if the postcopy migration capability was enabled to fix it easily. Capabilities cannot be enabled once migration is already running. Note 1: in the future we might either adjust migration code on the source to track pages that have actually been sent or adjust migration code on source and destination to eventually send pages multiple times from the source and and deal with pages that are sent multiple times on the destination. Note 2: virtio-mem has similar issues, however, access to "unplugged" memory by the guest is very rare and we would have to be very lucky for it to happen during migration. The spec states "The driver SHOULD NOT read from unplugged memory blocks ..." and "The driver MUST NOT write to unplugged memory blocks". virtio-mem will move away from virtio_balloon_free_page_done() soon and handle this case explicitly on the destination. [1] https://lkml.kernel.org/r/e79fd18c-aa62-c1d8-c7f3-ba3fc2c25fc8@redhat.com Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") Cc: qemu-stable@nongnu.org Cc: Wei Wang Cc: Michael S. Tsirkin Cc: Philippe Mathieu-Daudé Cc: Alexander Duyck Cc: Juan Quintela Cc: "Dr. David Alan Gilbert" Cc: Peter Xu Signed-off-by: David Hildenbrand Message-Id: <20210708095339.20274-2-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Peter Xu (cherry picked from commit fd51e54fa10221e5a8add894c38cc1cf199f4bc4) Signed-off-by: Michael Roth --- hw/virtio/virtio-balloon.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index d120bf8f43..4cdbe6b540 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -30,6 +30,7 @@ #include "trace.h" #include "qemu/error-report.h" #include "migration/misc.h" +#include "migration/migration.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" @@ -662,6 +663,18 @@ virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data) return 0; } + /* + * Pages hinted via qemu_guest_free_page_hint() are cleared from the dirty + * bitmap and will not get migrated, especially also not when the postcopy + * destination starts using them and requests migration from the source; the + * faulting thread will stall until postcopy migration finishes and + * all threads are woken up. Let's not start free page hinting if postcopy + * is possible. + */ + if (migrate_postcopy_ram()) { + return 0; + } + switch (pnd->reason) { case PRECOPY_NOTIFY_SETUP: precopy_enable_free_page_optimization(); From patchwork Tue Oct 19 14:09:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16C72C433EF for ; Tue, 19 Oct 2021 14:56:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 773406138F for ; Tue, 19 Oct 2021 14:56:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 773406138F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqXl-00056W-In for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 10:56:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq6J-0002r5-F5; Tue, 19 Oct 2021 10:28:23 -0400 Received: from mail-dm6nam12on2060.outbound.protection.outlook.com ([40.107.243.60]:30344 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq6G-0004md-HZ; Tue, 19 Oct 2021 10:28:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jw5pAnrXc/xc6nEkcabg0II8sFZfUcugkPcLbLkqnmAEeWRf+LRiHlhy+ouLvE++OkJ1Vsf2WTbCp+XFkHM+0ozHMV+4kqkjF4UC8NGC2gaRDEiPYwk1CbSlksAv8cR5Qq5tP/p5cvhIRxeYaTrf39Mru5MGyaU2XN7ZnYcZC6XbWn0N+Zx4NtVsomGmHDzLm+ljksRlL+RjIhFt33991XY+O5Smqp0/8yHmxWuWntX7OifnhUNJ6bRofGQiXXf8CfmzRbCCBaKterSp9rv4ggvVric8xu6t6x9j9GOsqqDXoxoFfCxnx8+qI3Vl+hJ4ycwLbE3nljy1mo8rAiaWgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1kH8Em2T1K+uwp9kEoXCOmDNDYh6qB48qTJz4MvA4Ok=; b=kajy8o+uz3zNuJKtAGAVu7X0HvIt3j6eteMSTmueB66gGSW5IbeZznvhCkSPl62r3diBrUC/GgRSszeolG5XclfbJDybQ4Oj7BugKElt9Dw9lBaV4TFYiAnn/qIl9bDpXgclL8B2oc43e9WzU1aWu4HrDX8lMHbDdnrJfWcm+pf8FhoZZ2xcIe9LfDD5MeWnCki+vjg8uEH60bryfnf57nmRF9DYjOmDVAGdXoNCtUgHbU874tcR+mWRRMgm7P1rE/RNBd3db9x7Nbvfcz5uIdWwdErtMtQdEUE1LPZbwoW+HgMNXe8mP/lUwfH363tJ8GRxM32D/kkpqWbqiYc6Jg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1kH8Em2T1K+uwp9kEoXCOmDNDYh6qB48qTJz4MvA4Ok=; b=Ppyj9Pp2dGzb/kySvAHZQUs8VkK1DyymypAfrs8lLyGjA/7uxtl+0CQmXLqJ/vwC+D1nlW8W/8322ahnX/xJTUkLtaEdQrxZgthYL/fTxXBvq1sP6lErUFp0b22yc7sfbWwfKDltc+i3Y/w2HK6urRXJ45I+SXGHQsGLGVTLHBs= Received: from DM5PR18CA0067.namprd18.prod.outlook.com (2603:10b6:3:22::29) by BN9PR12MB5353.namprd12.prod.outlook.com (2603:10b6:408:102::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:28:15 +0000 Received: from DM6NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:3:22:cafe::47) by DM5PR18CA0067.outlook.office365.com (2603:10b6:3:22::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:28:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT030.mail.protection.outlook.com (10.13.172.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:28:14 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:28:12 -0500 From: Michael Roth To: CC: , Pavel Pisa , Qiang Ning , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jason Wang Subject: [PATCH 43/64] hw/net/can: sja1000 fix buff2frame_bas and buff2frame_pel when dlc is out of std CAN 8 bytes Date: Tue, 19 Oct 2021 09:09:23 -0500 Message-ID: <20211019140944.152419-44-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c9ddf02-2c35-43ef-2542-08d9930cafc3 X-MS-TrafficTypeDiagnostic: BN9PR12MB5353: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:203; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dF3z/atBdUJlj3NKm2zKoGNaQvkJZt0GlFbMbdgKIQMHDk0NulxvxE6dDLOZa19enyWvPeMmIJ1+YCJvG9XoLgo72VemHzLM6xhzqsT/+qyAP/gm/LeBdtYU9LGY5lqis2U3AeH1+HYrzfIwI4Ap28PKQCAzzSs2+g3H1QVqdf0D58hS2pkkXlKK4YEjTHjrQerRE6RJd/5S8yheYtmgEDiV9nHXUUwzCJkmhYeZjgBF/hojYCCqipEwJayxdn2iDMvBWWxxSh0c+nZz+HFe4OXy1DwIBEfAmc8/iFZ8tGDL3AIXuuIYOcUxTbFNJmooOo1QeqkP6P/VFVzZ84EAnVJHmt6dvkVU9TNhxJ8AlYIaZUDnyoWwOVjch4RL+5x5hgBGU01Q5hXSXdBUeniq1jGUrz48r6o/tyXI21TTM8n6T4z7EEBAJyCEQxjbjS9DgaBA47M1O0hdBSAhLDOikiSRDGcd8L4QlZiSpd8itYR7gYeQ3YM2pbOZLmztEmgni/J+WSbharHgt+5HhyPa5FftaMHtU6rpiqgW3gD4CuJ0VAhwsEVWyQdgrWfz8CzBD1ysKZpKNVNrcGZ9maMtO3WnYfw+VVQUb/XZzjmDQprBW/RL4EWeO8pOMYZ4Xd0Yc9O/Q4ISIeciJPTQjuE/VanUQf+0gOVWk205U7SyFU51uEqlDwdHeTpBCPB0jHkNUfvXo7XwQfP4zuKifgkfKRSIXk5g0zD80u8jd2Gpg7A= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(5660300002)(356005)(6666004)(44832011)(4326008)(82310400003)(81166007)(336012)(36860700001)(426003)(2906002)(54906003)(508600001)(26005)(316002)(2616005)(36756003)(86362001)(8676002)(70206006)(70586007)(83380400001)(47076005)(16526019)(1076003)(8936002)(6916009)(186003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:28:14.6518 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c9ddf02-2c35-43ef-2542-08d9930cafc3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5353 Received-SPF: softfail client-ip=40.107.243.60; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Pavel Pisa Problem reported by openEuler fuzz-sig group. The buff2frame_bas function (hw\net\can\can_sja1000.c) infoleak(qemu5.x~qemu6.x) or stack-overflow(qemu 4.x). Reported-by: Qiang Ning Cc: qemu-stable@nongnu.org Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Pavel Pisa Signed-off-by: Jason Wang (cherry picked from commit 11744862f27b9ba6488a247d2fd6bb83d9bc3c8d) Signed-off-by: Michael Roth --- hw/net/can/can_sja1000.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c index 42d2f99dfb..34eea684ce 100644 --- a/hw/net/can/can_sja1000.c +++ b/hw/net/can/can_sja1000.c @@ -275,6 +275,10 @@ static void buff2frame_pel(const uint8_t *buff, qemu_can_frame *frame) } frame->can_dlc = buff[0] & 0x0f; + if (frame->can_dlc > 8) { + frame->can_dlc = 8; + } + if (buff[0] & 0x80) { /* Extended */ frame->can_id |= QEMU_CAN_EFF_FLAG; frame->can_id |= buff[1] << 21; /* ID.28~ID.21 */ @@ -311,6 +315,10 @@ static void buff2frame_bas(const uint8_t *buff, qemu_can_frame *frame) } frame->can_dlc = buff[1] & 0x0f; + if (frame->can_dlc > 8) { + frame->can_dlc = 8; + } + for (i = 0; i < frame->can_dlc; i++) { frame->data[i] = buff[2 + i]; } From patchwork Tue Oct 19 14:09:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CACEBC433EF for ; Tue, 19 Oct 2021 15:14:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4F7E960FDA for ; Tue, 19 Oct 2021 15:14:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4F7E960FDA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:52216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqpC-0002l8-AL for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:14:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq6g-0003U8-AF; Tue, 19 Oct 2021 10:28:46 -0400 Received: from mail-bn7nam10on2088.outbound.protection.outlook.com ([40.107.92.88]:13244 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq6c-00052K-Vo; Tue, 19 Oct 2021 10:28:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QLHrrYAp3XZO3/d3NRmTGmaVopSwUbfRbKiP9OT+RDU7FB/iBP7pkSdTZ1X4M3OdZjhHFtZb9Wsqq1QyO1wmtxRjaZD5mnuqGDWLr84d/Qlw8fXnk+OqN8os1vXY6k3VP59TNT/3uu0UQJe5F/dBvDGSa83Yty36REtO2m5frp25GyB8rFeKlF+LOgCQhkZzcorT4wZiQGNSbqMFjNhSwH3ecS78OOKo19/zqU2Qoli2cxiV4NGSPfLEgT1iS+3U9RX6tFztm/p+fEpf9aGx/Mk4tEHlxMeEOndI1Q8JBol+9Y1IPHe7J/Dx5/POQO1bIZfKVbB9zCCdwqc4iqfM7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v4v/xZvSoue/D8NHr6cJOfLOt+Dt7FWF06fCjUXBGGY=; b=PWUCa1HsjuWMVnm4xah/ZYs6tgMf3JmOQUF+Ogs/pLg1QE+JlRjPJfpmfJGAa7mH5STdDnN06KHIWSxMbO8XnLgFklhTJAJtPCvLVg8MWJNY/BeKzKuqi7X2YVWISk2ze+bZYC+CSDI8bo00jBxcUo5ihPkqiAxpX4XMwtC5x65YSgV7Rse7hshaExXiLEGtlHAfJlWRUlXmaSR5QtDcSuDfwLHtNSlBtOfDM9E2KUnmJc+b0GJuyiQv3a1uc0rbXYJ7SN280TTjX0mZxuFZxLz2Me8SmAe5VQC2zlHEzdwhwPRQ0Q/9uVuA8/EDqlymTiw2oDd0cFHA2tjHinwzMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v4v/xZvSoue/D8NHr6cJOfLOt+Dt7FWF06fCjUXBGGY=; b=JN/vDzAyeg2AJPvtHhA6zjJ1vumlKfesBb7tpLzasmrmlycZPzaVmP8ife/EYf+kfGmVFj4gXTu8un6aRIfl1zIA4na7jkSI6K5j1R1xBD07YH7HCewHiKICQ84PNUH1AlPasZVRMURvand527s67pIH5hAC9BaOpd9bbJfkH6w= Received: from DM5PR13CA0026.namprd13.prod.outlook.com (2603:10b6:3:7b::12) by BY5PR12MB4084.namprd12.prod.outlook.com (2603:10b6:a03:205::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:28:39 +0000 Received: from DM6NAM11FT054.eop-nam11.prod.protection.outlook.com (2603:10b6:3:7b:cafe::d3) by DM5PR13CA0026.outlook.office365.com (2603:10b6:3:7b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.10 via Frontend Transport; Tue, 19 Oct 2021 14:28:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT054.mail.protection.outlook.com (10.13.173.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:28:36 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:28:35 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alexander Bulekov , Peter Maydell Subject: [PATCH 44/64] hw/sd/sdcard: Document out-of-range addresses for SEND_WRITE_PROT Date: Tue, 19 Oct 2021 09:09:24 -0500 Message-ID: <20211019140944.152419-45-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5ef2a21f-b5c5-4c53-aac2-08d9930cbc90 X-MS-TrafficTypeDiagnostic: BY5PR12MB4084: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:935; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aPHjgBikjH6ek1ynQIvQ+jq2C0mkZ7TBQAIWpG1CxpuyB3890s4zRPa/C9EY7A76Q+sxnu3yUoX346jy/FnxdoZs9Mox4qTiDMitgnz62f+2otgSyz86uWXkPhoZ38PRAaOHXJ+X4/3oEgTumhupXefa4auEl2PtxruUBbfjjMw6orx3e2h6imjR0IFbcQxly2RoOSAfKJwzFTVcIoXuiGHKnzD8i1U1DGrohOTWni4r/7uL/ZT5Y+DtKVS50LbURdQ5w424JPFPsF3VXnRteHd9NcU7qldz26zPuCMZOPXjZCCoq0d0sFVTT9H+VlgUxnd7y+NOHu984YRhUsSo/HhKrcs7fFaSS06HhxOYG9Z9Ix7tVZjZ2/aL19LyUrYLTQi5U7e3PfYvIIKDgZbI5DExSLlCQmglSitXwhnIhuvOoyeOCcqfxDYn2zBdIXaw0dtPFMl39C9IktzopoRw04chyiscoB2lfnSXcFTzBZjoE1G+0o3vZ5oygnDHLO+eHWpVLSoATvW1M4wA2J+HsqENCEJRzK2LEkBYc6zJJoQHZyhCuxJiWYiVOarfx4LPVtqf4PPoLAYGZI9EjgK+uz4ZrC+22cKNbP3EjML6z30oxTIkKhuBsCTlG5nRNJMEDKZo9XakzEcQDMbNcVOU5zU92ksbuXLGF4r8N+vu5CnJgZtKyq2vGRw0pfBshO8He80jplPutAIPNlmFpi/pVOA04NV+HbWmV/jN/LR1X2E= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(1076003)(2616005)(47076005)(26005)(6666004)(8936002)(316002)(8676002)(6916009)(54906003)(70586007)(70206006)(16526019)(186003)(2906002)(508600001)(5660300002)(4326008)(44832011)(36860700001)(82310400003)(36756003)(336012)(356005)(81166007)(86362001)(83380400001)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:28:36.1274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ef2a21f-b5c5-4c53-aac2-08d9930cbc90 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT054.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4084 Received-SPF: softfail client-ip=40.107.92.88; envelope-from=Michael.Roth@amd.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Per the 'Physical Layer Simplified Specification Version 3.01', Table 4-22: 'Block Oriented Write Protection Commands' SEND_WRITE_PROT (CMD30) If the card provides write protection features, this command asks the card to send the status of the write protection bits [1]. [1] 32 write protection bits (representing 32 write protect groups starting at the specified address) [...] The last (least significant) bit of the protection bits corresponds to the first addressed group. If the addresses of the last groups are outside the valid range, then the corresponding write protection bits shall be set to 0. Split the if() statement (without changing the behaviour of the code) to better position the description comment. Reviewed-by: Alexander Bulekov Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210802235524.3417739-2-f4bug@amsat.org> Reviewed-by: Peter Maydell Tested-by: Alexander Bulekov (cherry picked from commit 2a0396285daa9483459ec1d3791951300b595e85) *context dependency for 4ac0b72bae ("hw/sd/sdcard: Fix assertion accessing out-of-range addresses with CMD30") Signed-off-by: Michael Roth --- hw/sd/sd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 282d39a704..fa6bb79b15 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -822,7 +822,14 @@ static uint32_t sd_wpbits(SDState *sd, uint64_t addr) for (i = 0; i < 32; i++, wpnum++, addr += WPGROUP_SIZE) { assert(wpnum < sd->wpgrps_size); - if (addr < sd->size && test_bit(wpnum, sd->wp_groups)) { + if (addr >= sd->size) { + /* + * If the addresses of the last groups are outside the valid range, + * then the corresponding write protection bits shall be set to 0. + */ + continue; + } + if (test_bit(wpnum, sd->wp_groups)) { ret |= (1 << i); } } From patchwork Tue Oct 19 14:09:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54626C433EF for ; Tue, 19 Oct 2021 15:26:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE56A60FC2 for ; Tue, 19 Oct 2021 15:26:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CE56A60FC2 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:54566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcr0h-00076E-P2 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:26:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq6z-0004VP-TN; Tue, 19 Oct 2021 10:29:05 -0400 Received: from mail-bn8nam11on2078.outbound.protection.outlook.com ([40.107.236.78]:40640 helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq6w-0005FK-Gc; Tue, 19 Oct 2021 10:29:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SF5sZRsSwaBwdd7SOY41rRqhmpnImZnfAgLbfv0xlAc1/Iru4fsW57mmYOr2cwghTFQVtDx3oEkpBe8E+vTbmYACr4jYkZZtgakOdshYzwIGHusHW85cgKhxEie6B2j1Fn3xyLB6C3EG/9Ec1BEk3d/TusLHmaHsBKRyqu3DJdVl/GJfpA6E8FZ76IdkE8hg12XZ2gecipSntv0My+/Yj5NH/xW6+uwFGc1vuUmmtD2wmsq8/zclEoqn1KIC//BU80aZVhdkOVvRTRgu8OMpdKdeldjQxpj/yZ9prahjIpxvvXYBr6TgT++kIfskLxTMRwQbFHPYSauDUGiIdvtn5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=94Npene2IDsgGwoz31QM5rtuk8CH4oRXm7rdz+Zz6So=; b=k2lP9fuK0WyPzKjHUovjZxM1hcjYHYBRrxOAThcBTOyd/oh1icwDlDSZTMw3TeXxnZt9gO1LSN3YxCdr3Elhq2h+WVY3Cg/D9jrAmc/sDHIJxEe71OQPgXxJPmWotQBvM0qp0ujRf33yIoKy+AXZMKduLrCi6UvodfYQT0EltIIFWIi1yMNr7kd5hIhXTDJNETsFl/mM+xLCcFVN/heifQQQQH+USJOY6u9z3VwgMmv3z+113070MduiQfZ+RkowyBuvYl77szsFOE2uJvtSrj5E4cEIwE1jcVyh+zK+LwuyhwvLeqd5GrIjrI0OYn04Inm8dWP8z8eocX433PIXMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=94Npene2IDsgGwoz31QM5rtuk8CH4oRXm7rdz+Zz6So=; b=uHWgvxb+13X11WCUytJCw4p+ZLQZ7NsjnUC5xZ1avQAKRSbjYBnDBfR+W2vlV8R7bv7aqVFfIRj54w3RD8eBwG6x9cp+F6NeiK2T8edSxbee4juI5YvW7Ao/bMHPRdO2p61ACQUUGVND1UvylciP5N/UL+XyXsFK+QsRhFYwAKo= Received: from DS7PR03CA0197.namprd03.prod.outlook.com (2603:10b6:5:3b6::22) by MN2PR12MB4288.namprd12.prod.outlook.com (2603:10b6:208:1d2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:28:58 +0000 Received: from DM6NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::40) by DS7PR03CA0197.outlook.office365.com (2603:10b6:5:3b6::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:28:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT068.mail.protection.outlook.com (10.13.173.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:28:57 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:28:56 -0500 From: Michael Roth To: CC: , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Alexander Bulekov Subject: [PATCH 45/64] hw/sd/sdcard: Fix assertion accessing out-of-range addresses with CMD30 Date: Tue, 19 Oct 2021 09:09:25 -0500 Message-ID: <20211019140944.152419-46-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f9fee4c4-644f-407a-d485-08d9930cc977 X-MS-TrafficTypeDiagnostic: MN2PR12MB4288: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:758; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bqkLrNg2xX20eGH2AaEMhyK+yuzXkcLEXAMn4ctMrXfBWOcSc04P7L41CWUEIyLhvoWageo+MRZN2mZAAEGZkwhJGz7qs8AF7iwnyUyV0ac7RgJaWHjodO3W01tjnx6o5SccHXwS+qHNSKfgaXaBamiG7UfHhXe2nPT+w4m6Ji5bs9R0tR4Kqs+hwJRZYgsa2PJ32bRSBNs5WvXOGahXb5XOs3wIA4+4vdKQ0LDzUnwe6Xqcnpub8uFNfyJYfOBDAn02SbXPCBeKxM1wSUO2EH0RmdGrIiNgqQGlnCP27ruAwVAou7JG/my2EM7vV5Mi2U11r2auHCRljK+mXROh5ujDCeBoFxIkuckOLR2Hspwa2+J4jy288gO6Ns6pbLCCoipsJQNYlhJQNpNNarcxePuvd6iZYpfajwOG49BzNI4fLnxt3N9PD+wKiWpb7Q8DgDnUFnm+NtAct01k8UFYyI8En1jvp3g0Tn8RCN1+fcwKRDBpB3nKufey8UuYAMr2Ifgk88XAjHLUkj/ZnFMIWpWTVQbTEmTGVB/EKLEpZfFuWFHT574ZzproTisHO5/s3bMiNNILPXqs7Uvl4Oi6DpKsacpUBKr9uipJaCzqHFoTAfc/DvxJ6dTAJNf89qt2offqp4gwTvE0IWjhueLnfYZX78xOXx3qsQzYTockQdEwmgx7sQ/8lF8NRWlaCyhmC7d2Swne7dKyNa6B32B/LX4HqF6A9vtgfF0yVIlSdNdlZD3kVr0aLVqDD02qpgi/qT5n4Gcedn5NiW2Nt9Cemy8jXTDrUSGaruEbHunsgqTbA8Xjp8pOwBsXpSH/3pNx X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(81166007)(44832011)(4326008)(426003)(8676002)(2906002)(356005)(2616005)(70586007)(70206006)(36756003)(54906003)(508600001)(1076003)(5660300002)(86362001)(6666004)(316002)(8936002)(82310400003)(26005)(186003)(16526019)(6916009)(36860700001)(336012)(47076005)(83380400001)(966005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:28:57.7780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9fee4c4-644f-407a-d485-08d9930cc977 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4288 Received-SPF: softfail client-ip=40.107.236.78; envelope-from=Michael.Roth@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé OSS-Fuzz found sending illegal addresses when querying the write protection bits triggers the assertion added in commit 84816fb63e5 ("hw/sd/sdcard: Assert if accessing an illegal group"): qemu-fuzz-i386-target-generic-fuzz-sdhci-v3: ../hw/sd/sd.c:824: uint32_t sd_wpbits(SDState *, uint64_t): Assertion `wpnum < sd->wpgrps_size' failed. #3 0x7f62a8b22c91 in __assert_fail #4 0x5569adcec405 in sd_wpbits hw/sd/sd.c:824:9 #5 0x5569adce5f6d in sd_normal_command hw/sd/sd.c:1389:38 #6 0x5569adce3870 in sd_do_command hw/sd/sd.c:1737:17 #7 0x5569adcf1566 in sdbus_do_command hw/sd/core.c:100:16 #8 0x5569adcfc192 in sdhci_send_command hw/sd/sdhci.c:337:12 #9 0x5569adcfa3a3 in sdhci_write hw/sd/sdhci.c:1186:9 #10 0x5569adfb3447 in memory_region_write_accessor softmmu/memory.c:492:5 It is legal for the CMD30 to query for out-of-range addresses. Such invalid addresses are simply ignored in the response (write protection bits set to 0). In commit 84816fb63e5 ("hw/sd/sdcard: Assert if accessing an illegal group") we misplaced the assertion *before* we test the address is in range. Move it *after*. Include the qtest reproducer provided by Alexander Bulekov: $ make check-qtest-i386 ... Running test qtest-i386/fuzz-sdcard-test qemu-system-i386: ../hw/sd/sd.c:824: sd_wpbits: Assertion `wpnum < sd->wpgrps_size' failed. Cc: qemu-stable@nongnu.org Reported-by: OSS-Fuzz (Issue 29225) Suggested-by: Peter Maydell Fixes: 84816fb63e5 ("hw/sd/sdcard: Assert if accessing an illegal group") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/495 Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210802235524.3417739-3-f4bug@amsat.org> Reviewed-by: Peter Maydell Tested-by: Alexander Bulekov (cherry picked from commit 4ac0b72bae85cf94ae0e5153b9c2c288c71667d4) *drop fuzz test additions, since sdcard fuzz test has functional dependency on guest-visible change not flagged for stable: 59b63d78 ("hw/sd/sdcard: Check for valid address range in SEND_WRITE_PROT (CMD30)") Signed-off-by: Michael Roth --- hw/sd/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index fa6bb79b15..bc8f17ddf9 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -821,7 +821,6 @@ static uint32_t sd_wpbits(SDState *sd, uint64_t addr) wpnum = sd_addr_to_wpnum(addr); for (i = 0; i < 32; i++, wpnum++, addr += WPGROUP_SIZE) { - assert(wpnum < sd->wpgrps_size); if (addr >= sd->size) { /* * If the addresses of the last groups are outside the valid range, @@ -829,6 +828,7 @@ static uint32_t sd_wpbits(SDState *sd, uint64_t addr) */ continue; } + assert(wpnum < sd->wpgrps_size); if (test_bit(wpnum, sd->wp_groups)) { ret |= (1 << i); } From patchwork Tue Oct 19 14:09:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFBD7C433EF for ; Tue, 19 Oct 2021 15:18:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 836CE6115A for ; Tue, 19 Oct 2021 15:18:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 836CE6115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqsf-0000DU-HL for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:18:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq7Q-0004jq-RY; Tue, 19 Oct 2021 10:29:34 -0400 Received: from mail-dm6nam08on2078.outbound.protection.outlook.com ([40.107.102.78]:40472 helo=NAM04-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq7J-0006Zw-3z; Tue, 19 Oct 2021 10:29:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l3Nd8YXVDdfVthAyEGwyGQLTSuvDOWqhO7v788OcPMz3V512Pd0FKd+bfAsF1Dst3WDY5xeH20M++20c0RvDSVisqTIHzB3Svg4oVbNk5uEcYC8YDJwSx7uEYK59IvSVQFpVqN03tzhhaBAxEJ0YjCP6Ve54CeA25yRlXEusgMSTMEqp9ujqbZWO1SnKWRwztKJu9bIYmNH1UPQiraiLbmYv50Ug0l9Nac5UxR2bH3pyergHILS9omBySLFwUDzDFdnzWZi5hGXCmrjXag9Z+v2P3AyvhFa95NIg7H1n5LTifNw56HBzCiR+KND2cS3XY2d/9Oz9saoNEbp98m3yew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uljkpOr6+O+fjuZVPYJNezscSDyKjQ8AyZv22gYS4FY=; b=KbBHl7Y/hFrPGech8OT1vWPSWiQO56ZBj2SWPPkgaJJG28YWqXKd/CjdExMM9doJcD8yRNoDrWCFbIvjiTL1y+9lLu5TpZYms7GgEOSrYiqcu7obkd0ab/pqcdM/+czLsJcCVOyFWqPwtqbmv3vyHE4vBcW9ZMwdXKq0HTfdwaLFtztu+BvcPp2CSLmotfKq3jiDsoRZpxGwjFxKUIOEl4dE2tYAKDH2uhVd2uwBVTwcR3H3sQF7jHMBYd40lFhwvLYnzaCr01+ZVBYDdlGWy/VLhKuigOzg6a+8FVOtQQkIJ4mItVNJMViqy+0Jb/u/juwDLQlRB2ivshV4NfyUCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uljkpOr6+O+fjuZVPYJNezscSDyKjQ8AyZv22gYS4FY=; b=HYA+qyBifGyIV+wfms9hYE2Jc0ydNTZJDiEMsr8+hb4zA/E8ovu4InX4xWdvIO7FVtDja5Dj3AYboSs870mdS/OmTxbIjZM17bV6VZpB53fJ04ITbE7IrVfXa/xhD6vr2R0VbAmHElW9lrYTbDbcE/efDXIegYaZEK/2rgfMK7M= Received: from DM5PR20CA0006.namprd20.prod.outlook.com (2603:10b6:3:93::16) by DM5PR12MB2470.namprd12.prod.outlook.com (2603:10b6:4:b4::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:29:20 +0000 Received: from DM6NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:3:93:cafe::78) by DM5PR20CA0006.outlook.office365.com (2603:10b6:3:93::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:29:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT053.mail.protection.outlook.com (10.13.173.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:29:20 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:29:19 -0500 From: Michael Roth To: CC: , "Dr. David Alan Gilbert" , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Gerd Hoffmann Subject: [PATCH 46/64] audio: Never send migration section Date: Tue, 19 Oct 2021 09:09:26 -0500 Message-ID: <20211019140944.152419-47-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44c50592-e1b1-4f8b-7c32-08d9930cd6b7 X-MS-TrafficTypeDiagnostic: DM5PR12MB2470: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:291; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9q+6pyUzczp50fO6FbQHd96572ujzIHQfqflDu+BNUKiOfp3lZN6bkDCiBzWUPButVqMHFnQln04GRsTEmhUzU8VY3CoNYnP57DXdayVyuiQjLJhYWQrGMvsFOaGopwPX0UJF4R/OF3iQWeqKMGRpP6FY3BSo5iPS38cQXRZST0zXPPCLGqOOSKjDNc7r/Qnp3s0T2uykJBFeMVKkABZJ/Gjx9nUgsI2hAVkPZfmDfMdPlkx6/vCI3V9ZAtfxLdxeF/4jvIbTlAzVJVQf1MeUTP9XMXn4ngibUQve8/z+oO1sA2+nY9udhyY8TtpjjKMXpnTfq2/JBV7WeVdNvf9jDgCySn/7sy72Gvd4x0gTCS3eaiwp3YnNvxaag/nyGq8/1wOynemejZ/lCuuzGGCCzHwH5B3UNpnJLi0DL+dj6y0hbzQjrDphj7TNaUgGxT6swuSS6/yTMGoETT2PKSk/M0JemZ7IOJzB9UluqAYiJ3w5U38EJ06rSbjeyUu7/IwCAVVBAjBni7sehEdiASkogTdDgJbjT3pXadX0LX0uz69/4pFcl2J5kFxiptTkpy94qse6BWqmW04yv/wfDEjkjXxKLxq+1kYqvobc4eRddgz5QNeYw9GdsLRhNm5j7e7fTQ5XBJmpb1xPsOjWvT5Pl43TGksGvE2TKgQeU4dVgZFbIAmSgbiM17Ka2bEjLkdE4PDPrDs5pMwtTq+GC1nb1XESA/wlGI6+rrRGLmUuvk= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(86362001)(54906003)(316002)(6666004)(4326008)(1076003)(8676002)(36860700001)(8936002)(44832011)(16526019)(2906002)(36756003)(356005)(70586007)(70206006)(508600001)(26005)(186003)(81166007)(47076005)(6916009)(426003)(336012)(5660300002)(2616005)(82310400003)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:29:20.0136 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44c50592-e1b1-4f8b-7c32-08d9930cd6b7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2470 Received-SPF: softfail client-ip=40.107.102.78; envelope-from=Michael.Roth@amd.com; helo=NAM04-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" The audio migration vmstate is empty, and always has been; we can't just remove it though because an old qemu might send it us. Changes with -audiodev now mean it's sometimes created when it didn't used to be, and can confuse migration to old qemu. Change it so that vmstate_audio is never sent; if it's received it should still be accepted, and old qemu's shouldn't be too upset if it's missing. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrangé Tested-by: Daniel P. Berrangé Message-Id: <20210809170956.78536-1-dgilbert@redhat.com> Signed-off-by: Gerd Hoffmann (cherry picked from commit da77adbaf619c4d170cb42d769145ad1803fbad9) Signed-off-by: Michael Roth --- audio/audio.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/audio/audio.c b/audio/audio.c index 534278edfe..fa724ea8e0 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1621,10 +1621,20 @@ void audio_cleanup(void) } } +static bool vmstate_audio_needed(void *opaque) +{ + /* + * Never needed, this vmstate only exists in case + * an old qemu sends it to us. + */ + return false; +} + static const VMStateDescription vmstate_audio = { .name = "audio", .version_id = 1, .minimum_version_id = 1, + .needed = vmstate_audio_needed, .fields = (VMStateField[]) { VMSTATE_END_OF_LIST() } From patchwork Tue Oct 19 14:09:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C858DC433FE for ; Tue, 19 Oct 2021 15:21:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F58360F9F for ; Tue, 19 Oct 2021 15:21:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6F58360F9F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqvR-00066n-JB for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:21:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq7k-0005Gx-41; Tue, 19 Oct 2021 10:29:52 -0400 Received: from mail-mw2nam12on2046.outbound.protection.outlook.com ([40.107.244.46]:22968 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq7h-0007zC-W2; Tue, 19 Oct 2021 10:29:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZyJn9thatxHCu4nGUxdFgXcokbtz1zOBDguEdJeUbpPl4TwGFJxuNSjlc6cqpaeMGQd5hlkKwUdA27ZeyDEHSPJi3lhLZzG1Vbr1swuXEHbHq7/SBqPeagsj+K8uJxOM6yfpWqIZhqJGYr50jAkBl9ENeRKdo0QlGi/LvSmWSLP3pAQ8vNLDoG2Ng+RWNg5mMwtKa89VXkd5rqIOPVZDUNH++l1CmagNyAvLeEkmXOawHYDI7ofjnpPBJOkevS14MxdZw6M3lairNMfHsutCUJo/uzwbcXf1UAuHHQws2M19lGvloaFhm0g5TdaUNr32xY01ERs2TTJINPlk0wZmig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GfQ+H/xpPCSSJRn737zt7+p9SVApowO2Em6kFD/nCzA=; b=KJM22b83nXNL1N4nwPDrQXIVgONtES2EJre04BBKk0oRu2eCcsSh4mdvqjCpbm7QTJf8w0Ad30xnJxTvv5m5Jwzv7tqVYs0A+IZG8vaIi31e35LeCmhL/i+SczxgN1jofdriHwTRhdPnH3wCAGp3pDx765pZdJ+PSQxOy5VBjAnWBUEiNGAcx3COgsssDpQJz9tv/aT3vDcpakQdk8ebXSrPdE6jvkEtLwJcdsNdFkCCRfMVcfzhX1h0Mb49k3nP9N/0VSDvdwHQsooVn4Djrg04Ao0YhJuT93vRn4h2mGauQrp/zSFoIYX1vSa0mudspIOlzQs37nzHz1MNGRx3nA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GfQ+H/xpPCSSJRn737zt7+p9SVApowO2Em6kFD/nCzA=; b=nMkAPDPSYl2b8h15+qpxdjwmvM46GSCKHsQucwLnmAYY44pj+cayRW7lVohYV5USbUzodGq+qN9J22BFvAp/5vHz1PYii7A3UDiPI40qFWkxg+GhhZdBsJO9eZotNnXt1HDpssc0Ecw+rTZ0bS/KnkTOUvWpn4wUrJImALVAaUs= Received: from DM5PR04CA0048.namprd04.prod.outlook.com (2603:10b6:3:12b::34) by MW2PR12MB2490.namprd12.prod.outlook.com (2603:10b6:907:9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:29:44 +0000 Received: from DM6NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:3:12b:cafe::cf) by DM5PR04CA0048.outlook.office365.com (2603:10b6:3:12b::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:29:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT011.mail.protection.outlook.com (10.13.172.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:29:44 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:29:40 -0500 From: Michael Roth To: CC: , Peter Maydell , Richard Henderson Subject: [PATCH 47/64] target/arm: Don't skip M-profile reset entirely in user mode Date: Tue, 19 Oct 2021 09:09:27 -0500 Message-ID: <20211019140944.152419-48-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e082f2a-e587-4255-8e0a-08d9930ce544 X-MS-TrafficTypeDiagnostic: MW2PR12MB2490: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NvP2qrNq+mnUh8iMU7Nbq9USkTqhmAXiYHrO3TWyq6Ki/AR/8L9AgWzL7VTRsz7z+JKzf2GTFaRV8TtBBuJPLTJBpB41VEcm2/NK7J7ppe4hDkfW1oXEGiuoS7MdE8orF7zHWDwfGL/XCWwYf9Ui+O13drBXFS+LICGSVDR30l8BPzbXoP12GzH1fPNLoxax8RjkysfcG/D1LMiGqVv1i1bZnkCm+YiNGLPkZ9HPLqPlWF+zBPOd0G2uVUOXn+uB7sZL65i5hls4D8zkXqEW87TvVm8CJwcw1V1rO5uk4rqMu4a1OteVTGfoCYMpo2JajXZbj8eK/wgECefiIy3lKjdDNYoEe9hF2DmEOtXKAAGfNu2CaJRylZQBPrUCx+Irbyu3MIB8qlEyL5hPuuW6S7cnIxnS7CC2lzo6eHSEokus0ovZUQY2pOogCmIS8LUVf0rVJvnA7QE+sifqDPL99gy22NyEzy+W3FAF9dovGU9Q8udzWVumAAjUN7FEn5m1D/7wYu2oZa/9TJ+tMCn2u3VoarKqEF8AIqr1O4M8xgdEdE/bqmWo5eAb5W83HGa7YMcOKVsAggJbaIhIMpFJx4LGWgUPgPnRuRRrJ4zK1kZxFk+mkperPMM5Pqdv1/pn3Rji9w//49XJHkMbOCzQ5AGxelOcQfXLTSN/tnPjvozx/xlX4S2Uytrovkvznl5PksX+WXYRJAL64W4ZoJ7VyYMeqKDM436adILeQxkiKz6TmC8nul6IzDEbUIGLpieo02GjAGUNqN71PZdhap1ISMU2jHN+Gq/csF17nxgbJ8wyfei9xLfbI4a1umxf9mUW X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(8676002)(5660300002)(2616005)(2906002)(36860700001)(86362001)(16526019)(4326008)(44832011)(186003)(81166007)(966005)(70206006)(47076005)(1076003)(70586007)(26005)(426003)(6916009)(82310400003)(36756003)(6666004)(8936002)(356005)(54906003)(83380400001)(336012)(508600001)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:29:44.4123 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e082f2a-e587-4255-8e0a-08d9930ce544 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2490 Received-SPF: softfail client-ip=40.107.244.46; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Currently all of the M-profile specific code in arm_cpu_reset() is inside a !defined(CONFIG_USER_ONLY) ifdef block. This is unintentional: it happened because originally the only M-profile-specific handling was the setup of the initial SP and PC from the vector table, which is system-emulation only. But then we added a lot of other M-profile setup to the same "if (ARM_FEATURE_M)" code block without noticing that it was all inside a not-user-mode ifdef. This has generally been harmless, but with the addition of v8.1M low-overhead-loop support we ran into a problem: the reset of FPSCR.LTPSIZE to 4 was only being done for system emulation mode, so if a user-mode guest tried to execute the LE instruction it would incorrectly take a UsageFault. Adjust the ifdefs so only the really system-emulation specific parts are covered. Because this means we now run some reset code that sets up initial values in the FPCCR and similar FPU related registers, explicitly set up the registers controlling FPU context handling in user-emulation mode so that the FPU works by design and not by chance. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/613 Cc: qemu-stable@nongnu.org Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20210914120725.24992-2-peter.maydell@linaro.org (cherry picked from commit b62ceeaf8096fdbbbfdc6087da0028bc4a4dd77e) Signed-off-by: Michael Roth --- target/arm/cpu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 0dd623e590..4f03e74664 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -265,12 +265,15 @@ static void arm_cpu_reset(DeviceState *dev) env->uncached_cpsr = ARM_CPU_MODE_SVC; } env->daif = PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F; +#endif if (arm_feature(env, ARM_FEATURE_M)) { +#ifndef CONFIG_USER_ONLY uint32_t initial_msp; /* Loaded from 0x0 */ uint32_t initial_pc; /* Loaded from 0x4 */ uint8_t *rom; uint32_t vecbase; +#endif if (cpu_isar_feature(aa32_lob, cpu)) { /* @@ -324,6 +327,8 @@ static void arm_cpu_reset(DeviceState *dev) env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK | R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK; } + +#ifndef CONFIG_USER_ONLY /* Unlike A/R profile, M profile defines the reset LR value */ env->regs[14] = 0xffffffff; @@ -351,8 +356,22 @@ static void arm_cpu_reset(DeviceState *dev) env->regs[13] = initial_msp & 0xFFFFFFFC; env->regs[15] = initial_pc & ~1; env->thumb = initial_pc & 1; +#else + /* + * For user mode we run non-secure and with access to the FPU. + * The FPU context is active (ie does not need further setup) + * and is owned by non-secure. + */ + env->v7m.secure = false; + env->v7m.nsacr = 0xcff; + env->v7m.cpacr[M_REG_NS] = 0xf0ffff; + env->v7m.fpccr[M_REG_S] &= + ~(R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK); + env->v7m.control[M_REG_S] |= R_V7M_CONTROL_FPCA_MASK; +#endif } +#ifndef CONFIG_USER_ONLY /* AArch32 has a hard highvec setting of 0xFFFF0000. If we are currently * executing as AArch32 then check if highvecs are enabled and * adjust the PC accordingly. From patchwork Tue Oct 19 14:09:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A33BC433FE for ; Tue, 19 Oct 2021 15:29:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8C68610A1 for ; Tue, 19 Oct 2021 15:29:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D8C68610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcr3g-0004Sx-01 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:29:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq83-0005fM-M9; Tue, 19 Oct 2021 10:30:12 -0400 Received: from mail-co1nam11on2052.outbound.protection.outlook.com ([40.107.220.52]:20665 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq81-0008FB-JH; Tue, 19 Oct 2021 10:30:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UIaANTvJ54wpQRwqjhlPmr/Cbfzjk+RZV9YqSaKl0zfKMcWW2iA4S6Y56cdz2QPt+sGk43D0Bl319u+j/8cAo77+TGNXB+LO7C5I9Ifb2DT15i5qY/9fxI/PlnFPfgWlTEmfWS+Sam+DPFVpchFgCS370Er5/CCbv7e+bY+ioAB0xoMzeQL5OTEd2dNmvPy8Ws+e8R2KaUqiHTEStWpGPZBxEf5Z+dyH0RE68UKqqjmzLvByYeASuAffYfugfqHFzQvWtclfApYUM9iZlHFM8M7vWNPY58e+rhV0GMV7BX5qUx++pVXrb8VsQ71qhDbpfBsInb4rruznuBlsuaJ2jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f18gjX/lpVuH1bb8wZa+KCUCh8GvIqXkXRgdf5Fg95E=; b=G+Oi5VRBWBfPTzCEiy6g1vBYMY8Y17C6r0Lm9M/RhAs5ehZvKRXb3CyDVe7ZMyOFQ4Q5nbQ/Zrk7QzzlWbx9AU1T6M4gR2frmvh9rX48jM/YxuAg80yxML70v+XkSinHFuyV9bIa5LDVQ2S4oofN6Pl8C/anZ7b5+aRIpY+3iaojQzBrdXRCGpohieazqgtKNf6JaU6BYvTPHe5v1s071rS550Qxp4QXSGmUCc4TEksGfI7lqw09lwSdXuU5r280n09bqx5mLQj/W/zmYcFKJlM0pBUaCI2Fa+utXbmM+ZD1ny3Lkh4/PqQZ+1SoogWdENL/93MczPsA7ds+vxygsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f18gjX/lpVuH1bb8wZa+KCUCh8GvIqXkXRgdf5Fg95E=; b=Q5Nsdw7+R+F+K12VYamOv2ApokI/eM901mdHibA5sutykwhf37IFXUw4RDpZmJDFaObkrBl/tvkcPRbv1hg2yCHii50xYB5WlDB7HDih7n0+6Di7BdNLrAfFnzf49szWjZc9LbzqoL93u6EkaeDH83gbqglfJaAWmjtZ1K4nJyA= Received: from DM5PR04CA0031.namprd04.prod.outlook.com (2603:10b6:3:12b::17) by DM6PR12MB5567.namprd12.prod.outlook.com (2603:10b6:5:1ba::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:30:05 +0000 Received: from DM6NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:3:12b:cafe::2c) by DM5PR04CA0031.outlook.office365.com (2603:10b6:3:12b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:30:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT011.mail.protection.outlook.com (10.13.172.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:30:05 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:30:02 -0500 From: Michael Roth To: CC: , Jason Wang , Alexander Bulekov Subject: [PATCH 48/64] virtio-net: fix use after unmap/free for sg Date: Tue, 19 Oct 2021 09:09:28 -0500 Message-ID: <20211019140944.152419-49-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b8a3856-b93b-4eac-34a9-08d9930cf1ba X-MS-TrafficTypeDiagnostic: DM6PR12MB5567: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:792; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OrPtT/G4VyfCJuW2uvwCiN/VNsVzP/JS92iiiRo9sAJ25ewzT+qBWQA6zmZRscguA5bbNDhxnvp6+0J9YemRBa2+ehAg+tKrg17BysqZv9iimNIN17eyI0DIWcGzbyF9q3Vn0RzmIRDG0w8KagXU5kkVHKKLRzp5EHkFtftlwgAj3LdwF7VH8pLH9rPag19/Aws5OTSAoqr4YnskFBniH0TvE41ShmcO40MIX4zm9omvUgvwpUQ/34Wi7oLxdl9Xfx8PhkYcVOGlBbS47Z7+oKGmwmYlv7TK3oMW3nKwG4wo8o10A6FSHzKE0sm00oaN9Dz97fNiCf+RwWTznc3G6+QapFLGMTPvq/5tooOiBBWMFSvNiBeVy88jQPgsXmnGejcDv5SNtF2o1tFReM7+7loGnEKe5i8q7xUtRoWujxGcbnXyNR/feWKxY+Hro5+wb/SStzMV5/4ib7HdJ+UfKXtOFSiKSNAnPfIVkbm4WB+i8ylH5ZwBVu+5XbjCnAxBEJ1WIQ4LfF3IkRgMRJl0ahksTqjfZtr0T1J6dZv81HMPxkhuAEiC+J4mPGqqGQi2zlZ4/Z9RZPYqLnFD3jWUQ8Gr+WUw1sS4DYbPIzD2uHfQRZn0LtFNHk1wRy13/feayCaxBWtr6fth2IJEWp/tQpXCyPScWYwU5/Tx4qFFBj7vj4ZIjZJ/Ns4X0eBP2HqVs0D72xFPiv+JLlp5++s3cO5seA4+ucPvEis8/uVn/Is= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(336012)(2616005)(2906002)(6916009)(426003)(86362001)(36756003)(356005)(81166007)(70206006)(70586007)(6666004)(44832011)(8676002)(186003)(8936002)(508600001)(4326008)(54906003)(316002)(16526019)(36860700001)(5660300002)(83380400001)(47076005)(1076003)(82310400003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:30:05.3245 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b8a3856-b93b-4eac-34a9-08d9930cf1ba X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5567 Received-SPF: softfail client-ip=40.107.220.52; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang When mergeable buffer is enabled, we try to set the num_buffers after the virtqueue elem has been unmapped. This will lead several issues, E.g a use after free when the descriptor has an address which belongs to the non direct access region. In this case we use bounce buffer that is allocated during address_space_map() and freed during address_space_unmap(). Fixing this by storing the elems temporarily in an array and delay the unmap after we set the the num_buffers. This addresses CVE-2021-3748. Reported-by: Alexander Bulekov Fixes: fbe78f4f55c6 ("virtio-net support") Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang (cherry picked from commit bedd7e93d01961fcb16a97ae45d93acf357e11f6) Signed-off-by: Michael Roth --- hw/net/virtio-net.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 66b9ff4511..760203309b 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1659,10 +1659,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, VirtIONet *n = qemu_get_nic_opaque(nc); VirtIONetQueue *q = virtio_net_get_subqueue(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); + VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE]; + size_t lens[VIRTQUEUE_MAX_SIZE]; struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE]; struct virtio_net_hdr_mrg_rxbuf mhdr; unsigned mhdr_cnt = 0; - size_t offset, i, guest_offset; + size_t offset, i, guest_offset, j; + ssize_t err; if (!virtio_net_can_receive(nc)) { return -1; @@ -1693,6 +1696,12 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, total = 0; + if (i == VIRTQUEUE_MAX_SIZE) { + virtio_error(vdev, "virtio-net unexpected long buffer chain"); + err = size; + goto err; + } + elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement)); if (!elem) { if (i) { @@ -1704,7 +1713,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, n->guest_hdr_len, n->host_hdr_len, vdev->guest_features); } - return -1; + err = -1; + goto err; } if (elem->in_num < 1) { @@ -1712,7 +1722,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, "virtio-net receive queue contains no in buffers"); virtqueue_detach_element(q->rx_vq, elem, 0); g_free(elem); - return -1; + err = -1; + goto err; } sg = elem->in_sg; @@ -1749,12 +1760,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, if (!n->mergeable_rx_bufs && offset < size) { virtqueue_unpop(q->rx_vq, elem, total); g_free(elem); - return size; + err = size; + goto err; } - /* signal other side */ - virtqueue_fill(q->rx_vq, elem, total, i++); - g_free(elem); + elems[i] = elem; + lens[i] = total; + i++; } if (mhdr_cnt) { @@ -1764,10 +1776,23 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, &mhdr.num_buffers, sizeof mhdr.num_buffers); } + for (j = 0; j < i; j++) { + /* signal other side */ + virtqueue_fill(q->rx_vq, elems[j], lens[j], j); + g_free(elems[j]); + } + virtqueue_flush(q->rx_vq, i); virtio_notify(vdev, q->rx_vq); return size; + +err: + for (j = 0; j < i; j++) { + g_free(elems[j]); + } + + return err; } static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf, From patchwork Tue Oct 19 14:09:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A965CC433EF for ; Tue, 19 Oct 2021 15:01:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D93060FDA for ; Tue, 19 Oct 2021 15:01:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1D93060FDA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:45142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqcB-0004I9-1v for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:01:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq8Y-0006Ea-Ct; Tue, 19 Oct 2021 10:30:45 -0400 Received: from mail-mw2nam12on2074.outbound.protection.outlook.com ([40.107.244.74]:47841 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq8L-0008VY-AB; Tue, 19 Oct 2021 10:30:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l//rWa4qVgQudv39VcK2pXoLolRS0Adse+JUUv/zrNVAqOeSyvoK1F27OtcbEW3BZuX9IERu0uJKCpfLKsgP35FyhyGnlBk9gQ4vvEH0U9U8Fh+UxgY6pdhVhwAzAL1xFuuYgEazfYIXbfuxFL+8iSAGqQt5lFeMhYi2iUAiqKZTaj7DhcqOtA/BXtm8BsxQSlueHBWBPwHuufWXLbcmZLVQIw+JQZIi7Vn6MBIJ+5xFFCYlJMQXB+hCElfrNRVOxS47pEx+2e9GpTUSE832Qu2wUnDUirC6PDZkS8Vel5xZfksX4Aa5oLUc9UjZ4EMWsT5mD+F3s+UnuQnNDOOVRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b7t+ouPu5WYI+gHy9SAAMmKg863mI9sae+/3yPLcA3M=; b=A0TpK5ofjC3rvm/57h0HGOUMJ3Xe+1ranxU/zdqaYXyVCTe0iSA4lUR0AQrrC9YDxBdmQ7uJ2qfIycIzPKjgDGaPnD8RM3OEbWK38upiAiC2FeaD+BByT++B32K52ORaFmoxVVVod0zpinUrbHLQDNL1ulnN/J29jAS+15F6tNa6JUoQZ1HcEir5GmQ63tUnosMuJPELEytYRW2racYffqFw//SM/0jetBcZlHUc/Mne05uF4gp8Nsnq7btG1BKuvEwtHrQrRt7HoN2DnLgm7JMn+IQJTUWPciQF+CwJ3XyQfp6E4xLZ+WoSF/s89NKQ0Fqb9ETqoV42HIkAWPAdbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b7t+ouPu5WYI+gHy9SAAMmKg863mI9sae+/3yPLcA3M=; b=VnwmHWYJpTx8VvtJI+1x+RUVwNf3tAjPu7593Zxya+KFXkP9WVRgNvX4ZqNvAQngWfPaOw3nDkjOLYcdaKEnViRhpKYMCr7ieUzvtgRifHFg5NgI6cgIk4L4I4/EXC+t7VJ4pcFq95Hwz2G7j/6czOUR+aaEeBF2osMpnVVj66s= Received: from DM5PR2201CA0017.namprd22.prod.outlook.com (2603:10b6:4:14::27) by BN6PR12MB1890.namprd12.prod.outlook.com (2603:10b6:404:106::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:30:25 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:4:14:cafe::1e) by DM5PR2201CA0017.outlook.office365.com (2603:10b6:4:14::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:30:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:30:24 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:30:24 -0500 From: Michael Roth To: CC: , Nir Soffer , Nir Soffer , Eric Blake Subject: [PATCH 49/64] qemu-nbd: Change default cache mode to writeback Date: Tue, 19 Oct 2021 09:09:29 -0500 Message-ID: <20211019140944.152419-50-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7cb6190-5d77-4054-71eb-08d9930cfd6f X-MS-TrafficTypeDiagnostic: BN6PR12MB1890: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:473; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BHPOfoMHBinKdE/LV2OHF3i7uK0T3oTpahDItvcwhlRCYOzEb/iBv36kgH6rWbJHmKf/S39jF8bVK+03LpCHvbmVV9uyOsVjw97yAWSxQrRhj5DpUGCsA1u0KF9S4uDnblFjohj/Kty4fFVmQNAILFIjo0tBS5dzOWuwg647NmSMsePtg7dYpI5JpIat2CrF6qweo/fz+Cpe7WV8AycgKPiAVBwSvZuY82z5y8FQFYsNW3gA0QZN1tRuBQvclcPCq/sSXZ/tyBpWBvOUX6g4kfYlkxp4+Uq3TRstr/SgHuhVqWlMcgYz1rPSG21f8me8M/3CmqwKMouTmGLc/puGLEY5u1ENwwnCo/jqeY2ThrPrurYY99cpjzS6+4FLygR8qukeNpxk2N4r74ng4pp0byd9zxIOOKqNyQh5dGlCdCtBT23Lj5QgbX9eQ1FhYwCogakmAsJhFDsvcPBDzFQYDu2myxcsCiVaN0oL+OTCxu8tE/LobMFt8uJ8y4n7sbaBeXKQ+etjl38kbepN2onohCpDCjAOSisZy79UiloF1iUuRVVYu6WlR96P7m39Pd+Bv1C0mNoODW8ZdpgNpV5nnYoq63gcnPR40z43YSU3k3EHDllg7N3lpUo1PReSdtxyKCE5fajDlgW8nrnhnIXpIB1ixtY+CAMNPnYFBhJtjJoqLtCtA+XENEbQXJecgfBmycfdnPcYRLwqBG//tnPDDeuCTAE+rhq4RhftfLwyOIrRWRA+09aqOIuEoYeWluPODwj2cW3bYZcxZuOJurR+vFjcM4SX2bsCYyN9nTv70fIat9KiA3g56U0tva+CHIv4XnkE6pLVqv1bbUCLeNudI2VBpxj+BMp9Q978R81sI00= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(36756003)(54906003)(8676002)(186003)(356005)(16526019)(36860700001)(2906002)(966005)(70586007)(5660300002)(426003)(6916009)(1076003)(86362001)(4326008)(336012)(316002)(83380400001)(47076005)(70206006)(2616005)(26005)(82310400003)(44832011)(8936002)(81166007)(508600001)(36900700001)(33290500001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:30:24.9676 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7cb6190-5d77-4054-71eb-08d9930cfd6f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1890 Received-SPF: softfail client-ip=40.107.244.74; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Nir Soffer Both qemu and qemu-img use writeback cache mode by default, which is already documented in qemu(1). qemu-nbd uses writethrough cache mode by default, and the default cache mode is not documented. According to the qemu-nbd(8): --cache=CACHE The cache mode to be used with the file. See the documentation of the emulator's -drive cache=... option for allowed values. qemu(1) says: The default mode is cache=writeback. So users have no reason to assume that qemu-nbd is using writethough cache mode. The only hint is the painfully slow writing when using the defaults. Looking in git history, it seems that qemu used writethrough in the past to support broken guests that did not flush data properly, or could not flush due to limitations in qemu. But qemu-nbd clients can use NBD_CMD_FLUSH to flush data, so using writethrough does not help anyone. Change the default cache mode to writback, and document the default and available values properly in the online help and manual. With this change converting image via qemu-nbd is 3.5 times faster. $ qemu-img create dst.img 50g $ qemu-nbd -t -f raw -k /tmp/nbd.sock dst.img Before this change: $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock" Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock Time (mean ± σ): 83.639 s ± 5.970 s [User: 2.733 s, System: 6.112 s] Range (min … max): 76.749 s … 87.245 s 3 runs After this change: $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock" Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock Time (mean ± σ): 23.522 s ± 0.433 s [User: 2.083 s, System: 5.475 s] Range (min … max): 23.234 s … 24.019 s 3 runs Users can avoid the issue by using --cache=writeback[1] but the defaults should give good performance for the common use case. [1] https://bugzilla.redhat.com/1990656 Signed-off-by: Nir Soffer Message-Id: <20210813205519.50518-1-nsoffer@redhat.com> Reviewed-by: Eric Blake CC: qemu-stable@nongnu.org Signed-off-by: Eric Blake (cherry picked from commit 09615257058a0ae87b837bb041f56f7312d9ead8) Signed-off-by: Michael Roth --- docs/tools/qemu-nbd.rst | 6 ++++-- qemu-nbd.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst index ee862fa0bc..5643da26e9 100644 --- a/docs/tools/qemu-nbd.rst +++ b/docs/tools/qemu-nbd.rst @@ -98,8 +98,10 @@ driver options if ``--image-opts`` is specified. .. option:: --cache=CACHE - The cache mode to be used with the file. See the documentation of - the emulator's ``-drive cache=...`` option for allowed values. + The cache mode to be used with the file. Valid values are: + ``none``, ``writeback`` (the default), ``writethrough``, + ``directsync`` and ``unsafe``. See the documentation of + the emulator's ``-drive cache=...`` option for more info. .. option:: -n, --nocache diff --git a/qemu-nbd.c b/qemu-nbd.c index 26ffbf15af..6c18fcd19a 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -135,7 +135,9 @@ static void usage(const char *name) " 'snapshot.id=[ID],snapshot.name=[NAME]', or\n" " '[ID_OR_NAME]'\n" " -n, --nocache disable host cache\n" -" --cache=MODE set cache mode (none, writeback, ...)\n" +" --cache=MODE set cache mode used to access the disk image, the\n" +" valid options are: 'none', 'writeback' (default),\n" +" 'writethrough', 'directsync' and 'unsafe'\n" " --aio=MODE set AIO mode (native, io_uring or threads)\n" " --discard=MODE set discard mode (ignore, unmap)\n" " --detect-zeroes=MODE set detect-zeroes mode (off, on, unmap)\n" @@ -552,7 +554,7 @@ int main(int argc, char **argv) bool alloc_depth = false; const char *tlscredsid = NULL; bool imageOpts = false; - bool writethrough = true; + bool writethrough = false; /* Client will flush as needed. */ bool fork_process = false; bool list = false; int old_stderr = -1; From patchwork Tue Oct 19 14:09:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3040C433EF for ; Tue, 19 Oct 2021 15:33:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AFDE610A1 for ; Tue, 19 Oct 2021 15:33:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2AFDE610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:43238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcr7c-0001vm-7d for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:33:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq8m-0006K3-Pd; Tue, 19 Oct 2021 10:30:56 -0400 Received: from mail-dm6nam10on2085.outbound.protection.outlook.com ([40.107.93.85]:29921 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq8f-0000OQ-Qr; Tue, 19 Oct 2021 10:30:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MPFqi692ZyMADkIB4Jio9aKRKlPWJEmwz/ExOJnzvUXCM0gmTkKjG+2FT9cRBar1sQp9pe2/FMA+ACTShCrYQ7dkt2sZ6NZE1lZ2Z729cU9BI+KYWfzgs66ru1of2t2/u1P4jDFFdvi/dYD410MaC62q49Tyrw+04GPuVYjPjDEubjHwQ5PHVQUtioaurRawWnj43vpoQDuyH91HxK6I4InRPHs7XrLKEwKx5EbXc9Q678ZjFH2GTYNFSmHxDsXDuNZzjQuoeHNZlRfFmYTlkq2JQapCpZ0TiZJ9t/EoscGZwQqBXdJcELvy0hN+RgvD7/9BNW2DjkjmMlaysHcgGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eZIrhaFdJZdSx7RYkqBvhwTlOz2n+Yw5GTHhzt5OxCs=; b=RQaFbFJfPY7M6hUZ0csiifLpAPV9ox+p/763L0r9fdhQSFQx/j3fScl9PSWwpw4vGyCOQh4xPilROIdR+n+qEe2lWwU9RUnOrqtW0XNC/dadG7gd+VWqUEPaoYjdtwLwb/8+iuftL32l/sllpb64b1UndROzkSLmRZumFjMiI/ceSqPllSpfBefdOT3/wDrNsCYlX3IzUJYa2VOzpxW7EKSgtQMPGMaaRhNR28AgyrYfpcsYM8PkBG4/Y0A2m4J5FX1P8QWkF770o1n6ZUsRFdEAjXbcKzlo9y0rW47dck49uYO/jVvEnK1iwZ/ON7lcr+wsN4ZXjtqfgBKU1Y/e8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eZIrhaFdJZdSx7RYkqBvhwTlOz2n+Yw5GTHhzt5OxCs=; b=Iu2NIGi7ZxSy0Qt3mA2ouWvatq2vFCRcQLD26Z8cklxt2DQIfJuu2iOBjKrG5YbQG+qKqCkiOkg/fRbzeRrmuGUYNa9BHSNlc9sEleGF/I5hdrThzlBGWmxyMI/2Sbze55r6J/FoDFULY1uwg/gIZRViAxLw18b00YrXrbn+6pk= Received: from DS7PR03CA0228.namprd03.prod.outlook.com (2603:10b6:5:3ba::23) by BL1PR12MB5336.namprd12.prod.outlook.com (2603:10b6:208:314::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:30:46 +0000 Received: from DM6NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ba:cafe::18) by DS7PR03CA0228.outlook.office365.com (2603:10b6:5:3ba::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:30:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT031.mail.protection.outlook.com (10.13.172.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:30:46 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:30:45 -0500 From: Michael Roth To: CC: , Markus Armbruster , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Gerd Hoffmann , Laurent Vivier Subject: [PATCH 50/64] hmp: Unbreak "change vnc" Date: Tue, 19 Oct 2021 09:09:30 -0500 Message-ID: <20211019140944.152419-51-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3e336e1-671d-4b50-5d6d-08d9930d0a07 X-MS-TrafficTypeDiagnostic: BL1PR12MB5336: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X5Up6rV6Z5XSpYocj5wfEDKeDhj7gFjTjP/lxy5MnaUCzz9QcpZpteaAygl3rv69ANJvomedKt1/c83hzV0eZJw8smn+YuuTzjBHJCLpNbYI+g7jXxcn07wzOK+613VNZi5F2gGJmALR+wtE3vjTelhBJfi9Q5bAfEfjoG5UmGeW9fNGU+JuRAZ02GMDfBKS1IDsy4zerOY7FLjc66MzhcW8kH0wKIDFTmVQIqq2J0RuYud909vWXz6TX71ZOTncxaxLSLT8GWh+haBQAGAQ0FTWcyFEZU0heyhkpZBgIVfRKPM5QfEqLd1QVfFfbGkNkVwU1xUDVDTZWxLOhahioZIg8rMMCBjm9Bh+iGi/B6B5o/lhLE57szIHEJENvoql+3jqKFlaBU16xeKQQceq1Vd3vSv2KXHEJzwnk6+K14jSGTr684Eb1NMMpP3ZRjUW+JkXve/Nqh02uMHSYhJ/YklxsQcWOdwYKsRuHfvkPQxd//nvSXvEbQcGWaSWhYM79avt0y9lNucmL9T8dasUHAQxCqsdNEBFM4mcOizbpMcuCvj7AUSHtVMPshA2v1t84JQpgUhSfpcrrFNKucYV0jZ28zHEpy+RbRQJ3cPOSEzbV9t4VvxZqVEN2w2sfdqM0NKXHqH8oHkFpp83UwrOIE4V8Gt5PoEA4u9i6/cB/VyGKV3B+X/EOpNmDx2Dd7EcezkEJtNZqJPJX6r1+XpdVpj3GYuH14+vh4+ay2ohVUs= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(44832011)(86362001)(6666004)(70586007)(70206006)(47076005)(81166007)(8936002)(426003)(26005)(16526019)(8676002)(36756003)(186003)(508600001)(356005)(2616005)(54906003)(6916009)(36860700001)(82310400003)(336012)(4326008)(316002)(5660300002)(2906002)(1076003)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:30:46.0939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3e336e1-671d-4b50-5d6d-08d9930d0a07 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5336 Received-SPF: softfail client-ip=40.107.93.85; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Markus Armbruster HMP command "change vnc" can take the password as argument, or prompt for it: (qemu) change vnc password 123 (qemu) change vnc password Password: *** (qemu) This regressed in commit cfb5387a1d "hmp: remove "change vnc TARGET" command", v6.0.0. (qemu) change vnc passwd 123 Password: *** (qemu) change vnc passwd (qemu) The latter passes NULL to qmp_change_vnc_password(), which is a no-no. Looks like it puts the display into "password required, but none set" state. The logic error is easy to miss in review, but testing should've caught it. Fix the obvious way. Fixes: cfb5387a1de2acda23fb5c97d2378b9e7ddf8025 Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrangé Reviewed-by: Gerd Hoffmann Message-Id: <20210909081219.308065-2-armbru@redhat.com> Signed-off-by: Laurent Vivier (cherry picked from commit 6193344f9337f8b76cd44ce94a32c9900d907d35) Signed-off-by: Michael Roth --- monitor/hmp-cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index cc15d9b6ee..384cd186fa 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1492,7 +1492,7 @@ void hmp_change(Monitor *mon, const QDict *qdict) } if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) { - if (arg) { + if (!arg) { MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common); monitor_read_password(hmp_mon, hmp_change_read_arg, NULL); return; From patchwork Tue Oct 19 14:09:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2FB0C433EF for ; Tue, 19 Oct 2021 15:08:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3DA946115A for ; Tue, 19 Oct 2021 15:08:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3DA946115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:35186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqjX-0008DG-C8 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:08:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq9S-00078o-E8; Tue, 19 Oct 2021 10:31:38 -0400 Received: from mail-bn8nam11on2083.outbound.protection.outlook.com ([40.107.236.83]:41504 helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq9P-0000rp-4f; Tue, 19 Oct 2021 10:31:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O5zhPNTMCk1N1ZLqA9sd3mI8v/j/yIgat+4EMWiU9566gcUmNtUU0gpnL5WfuBv2EfirdkzmobAXr20ORXB/k/TfaBx96PxoQOc5uiUIw69VtDxgc8JCPTvJ3xNTBDqM7s+mzg103zblma16t0PZtBCLKOWXos9D599OHVUvCPbApfhz9fqHZnrLUdCQPpMLRrenqaMRUutj8RSLxykU9PcMIn2RBWNdM9aNFxsfeMLfKMDxG5s8rb4TGGPFEskb9ZfZVEQAocwxrtND0Tbkm4gY/anhJogyNOcYb6Wjtb+WI+DNOsbdnllLuBEIzV2apCNZuTUXAK+3sJbDfQfDCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JTuTcfJFG2D2G+EG65F+rhctkWVk5bPCtIxZ5uUtri8=; b=jA99L1E1azZMgYIxa9U/JE6MzucgsrLnnJmjlVpKhYCZF2JjqTw9G/08Ct/CKNOwvHFDuRmGq+zWYkekw27FnL6uzQzRKzYH+m8CuwOqOT49Y4ZdcZpdwrJv+OHohIXfEpNVIjKxbDyRxVBAfthQRhgk+T+DATkDww6rPtKGhatXSDxl0h5XBx5xRVZnmMg/Ya9oqXsWBy2WW6DXE051wQzu9FmfKmlgl45u7DguOoYe3BX2nKQE7IB3iWUqp13Er7pXuup/GpDpgy6lwNJAkw1ueArYbgR3HcIkltB8h1UOeIxZyMIUb+3HVw66419wf2TJ94P9oEjRslyZYVg70Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JTuTcfJFG2D2G+EG65F+rhctkWVk5bPCtIxZ5uUtri8=; b=T+xEOFGkB8hak95acWU1wIKATTnbX+i5MEYQzUdYoNJnK+hLfWxFkhmExbWX7hMK6tKrPupvYkZ97gkELThvFLq+GSJIvZ+z8N434tY2CVYYmgLelwkRmhgtVFDUj8v2hxiqJQmShUJaWW89I9YjPk2mZdg0W+n83YHiWOk7sLM= Received: from DM5PR16CA0025.namprd16.prod.outlook.com (2603:10b6:4:15::11) by CY4PR1201MB0247.namprd12.prod.outlook.com (2603:10b6:910:1b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:31:30 +0000 Received: from DM6NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:4:15:cafe::10) by DM5PR16CA0025.outlook.office365.com (2603:10b6:4:15::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:31:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT037.mail.protection.outlook.com (10.13.172.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:31:30 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:31:29 -0500 From: Michael Roth To: CC: , David Hildenbrand , Markus Armbruster , Paolo Bonzini Subject: [PATCH 51/64] virtio-mem-pci: Fix memory leak when creating MEMORY_DEVICE_SIZE_CHANGE event Date: Tue, 19 Oct 2021 09:09:31 -0500 Message-ID: <20211019140944.152419-52-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a738c0a0-d46c-4d4e-acb0-08d9930d2466 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0247: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:220; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qYYXZMSqVxpsja7fw3AeEGcwwGSj2km6nElss10FJLKtHWaaFtrp74EaWPzgJnWSfwCCoD5guqLQ3oS6bCk5NxsTHdR1VJfAeI0LfqOth8D2S/ApVDdT1qHlHToB2u5qq4l9mrJkOC7fDBO+PtJtkcquThfvem418EwS6Rw5K18hMRvqxrUhI0VKOg8BdwtPHapbOyUs7GPKwPAJEPVMDDS4QFfBcG44RoONlmg5ll2OAFCfgLqOKpAjIwoWvy0QfprDg8vUhhBEukEG/Qa8yjd6XHJp/GhGi1XMGAQEQknkO3fnPR5C8Rh2H459HFS5HNt4G3SbyWfUyQDi/sUXbww3+efTZ8wrO5icXN+tjZFTJKI69s7yTcbmvHpczJsX/JD2tx97LjnyPw+ksT5WkIUBVDRjFngqfMfYGexH/umVHcxrt6DBQeGOnUAOmz6KdAk3BRihlnSmExEjhEUiYMvCJMmcGipBLmvmKxcEJGEqt56Zqhds8vm3pz0FNkWF7GaACh6eWUYk3sVixjA/XAc/3mdi4gSupDi+NW6K7Nqomt1VzTcWuzRu346rcAKu0160mnOc6qAS9OzJTG3/GiOXK5LI9uUfYznJlTtMNEXTJbc0Fr3GIc20PI7WeF/s1UGGuMnV6RUpB+Mqg1gdoawvBqMLSlupt3i4FmvTmXzOF+s50V+0MhDBJgQkAJgH+AfkapRUOofG4cFGlQf+TR9HO+lQBX8pzC0VdDRCNMQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(86362001)(8676002)(4326008)(70206006)(508600001)(8936002)(6916009)(54906003)(36756003)(70586007)(82310400003)(83380400001)(16526019)(186003)(316002)(356005)(5660300002)(1076003)(44832011)(36860700001)(2906002)(26005)(81166007)(2616005)(426003)(6666004)(336012)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:31:30.3402 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a738c0a0-d46c-4d4e-acb0-08d9930d2466 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0247 Received-SPF: softfail client-ip=40.107.236.83; envelope-from=Michael.Roth@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand Apparently, we don't have to duplicate the string. Fixes: 722a3c783ef4 ("virtio-pci: Send qapi events when the virtio-mem size changes") Cc: qemu-stable@nongnu.org Signed-off-by: David Hildenbrand Reviewed-by: Markus Armbruster Message-Id: <20210929162445.64060-2-david@redhat.com> Signed-off-by: Paolo Bonzini (cherry picked from commit 75b98cb9f6456ccf194211beffcbf93b0a995fa4) Signed-off-by: Michael Roth --- hw/virtio/virtio-mem-pci.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index fa5395cd88..7e384b7397 100644 --- a/hw/virtio/virtio-mem-pci.c +++ b/hw/virtio/virtio-mem-pci.c @@ -88,13 +88,8 @@ static void virtio_mem_pci_size_change_notify(Notifier *notifier, void *data) size_change_notifier); DeviceState *dev = DEVICE(pci_mem); const uint64_t * const size_p = data; - const char *id = NULL; - if (dev->id) { - id = g_strdup(dev->id); - } - - qapi_event_send_memory_device_size_change(!!id, id, *size_p); + qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p); } static void virtio_mem_pci_class_init(ObjectClass *klass, void *data) From patchwork Tue Oct 19 14:09:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76B81C433EF for ; Tue, 19 Oct 2021 15:12:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAF2660F25 for ; Tue, 19 Oct 2021 15:12:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DAF2660F25 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqn0-0005wn-Up for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:12:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq9o-0007sx-Qt; Tue, 19 Oct 2021 10:32:01 -0400 Received: from mail-dm6nam10on2071.outbound.protection.outlook.com ([40.107.93.71]:26528 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcq9m-000148-L8; Tue, 19 Oct 2021 10:32:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XsheaD34UYGwhia2v04wiR2ZFUB75mWa9LHuOa1OQP4/2OSXJ4cR4b998SYTiXt8Zkwia7sfMcFCu8L+lYw4hkXn0rop2sEpRTp+piGhdJ6/oM3SUFPJr5ybGPbhKVYxkCwgTsM4aUX00S5rNX7KV1fBwod5h7PbWdsAarYWtj8TgiXAnif3z/yiMBTzftEN2izUejf5OYYxmoFgM+1tTUoDaPEsTGbjjlr0atzWiurnijrvIKeqilPl/T8RPdQsRpP3DsVR+9OHtuvY0rT85tlIXdLxZMKqfNfVe8usNwtMgl+aRaVTBajvKjxjeY4PU1Q8p5MEMGA9dQlqpJdTfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ukEp2kdWvHI6ZcY8tHjKzAOeloz+/2lidUt1i1C6z20=; b=F+XIEwvgUFoLyG0BHskojTlZnY1KPVOyF07ZZGRwEuQhu1eCPGEtVrRUPMxzOG/ekl4yFPv7DILA+St+Cy4Kr5g04e9wpQy4I+4fm+Dnt2wbNo7OEfuWyKLy1FjPg6xJguTLSJ27k8rhqrmh/veYEgEO+cKNp0OqxiazPknApVJPBEjCRgRutSQv2KpZNK+8l6MD3UW/0k0d+52fNVCgloHb9wEF4gntsJ16ExoNjQl1p5w31LqFjOL/eGpoumSROPshtpPwZfY84hdnYmL0GGgeE/DrOSkQ1SerYQXUS0WQ1N9cNfZPJiP5Ao9Oq7XsUHyzsEdYm2AY6VJtDrsQsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ukEp2kdWvHI6ZcY8tHjKzAOeloz+/2lidUt1i1C6z20=; b=xe8w4Q1rWKoFhnJzHuKu2E2qFQp7Fzt21/g7xelMk7Eg8QrAHcxTE6weEnWHqNelwdtH2bvubAnPSEh6E5BoTpCw02l4x83u3BuC/CBCQMImbJAXXGRAhnkpOOKwlKo+YIa16E5XSJ3uPNJfB2V8MePUEyP5wWjFjz7sfJI6K48= Received: from DM5PR06CA0088.namprd06.prod.outlook.com (2603:10b6:3:4::26) by BY5PR12MB3923.namprd12.prod.outlook.com (2603:10b6:a03:194::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:31:52 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:3:4:cafe::29) by DM5PR06CA0088.outlook.office365.com (2603:10b6:3:4::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:31:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:31:51 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:31:50 -0500 From: Michael Roth To: CC: , Gerd Hoffmann , Chen Zhe , Tan Jingguo , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 52/64] uas: add stream number sanity checks. Date: Tue, 19 Oct 2021 09:09:32 -0500 Message-ID: <20211019140944.152419-53-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c161e27-c585-4ab0-028a-08d9930d30fb X-MS-TrafficTypeDiagnostic: BY5PR12MB3923: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jMZE+mE4RdXzb0Q7rtTQOlswWFnyVa9UAzGywb2CarYTew92Fy/Sbt2ihoCtSHxc1iN5qRD61u6VlJfkP4AgUDEK3Y2iXN0ikXQoXOYH2ZHVZm4wmvkQKZ73a1dcNGW9fJzNbqqOXjWoUwCoil9oIQX/plpQ/XpgdbzHBvNfxEMaTHN10oh2unYo3SymrIO8/zq0nrdUQBX9KsRHeXQ7dvGAVzTYoZdAgQHAcy+vZ+csKE80u2jbPwl741SZ2CgfzzVIbbd6sykaCWj4czPyyQmANqEf/de5Jksj1GSdbQEyXuiM25kfrVt1afPoGYDgZ5Lxr83x68em6fjmtbr1V/7XrTjpz2axaZIPGqQ7j0iKor0RZKy0tQG4tNGQvzA+lX3XTSSD3ylcOBXlZLx4JlTuBwF5vodE+Ls55ijwXvv/46Gz3Sfi/NrpsRCWk9yYQPEIEONei8IHlTHGYe2Sx7gBZLAytNkWo+kux2agDhK2qNPhbOTxwYLt0lhSRl7f654+t3wTYxP8dr/CG+yFLkaKgr5C30AKk/XVwVlkwmQHu3JfkparuGDmdYVC4UgIEXI0vbltoldtPL5BStAiVLkUKQ/ofp4ugq4GroOC+BLfob7lXDxW9s7NDFfZwjfbJ7tDjNhIh+BlQtXLZdSHF/WEWbOcXR++LRDqjEg30rTpla81XiLe7TYm+HwY5hhbz2wWVN+HG44X9fIXKS8a6vw9fMoEAaougXvw7dNUHgU= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(44832011)(336012)(83380400001)(2616005)(426003)(508600001)(5660300002)(70206006)(6916009)(356005)(1076003)(81166007)(70586007)(8936002)(8676002)(47076005)(54906003)(36860700001)(2906002)(6666004)(36756003)(86362001)(4326008)(16526019)(186003)(26005)(82310400003)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:31:51.4430 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c161e27-c585-4ab0-028a-08d9930d30fb X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3923 Received-SPF: softfail client-ip=40.107.93.71; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann The device uses the guest-supplied stream number unchecked, which can lead to guest-triggered out-of-band access to the UASDevice->data3 and UASDevice->status3 fields. Add the missing checks. Fixes: CVE-2021-3713 Signed-off-by: Gerd Hoffmann Reported-by: Chen Zhe Reported-by: Tan Jingguo Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210818120505.1258262-2-kraxel@redhat.com> (cherry picked from commit 13b250b12ad3c59114a6a17d59caf073ce45b33a) Signed-off-by: Michael Roth --- hw/usb/dev-uas.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c index d2bd85d3f6..4866e0add6 100644 --- a/hw/usb/dev-uas.c +++ b/hw/usb/dev-uas.c @@ -840,6 +840,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) } break; case UAS_PIPE_ID_STATUS: + if (p->stream > UAS_MAX_STREAMS) { + goto err_stream; + } if (p->stream) { QTAILQ_FOREACH(st, &uas->results, next) { if (st->stream == p->stream) { @@ -867,6 +870,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) break; case UAS_PIPE_ID_DATA_IN: case UAS_PIPE_ID_DATA_OUT: + if (p->stream > UAS_MAX_STREAMS) { + goto err_stream; + } if (p->stream) { req = usb_uas_find_request(uas, p->stream); } else { @@ -902,6 +908,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p) p->status = USB_RET_STALL; break; } + +err_stream: + error_report("%s: invalid stream %d", __func__, p->stream); + p->status = USB_RET_STALL; + return; } static void usb_uas_unrealize(USBDevice *dev) From patchwork Tue Oct 19 14:09:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB3C9C433EF for ; Tue, 19 Oct 2021 15:08:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 510116115A for ; Tue, 19 Oct 2021 15:08:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 510116115A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqjD-0007Ps-9V for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:08:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqAE-0008JA-7r; Tue, 19 Oct 2021 10:32:26 -0400 Received: from mail-dm6nam12on2076.outbound.protection.outlook.com ([40.107.243.76]:56161 helo=NAM12-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqA9-0002DC-5i; Tue, 19 Oct 2021 10:32:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=At+VZ8wNcAmXGrVmQO/O6bS/AIlqOhK3MRCSE4UHeLeSOigIdKBGW/uKDXW1K6lhpsztK853025f7UbF3Tj5fCJVNWwhoA9rcN1ci8Il2l/YNDeJLNKoT3+lVsJVcytvScI/Qi52fPMYODg+muqZOz8sLObHZsVCf1T9XkYtKT78YIFBBFxixPJ8MI4QpY4I14T9b5+i0vfHxz5nrdNmUTlu3RrtwavUG7U9a6hiBxuDsGMbLU8kHO1IAlCtmlDEPe5OCg/wOM2jrw/9N0s0+Qr9BD9c8Gehe+0C7NB5CNXswsnlJlfWlqaInR1BBhS2rsl+1B0pHABTDMn4Kgxogg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jSI4HZaHBOcAjDAqOqUwKpf3VV+6TPKcrPPU80jFBUM=; b=bu75DmRQAyTwOGueJUG7ISuVQK4H1MqmYSgC1Bz29eJgcZRJ4I7tG6EssNIYRROcH01PmL5Nkh0NwHLLxqlANVpB8lb9rc3yVcAl/dn5uhG0d1VvIeIusZIkH0gWLICJwAasbPQjePSeytkYVYzJjRQOrg0WuN3ShPmH8y7+f55uTulbVw/BMmA3+FSwPrUdrWCsASYJlyuf5MgT3hjGJquO6Eg5T15uDMpTAlxiI8eCKi8Ga6Tnpu+PRDCJEO+MtlOlO55jppkH5fIC7HVyOlPzHyLtDTPDmvRY3lb3/RQ9TiazvtF9l+VF68k8zJqzFnyUJAjBtYWQ+l9EDEeRzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jSI4HZaHBOcAjDAqOqUwKpf3VV+6TPKcrPPU80jFBUM=; b=Jm0q7LdNjM5K02GChZbMoBgiiJhN2VT0qgQ3M0vPsYqQZfvv8KMoCDCJJEGKpHD0Cv6evO/f7fxdmr48IkzDvVCdy5MDdf59y9YK2mceVT4AnSaLpSJpDh0rj1ElpoHlNIA70miZagutxcYif1xxKABEiE/VuTH5a7MnHz87i54= Received: from DM5PR20CA0038.namprd20.prod.outlook.com (2603:10b6:3:13d::24) by MW2PR12MB4681.namprd12.prod.outlook.com (2603:10b6:302:12::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:32:16 +0000 Received: from DM6NAM11FT041.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13d::4) by DM5PR20CA0038.outlook.office365.com (2603:10b6:3:13d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:32:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT041.mail.protection.outlook.com (10.13.172.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:32:15 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:32:12 -0500 From: Michael Roth To: CC: , Gerd Hoffmann , =?utf-8?q?P?= =?utf-8?q?hilippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 53/64] usb/redir: avoid dynamic stack allocation (CVE-2021-3527) Date: Tue, 19 Oct 2021 09:09:33 -0500 Message-ID: <20211019140944.152419-54-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ec3fc3a-5e29-4436-8383-08d9930d3f5e X-MS-TrafficTypeDiagnostic: MW2PR12MB4681: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:454; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UTFkxxBB7H050vaPsazJPXxs1K6PEypQwjVYJ8c/fv5DpXw87rJ0FUKLfgudcTJrgbCTC+yEQN1XTPfcrTNEaBZN8cW/QdK+vydfoDkijrxclCHSX5ySstkUC7TUw9MkZn3Mb8xAeKDqvBa5W2L1EBsyuneEkgS6BZaYzRkW0Xnqe7NgYssowarBOyqkEMmNKx99cRtuZdYOzWAsnWcvXEUFiu0BsKCCiucJzlctUqLng0fMg9Ic8ODLVpbsmKmmia2qUHqPGoIuai/zdGnVHpgbHV/bKBuSLcbbWwM+fl1XmsU0dXNsaYwyc5ieK051i/DDRXmKWpyWCg7bQVST10XDui9vUytMn8GqBqW+m/evn/O3DD9634xGK5xSkBlWDpheulJFF1CbEW9D5oleXNWAZPYfDKL0O32biwSlJoqkZ8P9n7/nMjhzC7y8xjOlSdcrarZUHTZupRnNyzakkZHUAmH06FAhVRynqhW5V3uPtOGH9JdV14JzKnbs3K+3/lDw5YRo1GyTr18KxCEIsKy96UGRZXOswvDQkXl2SPXBjWbF9nbELQ3MTkhqL5S+038ZvngFGjx6jv7cv54F8XYD+PT2ZBZMoJ6H/xQUO4ItVheAD8N1jIVun6Y+v7UicaQPlXgPiHR4R3/beQ+qxva26TwQwqlwy5BlrPv7jI619rrcnnuo2gzfViVVcbyOeNi9XAi5KhWK+86T9WSyZnzyb1Cay39vx9RPrBFA/TU= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(26005)(36860700001)(81166007)(8676002)(6666004)(86362001)(316002)(70206006)(336012)(5660300002)(44832011)(16526019)(508600001)(82310400003)(8936002)(2616005)(356005)(426003)(36756003)(6916009)(186003)(2906002)(1076003)(83380400001)(54906003)(4326008)(47076005)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:32:15.5662 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ec3fc3a-5e29-4436-8383-08d9930d3f5e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB4681 Received-SPF: softfail client-ip=40.107.243.76; envelope-from=Michael.Roth@amd.com; helo=NAM12-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Use autofree heap allocation instead. Fixes: 4f4321c11ff ("usb: use iovecs in USBPacket") Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Gerd Hoffmann Tested-by: Philippe Mathieu-Daudé Message-Id: <20210503132915.2335822-3-kraxel@redhat.com> (cherry picked from commit 7ec54f9eb62b5d177e30eb8b1cad795a5f8d8986) Signed-off-by: Michael Roth --- hw/usb/redirect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 17f06f3417..6a75b0dc4a 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -620,7 +620,7 @@ static void usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p, .endpoint = ep, .length = p->iov.size }; - uint8_t buf[p->iov.size]; + g_autofree uint8_t *buf = g_malloc(p->iov.size); /* No id, we look at the ep when receiving a status back */ usb_packet_copy(p, buf, p->iov.size); usbredirparser_send_iso_packet(dev->parser, 0, &iso_packet, @@ -818,7 +818,7 @@ static void usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p, usbredirparser_send_bulk_packet(dev->parser, p->id, &bulk_packet, NULL, 0); } else { - uint8_t buf[size]; + g_autofree uint8_t *buf = g_malloc(size); usb_packet_copy(p, buf, size); usbredir_log_data(dev, "bulk data out:", buf, size); usbredirparser_send_bulk_packet(dev->parser, p->id, @@ -923,7 +923,7 @@ static void usbredir_handle_interrupt_out_data(USBRedirDevice *dev, USBPacket *p, uint8_t ep) { struct usb_redir_interrupt_packet_header interrupt_packet; - uint8_t buf[p->iov.size]; + g_autofree uint8_t *buf = g_malloc(p->iov.size); DPRINTF("interrupt-out ep %02X len %zd id %"PRIu64"\n", ep, p->iov.size, p->id); From patchwork Tue Oct 19 14:09:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D1A3C433EF for ; Tue, 19 Oct 2021 15:26:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEFD260F25 for ; Tue, 19 Oct 2021 15:26:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BEFD260F25 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:53968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcr0a-0006hu-GO for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:26:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqAY-0000GW-DQ; Tue, 19 Oct 2021 10:32:46 -0400 Received: from mail-mw2nam12on2051.outbound.protection.outlook.com ([40.107.244.51]:45063 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqAT-0003Yk-KW; Tue, 19 Oct 2021 10:32:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPhWdT1h7cv9+Ki+OgJLJEGGwT4+gzy4/dejxtl0ZVXVLWRz//hA4RZ5aDi9bfvFj94i5hP0vw2N27eVuH52q28i87zPEpXuwAYr/E821DDXrq6dbz+9XAdSnPJ/eCu2ken6r8g/c35qhV1iq413aZTSPrgO566oL0SHKdLt71mIlHgMcRgX50zP/k4moxDvylMfJUWgC+kVZeMGdU6HdkjmPrCQIHBWuA2CUo21y1+DRcVHaBLlyb1HOQEPFaZhjJ0hESSpPsklfiwzMHyj0GCPlSgvl4qSEIt3mq+XUvEQiFOwiiyIilZtpT8SqnRHl1R2Pa119G7c34PVbTNG1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BrL4aylYH3ae4cuUcay6KWZpjG+ZdRB5xVMOqFoqJpc=; b=Cs2NA8mycAxCmrzj7/47jmBaNrrFxCaqSsuLJWem5rD5GcgrdtzV/ooGfCRHG8f9cgYz/0/J7IWUyttlmWWvZjcUFUaiayyegMOY6IErrk5afGlxUtxirdMhstDrANqtQNqt+BebSkKCtZwlVFJ7vNEylqQr/0L6nMckVHAQqlNb6yLA7zEQQApJEee8HSgA7Xs1x9kdKw+Rf9lFUiIh7T/GgVj7MCS1a1CZRNW6Z+5JfJEqh5UkmwOzwz3crtUdtri5D8wvHwvwVTlObxkfiw7+2WLwdxCeWIF1cgSJ4MNf1YR1E5HNz/yTItiKaJ8JHWXYrQUneGpNz7uSHAyBNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BrL4aylYH3ae4cuUcay6KWZpjG+ZdRB5xVMOqFoqJpc=; b=odawLzVqNb9iC0PmHcUACt0CK9ODWwDYvEER3Qpy4bfimpcOr9wTxUZKDTouuWQx0Rd8sjqUfg0sUWpYu4/K06BxDwbeoZkq/zSyEhcFTCWlq5uKLPJN0oSwPNU0pE9uxeGdh05/iRpm67fSvoCap8lCIvVRykRWTbQWj8UAEoU= Received: from DM5PR13CA0022.namprd13.prod.outlook.com (2603:10b6:3:23::32) by DM5PR12MB1323.namprd12.prod.outlook.com (2603:10b6:3:75::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:32:36 +0000 Received: from DM6NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:3:23:cafe::c5) by DM5PR13CA0022.outlook.office365.com (2603:10b6:3:23::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.10 via Frontend Transport; Tue, 19 Oct 2021 14:32:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT056.mail.protection.outlook.com (10.13.173.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:32:36 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:32:33 -0500 From: Michael Roth To: CC: , Gerd Hoffmann Subject: [PATCH 54/64] usb: limit combined packets to 1 MiB (CVE-2021-3527) Date: Tue, 19 Oct 2021 09:09:34 -0500 Message-ID: <20211019140944.152419-55-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86984d3a-dd4b-48b0-3a3c-08d9930d4be2 X-MS-TrafficTypeDiagnostic: DM5PR12MB1323: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p5XkSiKyDXHX0IVHML150tvNKHJYhVJKK03GhuxywJn3RutvDpMdTT/JkQy2KNV0ObCfNrwma0eNUs54/BzM0xEpQqiZkvqcI37KI20aslhABaMEMUyEGXDvANNCNoHMPRDKJCnivdJ9Gm/GPCWOPfjcUdf7/pd/A+0zLfqKBoh/oQyGqxWK8TfU3YrnQaqJLS4wVzmUTANYRTZGn/1p5O1GdVKFUWXYD9S67LGEcyK6peIMraQiqSpoW9+IVHNpzYddqtaG+pUt2fQVm+L+Uvc/AuoSV2U8GH9LGvY3Qt0Pbv+zk94cFX3W2/uaLEjZC412b2uQC6KkIXewuhS2iMWF7yn4pyLd46/cOxlBtt8z2iEUWsT6IkBOQx5FwwFUAj9on59u6VMFtLI2AeFfPPsd6RcDace4Bbu+NbhTb3Z8Jw6ZpmcZ4m6BZ1sW0O5SFhSBGJwzrOBYAMSAzeAtkUBn9HfEI88nTNMz6BzCHuQdoak1BHNbgFjna6r5RIOvPGvEzp9HjfuDAIUN1fvCb5NV0Z/ToNBkAXGf2CcS6Oafhy2SnCLrK2YimO8EBr2el7ggUlk9gLnxDkOBPcjxHBrd7I6dCr+rd+5U8buCxYJlHS7tMWJz7NDz+LliYneVC+DI4D7DjtSjQ0gHa07C16I8BF/ji2d0oQW4pm+1yIrO1NCQa7LzzrNFXXjO2jKjmlypv2n2egjALOfGc0zyAQ5Z7BLC4U3/OX+IsnleQLo= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(1076003)(36860700001)(8936002)(54906003)(8676002)(336012)(70586007)(70206006)(508600001)(2906002)(426003)(2616005)(316002)(86362001)(186003)(5660300002)(4326008)(47076005)(82310400003)(44832011)(356005)(16526019)(6916009)(36756003)(26005)(83380400001)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:32:36.5791 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86984d3a-dd4b-48b0-3a3c-08d9930d4be2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1323 Received-SPF: softfail client-ip=40.107.244.51; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann usb-host and usb-redirect try to batch bulk transfers by combining many small usb packets into a single, large transfer request, to reduce the overhead and improve performance. This patch adds a size limit of 1 MiB for those combined packets to restrict the host resources the guest can bind that way. Signed-off-by: Gerd Hoffmann Message-Id: <20210503132915.2335822-6-kraxel@redhat.com> (cherry picked from commit 05a40b172e4d691371534828078be47e7fff524c) Signed-off-by: Michael Roth --- hw/usb/combined-packet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c index 5d57e883dc..e56802f89a 100644 --- a/hw/usb/combined-packet.c +++ b/hw/usb/combined-packet.c @@ -171,7 +171,9 @@ void usb_ep_combine_input_packets(USBEndpoint *ep) if ((p->iov.size % ep->max_packet_size) != 0 || !p->short_not_ok || next == NULL || /* Work around for Linux usbfs bulk splitting + migration */ - (totalsize == (16 * KiB - 36) && p->int_req)) { + (totalsize == (16 * KiB - 36) && p->int_req) || + /* Next package may grow combined package over 1MiB */ + totalsize > 1 * MiB - ep->max_packet_size) { usb_device_handle_data(ep->dev, first); assert(first->status == USB_RET_ASYNC); if (first->combined) { From patchwork Tue Oct 19 14:09:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DCD5C43217 for ; Tue, 19 Oct 2021 15:29:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C882B6108E for ; Tue, 19 Oct 2021 15:29:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C882B6108E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcr3W-0003wy-SZ for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:29:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqAq-0000vI-6V; Tue, 19 Oct 2021 10:33:04 -0400 Received: from mail-mw2nam10on2042.outbound.protection.outlook.com ([40.107.94.42]:36193 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqAm-0004uC-Eg; Tue, 19 Oct 2021 10:33:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nT02M09Q8Wxv+VLN2JrTnCoepgOJTzDvOtObGYCnQ7yLK1SFK4VZ2izNMGVsa1KNgXXFxlS78L4Td1lXrHklFUSdJCDASpTiKWzjG/KLyVxdxMrjHi91KsxqBzx6ikRV0yy/AhdLSfaWrG5JMkPeJpFzfURUQ5B0mHcEdxaco2DeZwdk17h2CjRz7/hl4RZiF17OyGqEx68GEzc0xTHzqerQmJ6ZhNlKWYpjOlAFaZfXx68j7011EhTR1gG1JhtSaHm+iKjFRwOoeLcL28a+WbsLkJVPxL0a9WID+DgH1ubAETU3Vr7LCsSFp7E9ToF0Hk78wT8dkXU4NcD9B1AWDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8aBVWEplFenlVU1Ww3LZqYlzRO4FDBKV4jnsPArWDHI=; b=RJ1SHMJP4JL3tB2fPyab2KOY42UAoMUhgA9tbcObj/Ll3mSFLRIjt+egtHZXvhnyLGylZt1VgnZNS8iriN9TB4+nZJT/4y7UwX/BXI64wadqxbQqhfOONmnnHTf1zr6trYJbdUwOrTqYQuzR79MyK2qDAG3QaB0EmmHJ/+reTOkevZ1lil/Oag1ZwUWVpT1GYkHydkCBcXKf0PBT5EyWR63LNsmAA2Vl6z1n15aJHr2fsuoY/JIJOXMSVQ2SKddOnY+jTQNlJsWMfh2iD1bxpMcfDYO8bBccRPX1gVI+2GuCsQQbBSdbFj2KlZqgLp8/iKcTeddd6SfyeLTzWnw5Jw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8aBVWEplFenlVU1Ww3LZqYlzRO4FDBKV4jnsPArWDHI=; b=GGKvaObOwox7ppdo5NFaSMJZIxYa2+P+CwnJFfpjUQtJDqiOUqvDw+kj3Ol7+X6yOTznYDoH0HJO5R7MjGjTwCRKFHtZE5t9dGBaqmymnRV46sAsRTNhwsfq/MmC13OvwpndChsMMmcdcTfSPHI/s1hL1GS6gco0lMMp0lvEAhI= Received: from DS7PR03CA0194.namprd03.prod.outlook.com (2603:10b6:5:3b6::19) by SA0PR12MB4381.namprd12.prod.outlook.com (2603:10b6:806:70::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Tue, 19 Oct 2021 14:32:56 +0000 Received: from DM6NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b6:cafe::87) by DS7PR03CA0194.outlook.office365.com (2603:10b6:5:3b6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:32:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT048.mail.protection.outlook.com (10.13.173.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:32:56 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:32:55 -0500 From: Michael Roth To: CC: , Li Qiang , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Gerd Hoffmann Subject: [PATCH 55/64] vhost-user-gpu: fix memory disclosure in virgl_cmd_get_capset_info (CVE-2021-3545) Date: Tue, 19 Oct 2021 09:09:35 -0500 Message-ID: <20211019140944.152419-56-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d78705e-b8b6-4cd2-8aef-08d9930d5787 X-MS-TrafficTypeDiagnostic: SA0PR12MB4381: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:469; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZvNPd+WtHUDnqidVf99SK4srKxtrh3WFD/+1jZ2wufVhc2aI6QP2Tri2laarZxvs/4g42+hnRiK7bUkl8oOmq8jyBPyklS4hJkNx0EyaXbbpds/iark+K9bhQo4mwqZJ+HM85vzpniWdUKGBgl6Z9to4oI6KEVOH0oMMdHZH4nz9xRkYP5qrvK/vjOIW/fIDvKJLiL8Lua7dXzTmVLRgsRtt1EjdkP86i2bH45+uAftEs4e35E8SCS1w1VCXA6egxy16+uF2GI03fStqSNovW3BxCTYHjtAoNkz4/Z1CK3Rj8jiADATmyg1OcGDWBcVB3+rw30VBjBRldTEwkXV/NmaYem6HRuXUOCfF3Oe1gYbyQt9HzPw6MzqEor3rXVBEwrpuoCB80imLCWu7MplgIj2xB9XW2VVN0Nv74D9WJGbdP1Th1gevtSx9SXFr6tECX3ouoZsBp0ryZ6GksRcmYMzii2qG35lWIk72xx5EE+rpF2NPfojHTrqTQVtYeOlbtMXF5NIWaf5yML/R59WQHbv3DiWBah+1WMfPyGnkwhLXZ6OCK4l/2kKhmNYdVeQ56JBvpveB3CUOCe8XB3RSEFdl7EaXDajfQBIrRloLJJBwz/Hz8wnFBPeSAV69n+rc8Tt+S5cqu9ZG73oHXp30FvnO5WwDXj2lbrDFESE2s//6opVfNCmAYkdpueJ/gR68TFQfzG3Lc3jvJ1jXUYz8OpCHhcSmd2/y1W7OVJ+SZCc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(36756003)(6916009)(82310400003)(86362001)(8936002)(5660300002)(54906003)(336012)(8676002)(2616005)(1076003)(426003)(26005)(6666004)(47076005)(16526019)(186003)(508600001)(4326008)(36860700001)(44832011)(2906002)(70586007)(70206006)(316002)(356005)(81166007)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:32:56.1254 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d78705e-b8b6-4cd2-8aef-08d9930d5787 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4381 Received-SPF: softfail client-ip=40.107.94.42; envelope-from=Michael.Roth@amd.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang Otherwise some of the 'resp' will be leaked to guest. Fixes: CVE-2021-3545 Reported-by: Li Qiang virtio-gpu fix: 42a8dadc74 ("virtio-gpu: fix information leak in getting capset info dispatch") Signed-off-by: Li Qiang Reviewed-by: Marc-André Lureau Message-Id: <20210516030403.107723-2-liq3ea@163.com> Signed-off-by: Gerd Hoffmann (cherry picked from commit 121841b25d72d13f8cad554363138c360f1250ea) Signed-off-by: Michael Roth --- contrib/vhost-user-gpu/virgl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c index 9e6660c7ab..6a332d601f 100644 --- a/contrib/vhost-user-gpu/virgl.c +++ b/contrib/vhost-user-gpu/virgl.c @@ -128,6 +128,7 @@ virgl_cmd_get_capset_info(VuGpu *g, VUGPU_FILL_CMD(info); + memset(&resp, 0, sizeof(resp)); if (info.capset_index == 0) { resp.capset_id = VIRTIO_GPU_CAPSET_VIRGL; virgl_renderer_get_cap_set(resp.capset_id, From patchwork Tue Oct 19 14:09:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47993C433F5 for ; Tue, 19 Oct 2021 15:33:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CFD00600D3 for ; Tue, 19 Oct 2021 15:33:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CFD00600D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:43480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcr7e-00026j-U6 for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:33:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqB9-0001ef-F6; Tue, 19 Oct 2021 10:33:24 -0400 Received: from mail-co1nam11on2079.outbound.protection.outlook.com ([40.107.220.79]:62944 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqB7-0005Op-Pp; Tue, 19 Oct 2021 10:33:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cVh/F+kEAVpxGARfuVlWlq/qaGif8AR0U9370Y3F2oxUzsDFzURvH+Ooe3WxHByhBHXB+6TS44yUXRY0hhWu3M1G9vR/DCkOt67r2CUQlKy+vrxzY+mgw/+G9FRo4IxmILy/F9TluTilIL395w35n9yWhBWTlq+qhbxxNjTCQeZ8tUhTVmIpFECOr394AObrsplcYtxVUlZWtZDejo0VvMjc4RiHtpz24t0C/FLPqBZK0YnTy/pMaWODBzutxMpiCmh80WDmcPgz4pzH8ZawMMsc07VI0Js6t5fNxDdO2fhrL0D2P0Ae7/s6OVZGoCk/UYwgnF3qSgMW1jEg8n7KFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QHTGhcaBr1JTWcO91JNLF8gFezP5d8kMASZci+5OfOc=; b=G61KRM/IhnzWIownKFZn+Hfgazj+7QI4jMU8Ab6mkrCX364/GuY/t12HSAEbQNHK5z1QH5nepeq7gdQKJtz22oKPdyqtBNiKphkkSjsCNaDTgVYaJu135WetaSWwyGXh7U83+dtLw9t4aHuWinPl5S9tEQL7lyK85I0zciX0Mwy0ts44C0vz2Qdkhdhv+3Dl86ZeAzUibDjuZykaIYeJVV8j4yVQTkb14v+nVP8RPd1BHARaBvGEuaACY0Bs8cb6l5DHKlu/xXFH7fqq7lraIHB2A3D/kyOnkx4Pg2d5H2Ew9XXdvm53IwMINvwGVlo8DA/MjJv5VkiTyqUSoF/79Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QHTGhcaBr1JTWcO91JNLF8gFezP5d8kMASZci+5OfOc=; b=3XrQr7AGdc18lsam+3s/bdfEzfoGfqIl7tN1Mfd3dCUIZnkdzKaEeAhF+iHtOAhfzjrbMDiYpcEqseFTWnE2C0B9kW6yugj4DJsO26wXmi/DRAy1IQjtpjRFPaOkxeUW1bfA8Zde9+xoDN5re2cKF1jxdhhokKz33H4w/A5/gNY= Received: from DM5PR16CA0001.namprd16.prod.outlook.com (2603:10b6:3:c0::11) by DM4PR12MB5182.namprd12.prod.outlook.com (2603:10b6:5:395::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:33:18 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:3:c0:cafe::8e) by DM5PR16CA0001.outlook.office365.com (2603:10b6:3:c0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:33:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:33:17 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:33:17 -0500 From: Michael Roth To: CC: , Li Qiang , Prasad J Pandit , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Subject: [PATCH 56/64] vhost-user-gpu: fix resource leak in 'vg_resource_create_2d' (CVE-2021-3544) Date: Tue, 19 Oct 2021 09:09:36 -0500 Message-ID: <20211019140944.152419-57-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3476bc28-2688-4720-c110-08d9930d648f X-MS-TrafficTypeDiagnostic: DM4PR12MB5182: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:47; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RMS1UkohUoyh/Fp2XWUhECHyjDhApmsexShl0JGg42NXle2ki/BElFjpKmrza9EQAGMASq9rlJF8x20ccUZVtPIzWDNvOU3I2fd0pOIP/AJaDq+tH8iO4BoOMpssoXjQoI91ZBca9dOTmjs7bB8inzxKBVlyE6kxzH2Dq4R6Vv2p6ISACAwTzljSyq+ljnHs+bMIx7/dYQypaJ0Tss9nc/qg5CiiYTguER+OJRJoA5NkJFwjblmSutqkc1F6zcd8DlY1bE53c8D40qSsC3PQMf96T84BYTzqrFuaEL1mwa0zp+HTHMT6+C8UQ9R1J9H2E7vbR+z6nL8hdHkKu92hclqHMW0wt5lGsEZw4ceGVFqMNpAT0o5CLAAEuFVnItyOmixI/IsavLRrqZNKw9/XZpOt9nC8ry9FNNDfTJRAcRNRho2+KSaakTc1gV6KZmKi46g+6ipU2qPPVn6ZosJ1ozRLPbB4DpVHhr9hwFrJhq/OFuEw5WIN0BiRKyrVSYtKC3IplPihPKwyUcICRPXotu+nGL6fLuTwIAA9LV8uyAJ/QamYA0NzJE5HNUFGxYeoEumRxrGhXcllJqtNEA56rrx6E8Nr4hV/Upr+uSJG/wkTioPzrZc4Cj8nKd3j6/mtUAnbLacUwe8c3pemsReOwJvzvKmdeQDIp8d4/oGNWtmJF4Ccc+xfVFBsobnfSuvFt/LdpFYA+d3AhozlkB3YHqU5I83plopYfqYhrMjfc3s= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(26005)(54906003)(5660300002)(8936002)(2906002)(6916009)(82310400003)(36756003)(86362001)(4326008)(316002)(83380400001)(336012)(81166007)(47076005)(8676002)(426003)(70206006)(70586007)(36860700001)(6666004)(16526019)(44832011)(2616005)(186003)(508600001)(356005)(1076003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:33:17.9886 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3476bc28-2688-4720-c110-08d9930d648f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5182 Received-SPF: softfail client-ip=40.107.220.79; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang Call 'vugbm_buffer_destroy' in error path to avoid resource leak. Fixes: CVE-2021-3544 Reported-by: Li Qiang Reviewed-by: Prasad J Pandit Signed-off-by: Li Qiang Reviewed-by: Marc-André Lureau Message-Id: <20210516030403.107723-3-liq3ea@163.com> Signed-off-by: Gerd Hoffmann (cherry picked from commit 86dd8fac2acc366930a5dc08d3fb1b1e816f4e1e) Signed-off-by: Michael Roth --- contrib/vhost-user-gpu/vhost-user-gpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c index f73f292c9f..b5e153d0d6 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -349,6 +349,7 @@ vg_resource_create_2d(VuGpu *g, g_critical("%s: resource creation failed %d %d %d", __func__, c2d.resource_id, c2d.width, c2d.height); g_free(res); + vugbm_buffer_destroy(&res->buffer); cmd->error = VIRTIO_GPU_RESP_ERR_OUT_OF_MEMORY; return; } From patchwork Tue Oct 19 14:09:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C965C433EF for ; Tue, 19 Oct 2021 15:41:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D52A961154 for ; Tue, 19 Oct 2021 15:41:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D52A961154 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrFT-00069Y-Pl for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:41:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqBZ-0002Eo-Iz; Tue, 19 Oct 2021 10:33:49 -0400 Received: from mail-dm6nam11on2058.outbound.protection.outlook.com ([40.107.223.58]:7009 helo=NAM11-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqBX-0005c3-Ij; Tue, 19 Oct 2021 10:33:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hqkZKUR9L4XGB/AHvMAfHLrk6tsrwOeZZuRbYK5qU3WlnjX8dU7lyw24REaPSXTckS+Wy3Vx6azv1/VPXN7YbtiCjkgYLULggr98NlMZjptWKIXkH/q8P3kBj52tos2Un6Pv8q5Z8tDb6reRJv1gRMoEArHjBvSgk4tSV3mGW/Aciifiu2RQMYqW5VLwGHrC2RzL7PfcsSaa6FqQELF3O9iV8tryJWgeZE1tcTVT1gyWFca9vWcvGbDUo2/rKO1bxHIWFrSea7k/KnvdJqVCDp/tWp9/cOPHf55o+aizVm+LEw6DezGHCA2hbC8S4MfS+7m8GPmenKSHGd0zKJqh1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OQWp9p6XxYhKlZMJUvjNkSRNWuzJQVMg4hZ0QzHvWoM=; b=F1XniL+LGcPMKAQWCruCQW46ceBpPj+zPsg1Cg5te/weFmS2KgZwQwmRxUOKl28BlXUIxsdGGEHMfETBxm2d+/javgqJn8VV2fswiWOgo7cytTFsR6CzYSJFFu0cdL4NbJhh1qrIlvO9mEFjLcbmw16CSwiGRXm11veDeWbOB52acC1bwhGJAYBqB3oG41Cbd9EJWXIewkpDgV5ljqOSDmQaR0xQt/1TExMnDiqBW+F/BUWw0c9WTywUW6SuhFjkrY0QrAbNpIqJ73ThrlV9pl4IdQhiYvzVYBz5SPeyEM/oUW2TRWobRECm8ktS/MfjxeQuf7X+s9p5DxIl5R6JNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OQWp9p6XxYhKlZMJUvjNkSRNWuzJQVMg4hZ0QzHvWoM=; b=Ey410sD6famvZCE0okZMmpfY7LMHA3DwoTW/IO47HRfIhS0yrfdGpa2qP5HfyPNbamZ2KHM5VCIZX5IfnUOFVcP30VqP1d+z17fih1EBF85vE8FSlRAdf8WWd5K2GhD44t2hMpRzq6J+LLwKSDXBztgA7BppOgsntKRYMFybAVE= Received: from DS7PR03CA0307.namprd03.prod.outlook.com (2603:10b6:8:2b::13) by MN2PR12MB2941.namprd12.prod.outlook.com (2603:10b6:208:a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:33:40 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2b:cafe::ce) by DS7PR03CA0307.outlook.office365.com (2603:10b6:8:2b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:33:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:33:40 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:33:39 -0500 From: Michael Roth To: CC: , Li Qiang , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Gerd Hoffmann Subject: [PATCH 57/64] vhost-user-gpu: fix memory leak in vg_resource_attach_backing (CVE-2021-3544) Date: Tue, 19 Oct 2021 09:09:37 -0500 Message-ID: <20211019140944.152419-58-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60fbd819-9540-413b-912b-08d9930d71ba X-MS-TrafficTypeDiagnostic: MN2PR12MB2941: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:357; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pLZKSKs8MCdIczVzw4D4KqriK9KcyrTfY0OyKnrTd1niAiMetIOhYgScfisFqlTb5Bq7mkGIFMC5fTwkMuubQH/ga9qxYMmGHxWDZor7dnXXIRN+MKluCKxSMRcHaQuL/SqbF2Pb2Aax+39wWIj84rQRHk3FzbxHDegsTs8mOcJxS2E4To7QnbON8VVK5MJMmUK8qQM28tNHfwtXlAMvUDvfyCZ9zxwM2s3aG+MDUkIkZ9IopQpOs7o/P/EhjsaPaDH0G1Ah9m3f/Ki5f29Ue9Joj0FyUMABXlJfSiB8ekPIW7CjWF/JYepSlFNhtYgI/15PF/QAWPSzfICKlLHLtkS6ky/iZ3/EM9+FVmsa4th1A/s7UW5gVv2AE0DBLZvoM1FimIF8Yw6lQNE3QkldXKSJuYdFflI38M6TqGxELWGwWPfYt+FZ3XCTLN4vqZr1yUTt6WHXAcGrU0MTLKLIOIdjfI2ikxvtlYhJbyRN8M8Ip2zqalRT1Jbits/HJxZv/ofrB6OyHWQCpdvbSGR9PE/fgnl3jea8FYTsF3+AJgvRPryW4fHF0KqqAqLU2MwFwxZLpHW2VvI1x3ntnffmma/8VjJwHYuxXp2YmHr9CaRY1RgpR2lYWzu+oHDtTTtMmX9aVgBPRXADqahU3DJLMy/mwn67PNxuoMsSpw6G7yg2A4lfCFQBxanh52RbWdJLCnS1aZ6kszV4GNdvPAwIbSbyHnLtkaljUeU3eUkmatA= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(6916009)(316002)(54906003)(186003)(16526019)(26005)(70206006)(70586007)(2616005)(8936002)(8676002)(82310400003)(2906002)(426003)(4326008)(1076003)(336012)(81166007)(86362001)(356005)(44832011)(36756003)(508600001)(5660300002)(47076005)(36860700001)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:33:40.0806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 60fbd819-9540-413b-912b-08d9930d71ba X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2941 Received-SPF: softfail client-ip=40.107.223.58; envelope-from=Michael.Roth@amd.com; helo=NAM11-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang Check whether the 'res' has already been attach_backing to avoid memory leak. Fixes: CVE-2021-3544 Reported-by: Li Qiang virtio-gpu fix: 204f01b309 ("virtio-gpu: fix memory leak in resource attach backing") Signed-off-by: Li Qiang Reviewed-by: Marc-André Lureau Message-Id: <20210516030403.107723-4-liq3ea@163.com> Signed-off-by: Gerd Hoffmann (cherry picked from commit b9f79858a614d95f5de875d0ca31096eaab72c3b) Signed-off-by: Michael Roth --- contrib/vhost-user-gpu/vhost-user-gpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c index b5e153d0d6..0437e52b64 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -489,6 +489,11 @@ vg_resource_attach_backing(VuGpu *g, return; } + if (res->iov) { + cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC; + return; + } + ret = vg_create_mapping_iov(g, &ab, cmd, &res->iov); if (ret != 0) { cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC; From patchwork Tue Oct 19 14:09:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7075EC433EF for ; Tue, 19 Oct 2021 15:44:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F213F610C7 for ; Tue, 19 Oct 2021 15:44:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F213F610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:42296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrHo-0003Mb-0Y for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:44:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqBv-0002bH-Gk; Tue, 19 Oct 2021 10:34:12 -0400 Received: from mail-bn8nam11on2080.outbound.protection.outlook.com ([40.107.236.80]:45042 helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqBt-0005q8-Iw; Tue, 19 Oct 2021 10:34:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SVpi7X4DvUwm+iVO/rCBiWd9dGJa86LBqA+G5qQo8CKsO281pydc2iupP0TjIlV8PS+ZOhtAwIN57qxgd+GSig+xlHVnEmMO0FT+0K03VUMW7aHSSejYb/WQMB6OJyfmdLqol5Ib/cJ7TfzWehhei2CEvLMjrl50+JLpP6j5YMdUu7xM6rYdU68hhqWRyrsbcComVUeMk/2xmWLi/3bmqgXJsyWHB6dqn5tocD3//kL1DNm0NRYgbsIo4MksBBZ4USpsmNh1JPY0eWKEpaCu1Q1QNSptAfllEtht353HzGm5e8Pm1CzV1kJQN62viiTHBC6SuLIhD9N3CoDo4Jykug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mq0nf964qR9RJYWV+Xhk9OM6/59SFvsu0pZ2p6YQE9Y=; b=I26aTLO7ELbwbEVtNn9IHc0ilbhh3q+e4YZHYleQTSm5ouBspHTb3oUjzBIItHW8bzC+F/6FKwe4DNqk+o7JA2HSqeolfYQ5VcRnaGfx5AS66Ho+ZDdKnawn/xRnXLEZBBeuI7fmHe0ZcW1U0hnqb5J1Rqi8BOUR2F4/ISZ0eZErkZ2a+FZlbzjYITSKi4WDXP3B046qvkk/HlCMRp6q4HgePZeCA3s0VSyuEQ42+JBy1x9J9J6Qs2IOQn8qWwnzAo/jmlwthP327G3wuHeGsv5RNgNaLxsS39rlJohnLaFQt+6xnI1jHYvEXGY38kQFRUEhu+Ggfp2EV3HAayInpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mq0nf964qR9RJYWV+Xhk9OM6/59SFvsu0pZ2p6YQE9Y=; b=llNvS9eRCBIRlSmtS+nyRBx9FGOE9pvAqIetRwP8xTO7Tn/oTFfXXPBfL4VMK6KiQcbpQj29uiwFL6gseuZM5konk1z6r/yzJqF0qCAFQ3qYoiL1ehO6Unhd1TiFH20KeQMdQocR2o1Mjcur2jF7OYhidv34j52J42Sl6v6tU4k= Received: from DS7PR03CA0316.namprd03.prod.outlook.com (2603:10b6:8:2b::17) by BN6PR1201MB2467.namprd12.prod.outlook.com (2603:10b6:404:a7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:34:02 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2b:cafe::60) by DS7PR03CA0316.outlook.office365.com (2603:10b6:8:2b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:34:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:34:01 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:34:00 -0500 From: Michael Roth To: CC: , Li Qiang , Prasad J Pandit , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Subject: [PATCH 58/64] vhost-user-gpu: fix memory leak while calling 'vg_resource_unref' (CVE-2021-3544) Date: Tue, 19 Oct 2021 09:09:38 -0500 Message-ID: <20211019140944.152419-59-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1d9d84b-e6aa-4329-c550-08d9930d7e9c X-MS-TrafficTypeDiagnostic: BN6PR1201MB2467: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:40; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pmXF/ebwHhhW2tJdGfNwazRGYkdYr+bF/fYgfLWCMWI+w+xNFYnEPDZwbrG/JzYUXnhL94EDe75xtQqqgYimYb63kvmrFcta+iHtGX4d1d2mEuaBcviz64oHlgl7gPbsu+6Wn0wqjmgEONTwpOplyRDloifcBodZ9p0gQnYtvQp03Fb8e+SqWywM3SQrUv8NvxANfoXaeKsFSc7nBBZ95K5pDd9ASm++P50nfW2WhLzBYP+a8LVfg4QDnjhRAyrUSGZQDtzlcDoMM2fIvfZVKM+nPbeGgH5ZIalO8ETMNTpgNhWrNnWbZLRdG/5ADnmcaC7KQYzqqTPEhA15BI2BcFKP9sQjKAQXAC8SJGxxfPXvfQkW910Yx19r9mAAUdNfRNPo4ycsjD/2LDQUur05/aNtqoWL21ZP0mUj1WbHpDd03IH9eUuwAAcF0XH834LZBCLbFpEY0yiBQoRGf3kGDk6EZ1mKM8xowEt5eyi2WtSxtJPQ9bUnHtHDVkR373VppSnAmA3rznc+13TomtJJOcK660PL4VD2aVbYIsVh6zJU4g3+K718KMHperDGHnbikGrVmgez48io19xvWaX+AnjqkydyS9qysbLsFQr0IUcRkVPONU8GxjksmFfjrZRPqYEgCvAmvrCsnAQChTohCkh3cTrqu3NgAAV0hQwPTPmp0CAyUVGr0Rns1Emr6gr1eb+x6oEaYbM0n0oNHQd+6LT2+fncRwQv3QeAi3z7q+U= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(6916009)(70586007)(82310400003)(47076005)(508600001)(316002)(6666004)(1076003)(16526019)(36756003)(186003)(2616005)(83380400001)(26005)(336012)(86362001)(2906002)(356005)(81166007)(44832011)(8936002)(4326008)(5660300002)(8676002)(54906003)(70206006)(426003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:34:01.6897 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f1d9d84b-e6aa-4329-c550-08d9930d7e9c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB2467 Received-SPF: softfail client-ip=40.107.236.80; envelope-from=Michael.Roth@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang If the guest trigger following sequences, the attach_backing will be leaked: vg_resource_create_2d vg_resource_attach_backing vg_resource_unref This patch fix this by freeing 'res->iov' in vg_resource_destroy. Fixes: CVE-2021-3544 Reported-by: Li Qiang virtio-gpu fix: 5e8e3c4c75 ("virtio-gpu: fix resource leak in virgl_cmd_resource_unref") Reviewed-by: Prasad J Pandit Signed-off-by: Li Qiang Reviewed-by: Marc-André Lureau Message-Id: <20210516030403.107723-5-liq3ea@163.com> Signed-off-by: Gerd Hoffmann (cherry picked from commit b7afebcf9e6ecf3cf9b5a9b9b731ed04bca6aa3e) Signed-off-by: Michael Roth --- contrib/vhost-user-gpu/vhost-user-gpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c index 0437e52b64..770dfad529 100644 --- a/contrib/vhost-user-gpu/vhost-user-gpu.c +++ b/contrib/vhost-user-gpu/vhost-user-gpu.c @@ -400,6 +400,7 @@ vg_resource_destroy(VuGpu *g, } vugbm_buffer_destroy(&res->buffer); + g_free(res->iov); pixman_image_unref(res->image); QTAILQ_REMOVE(&g->reslist, res, next); g_free(res); From patchwork Tue Oct 19 14:09:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC8E3C433EF for ; Tue, 19 Oct 2021 15:40:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A24F610A1 for ; Tue, 19 Oct 2021 15:40:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3A24F610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:57476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrDe-000361-9Z for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:40:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqCB-00034J-OZ; Tue, 19 Oct 2021 10:34:30 -0400 Received: from mail-dm6nam10on2080.outbound.protection.outlook.com ([40.107.93.80]:3442 helo=NAM10-DM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqC9-000647-U3; Tue, 19 Oct 2021 10:34:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L3QLtGRO0/rlXJS2Mpi+RegXNsPXoPlmWdTogLm8O0NqgpyBqGY9o8zYk3RVYU1giJPaPOYjubzSfjg2QcO9JKxu7ie1udijNdG0TPIWsyQErFvIeG+uSHW5ecv8AQ+5+6HGG6kF2SsbzZe3d4rLjPN9xYNFq51S/VutqMkltrIKD49qTthc3iPhJKf1av2wzmm89475okBrBTaC3mXkUfnCTdX3e9YOOU0UsE3hPXIU7sivhA7pT+g85rUi8rpxJW2RzJwyCTDZaushoe/Yt9vsjvhPkoHf2C1sq9pHKsP4OAi36YulNnXkeo8vIl2O2qhhIzdvtAkMRND0q5L6Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z0mH+OapYLLdxX+HZ+WI1GXOAGUzs7tLQ2xTReN3zDM=; b=ha0FmcjPOH3h/O7Sce7ZdNqfGm0g1W3+mJHLULQmhFrMAkWq/mAkz8DBfX9SDmyUl0zxqo9LnbXC95Aq01Bkf4dagI5mUIDgbwsteXkuccOXqC/Ei6YwQTFEJxmCS0rGdGDWF+Nic38cSJGFZ7wM99e5imsd/xJGqoYWawzDQVwj87mXKK3xTuEaz7hlSTgIciul48S9ol70Jcev5MlPoTY3LuhnSdsL9tU9ZQlkchpQN+HenAoWF017lDJi6mksnc5vjJXCDgzzVTlEi5Vu4K5/9/P1d+HlAIFfA3vmznQ3VRLUK/+i4iNJXEw94FGLW0aedWSUnICZGTjKchgtSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z0mH+OapYLLdxX+HZ+WI1GXOAGUzs7tLQ2xTReN3zDM=; b=izyljVYmKfIPntrKcHAdiDt3kUTJfvYhqEPTBurCp1hDS8A3pmKePdYRXYgiFuCPInaLoGq548jn6Z5LFBDG2TWNWVy+9m1x7i2fDFRK5CfqW3iCITao1ToYPoQCWDgxvSRNhLpNwmLexKKXC+olrWLVnxOQ9LTia4keSWn+PvY= Received: from DS7PR03CA0234.namprd03.prod.outlook.com (2603:10b6:5:3ba::29) by BN8PR12MB2865.namprd12.prod.outlook.com (2603:10b6:408:96::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18; Tue, 19 Oct 2021 14:34:22 +0000 Received: from DM6NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ba:cafe::a2) by DS7PR03CA0234.outlook.office365.com (2603:10b6:5:3ba::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:34:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT031.mail.protection.outlook.com (10.13.172.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:34:22 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:34:21 -0500 From: Michael Roth To: CC: , Li Qiang , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Gerd Hoffmann Subject: [PATCH 59/64] vhost-user-gpu: fix memory leak in 'virgl_cmd_resource_unref' (CVE-2021-3544) Date: Tue, 19 Oct 2021 09:09:39 -0500 Message-ID: <20211019140944.152419-60-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea92a977-1203-4a8b-d9b8-08d9930d8add X-MS-TrafficTypeDiagnostic: BN8PR12MB2865: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:483; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8zWTlbJvNMYk0Nit7nOY5ybRPuDBOS+1jSo2lVUuJvWAWzUhcoxk8WB4l4PshQPUMua4CZfnGVp7SNqUZoUrRSgW/BeG/Zcnyy3N4oiMdRoCO4ZCVC933NNuyh/LBI2lT5sZsNqiJOjDwVAY4G7LOK1fecxMEWMHACYHEE+76vAETVRi+QJ0scDqpazLcoTybvFBUHusYg3bCnG53O15wKLcZAySe1MVOy6PSXaMukcYH0wrVgKcrxwWnBUU26qVpd8fD+GUwJaQ39peCeATAZ6ZbXhPOFuwNEPRGoZm2MpADdlL6VPDLtZfsz96D2KmvpXJTr1VnYO+UJChAgQY4gaIj008TBNPqdWVgTyfLmLv3YqvJyOnnsv5mwHewn9hcQVefja35K8PGRoVdvJVT9DK5XKfhLX6p090vGLajJd081HDs0o+/GMQjVMneQaUlGAW2lrVujiP1v5mv/hJ5VHXgYl7wUJbhC3oTTQ24ZAOMM8tP0cTAj/BkinWM6Jeufl32LT5RN/8MZ0GWobUpfUmA3ZyW6w1Yxl5HHhgySlF04kIEu+KrRi8VGvLlRXIV3/P8D2G7WPT7u6Yimrl3Dt1Nj9gcrZLhXrfl8lOFwlHJGXYDR26+HzX7q6kgspmHugDf9jJ4I5gmaw4qcwsR8TGHAtSrYjnJp28P0mw1bAwYoisvugyIMw1yJ8Uq4YY5fSP34kosCFiHIIrNbOgJs9V8+GUJTHs/K5Cq+Q+NF0= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(44832011)(36756003)(36860700001)(6916009)(508600001)(8676002)(2906002)(5660300002)(356005)(2616005)(81166007)(426003)(47076005)(4326008)(316002)(186003)(54906003)(86362001)(26005)(1076003)(82310400003)(70206006)(16526019)(70586007)(6666004)(83380400001)(8936002)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:34:22.2549 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea92a977-1203-4a8b-d9b8-08d9930d8add X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2865 Received-SPF: softfail client-ip=40.107.93.80; envelope-from=Michael.Roth@amd.com; helo=NAM10-DM6-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang The 'res->iov' will be leaked if the guest trigger following sequences: virgl_cmd_create_resource_2d virgl_resource_attach_backing virgl_cmd_resource_unref This patch fixes this. Fixes: CVE-2021-3544 Reported-by: Li Qiang virtio-gpu fix: 5e8e3c4c75 ("virtio-gpu: fix resource leak in virgl_cmd_resource_unref" Signed-off-by: Li Qiang Reviewed-by: Marc-André Lureau Message-Id: <20210516030403.107723-6-liq3ea@163.com> Signed-off-by: Gerd Hoffmann (cherry picked from commit f6091d86ba9ea05f4e111b9b42ee0005c37a6779) Signed-off-by: Michael Roth --- contrib/vhost-user-gpu/virgl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c index 6a332d601f..c669d73a1d 100644 --- a/contrib/vhost-user-gpu/virgl.c +++ b/contrib/vhost-user-gpu/virgl.c @@ -108,9 +108,16 @@ virgl_cmd_resource_unref(VuGpu *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_resource_unref unref; + struct iovec *res_iovs = NULL; + int num_iovs = 0; VUGPU_FILL_CMD(unref); + virgl_renderer_resource_detach_iov(unref.resource_id, + &res_iovs, + &num_iovs); + g_free(res_iovs); + virgl_renderer_resource_unref(unref.resource_id); } From patchwork Tue Oct 19 14:09:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570443 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1335C433EF for ; Tue, 19 Oct 2021 15:51:18 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 43F5161154 for ; Tue, 19 Oct 2021 15:51:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 43F5161154 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:53450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrOX-0002Xp-5b for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:51:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqCk-0003tJ-R8; Tue, 19 Oct 2021 10:35:10 -0400 Received: from mail-sn1anam02on2047.outbound.protection.outlook.com ([40.107.96.47]:9535 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqCc-0006N5-GO; Tue, 19 Oct 2021 10:35:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lnc39U4ubIGG+K7jpT5PnguCD1DO9cg1cbryGqccUNd9uXg/MbfPWeT8NzU7k0GdFCqjkYSFe3g5bqZWJQ+9daoCb9bbAwMJ7LxZQ2sv8SFJB/OfMmKzIrxGuElRaeWGkKYbcOjo7pPSTh9boTJUuroUxGnXvN3TmPVUsLaRI+hSTS1j+9tmbgOVWorcFR3THG/kr+oBowRTVFO8r1OSmnDAyR0Au8A3e/QaGMz1/MOwa8C26ePP4izrk1XGscv7PEbbSm1/li6bKzsN1yD6Loi4jduvCASOq1QJ7rgVQzMzw/jUqIjBRUkd4m5glgYWduPu9QrnAH18stn2wcyFLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aSOzh3QuuMbQNrtIdS0wRlK2s8CCHS4uN6LNngsVoR0=; b=HqowmUrpI5c6lF6aDlNFlCvtIRhZLIkEAoulrOHBI0k8bzB7jnaQxd8nQU3tychd7OhAxe8VgDnI0TnDK+xQ8xphVBIg5QgLa6y1piDYB38guyrfeopP/L7J+vLT2W0mwxRMbqBtDge2wjLem2gc9zctnDqqMor9gIy1pWj2oroVTFk4uJG+w1ZpaLzvggAim1KcvHQx71TXBg8m4e58SX1MnBiHwv1u+mr+wLUnZ7/zvCpIR1sVKYG/2f/bLMNeEbGZphWfhmRRleWHCJYID/m1Zqa8Rp7/1C/I+obzrfVAMf0qWVORfc4XoiLl35uZ+avMCHXWPpDWdzvfXjk/tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aSOzh3QuuMbQNrtIdS0wRlK2s8CCHS4uN6LNngsVoR0=; b=na+SDvRo30vJp+WdFKjRy7PhS8YROEon3l/tUdxvRQDnFmgsw4csfvN7boTZoD9PsadH8liDbmeBNzdUrWi+vto8BHtkNnhdyHVXQedlF10j8gyvtRS1ZFsBPaj6bMrn4l9FvTlkMTxSYcBYsJu3HZevVP6KL2/hKPtg9dHkGFs= Received: from DM5PR15CA0039.namprd15.prod.outlook.com (2603:10b6:4:4b::25) by DM6PR12MB4171.namprd12.prod.outlook.com (2603:10b6:5:21f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:34:46 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:4:4b:cafe::d8) by DM5PR15CA0039.outlook.office365.com (2603:10b6:4:4b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:34:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:34:44 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:34:43 -0500 From: Michael Roth To: CC: , Li Qiang , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Gerd Hoffmann Subject: [PATCH 60/64] vhost-user-gpu: fix memory leak in 'virgl_resource_attach_backing' (CVE-2021-3544) Date: Tue, 19 Oct 2021 09:09:40 -0500 Message-ID: <20211019140944.152419-61-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6bd865ab-2611-4acb-66ea-08d9930d97d8 X-MS-TrafficTypeDiagnostic: DM6PR12MB4171: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:343; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bSe2JJp4sDjqrh2wzz5vkiCmJIcSp4l95GtDe3O5cvyVxBv+52bWgYQm41Gk446L6yQ8WhPUcX12cnNgIGUvshpEPm+4M22/l45UQP3giM4zlyOLm+He57g4i7FWehpw57NSvs2o4O5Q2h5jakmqYJigJsSPwhB7H2QcsuWH9icr5kbBqQNRMyyudtOBydS5uiA8W5ax/0rJv3B10av499KUHMW3R5vqHG2ZRh5CwSR84EIa72+fjwIlJ0CzgM3Hr+5rU3K8qreDl68ETbnonfcQvDF3SolIt8YQSmlVLLViomLDJk+9j2otC++64eopCTgWqqx8vTlRIydu27ta08vOA2Pmwhfb1o080pfwBYiOZ0SqXc+Yws8LwoUHzwzrNBhz+fALAI93lH9G4emCXBC+fE3RRMODtsIg4R3KGZuWmDyEyKgkZjVrPND5VdYTgctNWMQg+EMtteaev+NQO1CDx1lQmFps3TBveu9zyPdzLRSGVQ/avczIpD97ZcBzeYcqgLt/nnok3g8Y10X/DV18j0JkMy1D3O4KMzhewTOwHoNAis2qdA0k3VdH1Hptu+6cVGV0Cegrx8ViGKAvzJEnSDWr5To256BdgwPW1AoaMSeVXhbdbVxVf6X019JYLJCT5nUsND+Cct0rKzvM4CQ/goObZjDsYwjGfHs4wBBPGMo8xWEsJuyORiDYb+fGDWWGPIZnafJfbSoox2H/bNHYyugILozznu2G++tRlT8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(83380400001)(5660300002)(2616005)(36860700001)(356005)(82310400003)(8676002)(81166007)(4326008)(186003)(16526019)(8936002)(44832011)(26005)(1076003)(70206006)(70586007)(86362001)(6916009)(2906002)(336012)(508600001)(426003)(316002)(36756003)(47076005)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:34:44.0245 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bd865ab-2611-4acb-66ea-08d9930d97d8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4171 Received-SPF: softfail client-ip=40.107.96.47; envelope-from=Michael.Roth@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang If 'virgl_renderer_resource_attach_iov' failed, the 'res_iovs' will be leaked. Fixes: CVE-2021-3544 Reported-by: Li Qiang virtio-gpu fix: 33243031da ("virtio-gpu-3d: fix memory leak in resource attach backing") Signed-off-by: Li Qiang Reviewed-by: Marc-André Lureau Message-Id: <20210516030403.107723-7-liq3ea@163.com> Signed-off-by: Gerd Hoffmann (cherry picked from commit 63736af5a6571d9def93769431e0d7e38c6677bf) Signed-off-by: Michael Roth --- contrib/vhost-user-gpu/virgl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c index c669d73a1d..a16a311d80 100644 --- a/contrib/vhost-user-gpu/virgl.c +++ b/contrib/vhost-user-gpu/virgl.c @@ -287,8 +287,11 @@ virgl_resource_attach_backing(VuGpu *g, return; } - virgl_renderer_resource_attach_iov(att_rb.resource_id, + ret = virgl_renderer_resource_attach_iov(att_rb.resource_id, res_iovs, att_rb.nr_entries); + if (ret != 0) { + g_free(res_iovs); + } } static void From patchwork Tue Oct 19 14:09:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2993EC433EF for ; Tue, 19 Oct 2021 15:14:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A01C661359 for ; Tue, 19 Oct 2021 15:14:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A01C661359 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqoo-0001Ya-HH for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:14:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqDE-0004HN-UC; Tue, 19 Oct 2021 10:35:34 -0400 Received: from mail-mw2nam12on2050.outbound.protection.outlook.com ([40.107.244.50]:53633 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqDD-0007IC-19; Tue, 19 Oct 2021 10:35:32 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CwvOCx/COomg/cn1aDcv6VtFc2F90Pfb7zwIm+n+oRty2Nj7k1gdhiFuBhaueCrOioHNAph8e4aXuho/fq6E/mxxcH9Ur2/0VQxz57WHsy9OdyJ+lvYGN5S3Sh/LNMB6ereis482/qtVgoI6pqNIM0l3uqxGp/FBFlnhsWeZteH2FBBCp2rI92CKso4Zd8jYgFP/BajijvvXzYaaOqs5nDD0yVf54vnQ0O5zWn2TQv8NDRLnOJC2pu2psSvNQLQoSG2nqJyiEa+Oavv571ChGi6eETTYeTNQZ73oc32YQb3aovsm+YGhERzwqRJUjlJ/LlxUWMprpXl7OLtCIyFEEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TLxbo4PI4U0+zJlTkmS42jfaDc6aPBF6mkXGfdrs+ak=; b=YUGMh15GSFIBPZY4KzthF9QMrneH4TktWmj03SJKr/JMAPsDq/Cj06ULYj6xcjjhT3/uw9tkeqfjrZIt2m2XXLwMQZ+YlHVyL9ef834bknTruP4aOfWkak5R3Ec5Z/iKjf4a67XoYh5ULr6tahXZZBjGyfyvY/PB01nKmBQ+21yNhKr0/V2MXr0tEEcLP1vIoB5S+CQ7rrSFHL/9RwmxVNzyNFMl5mNQSygCCqQjp+WPYXV1g3X2kZdkWrJ6BBqp2PW61knt34b2qbphMD+IWZi0nrghJX/fnXn8jcXgJNaQJCjibfgDs/DaORoXfSwbrlQCdDfkyxh1xVoV2Fp5KQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TLxbo4PI4U0+zJlTkmS42jfaDc6aPBF6mkXGfdrs+ak=; b=iTNQDnJLqf9AqBx09JoJRFUz0TJ4WhDm1tu2fnkoimyqkKFmtgHJ41xGZeSd/1a0cF5nTnH5OIaql446ErsCKg0eiv+eYsTtgV3MxeKqvM3YaEG/ovRqNzvVzVe6h6MzsVzyJZj+UJwL4aW8fbR1kdtIfshvd9RB/5GI2qKYBVM= Received: from DM6PR10CA0020.namprd10.prod.outlook.com (2603:10b6:5:60::33) by BL1PR12MB5110.namprd12.prod.outlook.com (2603:10b6:208:312::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Tue, 19 Oct 2021 14:35:26 +0000 Received: from DM6NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:5:60:cafe::15) by DM6PR10CA0020.outlook.office365.com (2603:10b6:5:60::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Tue, 19 Oct 2021 14:35:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT055.mail.protection.outlook.com (10.13.173.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:35:26 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:35:25 -0500 From: Michael Roth To: CC: , Li Qiang , Prasad J Pandit , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Gerd Hoffmann Subject: [PATCH 61/64] vhost-user-gpu: fix OOB write in 'virgl_cmd_get_capset' (CVE-2021-3546) Date: Tue, 19 Oct 2021 09:09:41 -0500 Message-ID: <20211019140944.152419-62-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7ba6676d-3f1c-4b31-0e0b-08d9930db118 X-MS-TrafficTypeDiagnostic: BL1PR12MB5110: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:207; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: llnTloY0ahCiDVcvcofE9k8F92PDpPlPm1j4ao2HMTljrxf8kBVTN9C8zmD2bZC7NxlOhn96KmGpFQF+h5BLibepZWb9l/pIosdM6wxLjcWI9TKn0pBiWl127thSTxV2yYZMTH5Z04qyLqUrXG4eKOyL3Y5v5OZNp2Mjx5vSYJbni+zD5vvZ4WMJjZNtjt8IljIFYC8EtjMQohpBLKZSr4E3kBluEqFOXW41qkGDzBbPqObc2BPz9n8gz0vFA+YpRa77x7ZcCvTEBzv+KSR1pqPYfQxEEFYJ3uKV4ubTLh/Mwldp+5BnTfai5OfnEAasIajN43TANkOKhRJNz3SPhOwpczavPJCNGi1Bl1LFqGyVLmgr9amMxn6YWURd+zMWXLf6GxiP2DcARWlaTCAgralv9b3kBLp7m9GlyRFpS97BRJ8efjGFIWxuil6dzranfQEKyLyG93gKqoRSOppZWL8Zv5wOE4RXS98Slh6fG3jf1n/YkZibwWSOPfjz5Magb43F6vuSOFAN6D/cAz8luzLoXUVhbZTu7XhYOoFd/B3mNWU9DnRyXP+QrLGCBiaOXvdZIFQDOXw3oDPrs/SKCM1R9Y5Rm8j5cudcJecNJqzerHPurbWGk5H4EDonrR23AtmjzwGpecpO3y/u8WO8GYS167XG73GQtVvUTqmZoMoW122VpEXatYhlvqHE6vtwYr5MPgr5rHSflLzrl9q/peV4Ov9zGYDyg7TephI0TW4= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(36756003)(6916009)(82310400003)(86362001)(8936002)(5660300002)(54906003)(336012)(8676002)(2616005)(1076003)(426003)(26005)(6666004)(47076005)(16526019)(186003)(508600001)(4326008)(36860700001)(44832011)(2906002)(70586007)(70206006)(316002)(356005)(81166007)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:35:26.3837 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ba6676d-3f1c-4b31-0e0b-08d9930db118 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5110 Received-SPF: softfail client-ip=40.107.244.50; envelope-from=Michael.Roth@amd.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang If 'virgl_cmd_get_capset' set 'max_size' to 0, the 'virgl_renderer_fill_caps' will write the data after the 'resp'. This patch avoid this by checking the returned 'max_size'. virtio-gpu fix: abd7f08b23 ("display: virtio-gpu-3d: check virgl capabilities max_size") Fixes: CVE-2021-3546 Reported-by: Li Qiang Reviewed-by: Prasad J Pandit Signed-off-by: Li Qiang Reviewed-by: Marc-André Lureau Message-Id: <20210516030403.107723-8-liq3ea@163.com> Signed-off-by: Gerd Hoffmann (cherry picked from commit 9f22893adcb02580aee5968f32baa2cd109b3ec2) Signed-off-by: Michael Roth --- contrib/vhost-user-gpu/virgl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c index a16a311d80..7172104b19 100644 --- a/contrib/vhost-user-gpu/virgl.c +++ b/contrib/vhost-user-gpu/virgl.c @@ -177,6 +177,10 @@ virgl_cmd_get_capset(VuGpu *g, virgl_renderer_get_cap_set(gc.capset_id, &max_ver, &max_size); + if (!max_size) { + cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; + return; + } resp = g_malloc0(sizeof(*resp) + max_size); resp->hdr.type = VIRTIO_GPU_RESP_OK_CAPSET; From patchwork Tue Oct 19 14:09:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEECBC433EF for ; Tue, 19 Oct 2021 15:54:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33F3C60EE3 for ; Tue, 19 Oct 2021 15:54:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 33F3C60EE3 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:34812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrRd-0000lt-7R for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:54:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqDe-0004QL-5q; Tue, 19 Oct 2021 10:35:58 -0400 Received: from mail-co1nam11on2050.outbound.protection.outlook.com ([40.107.220.50]:52320 helo=NAM11-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqDY-0007aQ-60; Tue, 19 Oct 2021 10:35:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lhIh4BJRUb6LiM50p9BhNsb1wNlRc7MRctF3DW3g3a5zYE0HiGvZZWWNegkqlIY/mtfDC1HWoxfsoQPTPpNE8SKtOgvwOM6ZbVkn5UtnP/U4xR63ILoypMcbaJtn7JsMX3IaOoRmpdBGkhGLKim9CL2HJakURwruZrBVnR7Ti3ja2VVNaz9yyEpw0sYquMA/mpTROr80xyKzt+PViDvVtuZvlt4JGBjLqScIiOIOtUO2KwSMYGK4Qw4sZ6cv+FB0RuE69ef3nQjYB2iCiGRRIAWY/WlfoKca2dlD4R7PIQ/2boRTaVr+QqYBpa/xS0L3GfV5DJIYJI+COAOnOyErYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lgJ6LE9fMpufEDMAUh3VQZ9tW353qgKNpPYMBnUVlh0=; b=ZCtYEB0E86EDRbMIiWeSPjJNgonwRPJ7vveyih1b2YlKiqGytkPwxSUNUllZ8l8iePRQ0HIkcg6S9K8hA9w+qK7t50C7Q+pMzIUfoKi/vt4fc5JO1QyNTesFpkdvNiOOXD87oyjJYX4aef6l1Kew9z1PIBqzUuxz6eiq9MZKgqroNKw98GivHvyZLTozkjWRSczdcRhIiAqcCfDpLB6DWnlcvFOuXvgpktnXEXeyoB7lI327vzHmTGchV3qoXZJuU0GYia8yn5N20e5sRx4HzxAisvLwokADB/UTTBmINdYNuwfuvcViYHPxURMefk/kFdm6VnV2KaiU12emn8RhUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lgJ6LE9fMpufEDMAUh3VQZ9tW353qgKNpPYMBnUVlh0=; b=iGzzvx6rqkBmgFcttEs3Q67vKzaBnHnfzmre586I8EdJVQAEXUfYx3SPEVZ9+xlJoIYWT7leny4nf7s27/LiS5KbryMSyNq8oHllvlwEksT9+N1jmMSh+gsO8DwMUgJqdp9I5Zz+Mmpa7n48wWkjf7bYaZ1mYzSpSCZKXacj/ss= Received: from DM5PR1101CA0012.namprd11.prod.outlook.com (2603:10b6:4:4c::22) by BL1PR12MB5176.namprd12.prod.outlook.com (2603:10b6:208:311::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:35:47 +0000 Received: from DM6NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:4:4c:cafe::d1) by DM5PR1101CA0012.outlook.office365.com (2603:10b6:4:4c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Tue, 19 Oct 2021 14:35:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT053.mail.protection.outlook.com (10.13.173.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:35:47 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:35:46 -0500 From: Michael Roth To: CC: , Marcel Apfelbaum , VictorV , Yuval Shaia , Prasad J Pandit , Marcel Apfelbaum Subject: [PATCH 62/64] hw/rdma: Fix possible mremap overflow in the pvrdma device (CVE-2021-3582) Date: Tue, 19 Oct 2021 09:09:42 -0500 Message-ID: <20211019140944.152419-63-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6320a76f-7cd1-4146-8714-08d9930dbdcf X-MS-TrafficTypeDiagnostic: BL1PR12MB5176: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:83; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iJP/WZRnVpwaiJ9oJpb3aYqqJAO0C9syjKwhzY4k7rMV5Fzu7hfo9zeNMfTd6lBc1Urg4u5gLZqVw8kxTyM+mC+dDtzRZ4kxYLHRPjoI+PGgWe/gvOaEoC2IpyY7wKHZdfCgsUYb1QBqtvmEiYzyILmWqB7U+uB2HO6fQHeYV3aKQ7zq8UBEUn+9gF9AxqJKcVUHJgaxG2gwSAIHBsRCg5BpBVC0rDiC/Bc1FbY2lq9x4v57k1tc04NOw9poE4F+FIMiX/KvC8QbMXDoztuClLewi5L7Mq1wcTOgrxwIqldCOEn1dDSDh4m7GEVWx9Fh0m3NEUryhlxM1uMUh3iE4M0xC2NTAl5RaifeM/aaA2yLvAhBwM/vnNzeN9qO4X7yv7BjEnzy3GV6L+N54skwFl9ww7+9aFp/JZTmRQBFA45ViJsM6JCb0SbC11huNBkJtuBxtCwHomjqYI47QUpA/buXkTYzh3yozAuWEali+fJ9OqD/9OhU7Nvw/eDmc9zXMI8hY++OT4O/hI/+yMtopveFwmTWBU9My8nKJh0B8pRo1QnfmLe+/gFgc4Kwma+DVhYD6iLJU1T7Y9O8Mr4YNTgK65CQcImQcaMtjFsiRFUT6ju+9AWDJrl+tPpdmueVgtZ3S8ZGjCem3gn7ro8p8bXQPoafZHKDmS8CbcJWBCCHJdV5fXhlQncZLLiIbeEsvrpj97jFLu5WWGb2rjf9UphydQdth6/+aa0MH46YXyc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(70206006)(36860700001)(54906003)(70586007)(2616005)(1076003)(81166007)(356005)(86362001)(2906002)(426003)(44832011)(16526019)(6916009)(186003)(5660300002)(6666004)(83380400001)(8936002)(36756003)(82310400003)(316002)(508600001)(47076005)(8676002)(26005)(336012)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:35:47.7168 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6320a76f-7cd1-4146-8714-08d9930dbdcf X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5176 Received-SPF: softfail client-ip=40.107.220.50; envelope-from=Michael.Roth@amd.com; helo=NAM11-CO1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marcel Apfelbaum Ensure mremap boundaries not trusting the guest kernel to pass the correct buffer length. Fixes: CVE-2021-3582 Reported-by: VictorV (Kunlun Lab) Tested-by: VictorV (Kunlun Lab) Signed-off-by: Marcel Apfelbaum Message-Id: <20210616110600.20889-1-marcel.apfelbaum@gmail.com> Reviewed-by: Yuval Shaia Tested-by: Yuval Shaia Reviewed-by: Prasad J Pandit Signed-off-by: Marcel Apfelbaum (cherry picked from commit 284f191b4abad213aed04cb0458e1600fd18d7c4) Signed-off-by: Michael Roth --- hw/rdma/vmw/pvrdma_cmd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c index f59879e257..da7ddfa548 100644 --- a/hw/rdma/vmw/pvrdma_cmd.c +++ b/hw/rdma/vmw/pvrdma_cmd.c @@ -38,6 +38,13 @@ static void *pvrdma_map_to_pdir(PCIDevice *pdev, uint64_t pdir_dma, return NULL; } + length = ROUND_UP(length, TARGET_PAGE_SIZE); + if (nchunks * TARGET_PAGE_SIZE != length) { + rdma_error_report("Invalid nchunks/length (%u, %lu)", nchunks, + (unsigned long)length); + return NULL; + } + dir = rdma_pci_dma_map(pdev, pdir_dma, TARGET_PAGE_SIZE); if (!dir) { rdma_error_report("Failed to map to page directory"); From patchwork Tue Oct 19 14:09:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B15FCC433EF for ; Tue, 19 Oct 2021 15:18:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4EC0F60F9F for ; Tue, 19 Oct 2021 15:18:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4EC0F60F9F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqsK-0007Si-EU for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:18:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqDw-0004xj-It; Tue, 19 Oct 2021 10:36:16 -0400 Received: from mail-dm3nam07on2050.outbound.protection.outlook.com ([40.107.95.50]:5566 helo=NAM02-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqDu-0007tr-Hd; Tue, 19 Oct 2021 10:36:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VCS2E7AC2Uiwp3o19TUhNyBX86I2Lp11WRIh+TnlVLEi9R79PrZ7tG3peAW00FPdP+eS8Yi/4ZXJgknA/T+K/5hykS1KXVoHOlMLKTAEHnzEKsMB08Qwe8UkmKOHCmAh4eGOol8a2TZ8IrBM5CMoGqkTPTqfiwbIPv1GH5Kvl4Qpd1zaNbgC7qhrWu1dfKcQLymAMPEbYirgn2dAM7jWxA1Zinw4o6UARRosIM656A2AXVgnJhRNlfNR7iZcaraOTDixCDOxMBlQ/CzHfPBkNTBUtbeil7gBBQIkzO78DOewwZz3LsrvgfIs/5TlYPy5ZF/cyJGqPL9CYfL0w8ioGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6NGYKSW6SbhlkZbb3zVare+HblnWLct1EB2XdNCRTa0=; b=RrEULjSHWtD8qVF0vcggaYqN1vMkOcBX/vrxKdn8wIJN6fOz56AAR+J+DiFyv4EQ4rr6vwvjFCUHGZ946N7Co1AOdLKIk/JEDYDza2Ym13eDgeEyhas+VnkukZ7vaX4riPx7XHFJntgbgnB4otI0Fgot3luf+BlwKQBkz9dFzIMqDXnLkIz3l5UM0wc0glC32ySOlRDqeFNJ0Md/uPv/OxtUq073cvlE2kBQvvawLBJ/J7HR1YKwdeOIhpnKivWuGy9WHiHwTXla+b6z+qoFozCgLvanSDlnI3aKg9VFd2I2X5vx0+2Ym5bg2rKUgHXKVABHv2SVGe2OBdkgXDfqEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6NGYKSW6SbhlkZbb3zVare+HblnWLct1EB2XdNCRTa0=; b=E3tYr0NbWWQn6QUKovfdaz7cBcVquRVW3ewI0rnq3rRlP4v95NES7hgUmPmEEa3rjDLm7kVX0CTq9e1l/U/OdMNByqCCg9NutK2esJmoli5eMuuq2px12upjXO1wxDeu7/N0C9pbBlwyL1pZjp6WxhM4EFXLoN25jL5Bnf2GIE0= Received: from DM5PR12CA0051.namprd12.prod.outlook.com (2603:10b6:3:103::13) by PH0PR12MB5468.namprd12.prod.outlook.com (2603:10b6:510:ea::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 14:36:10 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:3:103:cafe::57) by DM5PR12CA0051.outlook.office365.com (2603:10b6:3:103::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:36:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:36:10 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:36:08 -0500 From: Michael Roth To: CC: , Marcel Apfelbaum , VictorV , Marcel Apfelbaum , Yuval Shaia Subject: [PATCH 63/64] pvrdma: Ensure correct input on ring init (CVE-2021-3607) Date: Tue, 19 Oct 2021 09:09:43 -0500 Message-ID: <20211019140944.152419-64-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 300099b1-a480-4189-f398-08d9930dcb28 X-MS-TrafficTypeDiagnostic: PH0PR12MB5468: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GDpzft54fC/cHhyuj6cl1cGE8e+qTha+0kE+KjXvAOWSwLrf/hZmVCKWzRM0t1DHVmKaW+2msUTsy32/SPmaH3Xg5EHCeV3zpFRz622VaeKu+jn8XWGOpPPBu4Z8886XoaFtG7Dm+U5jRGV5e+2wpp2JELbqiVzg2N7GF0THVlL26igEhq0XlgV2nkLfYI98g8ZCj/VloWuD7O7WC5ZBGP/rLDRRS2TM0eoIxEXHeUg+ur0cilvmMLWlMrX/VGMARZEqKM5kGFcLZNyM4l0XiUw1KImxpiVHbkdfGSxRelmbbGpbAw1tlmbguu149c4FyY3nGS3avWid6gaQdKhweqAfTzzi7hqKtQCOP5ncEkMxG/gcO3DaoZJrXfczZ5xH9MncPhYSq5rGWm1AJxf6IJ93/QGqYrMieVo0GWizY1QQUYMDR//WwYOZIpfg7RloQf4xHUvlCgHffAhQMAeVSny/dHW44X4hgYWz3Zt+jNJtTv6Gc+BQaUapkAvNRRYULucpuqRofVbe48f2GHbkp96hQamJc6Brk6I8SQVvkbhJA11Sd3iC796x32UgYtk4jVcAXeR5Qvv2t7d0zYdpY+he7OG1dJPKw2g92f/RKazbvEUJAaHe+h6hdKzSvB2kQNmcXBiN9Cw6S7tUWiOLkDMuOdyeat1oz3l8cJ9JJGtaI02JPeZ48jcPsbu6OxwbeyPbn39Dkc5Ry6y2e9NHnitCLd+c8Q18MECPcuPQNUk= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(83380400001)(36756003)(16526019)(508600001)(186003)(6666004)(4326008)(316002)(26005)(426003)(47076005)(8676002)(36860700001)(5660300002)(2906002)(82310400003)(70586007)(8936002)(356005)(70206006)(2616005)(336012)(54906003)(81166007)(1076003)(86362001)(44832011)(6916009)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:36:10.1213 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 300099b1-a480-4189-f398-08d9930dcb28 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5468 Received-SPF: softfail client-ip=40.107.95.50; envelope-from=Michael.Roth@amd.com; helo=NAM02-DM3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marcel Apfelbaum Check the guest passed a non zero page count for pvrdma device ring buffers. Fixes: CVE-2021-3607 Reported-by: VictorV (Kunlun Lab) Reviewed-by: VictorV (Kunlun Lab) Signed-off-by: Marcel Apfelbaum Message-Id: <20210630114634.2168872-1-marcel@redhat.com> Reviewed-by: Yuval Shaia Tested-by: Yuval Shaia Signed-off-by: Marcel Apfelbaum (cherry picked from commit 32e5703cfea07c91e6e84bcb0313f633bb146534) Signed-off-by: Michael Roth --- hw/rdma/vmw/pvrdma_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c index 84ae8024fc..7c0c3551a8 100644 --- a/hw/rdma/vmw/pvrdma_main.c +++ b/hw/rdma/vmw/pvrdma_main.c @@ -92,6 +92,11 @@ static int init_dev_ring(PvrdmaRing *ring, PvrdmaRingState **ring_state, uint64_t *dir, *tbl; int rc = 0; + if (!num_pages) { + rdma_error_report("Ring pages count must be strictly positive"); + return -EINVAL; + } + dir = rdma_pci_dma_map(pci_dev, dir_addr, TARGET_PAGE_SIZE); if (!dir) { rdma_error_report("Failed to map to page directory (ring %s)", name); From patchwork Tue Oct 19 14:09:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 12570313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 605A0C433F5 for ; Tue, 19 Oct 2021 15:17:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5A436101A for ; Tue, 19 Oct 2021 15:17:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E5A436101A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:57470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqrh-0006Oa-1w for qemu-devel@archiver.kernel.org; Tue, 19 Oct 2021 11:17:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqEG-0005xj-U8; Tue, 19 Oct 2021 10:36:36 -0400 Received: from mail-sn1anam02on2065.outbound.protection.outlook.com ([40.107.96.65]:47119 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqEF-0008FN-36; Tue, 19 Oct 2021 10:36:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B8uPBQKbORSen2TspjjgBLvkMyphM+tvG3TQQmdNrqlSCxFnnWugiYNDj89m+RQ2ZdNsCxqwZAjBHc+AJG56ugmvv7riz8gr12UJXytm/XV3TPnKFz3ZDIUWnojduxj7SAFAG1TydJ4VwsYlrVnLMpVcQ1C6HzfzFCeuxv+DBWOgV+ULT1Q8WmwAx7w/9Gh20j7gsekih/GtIuS0taujFLys78RdnZTihs5pzV72djbT/QTV8zLHUuiibw1VVFXbmVTlwGLgUpxlIAVeglx++cakwl4o8HrgAiyF2LsW3fGiGJ0Pma3LbINLuE5b3aUZEbbGj3qQ1CtM2eKN84Blpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m5Ht0SSs4s5oxoM/DZTJvgzbQ8GZhPeVAtyxL2BeEPY=; b=EbeWn4n3POjslYEZ8BMQqqbI3+Nfg33o4KPHvvf/wa5f0JcEWCMkqZAJ4Il2oW6OJVqhNmH8litQ8ExJud+5kCpf6EdvYJ05hG1tWNZN6OH6psIkQdNVkdD7BprljgKE9+SJ2USV1LdbI9EWtIAHp585CpzC+5qbmMYnhPo0xaAayajXvjvzXm2tV6NYP6lSSDYBJZv8AXuajx8hWZqez1MEfkDsM1B+b/EjZZTp42xO52O+SshV5QdwYPNtWjDwx2vh++prmFKdi7MwMiZeRKpqZiNz5Fh/MYENqSN6YNFbwJwdJvluCQPGd3uDaweJTuBvgjuIp7KlT/RsajNFiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m5Ht0SSs4s5oxoM/DZTJvgzbQ8GZhPeVAtyxL2BeEPY=; b=mMbkluEdQIlvr6CS5dXoCmBjUywmv3WvqYrzvX3DJdtKiqfyBu7Z2JGnAvKS7J4miDes6fYFAicrJHv92rJpYh2KG6PVz3QU8d4HeZGvztOWWwvikbpV3TY02DxWYqhMJFDnZO9PD+A5zZF01RhwjSbwV5prRIxGuPIT/wYfYOs= Received: from DM6PR21CA0026.namprd21.prod.outlook.com (2603:10b6:5:174::36) by MWHPR1201MB0222.namprd12.prod.outlook.com (2603:10b6:301:54::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16; Tue, 19 Oct 2021 14:36:31 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:5:174:cafe::53) by DM6PR21CA0026.outlook.office365.com (2603:10b6:5:174::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.2 via Frontend Transport; Tue, 19 Oct 2021 14:36:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4608.15 via Frontend Transport; Tue, 19 Oct 2021 14:36:31 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 09:36:30 -0500 From: Michael Roth To: CC: , Marcel Apfelbaum , VictorV , Marcel Apfelbaum , Yuval Shaia , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH 64/64] pvrdma: Fix the ring init error flow (CVE-2021-3608) Date: Tue, 19 Oct 2021 09:09:44 -0500 Message-ID: <20211019140944.152419-65-michael.roth@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211019140944.152419-1-michael.roth@amd.com> References: <20211019140944.152419-1-michael.roth@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9370beb9-ec13-40c3-6666-08d9930dd7a5 X-MS-TrafficTypeDiagnostic: MWHPR1201MB0222: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:159; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dlQqaHI3OTXqtfvjFbj5DD917IMnW5Ul5Rs8sM2eq5/C5AVzzewGokYTBPO2Op22i1TvoKwc67sMcegO7nWN9CQYEMWY9iOhvYEIHDov3kn7ElK9bjAD3jyVd0dPX3n+FZpp4xhFXfWhMllbvrab6/+GmmaHTEWEXZXdnS2v6mL8MdPsKxP7kwfR7dlfo7NZlNEo59NxldOLre3emFD+ACW41TNGTvR+UhGacAtFiickgpt3qCw5qQg21O9RMKFiIyQdDNqJBj5FU3fe4yy1iHjulT+6AgqCnR2OQzJfX6c0HQuInsuOf6YxjPLCizt9awsXT+9JM4mgmZstaxem7Fh+26w0j4okwWEPMUv4lPuGojwWAxLdYDkEjSh/glZJbXs5P2T7Zdgtc+TX1f9omGMqQA7wQdMobwjZ9ApP42n8HqPvS4JztsGY1Zpf0g+Hp8M9WktWYZoic7pFrZRgSkbpPHb5eDxrhLYxqRPCq406q7yFhQ6u8nQKhsu3+YrXHk6cg2+/U8LkwKmTLqkGjAdcWZ+T+xmrJurlInizx9mN7DE5EldXT0LbfAtR+v+N4Z2q2JI14hNZtHUeC9pkfnt0PBZZ6cO4lKIeomMtc/rYqjfFLMtkXf0agKA9uBNQsnr8TNWxJAGsQsD6om9KIT+MQ16qGiQKpmTYkLZSc6gByRnhOztlStUUro9vDlzQ4rUa6LK9/tITdeVFvowyYOHLkHQljFdlHSYRZscCpHE= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(2616005)(8676002)(1076003)(36756003)(83380400001)(6666004)(336012)(70586007)(356005)(81166007)(426003)(36860700001)(54906003)(2906002)(6916009)(508600001)(82310400003)(70206006)(4326008)(26005)(16526019)(44832011)(8936002)(5660300002)(186003)(86362001)(316002)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 14:36:31.0636 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9370beb9-ec13-40c3-6666-08d9930dd7a5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0222 Received-SPF: softfail client-ip=40.107.96.65; envelope-from=Michael.Roth@amd.com; helo=NAM02-SN1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marcel Apfelbaum Do not unmap uninitialized dma addresses. Fixes: CVE-2021-3608 Reviewed-by: VictorV (Kunlun Lab) Tested-by: VictorV (Kunlun Lab) Signed-off-by: Marcel Apfelbaum Message-Id: <20210630115246.2178219-1-marcel@redhat.com> Tested-by: Yuval Shaia Reviewed-by: Yuval Shaia Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Marcel Apfelbaum (cherry picked from commit 66ae37d8cc313f89272e711174a846a229bcdbd3) Signed-off-by: Michael Roth --- hw/rdma/vmw/pvrdma_dev_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/rdma/vmw/pvrdma_dev_ring.c b/hw/rdma/vmw/pvrdma_dev_ring.c index 074ac59b84..42130667a7 100644 --- a/hw/rdma/vmw/pvrdma_dev_ring.c +++ b/hw/rdma/vmw/pvrdma_dev_ring.c @@ -41,7 +41,7 @@ int pvrdma_ring_init(PvrdmaRing *ring, const char *name, PCIDevice *dev, qatomic_set(&ring->ring_state->cons_head, 0); */ ring->npages = npages; - ring->pages = g_malloc(npages * sizeof(void *)); + ring->pages = g_malloc0(npages * sizeof(void *)); for (i = 0; i < npages; i++) { if (!tbl[i]) {