From patchwork Wed Jun 5 07:50:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20201 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4332EBDE6B for ; Wed, 5 Jun 2024 07:51:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DD1026543E; Wed, 5 Jun 2024 09:51:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cZXJvsYp"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CFE04634B5 for ; Wed, 5 Jun 2024 09:51:13 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6E356BEB; Wed, 5 Jun 2024 09:51:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1717573865; bh=/+cvgCiQUzbgcWnh8tv6g3xWIFQolJwST+CZL24vp00=; h=From:To:Cc:Subject:Date:From; b=cZXJvsYpU1uSsA+uJ2fTA9bHH5mzgUFG9q7g8wEuohbD7mHvoQzvuKqt9EKWx5xbI 8zr1A2IQQcesnQUmlelvNe5y3JVe78jaSFBQ2VNJlL6YuQ6/gzdCoctqwEeqgpXJGv MUyDoUxUPFGWGScpLX6ndsiAPITpEjzTivpnRqXc= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Hans de Goede Subject: [PATCH] libcamera: dma_buf_allocator: Create memfd with CLOEXEC Date: Wed, 5 Jun 2024 10:50:55 +0300 Message-ID: <20240605075055.18039-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Ensure that the memfd file descriptor won't be leaked to child processes by creating it with MFD_CLOEXEC. Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") Signed-off-by: Laurent Pinchart Reviewed-by: Hans de Goede Reviewed-by: Kieran Bingham --- src/libcamera/dma_buf_allocator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 98071d3109c131820439f61d9380c0bd4cd2119a diff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp index 5ae517210adf..5ec29949c66a 100644 --- a/src/libcamera/dma_buf_allocator.cpp +++ b/src/libcamera/dma_buf_allocator.cpp @@ -132,7 +132,7 @@ UniqueFD DmaBufAllocator::allocFromUDmaBuf(const char *name, std::size_t size) std::size_t pageMask = sysconf(_SC_PAGESIZE) - 1; size = (size + pageMask) & ~pageMask; - int ret = memfd_create(name, MFD_ALLOW_SEALING); + int ret = memfd_create(name, MFD_ALLOW_SEALING | MFD_CLOEXEC); if (ret < 0) { ret = errno; LOG(DmaBufAllocator, Error)