From patchwork Wed Dec 15 22:29:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Raphael Norwitz X-Patchwork-Id: 12679643 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 29748C433FE for ; Wed, 15 Dec 2021 22:32:29 +0000 (UTC) Received: from localhost ([::1]:57654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxcp1-0005uV-Tu for qemu-devel@archiver.kernel.org; Wed, 15 Dec 2021 17:32:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxcmZ-0003Av-Hy for qemu-devel@nongnu.org; Wed, 15 Dec 2021 17:29:55 -0500 Received: from mx0a-002c1b01.pphosted.com ([148.163.151.68]:15540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxcmX-0006G0-4B for qemu-devel@nongnu.org; Wed, 15 Dec 2021 17:29:55 -0500 Received: from pps.filterd (m0127839.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BFIkLd7030328; Wed, 15 Dec 2021 14:29:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=from : to : cc : subject : date : message-id : content-type : content-id : content-transfer-encoding : mime-version; s=proofpoint20171006; bh=1VmkOxsPhTK55LLCrgGy6TKoNU9w+vg3jpIJMx8uoYk=; b=khxqMc0EcdS9//mXNpHdC7B7tBEqzbwT6sdQmlAzMGjBMgqR6fID95xao2siFm6aayNC APYlHFGs5M3wKNomdhAfrm9CXiY/V0cIpJ/M1BPH/wDdkqnWa6TMrNbt53LRV82SGw7B 7KOMkSmQoVS+Y2XvBgZbWK8Ys62jpbrRO7YyLHXt2ZdG5VJdLfEGJI/YKWMPMqwidFi6 mj/HNJlZDYT73W5lysdKT/OJoibso+XvZWM/jnreMYAabuX7tRsAxA/erHS+YOE7wO8B CDA9S3yy3dRby0XKvhuseawv70savmQIze/zhOxZu++m2pkdI2rUYQrouGAu6EgD6xu5 SQ== Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3cy7vej3qj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Dec 2021 14:29:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iyBgx/bW/3/kojFJpO2X3kjpAeqx9hkw4Q3Lm4J+4AIGQSucExBssmsXNMuHuBej4e68pgKaKDV6JA4NYab+ZNFcEJwkSCRXqtOZKw5UDJofCh/WB2Qg2ASFJlyggg4dDf65W5j+nJKvz3IHQOUaito1XNLeGWyCivOd5/nJXdOwDyvAie0BX/26greqqbn63EH/jdnvlemvjE4q7ulJ1ZgoozbbxFuyURYkApAAjuv7fesKquTrkxgOP5QC040hunex9K7wzCw/4Cp8D8AqMRO8109Au8kkZxqGXdTl8YiL13ap4byxJG/w9xfKHv1i2+QTgzEmT3Sc2igfomNtmg== 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=1VmkOxsPhTK55LLCrgGy6TKoNU9w+vg3jpIJMx8uoYk=; b=Xk1MzkCLC8gi1nzJJm1Wh5audSMEjjOwFfraSCVfcEWC9YP5KVd64CNzvk/DUI9afrHUjyoSuIFZ+tP9SAG2E7C+eZlCnzDvkzIXvgnkHb6n47Ouf/cjvwCXG9ZjvZnrCtrJ2cp5BvwdrmCOPsZ/hdmFnOA6gY5EsjqD1b6st+6tDGx4StbI2j/eTRYkHBF89NMJvemiqwB87h2zO/qQY3ZwVjr2RH8/kor4yIh+hTve0eBvV5AHdIMULQvZSnC3hh4ltaUBjwC7JsPJXi0LApufGx77y72vNwcSGpnaQOxcAHuYC5qbv8XOfgtNr8io78Ki31Ma7brPf5Qc/0AJ/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none Received: from BL3PR02MB7938.namprd02.prod.outlook.com (2603:10b6:208:355::20) by BL0PR02MB5457.namprd02.prod.outlook.com (2603:10b6:208:87::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12; Wed, 15 Dec 2021 22:29:46 +0000 Received: from BL3PR02MB7938.namprd02.prod.outlook.com ([fe80::25f1:c1cf:5f90:35af]) by BL3PR02MB7938.namprd02.prod.outlook.com ([fe80::25f1:c1cf:5f90:35af%8]) with mapi id 15.20.4778.016; Wed, 15 Dec 2021 22:29:46 +0000 From: Raphael Norwitz To: "stefanha@redhat.com" , "marcandre.lureau@redhat.com" , "mst@redhat.com" , "david@redhat.com" Subject: [RFC 0/5] Clean up error handling in libvhost-user memory mapping Thread-Topic: [RFC 0/5] Clean up error handling in libvhost-user memory mapping Thread-Index: AQHX8gNDpGtXsOkIkUmuyd0RrsddvQ== Date: Wed, 15 Dec 2021 22:29:46 +0000 Message-ID: <20211215222939.24738-1-raphael.norwitz@nutanix.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.20.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ce9dd605-3b6a-4858-c105-08d9c01a6607 x-ms-traffictypediagnostic: BL0PR02MB5457:EE_ x-microsoft-antispam-prvs: x-proofpoint-crosstenant: true 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: ptRYwGtqT4bkerS2nMhzrq1YtgB6swdacC7W2J/IcX8YR3eY6VskL9HFbzqsFPmLINo8k6svRCBPlvWav6XhUWmlo9SgJ6bGzqsGjIl4d/ooKhbMkQeopjhcp9hXUTsRpziP3ihba3WKDA7DAUP0JiXrXOTZcIyt4Fhr7dfPS4QFFTMnmO2pL9ZbwnczUjibWVv2BgHzax2QB8MNIxpVj1bpXH8gQeiou5kHDvBZfrT0GCDt6lICByLL+ccl+1wHMYz6PmLuefCPb143JuQoWf0IpMF+LlONqRsUPCk8wCrwarb7NuZjUYu543mxCDtJ4oheuQxfEArouJ/ND+AkZBYHxGQtHb4cdRAO+jmUblwuVqA9ezeQhinbPmOLj54Yn6LzW6lGJA9Ka7nzTf0dKFlxmXRr0CXrStJyKHrVSAIZAc2FwW75bww+O/8gbqqXfoIiQH8XcmeayQrtkZSH465+34a2JK/bgTHlbBoKfakVRXwGqwaOWVrbYQ3dNynaCohZNAhh+2IAQartrYt7eVQoJdbyDkBPtt+kIp8Mv/TvnilwXNZJsqylLvprOiLpyWbsknuEemfTMwE61H30GPxB4VoM8FvN7fPcQeJVJ9H3/9JVOsDsRaVNIBn6GBuTHeC+bBTibFTfGqu3QBg3GFr/RaoRMtb9J67tqOhfV9yxfrlP1LgXlV/HJkVIz9r2fySdwwB8MtNEAYuAHOw7XFXzkL5DeK1kDVmR2/1gSQLDTWuoeG5Tn2M6YWLJgSxA6AXEZlnUeEmclTAz8HCHo8tc/xCyVzkFjKoab5pK7YDrLmr3pXCOOYeYauQyMrQ3zJzS4rTNhZdDo8g02x9Tkg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL3PR02MB7938.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(83380400001)(2906002)(8936002)(6506007)(8676002)(26005)(1076003)(107886003)(2616005)(316002)(110136005)(122000001)(54906003)(5660300002)(38100700002)(86362001)(38070700005)(66946007)(186003)(44832011)(36756003)(66446008)(4326008)(64756008)(66476007)(76116006)(91956017)(6512007)(66556008)(966005)(71200400001)(6486002)(508600001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?fsMVq1rT298ZakzXZcwO3sLtvUUk?= =?utf-8?q?OPBFsV2x6SkdL8qkEb1UPcYEme/9gYcfIHmHLQDGOe32efKQcxV+q7eDHtL+Q7iUO?= =?utf-8?q?a8bHmdhTIbI/wV1uZ/aJwDK6xdZpdEfiSVt3XEIcLvK4aBjZ30C+XGhgjxsrkWITN?= =?utf-8?q?Tr6lFLUWxX/QBhGrSordQgtjvy/oAuOFmClG8tM89sw6BOwpGLtpw+Xvr0Qoz8ws6?= =?utf-8?q?pWF3TZ2tV3/aKVxyLQDIJwnyyKtxDoQXM+hoOe25G45mp1fEfxM8/Yx8xwA8n1R9d?= =?utf-8?q?EE5wgeCWF7KqMn52Td+ClMUe/ELrXoF2Qg4ZKvLcEngaB8WQKUqlyNhpJ3gQBd3Y0?= =?utf-8?q?72qfMHlCko6YJ35Zx/EHM7gdC/xEGjv8srTFFQox3CTR6zUne12tS/+lonZXcsS1t?= =?utf-8?q?oDU9L5WoOqsPZLltmXQ8/Jw+Mou4c407+0oIF3Qkglz9ap498B3DX1rrQzQsTYsVD?= =?utf-8?q?2DL1Cp57PVheUkBClpDUIXBc8bZ7Sr2sS5cg+JOA9jGOky1TiURrVFI8T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53?= =?utf-8?q?/xPi5TVnRfTEUdCefm5QofZK3PLNqiq7PjlaNXxR9LQVwQ0Pok0OERP6DSk1zWjq0?= =?utf-8?q?Y4YHQoHYkf9VNR0N8jzihXpiQEJeNykxshiZjlUSq35Q9pR/zL77utTh/7dD6kdjL?= =?utf-8?q?wH1sYzvxUtm3fflQxu63IpfW1RwWBJamsHCR9MaUwQjEgCD5bdfCe3rKrpHXabBPs?= =?utf-8?q?Fetaw/lK+AHkwEtncSJHlLjOilYYZs8Q9r3oYenl0CPtSuT2XBt5Ik=3D?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL3PR02MB7938.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce9dd605-3b6a-4858-c105-08d9c01a6607 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 22:29:46.1250 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: VVHedoTVktOoGLKuhxfQ+1IqWOWvUmE9sI4GoSX+351RD5a6BSt7vA7UmMrdcxQ+r87sLH/o3+ojsGqUHE7O8tmMHfYuIyiEEPzMo2CfvQI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB5457 X-Proofpoint-GUID: AdAWicViKtI_aagTrxYRF9elaSLMUwnA X-Proofpoint-ORIG-GUID: AdAWicViKtI_aagTrxYRF9elaSLMUwnA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-15_13,2021-12-14_01,2021-12-02_01 X-Proofpoint-Spam-Reason: safe Received-SPF: pass client-ip=148.163.151.68; envelope-from=raphael.norwitz@nutanix.com; helo=mx0a-002c1b01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.719, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "raphael.s.norwitz@gmail.com" , "qemu-devel@nongnu.org" , Raphael Norwitz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hey Stefan, Marc-Andre, MST, David - As promised here is a series cleaning up error handling in the libvhost-user memory mapping path. Most of these cleanups are straightforward and have been discussed on the mailing list in threads [1] and [2]. Hopefully there is nothing super controversial in the first 4 patches. I am concerned about is patch 5 “libvhost-user: handle removal of identical regions”. From my reading of Stefan's comments in [1], the proposal seemed to be to remove any duplicate regions. I’d prefer to prevent duplicate regions from being added in the first place. Thoughts? [1] https://lore.kernel.org/qemu-devel/20211018143319.GA11006@raphael-debian-dev/ [2] https://lore.kernel.org/qemu-devel/9391f500-70be-26cf-bcfc-591d3ee84d4e@redhat.com/ Sorry for the delay, Raphael David Hildenbrand (1): libvhost-user: Simplify VHOST_USER_REM_MEM_REG Raphael Norwitz (4): libvhost-user: Add vu_rem_mem_reg input validation libvhost-user: Add vu_add_mem_reg input validation libvhost-user: prevent over-running max RAM slots libvhost-user: handle removal of identical regions subprojects/libvhost-user/libvhost-user.c | 52 +++++++++++++++-------- 1 file changed, 34 insertions(+), 18 deletions(-)