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 E1FEEA04C3 for ; Fri, 22 Nov 2019 15:42:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D38AC374; Fri, 22 Nov 2019 15:42:42 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id ADD81374 for ; Fri, 22 Nov 2019 15:42:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574433760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yrMvmhzeYtmU1Ik/TaXPO54WCpYk1jIGEUFqxevp18o=; b=TpaAY360v7v2H+VB5bjOEC7VRJo/xTHqHUcRiFXsVMDhsa2OKLe7F6SEj2tg4qvWcoRtW8 VN8MXvEsxLOuREHsBlhg1F2g8u/hal8xSrWSp5SdLT/45h7iZVTLiGXNCRT+WLxwrPpNtk jUQbwswdod+/8/rSYDbjjzl36rptWC0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-a4NVM3lNM_2UdGerD9_gGA-1; Fri, 22 Nov 2019 09:42:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D03E110054E3; Fri, 22 Nov 2019 14:42:35 +0000 (UTC) Received: from rh.redhat.com (unknown [10.36.118.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 242026E71E; Fri, 22 Nov 2019 14:42:32 +0000 (UTC) From: Kevin Traynor To: Stephen Hemminger Cc: David Marchand , dpdk stable Date: Fri, 22 Nov 2019 14:41:12 +0000 Message-Id: <20191122144131.21231-26-ktraynor@redhat.com> In-Reply-To: <20191122144131.21231-1-ktraynor@redhat.com> References: <20191122144131.21231-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: a4NVM3lNM_2UdGerD9_gGA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'bus/pci: fix Intel IOMMU sysfs access check' has been queued to LTS release 18.11.6 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 LTS release 18.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/29/19. 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 rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/a87111e546a52f567b= 0bc9df129d89f4738e2932 Thanks. Kevin. --- >From a87111e546a52f567b0bc9df129d89f4738e2932 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 13 Aug 2019 08:38:22 -0700 Subject: [PATCH] bus/pci: fix Intel IOMMU sysfs access check [ upstream commit 2e8d5cf7631cbc5efb4b3abf7393d2526dee0424 ] Just open the sysfs file and handle failure, rather than using access(). This eliminates Coverity warnings about TOCTOU "time of check versus time of use"; although for this sysfs file that is not really an issue anyway. Coverity issue: 347276 Fixes: 54a328f552ff ("bus/pci: forbid IOVA mode if IOMMU address width too = small") Signed-off-by: Stephen Hemminger Reviewed-by: David Marchand --- drivers/bus/pci/linux/pci.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 74794a3ba..9b1c7c839 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -593,16 +593,17 @@ pci_one_device_iommu_support_va(struct rte_pci_device= *dev) =09=09 rte_pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid, =09=09 addr->function); -=09if (access(filename, F_OK) =3D=3D -1) { -=09=09/* We don't have an Intel IOMMU, assume VA supported*/ -=09=09return true; -=09} =20 -=09/* We have an intel IOMMU */ =09fp =3D fopen(filename, "r"); =09if (fp =3D=3D NULL) { -=09=09RTE_LOG(ERR, EAL, "%s(): can't open %s\n", __func__, filename); +=09=09/* We don't have an Intel IOMMU, assume VA supported */ +=09=09if (errno =3D=3D ENOENT) +=09=09=09return true; + +=09=09RTE_LOG(ERR, EAL, "%s(): can't open %s: %s\n", +=09=09=09__func__, filename, strerror(errno)); =09=09return false; =09} =20 +=09/* We have an Intel IOMMU */ =09if (fscanf(fp, "%" PRIx64, &vtd_cap_reg) !=3D 1) { =09=09RTE_LOG(ERR, EAL, "%s(): can't read %s\n", __func__, filename); --=20 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092019-11-22 14:36:56.618889629 +0000 +++ 0026-bus-pci-fix-Intel-IOMMU-sysfs-access-check.patch=092019-11-22 14:3= 6:55.194149350 +0000 @@ -1 +1 @@ -From 2e8d5cf7631cbc5efb4b3abf7393d2526dee0424 Mon Sep 17 00:00:00 2001 +From a87111e546a52f567b0bc9df129d89f4738e2932 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 2e8d5cf7631cbc5efb4b3abf7393d2526dee0424 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 1ac2bff77..318db1953 100644 +index 74794a3ba..9b1c7c839 100644 @@ -25 +26 @@ -@@ -512,16 +512,17 @@ pci_device_iommu_support_va(const struct rte_pci_dev= ice *dev) +@@ -593,16 +593,17 @@ pci_one_device_iommu_support_va(struct rte_pci_devic= e *dev)