[PATCH] libcamera: dma_buf_allocator: Create memfd with CLOEXEC
Hans de Goede
hdegoede at redhat.com
Wed Jun 5 10:04:29 CEST 2024
Hi,
On 6/5/24 9:50 AM, Laurent Pinchart wrote:
> 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 <laurent.pinchart at ideasonboard.com>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede at redhat.com>
Regards,
Hans
> ---
> src/libcamera/dma_buf_allocator.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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)
>
> base-commit: 98071d3109c131820439f61d9380c0bd4cd2119a
More information about the libcamera-devel
mailing list