[{"id":2298,"web_url":"https://patchwork.libcamera.org/comment/2298/","msgid":"<9664a9c0-75a4-5bdc-9900-ccae770906c7@ideasonboard.com>","date":"2019-07-19T11:51:54","subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn 19/07/2019 09:05, Jacopo Mondi wrote:\n> Add an error debug message when disassociating part of a process\n> execution context using unshare fails.\n> \n> As this is currently used to isolate a child process which is\n> immediately terminated silently if unshare fails, add a debug printout\n> and propagate up the error code to make the failure more visible.\n> \n\nThis sounds good to me.\n\nHave you added this because it has happened to you ?\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/process.cpp | 10 +++++++++-\n>  1 file changed, 9 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp\n> index 6c41da219f05..ab716a9cd57f 100644\n> --- a/src/libcamera/process.cpp\n> +++ b/src/libcamera/process.cpp\n> @@ -306,7 +306,15 @@ void Process::closeAllFdsExcept(const std::vector<int> &fds)\n> \n>  int Process::isolate()\n>  {\n> -\treturn unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> +\tint ret = unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> +\tif (ret) {\n> +\t\tret = -errno;\n> +\t\tLOG(Process, Error) << \"Failed to unshare execution context: \"\n> +\t\t\t\t    << strerror(-ret);\n> +\t\treturn ret;\n> +\t}\n> +\n> +\treturn 0;\n>  }\n> \n>  /**\n> --\n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel\n>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1ABFD60E3B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 19 Jul 2019 13:51:58 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 73D94CC;\n\tFri, 19 Jul 2019 13:51:57 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1563537117;\n\tbh=ThTLvJ8LK6QenLH31X7kOoFxK6vOp7hpb5nyvNL50Po=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=ivdOHi+R9ILProak+sZc6e/uysq0IK2YknYcgvB/AJuwfXZOW/Dztsvx54LfvPgu2\n\t/avIiAWU+YPX2OoTMHjlNILzHKbAVTfCvST9o25R6SwWlnV/FuuN+RXTSOr+ad9bPE\n\tmb2GGt6RhNFcX4szPhxUu0v44NOCuGWmuzrI2I4c=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","References":"<20190719080556.26785-1-jacopo@jmondi.org>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB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1yYRAAq+Yo\n\tnbf9DGdK1kTAm2RTFg+w9oOp2Xjqfhds2PAhFFvrHQg1XfQR/UF/SjeUmaOmLSczM0s6XMeO\n\tVcE77UFtJ/+hLo4PRFKm5X1Pcar6g5m4xGqa+Xfzi9tRkwC29KMCoQOag1BhHChgqYaUH3yo\n\tUzaPwT/fY75iVI+yD0ih/e6j8qYvP8pvGwMQfrmN9YB0zB39YzCSdaUaNrWGD3iCBxg6lwSO\n\tLKeRhxxfiXCIYEf3vwOsP3YMx2JkD5doseXmWBGW1U0T/oJF+DVfKB6mv5UfsTzpVhJRgee7\n\t4jkjqFq4qsUGxcvF2xtRkfHFpZDbRgRlVmiWkqDkT4qMA+4q1y/dWwshSKi/uwVZNycuLsz+\n\t+OD8xPNCsMTqeUkAKfbD8xW4LCay3r/dD2ckoxRxtMD9eOAyu5wYzo/ydIPTh1QEj9SYyvp8\n\tO0g6CpxEwyHUQtF5oh15O018z3ZLztFJKR3RD42VKVsrnNDKnoY0f4U0z7eJv2NeF8xHMuiU\n\tRCIzqxX1GVYaNkKTnb/Qja8hnYnkUzY1Lc+OtwiGmXTwYsPZjjAaDX35J/RSKAoy5wGo/YFA\n\tJxB1gWThL4kOTbsqqXj9GLcyOImkW0lJGGR3o/fV91Zh63S5TKnf2YGGGzxki+ADdxVQAm+Q\n\tsbsRB8KNNvVXBOVNwko86rQqF9drZuw=","Organization":"Ideas on Board","Message-ID":"<9664a9c0-75a4-5bdc-9900-ccae770906c7@ideasonboard.com>","Date":"Fri, 19 Jul 2019 12:51:54 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.7.2","MIME-Version":"1.0","In-Reply-To":"<20190719080556.26785-1-jacopo@jmondi.org>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","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":"Fri, 19 Jul 2019 11:51:58 -0000"}},{"id":2299,"web_url":"https://patchwork.libcamera.org/comment/2299/","msgid":"<20190720130724.GC1679@wyvern>","date":"2019-07-20T13:07:24","subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-07-19 10:05:56 +0200, Jacopo Mondi wrote:\n> Add an error debug message when disassociating part of a process\n> execution context using unshare fails.\n> \n> As this is currently used to isolate a child process which is\n> immediately terminated silently if unshare fails, add a debug printout\n> and propagate up the error code to make the failure more visible.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/process.cpp | 10 +++++++++-\n>  1 file changed, 9 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp\n> index 6c41da219f05..ab716a9cd57f 100644\n> --- a/src/libcamera/process.cpp\n> +++ b/src/libcamera/process.cpp\n> @@ -306,7 +306,15 @@ void Process::closeAllFdsExcept(const std::vector<int> &fds)\n> \n>  int Process::isolate()\n>  {\n> -\treturn unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> +\tint ret = unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> +\tif (ret) {\n> +\t\tret = -errno;\n> +\t\tLOG(Process, Error) << \"Failed to unshare execution context: \"\n> +\t\t\t\t    << strerror(-ret);\n> +\t\treturn ret;\n> +\t}\n> +\n> +\treturn 0;\n>  }\n> \n>  /**\n> --\n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-pg1-x542.google.com (mail-pg1-x542.google.com\n\t[IPv6:2607:f8b0:4864:20::542])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8590360C00\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Jul 2019 15:07:29 +0200 (CEST)","by mail-pg1-x542.google.com with SMTP id l21so15636714pgm.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Jul 2019 06:07:29 -0700 (PDT)","from localhost (M106185144154.v4.enabler.ne.jp. [106.185.144.154])\n\tby smtp.gmail.com with ESMTPSA id\n\te11sm41430741pfm.35.2019.07.20.06.07.26\n\t(version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);\n\tSat, 20 Jul 2019 06:07:26 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=higlLl7rvaZ+wGm0z5IHlEMlLY7/SGyQbSmD+LyvmW0=;\n\tb=N6LOw9iK16mNFw4R7+fjRt1bJAQLVKubWi3tk+k+cbS6SEILJ4aD0Et5IAkkzYInbX\n\t6VK9mo7bPmjVOGKefIvFdX3GY8liePXFYjO9jXZ2Yq7hrWkTw/lHJvT6NOlNqz5UyaUI\n\twqUyZ/Wj39ZAf/9Ncmo/CVV6M+yJzbvK8v4f/AnEFf6eT8wJsnC9DYPOceFNgVRAqO5t\n\tJKRrxdg0T+SGjB3ca9KFrAMmoOQOles2T/YDHQBmI170mbjPnQfZ28yxRCgNIIl/oDjR\n\t/AWZ62+FlWFU8bA962Cm4Hu3XZoU4bnzxjaY6rt3xFQyFqEGIhPg+CMSF0kebn6eP7OH\n\tLR6Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=higlLl7rvaZ+wGm0z5IHlEMlLY7/SGyQbSmD+LyvmW0=;\n\tb=HVxdo6Bj2dGb+p6IGn+x/W7jIJpU8o+Ljp6r4t5y6KNeURpm1DsWnhoGOxDVsjVP15\n\t3zPnLBISY0c/ijxznUFKjk57W32o0LzUDP6A9UQ0bAqp7xO3DyiZ2P8ysUzdzqI+IV/B\n\tF5eXyyuoRDtiLWVoAZkzB0uLN2+33o7Ucnca4JIhfi36qUcDzaSdkLbKpgrLKG+Y8Sez\n\tlICJBJULysQ9+yLO+DVt1EQoNFyFw1LOiZBGR90Z+D3WigQxqwGWn2o2Ln+eTjDg9Ysu\n\tZgLCEfR7/ddT3veEV9vRW5fPF1VuoJOCyl0tpRF2b2qq3EuvvQQF/nU13ZAJOGuTZrkZ\n\tHU8w==","X-Gm-Message-State":"APjAAAX153ce13kF38TFGtLhBlG97vNhc9bKF1FllJfIbLkO2njhMGJS\n\ty7DCUQf/+HeMZg0QJSxq89SLBDiF9gZdAJw5","X-Google-Smtp-Source":"APXvYqyMCMnbvzndin3nT2bRt7unYgETuK3q1KbtoTuDxFglf7uAnDrSzhRIqA/prOkGlkQycwo7eg==","X-Received":"by 2002:a17:90a:d58c:: with SMTP id\n\tv12mr62890844pju.7.1563628047717; \n\tSat, 20 Jul 2019 06:07:27 -0700 (PDT)","Date":"Sat, 20 Jul 2019 22:07:24 +0900","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190720130724.GC1679@wyvern>","References":"<20190719080556.26785-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190719080556.26785-1-jacopo@jmondi.org>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","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":"Sat, 20 Jul 2019 13:07:29 -0000"}},{"id":2304,"web_url":"https://patchwork.libcamera.org/comment/2304/","msgid":"<20190725083858.GB16970@localhost.localdomain>","date":"2019-07-25T08:38:58","subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Fri, Jul 19, 2019 at 10:05:56AM +0200, Jacopo Mondi wrote:\n> Add an error debug message when disassociating part of a process\n> execution context using unshare fails.\n> \n> As this is currently used to isolate a child process which is\n> immediately terminated silently if unshare fails, add a debug printout\n> and propagate up the error code to make the failure more visible.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nLooks good to me.\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/libcamera/process.cpp | 10 +++++++++-\n>  1 file changed, 9 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp\n> index 6c41da219f05..ab716a9cd57f 100644\n> --- a/src/libcamera/process.cpp\n> +++ b/src/libcamera/process.cpp\n> @@ -306,7 +306,15 @@ void Process::closeAllFdsExcept(const std::vector<int> &fds)\n> \n>  int Process::isolate()\n>  {\n> -\treturn unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> +\tint ret = unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> +\tif (ret) {\n> +\t\tret = -errno;\n> +\t\tLOG(Process, Error) << \"Failed to unshare execution context: \"\n> +\t\t\t\t    << strerror(-ret);\n> +\t\treturn ret;\n> +\t}\n> +\n> +\treturn 0;\n>  }\n> \n>  /**\n> --\n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 1318060BD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Jul 2019 10:39:07 +0200 (CEST)","from localhost.localdomain\n\t(p1836225-ipngn13901hodogaya.kanagawa.ocn.ne.jp [153.220.52.225])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 402152E7;\n\tThu, 25 Jul 2019 10:39:04 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1564043946;\n\tbh=gbnN/bJjA9ucP5mOeDCkhq9e1TpKq/Pru3P8As7qiek=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JrjbFp5+ycxisqsBFbV2wZ+bADMCPckx5NVBJvRaDUMtJ8W+15LHJnP9YR4RPntHN\n\tiMFb4E9DTh5cFPlmMz1PockhMoq5W65hmEq9WVkglhTsTfH0Av2TUOz6WmzV8pR8BL\n\t/n8/jhBXbPu7GA/leURD5V0gtAiUj1gnW6hgV+rM=","Date":"Thu, 25 Jul 2019 17:38:58 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190725083858.GB16970@localhost.localdomain>","References":"<20190719080556.26785-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20190719080556.26785-1-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","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, 25 Jul 2019 08:39:07 -0000"}},{"id":2306,"web_url":"https://patchwork.libcamera.org/comment/2306/","msgid":"<20190730041300.GD4852@pendragon.ideasonboard.com>","date":"2019-07-30T04:13:00","subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Fri, Jul 19, 2019 at 10:05:56AM +0200, Jacopo Mondi wrote:\n> Add an error debug message when disassociating part of a process\n> execution context using unshare fails.\n> \n> As this is currently used to isolate a child process which is\n> immediately terminated silently if unshare fails, add a debug printout\n> and propagate up the error code to make the failure more visible.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/process.cpp | 10 +++++++++-\n>  1 file changed, 9 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp\n> index 6c41da219f05..ab716a9cd57f 100644\n> --- a/src/libcamera/process.cpp\n> +++ b/src/libcamera/process.cpp\n> @@ -306,7 +306,15 @@ void Process::closeAllFdsExcept(const std::vector<int> &fds)\n> \n>  int Process::isolate()\n>  {\n> -\treturn unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> +\tint ret = unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> +\tif (ret) {\n> +\t\tret = -errno;\n> +\t\tLOG(Process, Error) << \"Failed to unshare execution context: \"\n> +\t\t\t\t    << strerror(-ret);\n> +\t\treturn ret;\n> +\t}\n> +\n> +\treturn 0;\n>  }\n\nI wonder if we shouldn't add the error message in the caller instead, as\nthe isolate() method is expected to grow, but for now this should be\ngood enough and can be changed later if needed.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nPlease push :-)\n\n> \n>  /**","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D2334615A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Jul 2019 06:13:07 +0200 (CEST)","from pendragon.ideasonboard.com (om126208166005.22.openmobile.ne.jp\n\t[126.208.166.5])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1A849CC;\n\tTue, 30 Jul 2019 06:13:05 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1564459987;\n\tbh=bUzaNevFy3kGK7r+0OaadIknnN1Vr+PomVFtgu5aCzg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=q2o/sgVULs0WyQDiKhyfGWWKVlJd4L3UaJYt9cNGpQ4CeG4KT6UOUdqqvTBs3GafN\n\tOgX8PcN7r1JZRDZlOqi6OFjm2Dx+1EzicUz6G7NDt4FQawaO9WqbISZa5RoZ7SmjnZ\n\tGVPtMki7Z5H5cJ0vAMt45cRdU5H6u/qU8HXckORU=","Date":"Tue, 30 Jul 2019 07:13:00 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190730041300.GD4852@pendragon.ideasonboard.com>","References":"<20190719080556.26785-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190719080556.26785-1-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","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":"Tue, 30 Jul 2019 04:13:08 -0000"}},{"id":2309,"web_url":"https://patchwork.libcamera.org/comment/2309/","msgid":"<20190731132919.kjjr2zt5bafv5moz@uno.localdomain>","date":"2019-07-31T13:29:19","subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Kieran,\n\nOn Fri, Jul 19, 2019 at 12:51:54PM +0100, Kieran Bingham wrote:\n> Hi Jacopo,\n>\n> On 19/07/2019 09:05, Jacopo Mondi wrote:\n> > Add an error debug message when disassociating part of a process\n> > execution context using unshare fails.\n> >\n> > As this is currently used to isolate a child process which is\n> > immediately terminated silently if unshare fails, add a debug printout\n> > and propagate up the error code to make the failure more visible.\n> >\n>\n> This sounds good to me.\n>\n> Have you added this because it has happened to you ?\n\nYes, isolate() fails on my device with -EPERM...\nThe only explanation I have is that CLONE_NEWUSER and CLONE_NEWNET\nboth requires CAP_SYS_ADMIN capability. I've just superficially looked\ninto this, but the printout helped me understand what was happening.\n\nThanks\n  j\n\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/process.cpp | 10 +++++++++-\n> >  1 file changed, 9 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp\n> > index 6c41da219f05..ab716a9cd57f 100644\n> > --- a/src/libcamera/process.cpp\n> > +++ b/src/libcamera/process.cpp\n> > @@ -306,7 +306,15 @@ void Process::closeAllFdsExcept(const std::vector<int> &fds)\n> >\n> >  int Process::isolate()\n> >  {\n> > -\treturn unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> > +\tint ret = unshare(CLONE_NEWUSER | CLONE_NEWNET);\n> > +\tif (ret) {\n> > +\t\tret = -errno;\n> > +\t\tLOG(Process, Error) << \"Failed to unshare execution context: \"\n> > +\t\t\t\t    << strerror(-ret);\n> > +\t\treturn ret;\n> > +\t}\n> > +\n> > +\treturn 0;\n> >  }\n> >\n> >  /**\n> > --\n> > 2.21.0\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel\n> >\n>\n> --\n> Regards\n> --\n> Kieran","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BB8D360E38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 31 Jul 2019 15:27:57 +0200 (CEST)","from uno.localdomain\n\t(host211-19-dynamic.58-82-r.retail.telecomitalia.it [82.58.19.211])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id C52381BF203;\n\tWed, 31 Jul 2019 13:27:56 +0000 (UTC)"],"X-Originating-IP":"82.58.19.211","Date":"Wed, 31 Jul 2019 15:29:19 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190731132919.kjjr2zt5bafv5moz@uno.localdomain>","References":"<20190719080556.26785-1-jacopo@jmondi.org>\n\t<9664a9c0-75a4-5bdc-9900-ccae770906c7@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"oq5n7fd26du4nryw\"","Content-Disposition":"inline","In-Reply-To":"<9664a9c0-75a4-5bdc-9900-ccae770906c7@ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH] libcamera: process: Fail loudly on\n\tisolate","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":"Wed, 31 Jul 2019 13:27:57 -0000"}}]