Patch Detail
Show a patch.
GET /api/1.1/patches/11892/?format=api
{ "id": 11892, "url": "https://patchwork.libcamera.org/api/1.1/patches/11892/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11892/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210412225948.13796-1-laurent.pinchart@ideasonboard.com>", "date": "2021-04-12T22:59:48", "name": "[libcamera-devel,PATCH/RFC] libcamera: bound_method: Please gcc undefined behaviour sanitizer", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "862c8d2e03a831e50b85146ff20857e40bdb8174", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": { "id": 14, "url": "https://patchwork.libcamera.org/api/1.1/users/14/?format=api", "username": "pinchartl", "first_name": "Laurent", "last_name": "Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/11892/mbox/", "series": [ { "id": 1913, "url": "https://patchwork.libcamera.org/api/1.1/series/1913/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1913", "date": "2021-04-12T22:59:48", "name": "[libcamera-devel,PATCH/RFC] libcamera: bound_method: Please gcc undefined behaviour sanitizer", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1913/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11892/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11892/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 6ADADBD1F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Apr 2021 23:00:43 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 244BF687EC;\n\tTue, 13 Apr 2021 01:00:43 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A4A7605AE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 01:00:42 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A1F746F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 01:00:40 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"fHub573R\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1618268440;\n\tbh=M86+T0Hyl2XeTFZPHn4XfxWMmYK5uDykONM7Gw1nOao=;\n\th=From:To:Subject:Date:From;\n\tb=fHub573R/EEXd2M+DZPY+ZnOuI9vMLs8l5z7frzPajuGHpdanJqOSFqNcmNSA1adB\n\tFIQb66ITzhVkCymgWouREYwBbWTiv3LQhOt17zrsyiaxmXoW4Nyj8hquWyLohWthgu\n\tePwjcZynoPSS7VsmiPIXvYV9PT/BHAE9oqkMEY6Y=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 13 Apr 2021 01:59:48 +0300", "Message-Id": "<20210412225948.13796-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.28.1", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH/RFC] libcamera: bound_method: Please gcc\n\tundefined behaviour sanitizer", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Enabling the gcc undefined behaviour sanitizer (with the meson configure\n-Db_sanitize=undefined option) causes many tests to fail, with errors\nsuch as the following (for test/object-invoke):\n\n../../include/libcamera/bound_method.h:198:27: runtime error: member access within address 0x55fcd7bfbd38 which does not point to an object of type 'BoundMethodBase'\n0x55fcd7bfbd38: note: object has invalid vptr\n fc 55 00 00 2a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 00 00 00 00 00 00 00 4b c6 72 88\n ^~~~~~~~~~~~~~~~~~~~~~~\n invalid vptr\n../../include/libcamera/bound_method.h:198:41: runtime error: member call on null pointer of type 'struct InvokedObject'\n../../include/libcamera/bound_method.h:198:41: runtime error: member access within null pointer of type 'struct InvokedObject'\nSegmentation fault\n\nThe root cause isn't clear, but this change fixes the issue. It may be a\nbug in gcc.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/bound_method.h | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\nIf anyone is interested in trying the gcc undefined behaviour sanitizer,\nthis patch is needed. Bonus points if you can spot why it helps.", "diff": "diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h\nindex f216e3b56826..de17fdee3612 100644\n--- a/include/libcamera/bound_method.h\n+++ b/include/libcamera/bound_method.h\n@@ -163,7 +163,8 @@ public:\n \n \tR invoke(Args... args) override\n \t{\n-\t\treturn (static_cast<T *>(this->obj_)->*func_)(args...);\n+\t\tT *obj = static_cast<T *>(this->obj_);\n+\t\treturn (obj->*func_)(args...);\n \t}\n \n private:\n@@ -195,7 +196,8 @@ public:\n \n \tvoid invoke(Args... args) override\n \t{\n-\t\t(static_cast<T *>(this->obj_)->*func_)(args...);\n+\t\tT *obj = static_cast<T *>(this->obj_);\n+\t\t(obj->*func_)(args...);\n \t}\n \n private:\n", "prefixes": [ "libcamera-devel", "PATCH/RFC" ] }