Show a patch.

GET /api/patches/18605/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18605,
    "url": "https://patchwork.libcamera.org/api/patches/18605/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18605/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20230505161843.25545-1-mail@eliasnaur.com>",
    "date": "2023-05-05T16:18:43",
    "name": "[libcamera-devel,v3] libcamera: v4l2_videodevice: Use O_CLOEXEC when exporting DMA buffers",
    "commit_ref": "4c71ec00c2ea5c6acc75e436bf6d24e6861cb66f",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7ba14f4d137fb685b307d66b163459e06cd35a8e",
    "submitter": {
        "id": 159,
        "url": "https://patchwork.libcamera.org/api/people/159/?format=api",
        "name": "Elias Naur",
        "email": "mail@eliasnaur.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18605/mbox/",
    "series": [
        {
            "id": 3867,
            "url": "https://patchwork.libcamera.org/api/series/3867/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3867",
            "date": "2023-05-05T16:18:43",
            "name": "[libcamera-devel,v3] libcamera: v4l2_videodevice: Use O_CLOEXEC when exporting DMA buffers",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/3867/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18605/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18605/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 56AB9BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 May 2023 16:18:54 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD0AA633B5;\n\tFri,  5 May 2023 18:18:53 +0200 (CEST)",
            "from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com\n\t[IPv6:2607:f8b0:4864:20::e31])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 91851627DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 May 2023 18:18:52 +0200 (CEST)",
            "by mail-vs1-xe31.google.com with SMTP id\n\tada2fe7eead31-43483520faaso247773137.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 05 May 2023 09:18:52 -0700 (PDT)",
            "from localhost.localdomain ([190.53.13.8])\n\tby smtp.gmail.com with ESMTPSA id\n\te2-20020ab01102000000b0076ea015dd34sm323303uab.13.2023.05.05.09.18.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 05 May 2023 09:18:50 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1683303533;\n\tbh=L8hY8KfX/qMibdOoUxWMbJ6nUM/V73unTyh0WiCXZuE=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=BxT+Z0ecow3GIhBHzDwbseM4Fh2XAV8JaW0G6Lu50K7BC3dRvQt+z19nTWoghg+48\n\tJHbcmS8+85r6iGZEIrDLfeK1Ipn6VJycgqsJ8MIvhMZ6UElIPNK2LjGHUm6zVyjPx8\n\tpx3GWDge1lGTDxUXPSr0x9anQuLuAeIxYouduWSmTWihdBTxUxnCZRTqemtYXakgqY\n\tdkIVw6Tj4rkD5qP+EIvmQcft9t+psWzf5wJK4lfqc/YlxpjT2uvzdOT4j3aDuInxqq\n\totA4SdKgAEg+cydFSl3bYWQHViUlFelhrXExfiYnWGQXcS5Cy0MHRwHkkhjVDrK0WY\n\t+x6CqS+qWvA4Q==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=eliasnaur.com; s=google; t=1683303531; x=1685895531;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=Xp2rABvHpmpB1uL0IV5ZRuGGNGvedXtVvn03fu959CE=;\n\tb=F+vyfO0nzxgqKZnoj8ap45EZbdgQ4XAb7KMEuRRvoYnMdWUbWy7oy2S4Nez3fVITO+\n\tJFKcqipda37ph5k6Ak/tdoP+DvK/Ca6j5p9pJoBV4YBYBBxTaawDsxSc+9BdZB/k7S1d\n\trVO+ON/obMANAAMbtmMFHMLGvDg+d8cKYRGqA5ItP/JMLKCBtlb0ausOYUQh9GfAWjFy\n\tVZ2dRYqm0QYFYLW8Zq85rf9BUMD+1Y+UCk/MSlQ0RZdEcC/fQSrXhzQHj8yP6ZtmCIOx\n\tueJbv5o34iSjGCo5jXeD+Jp9CK8VV4JZnuCVOXiGNVAAIYWTBnnz5GLVTZ+ZpuRGmtaD\n\ttHGw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=eliasnaur.com\n\theader.i=@eliasnaur.com\n\theader.b=\"F+vyfO0n\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1683303531; x=1685895531;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=Xp2rABvHpmpB1uL0IV5ZRuGGNGvedXtVvn03fu959CE=;\n\tb=grORbF6pUyi7emKk8NBPSGt8qfAewxeahzIwlqtDshNfgfl496h1FR1vXfP9mpjx36\n\tqOfWQtggmhcGUAbLwIGqjTZYKdqLCtPrdyJGWYkNJA3/iU9xL4jCDTtFks37pm1q9xuZ\n\to6S3vuMQkHctrWI8V0tHCi2B7ARCSbVbNDyOxKdTOmQMHBQ3UqfWORoena2n7rSKrn1c\n\t+AyfVVRoE1w1Z36qg7+zul+Ptg7ydJrwwVdFQZFsPJym6WzBfJt6DZMk385DZYqI3qU5\n\tNU1V8papm5rAqFJOutSxSnj0KOAQtbM7m9yGVvZ4cYDNIwaMhjhJUAunegxFxlvYJdK4\n\tR1UQ==",
        "X-Gm-Message-State": "AC+VfDyK4mBi7RCzOTkEMdDUEZsp0qW5fA6QLGx8Y4hLEalqIjekuT1i\n\tGWRMfaAE7TvkDP6LNJMnFsQA62wSAUwGRH+BBtI=",
        "X-Google-Smtp-Source": "ACHHUZ474XVYpv6OKxCU1uJLSUAtZ1TDWZCcT2vWbyNTT4WbjsB61rlWCckcTbxLhCzevx/1LhGdag==",
        "X-Received": "by 2002:a05:6102:199:b0:42c:624c:147c with SMTP id\n\tr25-20020a056102019900b0042c624c147cmr812321vsq.7.1683303531245; \n\tFri, 05 May 2023 09:18:51 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  5 May 2023 10:18:43 -0600",
        "Message-Id": "<20230505161843.25545-1-mail@eliasnaur.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3] libcamera: v4l2_videodevice: Use\n\tO_CLOEXEC when exporting DMA buffers",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "From": "Elias Naur via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Elias Naur <mail@eliasnaur.com>",
        "Cc": "Elias Naur <mail@eliasnaur.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Files opened internally in libcamera without the O_CLOEXEC file will\nremain open upon a call to one of the exec(3) functions. As exec()\ndoesn't destroy local or global objects, this can lead to various side\neffects. Avoid this by opening file descriptors with O_CLOEXEC for all\ninternal files.\n\nThe O_CLOEXEC flag should also be set when obtaining file handles from\nthe V4L2 VIDIOC_EXPBUF operation, but was missed during the updates to\nboth d942bdc913c5 (\"libcamera: v4l2_device: openat(2) with O_CLOEXEC to\ncleanup after exec(3)\") and 436b38fd89fe (\"libcamera: Open files with\nO_CLOEXEC\").\n\nSet the O_CLOEXEC flag on calls to ioctl(VIDIOC_EXPBUF).\n\nFixes: 436b38fd89fe (\"libcamera: Open files with O_CLOEXEC\")\nSigned-off-by: Elias Naur <mail@eliasnaur.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n\nAdded Laurent's Reviewed-by that I missed.\n\n src/libcamera/v4l2_videodevice.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 1051997e..a72ef64d 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1471,7 +1471,7 @@ UniqueFD V4L2VideoDevice::exportDmabufFd(unsigned int index,\n \texpbuf.type = bufferType_;\n \texpbuf.index = index;\n \texpbuf.plane = plane;\n-\texpbuf.flags = O_RDWR;\n+\texpbuf.flags = O_CLOEXEC | O_RDWR;\n \n \tret = ioctl(VIDIOC_EXPBUF, &expbuf);\n \tif (ret < 0) {\n",
    "prefixes": [
        "libcamera-devel",
        "v3"
    ]
}