Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/96709/?format=api
http://patchwork.dpdk.org/api/patches/96709/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210807082504.1432-1-gaoxiangliu0@163.com/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20210807082504.1432-1-gaoxiangliu0@163.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210807082504.1432-1-gaoxiangliu0@163.com", "date": "2021-08-07T08:25:03", "name": "vhost: fix coredump on port deletion", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "725e720354a84bfb49e70556ef5c2a40b600bbcb", "submitter": { "id": 2304, "url": "http://patchwork.dpdk.org/api/people/2304/?format=api", "name": "Gaoxiang Liu", "email": "gaoxiangliu0@163.com" }, "delegate": { "id": 2642, "url": "http://patchwork.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210807082504.1432-1-gaoxiangliu0@163.com/mbox/", "series": [ { "id": 18222, "url": "http://patchwork.dpdk.org/api/series/18222/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=18222", "date": "2021-08-07T08:25:03", "name": "vhost: fix coredump on port deletion", "version": 1, "mbox": "http://patchwork.dpdk.org/series/18222/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/96709/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/96709/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id F3109A0C41;\n\tSat, 7 Aug 2021 10:25:24 +0200 (CEST)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id AA43740691;\n\tSat, 7 Aug 2021 10:25:24 +0200 (CEST)", "from m12-13.163.com (m12-13.163.com [220.181.12.13])\n by mails.dpdk.org (Postfix) with ESMTP id 19AB34067E\n for <dev@dpdk.org>; Sat, 7 Aug 2021 10:25:22 +0200 (CEST)", "from DESKTOP-ONA2IA7.localdomain (unknown [39.182.55.95])\n by smtp9 (Coremail) with SMTP id DcCowADH1GliQw5hRBInOg--.27868S4;\n Sat, 07 Aug 2021 16:25:20 +0800 (CST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;\n s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=d9zEp\n wkGFuNq2pVN+RZQYmkDqRyj+yxqd3l0WbSpd4c=; b=p2qnd8J7p3ps3sNbJM+9g\n 10SHrcB8AQvoUFswh0QOSO0hKhwxbYzWyHOwnTYwwmlVK0bCJ/xQUegRiuJgmhet\n D9IVfnqR/udwD1HVhCgK7zkUi6tHzykQzUSlrAYSwH6j0AdpgacK893o/7WaEN/d\n NUpj25zMJg0dvx8UbyOkw8=", "From": "Gaoxiang Liu <gaoxiangliu0@163.com>", "To": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n Chenbo Xia <chenbo.xia@intel.com>", "Cc": "dev@dpdk.org, liugaoxiang@huawei.com, Gaoxiang Liu <gaoxiangliu0@163.com>", "Date": "Sat, 7 Aug 2021 16:25:03 +0800", "Message-Id": "<20210807082504.1432-1-gaoxiangliu0@163.com>", "X-Mailer": "git-send-email 2.32.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-CM-TRANSID": "DcCowADH1GliQw5hRBInOg--.27868S4", "X-Coremail-Antispam": "1Uf129KBjvJXoW7CF43JF4UtrW5trWrJF1kZrb_yoW8ur47pF\n y3KFy3Jr97Jrn5Z39xAF4DXFyrCan5ua17G3srG3W5AF4DGws0qayq93WF9F18JFy8XFyU\n tF1jgF4S9FWUJw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jSjgxUUUUU=", "X-Originating-IP": "[39.182.55.95]", "X-CM-SenderInfo": "xjdr5xxdqjzxjxq6il2tof0z/1tbiMhDnOlWBu7FVGAAAss", "Subject": "[dpdk-dev] [PATCH] vhost: fix coredump on port deletion", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "The rte_vhost_driver_unregister() and vhost_user_read_cb()\ncan be called at the same time by 2 threads.\nEg thread1 calls rte_vhost_driver_unregister() and frees memory of conn,\nthen thread2 calls vhost_user_read_cb() and access invalid memory of\nconn.\n\nThe fix is to move the \"fdset_try_del\" in front of free memory of conn ,\nthen avoid the race condition.\n\nFixes: 52d874dc6705 (\"vhost: fix crash on closing in client mode\")\n\nSigned-off-by: Gaoxiang Liu <liugaoxiang@huawei.com>\n---\n lib/vhost/socket.c | 26 +++++++++++++-------------\n 1 file changed, 13 insertions(+), 13 deletions(-)", "diff": "diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c\nindex 5d0d728d5..bc7278e8a 100644\n--- a/lib/vhost/socket.c\n+++ b/lib/vhost/socket.c\n@@ -1024,6 +1024,19 @@ rte_vhost_driver_unregister(const char *path)\n \tfor (i = 0; i < vhost_user.vsocket_cnt; i++) {\n \t\tstruct vhost_user_socket *vsocket = vhost_user.vsockets[i];\n \n+\t\tif (vsocket->is_server) {\n+\t\t\t/*\n+\t\t\t * If r/wcb is executing, release vhost_user's\n+\t\t\t * mutex lock, and try again since the r/wcb\n+\t\t\t * may use the mutex lock.\n+\t\t\t */\n+\t\t\tif (fdset_try_del(&vhost_user.fdset, vsocket->socket_fd) == -1) {\n+\t\t\t\tpthread_mutex_unlock(&vhost_user.mutex);\n+\t\t\t\tgoto again;\n+\t\t\t}\n+\t\t } else if (vsocket->reconnect)\n+\t\t\tvhost_user_remove_reconnect(vsocket);\n+\n \t\tif (!strcmp(vsocket->path, path)) {\n \t\t\tpthread_mutex_lock(&vsocket->conn_mutex);\n \t\t\tfor (conn = TAILQ_FIRST(&vsocket->conn_list);\n@@ -1056,21 +1069,8 @@ rte_vhost_driver_unregister(const char *path)\n \t\t\tpthread_mutex_unlock(&vsocket->conn_mutex);\n \n \t\t\tif (vsocket->is_server) {\n-\t\t\t\t/*\n-\t\t\t\t * If r/wcb is executing, release vhost_user's\n-\t\t\t\t * mutex lock, and try again since the r/wcb\n-\t\t\t\t * may use the mutex lock.\n-\t\t\t\t */\n-\t\t\t\tif (fdset_try_del(&vhost_user.fdset,\n-\t\t\t\t\t\tvsocket->socket_fd) == -1) {\n-\t\t\t\t\tpthread_mutex_unlock(&vhost_user.mutex);\n-\t\t\t\t\tgoto again;\n-\t\t\t\t}\n-\n \t\t\t\tclose(vsocket->socket_fd);\n \t\t\t\tunlink(path);\n-\t\t\t} else if (vsocket->reconnect) {\n-\t\t\t\tvhost_user_remove_reconnect(vsocket);\n \t\t\t}\n \n \t\t\tpthread_mutex_destroy(&vsocket->conn_mutex);\n", "prefixes": [] }{ "id": 96709, "url": "