From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5B63EA0093 for ; Tue, 19 May 2020 15:00:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 520681D5DE; Tue, 19 May 2020 15:00:39 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 328E11D5DE for ; Tue, 19 May 2020 15:00:38 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id m185so3445953wme.3 for ; Tue, 19 May 2020 06:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DC85j74FiekvzKRI7uc/B26jxU3EWFTa62unfdTvl7s=; b=OZf71mDG0vlhZ0ywo8egOyrph1mwZI53HQ3n7aPz0bmmv7qwCUQAcxVv6vMoB3kbx4 2CmrMZgYzMClx8vhFRKslnG7diWc+Vs2QPRuIs/GWVgHCqCQm2MtXswrALWrwoNZ/4Q6 ydQxGhscmuGZsIpLqTGdPzL7V7iiTf/qDDwAPvflooQ12gcB+kXLcJA5LUIxHqLoxOM3 fOP4cuSD4e1aG0IfwVEVcvZHxSz5NlG+8HD2jp16jvRaw4j037PgAgvXIl1/du53GpQ6 /T7QJs5TJ/DKom8qX+h8X3nLD/4yRrzJBle02klBngJ6lZD1HeGTzsaxX1IgjXPLgCUS Pi9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DC85j74FiekvzKRI7uc/B26jxU3EWFTa62unfdTvl7s=; b=UIAoRnQaHNwedgf9QGvRmh2grbWvlMwohV77W7UDwMo4hFhIkP8N2z8NPbaT5d8vgv i2QhFQ4hqjPWkn8UJoYwSW0ezcaiPTng4i+wSSs4fZY8TrZeRYC7CStoMbgrGo2r+5lg 7uKQ0+CCRJjDTjd0m9l6K1yey9/Fiq5vlfZ+OmzYj7r1XXKWJKb2s/QS9MLTL1kHPUA3 biIaGbZivoCN5cO2oxkNjfp0yO5bVHCIJMx3LWgtZddD2J9y3bLaZ/LXxGQ13N8S0hS2 G6YmLqlVuik7N17LJVkAAl0yBzYrvCvW/IKEV4E7GynbCFqKR2Q7p2lCZW39Uh5Ti6u1 8c+w== X-Gm-Message-State: AOAM530aMxzLrkE8RG0GiqhChXgRF3CxoOOF518Z22ZdYCkyxVgNU/gN tuIhE4NGi8k6oUdUp2QWnZg= X-Google-Smtp-Source: ABdhPJxBsAmN9OTIeptTjWTJhcTOVhU8yQ/xqo4TvREZDJod1E7FxFYDKVNeZAA58XfP+uKr15QNxA== X-Received: by 2002:a05:600c:2146:: with SMTP id v6mr5574391wml.142.1589893237919; Tue, 19 May 2020 06:00:37 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id c80sm4010564wme.15.2020.05.19.06.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:00:37 -0700 (PDT) From: luca.boccassi@gmail.com To: "Wei Hu (Xavier)" Cc: Chengwen Feng , Anatoly Burakov , dpdk stable Date: Tue, 19 May 2020 13:54:24 +0100 Message-Id: <20200519125804.104349-74-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519125804.104349-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'vfio: fix use after free with multiprocess' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 2ef98701189ff669783c9b5f0417ac8811b6fa56 Mon Sep 17 00:00:00 2001 From: "Wei Hu (Xavier)" Date: Tue, 21 Apr 2020 11:29:57 +0800 Subject: [PATCH] vfio: fix use after free with multiprocess [ upstream commit d6298844da7e3e83034f1af196bdfddf388f979e ] This patch fixes the heap-use-after-free bug which was found by ASAN (Address-Sanitizer) in the vfio_get_default_container_fd function. Fixes: 6bcb7c95fe14 ("vfio: share default container in multi-process") Signed-off-by: Chengwen Feng Signed-off-by: Wei Hu (Xavier) Acked-by: Anatoly Burakov --- lib/librte_eal/linux/eal/eal_vfio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c index b82a5018bf..62ffe13e0e 100644 --- a/lib/librte_eal/linux/eal/eal_vfio.c +++ b/lib/librte_eal/linux/eal/eal_vfio.c @@ -1049,6 +1049,7 @@ vfio_get_default_container_fd(void) struct rte_mp_reply mp_reply = {0}; struct timespec ts = {.tv_sec = 5, .tv_nsec = 0}; struct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param; + int container_fd; if (default_vfio_cfg->vfio_enabled) return default_vfio_cfg->vfio_container_fd; @@ -1071,8 +1072,9 @@ vfio_get_default_container_fd(void) mp_rep = &mp_reply.msgs[0]; p = (struct vfio_mp_param *)mp_rep->param; if (p->result == SOCKET_OK && mp_rep->num_fds == 1) { + container_fd = mp_rep->fds[0]; free(mp_reply.msgs); - return mp_rep->fds[0]; + return container_fd; } } -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 13:56:21.811397667 +0100 +++ 0074-vfio-fix-use-after-free-with-multiprocess.patch 2020-05-19 13:56:18.303503332 +0100 @@ -1,26 +1,27 @@ -From d6298844da7e3e83034f1af196bdfddf388f979e Mon Sep 17 00:00:00 2001 +From 2ef98701189ff669783c9b5f0417ac8811b6fa56 Mon Sep 17 00:00:00 2001 From: "Wei Hu (Xavier)" Date: Tue, 21 Apr 2020 11:29:57 +0800 Subject: [PATCH] vfio: fix use after free with multiprocess +[ upstream commit d6298844da7e3e83034f1af196bdfddf388f979e ] + This patch fixes the heap-use-after-free bug which was found by ASAN (Address-Sanitizer) in the vfio_get_default_container_fd function. Fixes: 6bcb7c95fe14 ("vfio: share default container in multi-process") -Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Wei Hu (Xavier) Acked-by: Anatoly Burakov --- - lib/librte_eal/linux/eal_vfio.c | 4 +++- + lib/librte_eal/linux/eal/eal_vfio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -diff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c -index 1979f6fdd8..d26e1649a5 100644 ---- a/lib/librte_eal/linux/eal_vfio.c -+++ b/lib/librte_eal/linux/eal_vfio.c -@@ -1092,6 +1092,7 @@ vfio_get_default_container_fd(void) +diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c +index b82a5018bf..62ffe13e0e 100644 +--- a/lib/librte_eal/linux/eal/eal_vfio.c ++++ b/lib/librte_eal/linux/eal/eal_vfio.c +@@ -1049,6 +1049,7 @@ vfio_get_default_container_fd(void) struct rte_mp_reply mp_reply = {0}; struct timespec ts = {.tv_sec = 5, .tv_nsec = 0}; struct vfio_mp_param *p = (struct vfio_mp_param *)mp_req.param; @@ -28,7 +29,7 @@ if (default_vfio_cfg->vfio_enabled) return default_vfio_cfg->vfio_container_fd; -@@ -1114,8 +1115,9 @@ vfio_get_default_container_fd(void) +@@ -1071,8 +1072,9 @@ vfio_get_default_container_fd(void) mp_rep = &mp_reply.msgs[0]; p = (struct vfio_mp_param *)mp_rep->param; if (p->result == SOCKET_OK && mp_rep->num_fds == 1) {