{"id":1665,"url":"https://patchwork.libcamera.org/api/patches/1665/?format=json","web_url":"https://patchwork.libcamera.org/patch/1665/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190711185047.11671-7-paul.elder@ideasonboard.com>","date":"2019-07-11T18:50:45","name":"[libcamera-devel,v4,6/8] libcamera: ipa_manager: use proxy","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"2417cfc81cec8a2c181e10a40274ef7e9da38b9b","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1665/mbox/","series":[{"id":420,"url":"https://patchwork.libcamera.org/api/series/420/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=420","date":"2019-07-11T18:50:39","name":"Add IPA process isolation","version":4,"mbox":"https://patchwork.libcamera.org/series/420/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1665/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1665/checks/","tags":{},"headers":{"Return-Path":"<paul.elder@ideasonboard.com>","Received":["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 CCE8A6157A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Jul 2019 20:51:15 +0200 (CEST)","from neptunite.amanokami.net (softbank126163157105.bbtec.net\n\t[126.163.157.105])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 701C531C;\n\tThu, 11 Jul 2019 20:51:14 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562871075;\n\tbh=asMxJuYS3eRmMn+bPArvHQyqlmibUefl73Gg935Uxzw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=eyRvtw8Az4XNU8j95Lqci5JhReIkrVv+rS5m7qv0jeXXadQanx3DTxrnpdXsY66tf\n\twwnPQTmyEGrx1vqGnkZrJoN742m42fCr1JW6tGYM99R3kjN20gTPGZvSndbCGO4WQX\n\t/bayCd/TCEmgU8IsAn2J0FnkEsjYDPXo3PeVu9OU=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 12 Jul 2019 03:50:45 +0900","Message-Id":"<20190711185047.11671-7-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190711185047.11671-1-paul.elder@ideasonboard.com>","References":"<20190711185047.11671-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 6/8] libcamera: ipa_manager: use proxy","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Thu, 11 Jul 2019 18:51:16 -0000"},"content":"Make IPAManager isolate an IPA in a Proxy if the IPA's license is not\nopen source, before returning the IPA to the caller. For now, only use\nthe default Linux IPA proxy, and only LGPL 2.1+ is considered open\nsource.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nChanges in v4:\n- move IPAModule open source verification to IPAModule::isOpenSource()\n\nChanges in v3:\n- license checking is done with SPDX license strings, and only LGPL 2.1+\n  is accepted for now\n\nNew in v2\n- replaces adding shims\n- since Proxies are not external shared objects like the shims in v1\n  were, there is no longer a list of shims that is treated like\n  IPAModules\n- instead the matching is done by searching the list of proxy factories\n\n src/libcamera/ipa_manager.cpp | 34 ++++++++++++++++++++++++++++++++--\n 1 file changed, 32 insertions(+), 2 deletions(-)","diff":"diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex 532b77d..4276d99 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -12,6 +12,7 @@\n #include <sys/types.h>\n \n #include \"ipa_module.h\"\n+#include \"ipa_proxy.h\"\n #include \"log.h\"\n #include \"pipeline_handler.h\"\n #include \"utils.h\"\n@@ -129,7 +130,7 @@ int IPAManager::addDir(const char *libDir)\n  * \\param[in] maxVersion Maximum acceptable version of IPA module\n  *\n  * \\return A newly created IPA interface, or nullptr if no matching\n- * IPA module is found\n+ * IPA module is found or if the IPA interface fails to initialize\n  */\n std::unique_ptr<IPAInterface> IPAManager::createIPA(PipelineHandler *pipe,\n \t\t\t\t\t\t    uint32_t maxVersion,\n@@ -144,7 +145,36 @@ std::unique_ptr<IPAInterface> IPAManager::createIPA(PipelineHandler *pipe,\n \t\t}\n \t}\n \n-\tif (!m || !m->load())\n+\tif (!m)\n+\t\treturn nullptr;\n+\n+\tif (!m->isOpenSource()) {\n+\t\tIPAProxyFactory *pf = nullptr;\n+\t\tstd::vector<IPAProxyFactory *> &factories = IPAProxyFactory::factories();\n+\n+\t\tfor (IPAProxyFactory *factory : factories) {\n+\t\t\t/* TODO: Better matching */\n+\t\t\tif (!strcmp(factory->name().c_str(), \"IPAProxyLinux\")) {\n+\t\t\t\tpf = factory;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (!pf) {\n+\t\t\tLOG(IPAManager, Error) << \"Failed to get proxy factory\";\n+\t\t\treturn nullptr;\n+\t\t}\n+\n+\t\tstd::unique_ptr<IPAProxy> proxy = pf->create(m);\n+\t\tif (!proxy->isValid()) {\n+\t\t\tLOG(IPAManager, Error) << \"Failed to load proxy\";\n+\t\t\treturn nullptr;\n+\t\t}\n+\n+\t\treturn proxy;\n+\t}\n+\n+\tif (!m->load())\n \t\treturn nullptr;\n \n \treturn m->createInstance();\n","prefixes":["libcamera-devel","v4","6/8"]}