From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 567F846BAE for ; Fri, 18 Jul 2025 21:36:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30D1040E4D; Fri, 18 Jul 2025 21:36:12 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 1CF8540E35 for ; Fri, 18 Jul 2025 21:36:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752867369; 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=mdVTC9YKyi8jx9hFpnhxHLJNg9Jiru+ldKxaTe1c7Fw=; b=adKltLAXyk0/7vzmSWL7M65lRTv8N0V7Ruqh1nHMbMz96y7RL8+a2EX9Hu57ttKIqQzxP8 KbZPB6A82F7XPbjmLSCaTGZUdUxmrXQSoTPWPYTS1zI7kQDL0hqeGnrXlvAzOdqnrENUhV Rj0WWIMF2ZDdNvur58HhOQlaHPQcW3Q= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-gQp0KvEXPrmjobeewdf2yQ-1; Fri, 18 Jul 2025 15:36:04 -0400 X-MC-Unique: gQp0KvEXPrmjobeewdf2yQ-1 X-Mimecast-MFC-AGG-ID: gQp0KvEXPrmjobeewdf2yQ_1752867363 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5110419560A5; Fri, 18 Jul 2025 19:36:03 +0000 (UTC) Received: from rh.redhat.com (unknown [10.44.32.40]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D8B7918003FC; Fri, 18 Jul 2025 19:36:01 +0000 (UTC) From: Kevin Traynor To: Jake Freeland Cc: Anatoly Burakov , dpdk stable Subject: patch 'bus/pci/bsd: fix device existence check' has been queued to stable release 24.11.3 Date: Fri, 18 Jul 2025 20:30:24 +0100 Message-ID: <20250718193247.1008129-90-ktraynor@redhat.com> In-Reply-To: <20250718193247.1008129-1-ktraynor@redhat.com> References: <20250718193247.1008129-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: iHvzrjuDJ5uJvPdi-ah8X8fDtHfsCP6p1JIwS2n5MgU_1752867363 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi, FYI, your patch has been queued to stable release 24.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 07/23/25. 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. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/78e15dd8952bdd7c4a914ca007f9dd074dc6d144 Thanks. Kevin --- >From 78e15dd8952bdd7c4a914ca007f9dd074dc6d144 Mon Sep 17 00:00:00 2001 From: Jake Freeland Date: Tue, 6 May 2025 12:40:44 -0500 Subject: [PATCH] bus/pci/bsd: fix device existence check [ upstream commit 6d4e6dbccc3bd965bfd5e5836d7cb21c1b1f9c6c ] Use open(2) instead of access(2) to check for the existence of the target device. This avoids a possible race condition where the device file is removed after a successful call to access(2) but before open(2). This also fixes any potential bugs associated with passing open(2)-style flags into access(2). i.e. access(2) does not formally support the O_RDWR flag. Fixes: 764bf26873b9 ("add FreeBSD support") Signed-off-by: Jake Freeland Acked-by: Anatoly Burakov --- drivers/bus/pci/bsd/pci.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c index 2f88252418..5168eb2e22 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -104,4 +104,5 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, char devname[PATH_MAX]; /* contains the /dev/uioX */ struct rte_pci_addr *loc; + int fd; loc = &dev->addr; @@ -110,12 +111,18 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, dev->addr.bus, dev->addr.devid, dev->addr.function); - if (access(devname, O_RDWR) < 0) { - PCI_LOG(WARNING, " "PCI_PRI_FMT" not managed by UIO driver, skipping", - loc->domain, loc->bus, loc->devid, loc->function); - return 1; + fd = open(devname, O_RDWR); + if (fd < 0) { + if (errno == ENOENT) { + PCI_LOG(WARNING, PCI_PRI_FMT" not managed by UIO driver, skipping", + loc->domain, loc->bus, loc->devid, loc->function); + return 1; + } + PCI_LOG(ERR, "Failed to open device file for " PCI_PRI_FMT " (%s)", + loc->domain, loc->bus, loc->devid, loc->function, devname); + return -1; } /* save fd if in primary process */ - if (rte_intr_fd_set(dev->intr_handle, open(devname, O_RDWR))) { + if (rte_intr_fd_set(dev->intr_handle, fd)) { PCI_LOG(WARNING, "Failed to save fd"); goto error; -- 2.50.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-07-18 20:29:14.136436213 +0100 +++ 0090-bus-pci-bsd-fix-device-existence-check.patch 2025-07-18 20:29:10.996747187 +0100 @@ -1 +1 @@ -From 6d4e6dbccc3bd965bfd5e5836d7cb21c1b1f9c6c Mon Sep 17 00:00:00 2001 +From 78e15dd8952bdd7c4a914ca007f9dd074dc6d144 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 6d4e6dbccc3bd965bfd5e5836d7cb21c1b1f9c6c ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 2508e36a85..3f13e1d6ac 100644 +index 2f88252418..5168eb2e22 100644 @@ -27 +28 @@ -@@ -107,4 +107,5 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, +@@ -104,4 +104,5 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, @@ -33 +34 @@ -@@ -113,12 +114,18 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, +@@ -110,12 +111,18 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,