[{"id":18994,"web_url":"https://patchwork.libcamera.org/comment/18994/","msgid":"<YSGjPOouvDa1+UsV@pendragon.ideasonboard.com>","date":"2021-08-22T01:07:08","subject":"Re: [libcamera-devel] [PATCH v2] test: gstreamer: Disable gstreamer\n\tregistry forks","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Vedant,\n\nThank you for the patch.\n\nLooks like you've found an answer to the question you asked on my review\nof v1 :-)\n\nOn Sat, Aug 21, 2021 at 08:11:45PM +0530, Vedant Paranjape wrote:\n> ASan needs to be loaded first before gstreamer is loaded. This was not\n> possible, so verify_asan_link_order was disabled. Better way to tackle\n> this issue was disabling forks on the gstreamer side.\n> \n> verify_asan_link_order=0 disables the check on ASan side which checks if\n> ASan was loaded before any other DLLs. Since, gstreamer spawns a child\n\ns/DLLs/shared objects/ as we're on Linux, no Windows :-)\n\n> helper process while building the registry, we needed to disable this\n> check. But with gst_registry_fork_set_enabled() it is possible to\n> disable spawning this child helper process, so this ensures that ASan is\n> loaded before any other DLL is loaded.\n> \n> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> ---\n>  test/gstreamer/gstreamer_single_stream_test.cpp | 17 ++++++-----------\n>  1 file changed, 6 insertions(+), 11 deletions(-)\n> \n> diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp\n> index 349dcfa4..80e652eb 100644\n> --- a/test/gstreamer/gstreamer_single_stream_test.cpp\n> +++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n> @@ -41,18 +41,13 @@ protected:\n\nThe comment starts with \"GStreamer by spawns a process ...\". Now that we\nknow this can be changed with gst_registry_fork_set_enabled(), I think\nthis should be changed to \"GStreamer by default spawns a process ...\".\n\n>  \t\t * GStreamer is most likely not, this will cause the ASan link\n>  \t\t * order check to fail when gst-plugin-scanner dlopen()s the\n>  \t\t * plugin as many libraries will have already been loaded by\n> -\t\t * then. Work around this issue by disabling the link order\n> -\t\t * check. This will only affect child processes, as ASan is\n> -\t\t * already loaded for this process by the time this code is\n> -\t\t * executed, and should thus hopefully be safe.\n> -\t\t *\n> -\t\t * This option is not available in gcc older than 8, the only\n> -\t\t * option in that case is to skip the test.\n> +\t\t * then. Work around this issue by disabling spawning of a\n> +\t\t * child helper process when rebuilding the registry. This will\n\nHow about \"when scanning the build directory for plugins\" instead of\n\"when rebuilding the registry\", as the problems occurs when\ngst_registry_scan_path() is called ?\n\n> +\t\t * only affect child processes, as ASan is already loaded for\n> +\t\t * this process by the time this code is executed, and should\n> +\t\t * thus hopefully be safe.\n\nI think the last sentence can be dropped. I wrote it to document that\nverify_asan_link_order=0 didn't disable the check for the current\nprocess, which isn't a concern anymore as we don't disable the check\nnow.\n\nIf you're fine with those changes, I can update the patch when pushing,\nthere's no need to send a v3.\n\n>  \t\t */\n> -#if defined(__SANITIZE_ADDRESS__) && !defined(__clang__) && __GNUC__ < 8\n> -\t\treturn TestSkip;\n> -#endif\n> -\t\tsetenv(\"ASAN_OPTIONS\", \"verify_asan_link_order=0\", 1);\n> +\t\tgst_registry_fork_set_enabled(false);\n>  \n>  \t\t/* Initialize GStreamer */\n>  \t\tg_autoptr(GError) errInit = NULL;","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 B71BCBD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 22 Aug 2021 01:07:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 16B8D68893;\n\tSun, 22 Aug 2021 03:07:20 +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 DA432605A9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 22 Aug 2021 03:07:17 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4F41F8F;\n\tSun, 22 Aug 2021 03:07:17 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"hnIoJ8g9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1629594437;\n\tbh=ycOWTyJ/Eo2Nqt/MILynX0DRNh56YroA7w8L93f3Gdw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hnIoJ8g9IUwmt2AlxGMlGx50hi+b/NleJtU1lSstmdMaV+IckUfTi4q7+R09BZLZn\n\t9DewRCrqLxAD7RoQymWd/D4oN4L//ngUNeqWd8gfSmjdQstKDPbztcvWY1GUWGkeAp\n\tJq8nkaLYFfsXWgkj7/PPHS8HQeGjqZhNVAhz+sSY=","Date":"Sun, 22 Aug 2021 04:07:08 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Message-ID":"<YSGjPOouvDa1+UsV@pendragon.ideasonboard.com>","References":"<20210821144145.3077223-1-vedantparanjape160201@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210821144145.3077223-1-vedantparanjape160201@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2] test: gstreamer: Disable gstreamer\n\tregistry forks","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18995,"web_url":"https://patchwork.libcamera.org/comment/18995/","msgid":"<CACGrz-NchfVUDzGKbCvRJHQAxr-6AEuQpdBe_oqPWyWSwB7Rfw@mail.gmail.com>","date":"2021-08-22T03:14:28","subject":"Re: [libcamera-devel] [PATCH v2] test: gstreamer: Disable gstreamer\n\tregistry forks","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/people/85/","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"content":"Hi Laurent,\nThanks for the feedback.\n\n\nOn Sun, 22 Aug, 2021, 06:37 Laurent Pinchart, <\nlaurent.pinchart@ideasonboard.com> wrote:\n\n> Hi Vedant,\n>\n> Thank you for the patch.\n>\n> Looks like you've found an answer to the question you asked on my review\n> of v1 :-)\n>\n> On Sat, Aug 21, 2021 at 08:11:45PM +0530, Vedant Paranjape wrote:\n> > ASan needs to be loaded first before gstreamer is loaded. This was not\n> > possible, so verify_asan_link_order was disabled. Better way to tackle\n> > this issue was disabling forks on the gstreamer side.\n> >\n> > verify_asan_link_order=0 disables the check on ASan side which checks if\n> > ASan was loaded before any other DLLs. Since, gstreamer spawns a child\n>\n> s/DLLs/shared objects/ as we're on Linux, no Windows :-)\n>\n\nOops 😅\n\n> helper process while building the registry, we needed to disable this\n> > check. But with gst_registry_fork_set_enabled() it is possible to\n> > disable spawning this child helper process, so this ensures that ASan is\n> > loaded before any other DLL is loaded.\n> >\n> > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > ---\n> >  test/gstreamer/gstreamer_single_stream_test.cpp | 17 ++++++-----------\n> >  1 file changed, 6 insertions(+), 11 deletions(-)\n> >\n> > diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp\n> b/test/gstreamer/gstreamer_single_stream_test.cpp\n> > index 349dcfa4..80e652eb 100644\n> > --- a/test/gstreamer/gstreamer_single_stream_test.cpp\n> > +++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n> > @@ -41,18 +41,13 @@ protected:\n>\n> The comment starts with \"GStreamer by spawns a process ...\". Now that we\n> know this can be changed with gst_registry_fork_set_enabled(), I think\n> this should be changed to \"GStreamer by default spawns a process ...\".\n>\n> >                * GStreamer is most likely not, this will cause the ASan\n> link\n> >                * order check to fail when gst-plugin-scanner dlopen()s\n> the\n> >                * plugin as many libraries will have already been loaded\n> by\n> > -              * then. Work around this issue by disabling the link order\n> > -              * check. This will only affect child processes, as ASan is\n> > -              * already loaded for this process by the time this code is\n> > -              * executed, and should thus hopefully be safe.\n> > -              *\n> > -              * This option is not available in gcc older than 8, the\n> only\n> > -              * option in that case is to skip the test.\n> > +              * then. Work around this issue by disabling spawning of a\n> > +              * child helper process when rebuilding the registry. This\n> will\n>\n> How about \"when scanning the build directory for plugins\" instead of\n> \"when rebuilding the registry\", as the problems occurs when\n> gst_registry_scan_path() is called ?\n>\n> > +              * only affect child processes, as ASan is already loaded\n> for\n> > +              * this process by the time this code is executed, and\n> should\n> > +              * thus hopefully be safe.\n>\n> I think the last sentence can be dropped. I wrote it to document that\n> verify_asan_link_order=0 didn't disable the check for the current\n> process, which isn't a concern anymore as we don't disable the check\n> now.\n>\n> If you're fine with those changes, I can update the patch when pushing,\n> there's no need to send a v3.\n>\n\nYes I am mostly fine with the changes.\n\n>                */\n> > -#if defined(__SANITIZE_ADDRESS__) && !defined(__clang__) && __GNUC__ < 8\n> > -             return TestSkip;\n> > -#endif\n> > -             setenv(\"ASAN_OPTIONS\", \"verify_asan_link_order=0\", 1);\n> > +             gst_registry_fork_set_enabled(false);\n> >\n> >               /* Initialize GStreamer */\n> >               g_autoptr(GError) errInit = NULL;\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n\n\n>\nRegards\nVedant Paranjape","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 ADDF8BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 22 Aug 2021 03:14:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 02B6268895;\n\tSun, 22 Aug 2021 05:14:42 +0200 (CEST)","from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com\n\t[IPv6:2607:f8b0:4864:20::b33])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 607DA6025A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 22 Aug 2021 05:14:40 +0200 (CEST)","by mail-yb1-xb33.google.com with SMTP id g26so26956137ybe.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Aug 2021 20:14:40 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"j1KbgZKO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=q3r/c8uJhQb0scL6QnqvpIctfpxPh2nAGWlKxjaeUa8=;\n\tb=j1KbgZKOBKrSfdPvav73HR8XpZi030NHgM17VXk+y3momTbrIN9Xzw5KmVSLa6LlVh\n\thJ3gTrDBnxVhp3n3xSiXE9LDnzc3TBzqBqAPndwc6ZrT3aSdj2VXxu39LpD2FpHoXHq/\n\tqiN5BOoTC/BSZR3eFlHkO8QZUslPI7DuJE2ihfGNin34VSeg/WCAPsFzCT2JOlYVSCax\n\tASzG0ZDdPfhGVZQBjtQ3uTcgacjfkaDeLd+ecbjc9PUdgNIA08xmi7WhNuGkDxvhDMSa\n\tqFnV3Wwe6iAVEUca7VzIjhHfje76Y+ETZCZEltqM0T7MJqhoYlIvlDbU0M8wrN40s2O5\n\tOEqA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=q3r/c8uJhQb0scL6QnqvpIctfpxPh2nAGWlKxjaeUa8=;\n\tb=p3IgWNkXM/LSq82jnLF6VS6trcbZgDcPAEMPzg5IkncMnlKs+P9Wae6lfJxeD1I6y1\n\tHLwY2gkjqc9vvY3U+lFawwPdBuhUOK5PPSq4C7H9Uuqdi7HvrzL7u5DZPu6gqmTcge8s\n\tnAmRoY8xMe8/YgY0QY13boJsQDl9oA1smFTEvP4sXmVqSrmwxfMSDYDfr5HD9gwaAKgl\n\t2IzeETzFEhUNrkDux0VZqF4N8skUBtywiO+y9Kd3dqenefgK3F4AuitFfEx0B4UitWCs\n\tALjKEmcuuUj3CTTIdfrKF6L7qGwDn7+KOLkYdNIPmlTOtfsucr2rafIdIo7huL5gLKNO\n\tndtQ==","X-Gm-Message-State":"AOAM5315FxOC6qTBRSg3DlvQSM4uWAChHbvSiV4DZ1vbvcfPQV6aIBTe\n\teN1kBc1jzBm/iNgafzr/P5dncCi4kNapDFprmSo=","X-Google-Smtp-Source":"ABdhPJzdl6cVhLgh0X1xyukoOdsGA/a8aZ10hkHWf6iELiNKtEWXWGnfOo8t93izvAtty/2mUwARq6bkORQT6Ss16Bc=","X-Received":"by 2002:a25:c9c5:: with SMTP id\n\tz188mr35783862ybf.223.1629602078858; \n\tSat, 21 Aug 2021 20:14:38 -0700 (PDT)","MIME-Version":"1.0","References":"<20210821144145.3077223-1-vedantparanjape160201@gmail.com>\n\t<YSGjPOouvDa1+UsV@pendragon.ideasonboard.com>","In-Reply-To":"<YSGjPOouvDa1+UsV@pendragon.ideasonboard.com>","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Date":"Sun, 22 Aug 2021 08:44:28 +0530","Message-ID":"<CACGrz-NchfVUDzGKbCvRJHQAxr-6AEuQpdBe_oqPWyWSwB7Rfw@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"multipart/alternative; boundary=\"0000000000000921bd05ca1d4d71\"","Subject":"Re: [libcamera-devel] [PATCH v2] test: gstreamer: Disable gstreamer\n\tregistry forks","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]