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 417EFA051C for ; Tue, 11 Feb 2020 12:29:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 383C51BE90; Tue, 11 Feb 2020 12:29:36 +0100 (CET) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 5B8CD1BF9C for ; Tue, 11 Feb 2020 12:29:34 +0100 (CET) Received: by mail-wm1-f66.google.com with SMTP id q9so3026529wmj.5 for ; Tue, 11 Feb 2020 03:29:34 -0800 (PST) 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=OF1w4EiBckCb0Y/qX+NoqhEbLPt2cGprPxaXCQQKMsM=; b=ttPIPF7MdwXyF7QP2HIli7Yx37eHBCU90ffLxCExECNpQ9sLbJ1EzQCjJ7OG0z0x4O ATXV1aZy+3v/S+cF+nNZ6xlGOJ+WO1I5MOmofrCOy++550WNH2CAUqQmzH3rWuX6H2D5 grYiA17NhbwQMO9O5phsqruRXCe24BjKzOMLPeLGFO+r6aiZmflcArz1vZ/h5BoYbvRI mdCFnE0RFqvMRMwnAIomxV0+yzwHBCLdbwUBpl/pjJxoRzVHjonLgQy8QVn1Pt53fzp6 JTa2iCcaXMm+XmN81OekgW5RMRzdyxcPxf2GDNkEWK60jPxUAfoAgKMBxrE5ajSPfw9v R4bw== 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=OF1w4EiBckCb0Y/qX+NoqhEbLPt2cGprPxaXCQQKMsM=; b=sZCTO0GkzDqmuuzLkt+jNhYoDkGHRJSJhHWo5mfPEhAASkHUlSPLwrhQW0tQcFKdSe 6WeDbSVZx7w6FuWjubqJZ4mHJQyu3jfkwIZPvvF8i/inVse8zNXqHCKZFEx+9ufAvp2w qRQBk1Vcev5+iPShMFGNyDVPXnqYZv7C3GjawZUEg2+CEsvilj5G10P92dVXfFAl+XA4 dzW6amalc8DRCWsSuZttz1WRwTPOWHk3qQrRAcq5WUc2TMGq6pSWK7QlMdc9g05x9Dze 0dtMDCM/S9C1blAWJZTuI4J/QTpPzmKWff6IGWOIBDzik1pjB0oMRoDbKYHMBiomp2If NVoA== X-Gm-Message-State: APjAAAUZcXT+OLr8KbyPiwmipufhoq9Fny87D6on8KAag6hk8R/6tYv2 DddZn6xG/D7KZy3e6MKV01Frd5oPiAg= X-Google-Smtp-Source: APXvYqwh/9tYFz8SRNdwK8xC1i3hUYuML9FDHBr3W5whY6gh8RSLTMc5vUv73VjnSIMjrrYd865WnA== X-Received: by 2002:a7b:c759:: with SMTP id w25mr5036318wmk.15.1581420574091; Tue, 11 Feb 2020 03:29:34 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id y12sm3307273wmj.6.2020.02.11.03.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:29:33 -0800 (PST) From: luca.boccassi@gmail.com To: Fang TongHao Cc: Andrew Rybchenko , Ferruh Yigit , dpdk stable Date: Tue, 11 Feb 2020 11:20:49 +0000 Message-Id: <20200211112216.3929-103-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'ethdev: fix secondary process memory overwrite' has been queued to stable release 19.11.1 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.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/13/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 467052faa5d3363b174ceff3f8e54fba5ddc9c20 Mon Sep 17 00:00:00 2001 From: Fang TongHao Date: Fri, 17 Jan 2020 10:08:04 +0800 Subject: [PATCH] ethdev: fix secondary process memory overwrite [ upstream commit 99ef90317da69a5e6ecc831ad05c6d2053e2b065 ] Avoid overwriting device flags and other information in device data stored in shared memory when a secondary process probes PCI device. Fixes: 494adb7f63f2 ("ethdev: add device fields from PCI layer") Signed-off-by: Fang TongHao Reviewed-by: Andrew Rybchenko Reviewed-by: Ferruh Yigit --- lib/librte_ethdev/rte_ethdev_pci.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h index ccdbb46ec0..cca94ec864 100644 --- a/lib/librte_ethdev/rte_ethdev_pci.h +++ b/lib/librte_ethdev/rte_ethdev_pci.h @@ -42,6 +42,8 @@ /** * Copy pci device info to the Ethernet device data. + * Shared memory (eth_dev->data) only updated by primary process, so it is safe + * to call this function from both primary and secondary processes. * * @param eth_dev * The *eth_dev* pointer is the address of the *rte_eth_dev* structure. @@ -60,14 +62,16 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, eth_dev->intr_handle = &pci_dev->intr_handle; - eth_dev->data->dev_flags = 0; - if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) - eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; - if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV) - eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_RMV; + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + eth_dev->data->dev_flags = 0; + if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC) + eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; + if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV) + eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_RMV; - eth_dev->data->kdrv = pci_dev->kdrv; - eth_dev->data->numa_node = pci_dev->device.numa_node; + eth_dev->data->kdrv = pci_dev->kdrv; + eth_dev->data->numa_node = pci_dev->device.numa_node; + } } static inline int -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:42.440402307 +0000 +++ 0103-ethdev-fix-secondary-process-memory-overwrite.patch 2020-02-11 11:17:38.572004563 +0000 @@ -1,14 +1,15 @@ -From 99ef90317da69a5e6ecc831ad05c6d2053e2b065 Mon Sep 17 00:00:00 2001 +From 467052faa5d3363b174ceff3f8e54fba5ddc9c20 Mon Sep 17 00:00:00 2001 From: Fang TongHao Date: Fri, 17 Jan 2020 10:08:04 +0800 Subject: [PATCH] ethdev: fix secondary process memory overwrite +[ upstream commit 99ef90317da69a5e6ecc831ad05c6d2053e2b065 ] + Avoid overwriting device flags and other information in device data stored in shared memory when a secondary process probes PCI device. Fixes: 494adb7f63f2 ("ethdev: add device fields from PCI layer") -Cc: stable@dpdk.org Signed-off-by: Fang TongHao Reviewed-by: Andrew Rybchenko