From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 2A5FCFA8F for ; Thu, 9 Feb 2017 18:36:20 +0100 (CET) Received: by mail-wm0-f44.google.com with SMTP id t18so59355064wmt.0 for ; Thu, 09 Feb 2017 09:36:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=KEQkCQ4azr3594iBqtfzikQb3mC8MLQSPznRwR9dAH8=; b=FDwSLPALNVATzWbKlJHecN/RVmS9n4ZEVSlWtS4r3EVCesJtoGY3TbavrYGWrD2IOC ZM4XjQrJoYha1NvBTnNokXBJehDjsLKkVNG3LHiHjAYG24clQh30ur1bjSts/yRdXWUD Agh05Q5caNugJPA4aenzXVevsWeHTXRr5qTl9SXRwCLVUzy2++HakibRkh+J+gwHQN23 nPUOfYVK7UW0q9loYwl1B7pTrI1hNO3J5Jo6yFdnsw5PrfIFbrqbxcF5NFdXN2XGHDbI bCxm7ylbt8NXRRR2z8KOSuh82klz5Ub5W4isFqFygkXleTyj/7A2I9MH3wSy/BrloKIH 7trQ== 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:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=KEQkCQ4azr3594iBqtfzikQb3mC8MLQSPznRwR9dAH8=; b=jUY8MY90WdyyfVFLpHIZrzRkjIgmFQq7zrXj7Z2kyXk5W6WRCLOXOe4mE2B1oPcEr6 +UCkDBKYHEOmUdsjxiDyuSJXfkvyoU2lEQSk8THx65IcOBYJXIG2qqlraua5Oxzzl6Q5 d/EDOQJ09NP679xEKH5+0t/60uYcyi0GF0Z8rU5NLTr6/oKXAkqGFosRNSLNPN/7/YBj 2yWROFaH99Glgum05P8n0rdp847uOj8hbteFNCb9w7R+rUarYEYafUMAiKm/ZlPisHzG Yup0MXYamgyMVBh1m7oUUw2kY65KQ2wo3gaQoGwUw/ElXlzsqvF/cZfHOvB7xsYNb1ZX +pcA== X-Gm-Message-State: AMke39kP3z7Ou14akc9x9xKF9x89L4uLuSFNgJvt+skWFrCMvJUgt9hghN6MZZDguRXPXSDD X-Received: by 10.28.51.72 with SMTP id z69mr4410494wmz.38.1486661779924; Thu, 09 Feb 2017 09:36:19 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id q5sm19625144wrd.32.2017.02.09.09.36.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 09:36:19 -0800 (PST) From: Thomas Monjalon To: Patrick MacArthur Cc: dev@dpdk.org, "Burakov, Anatoly" Date: Thu, 09 Feb 2017 18:36:18 +0100 Message-ID: <6697903.IRQjSijl37@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: References: <20170126230521.28314-1-patrick@patrickmacarthur.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH] vfio: fix file descriptor leak in multi-process applications X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2017 17:36:20 -0000 > > 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 Applied, thanks