From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id CE881316B for ; Wed, 15 Feb 2017 07:24:54 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2017 22:24:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,164,1484035200"; d="scan'208";a="1094927510" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga001.jf.intel.com with ESMTP; 14 Feb 2017 22:24:53 -0800 From: Yuanhan Liu To: Patrick MacArthur Cc: Yuanhan Liu , Anatoly Burakov , dpdk stable Date: Wed, 15 Feb 2017 14:26:27 +0800 Message-Id: <1487140012-13314-15-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1487140012-13314-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1487140012-13314-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-stable] patch 'vfio: fix file descriptor leak in multi-process' has been queued to stable release 16.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: , X-List-Received-Date: Wed, 15 Feb 2017 06:24:55 -0000 Hi, FYI, your patch has been queued to stable release 16.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/18/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 884ba36ce34940bacfc11a9cce254791ea15ecba Mon Sep 17 00:00:00 2001 From: Patrick MacArthur Date: Thu, 26 Jan 2017 18:05:21 -0500 Subject: [PATCH] vfio: fix file descriptor leak in multi-process [ upstream commit 811b6b25060f8b0ba32fd35af7c5f0354bd57a14 ] When a secondary process wants access to the VFIO container file descriptor, the primary process calls vfio_get_container_fd() which always opens an entirely new file descriptor on /dev/vfio/vfio. However, once the file descriptor has been passed to the subprocess, it is effectively duplicated, meaning that the copy of the file descriptor in the primary process is no longer needed. However, the primary process does not close the duplicate fd, which results in a resource leak. This can be reproduced by starting a primary process with a small RLIMIT_NOFILE limit configured to use VFIO for at least one device, and repeatedly launching secondary processes until the file descriptor limit is exceeded. Fix the resource leak by closing the local vfio container file descriptor after passing it to the secondary process. Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") Signed-off-by: Patrick MacArthur Acked-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c index 00cf919..fb4a2f8 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c @@ -301,6 +301,7 @@ vfio_mp_sync_thread(void __rte_unused * arg) vfio_mp_sync_send_request(conn_sock, SOCKET_ERR); else vfio_mp_sync_send_fd(conn_sock, fd); + close(fd); break; case SOCKET_REQ_GROUP: /* wait for group number */ -- 1.9.0