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 2A444468E4 for ; Thu, 12 Jun 2025 23:11:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 255A342E5E; Thu, 12 Jun 2025 23:11:10 +0200 (CEST) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mails.dpdk.org (Postfix) with ESMTP id D44CD42E0C for ; Thu, 12 Jun 2025 23:11:07 +0200 (CEST) Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3a54690d369so1423428f8f.3 for ; Thu, 12 Jun 2025 14:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749762667; x=1750367467; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AeYsPJoLk/qPvBpi2cxqgskMTUY55k8duw8JhwhAJIQ=; b=nPR2UbspiThL+GE8Q97NuzTeNRiYMuH8tKLerlO9ViCTdQaXnaEjE6839ctJ6647ph s13lnOj8z4eAR5aLiveTqyCD2r4U1DdLylYd9l0mbN+2s7XURqMsgrCwfRe0W+08p2Iv J9c4HmNjsfexQU413LHlazsRIMje8DjNRhBKqZaO18tbe33qxYVxeMG1mdJ4W/+Wa+lJ auFbuDn27FkzZyy4w2UqwbKJA5UVFb11ySE4N2HiqP77VQ40xG5VvqKEIxp/5bXvpscT ffBBVTAlrKhcBsikGnKUNB/wHQ+FTLqsVZ8mogaPl31ZFJaVwAVOUjdfUGeglin0HcPL MJbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749762667; x=1750367467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message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source: AGHT+IFoTdOrHf4r5eatpQ0Td8T56OWEfhXxPwb8fpkfsSppsIy+olPvIjbvMStPob7UoDthRF2Baw== X-Received: by 2002:a05:6000:2204:b0:3a4:e7b7:3851 with SMTP id ffacd0b85a97d-3a56877ff2emr634813f8f.58.1749762667311; Thu, 12 Jun 2025 14:11:07 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:f2df:571a:ae4c:bef2]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3a568b47198sm369047f8f.81.2025.06.12.14.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Jun 2025 14:11:06 -0700 (PDT) From: luca.boccassi@gmail.com To: Jake Freeland Cc: Anatoly Burakov , dpdk stable Subject: patch 'bus/pci/bsd: fix device existence check' has been queued to stable release 22.11.9 Date: Thu, 12 Jun 2025 22:07:22 +0100 Message-ID: <20250612210733.2506558-65-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250612210733.2506558-1-luca.boccassi@gmail.com> References: <20250612210733.2506558-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/14/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/605117a0ccd604b73b4de19fadd24e228329a930 Thanks. Luca Boccassi --- >From 605117a0ccd604b73b4de19fadd24e228329a930 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 7459d15c7e..b11cfdd450 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -105,20 +105,27 @@ 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; snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u", dev->addr.bus, dev->addr.devid, dev->addr.function); - if (access(devname, O_RDWR) < 0) { - RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, " - "skipping\n", loc->domain, loc->bus, loc->devid, loc->function); - return 1; + fd = open(devname, O_RDWR); + if (fd < 0) { + if (errno == ENOENT) { + RTE_LOG(WARNING, EAL, PCI_PRI_FMT" not managed by UIO driver, skipping\n", + loc->domain, loc->bus, loc->devid, loc->function); + return 1; + } + RTE_LOG(ERR, EAL, "Failed to open device file for " PCI_PRI_FMT " (%s)\n", + 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)) { RTE_LOG(WARNING, EAL, "Failed to save fd"); goto error; } -- 2.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-06-12 22:06:26.221212201 +0100 +++ 0065-bus-pci-bsd-fix-device-existence-check.patch 2025-06-12 22:06:23.894045145 +0100 @@ -1 +1 @@ -From 6d4e6dbccc3bd965bfd5e5836d7cb21c1b1f9c6c Mon Sep 17 00:00:00 2001 +From 605117a0ccd604b73b4de19fadd24e228329a930 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 7459d15c7e..b11cfdd450 100644 @@ -27 +28 @@ -@@ -106,20 +106,27 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, +@@ -105,20 +105,27 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, @@ -39,2 +40,2 @@ -- PCI_LOG(WARNING, " "PCI_PRI_FMT" not managed by UIO driver, skipping", -- loc->domain, loc->bus, loc->devid, loc->function); +- RTE_LOG(WARNING, EAL, " "PCI_PRI_FMT" not managed by UIO driver, " +- "skipping\n", loc->domain, loc->bus, loc->devid, loc->function); @@ -45 +46 @@ -+ PCI_LOG(WARNING, PCI_PRI_FMT" not managed by UIO driver, skipping", ++ RTE_LOG(WARNING, EAL, PCI_PRI_FMT" not managed by UIO driver, skipping\n", @@ -49 +50 @@ -+ PCI_LOG(ERR, "Failed to open device file for " PCI_PRI_FMT " (%s)", ++ RTE_LOG(ERR, EAL, "Failed to open device file for " PCI_PRI_FMT " (%s)\n", @@ -57 +58 @@ - PCI_LOG(WARNING, "Failed to save fd"); + RTE_LOG(WARNING, EAL, "Failed to save fd");