<div dir="ltr"><div dir="ltr">Hi Laurent, thank you for the patch.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 17, 2021 at 12:53 AM Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Android provides neither secure_getenv() nor issetugid(). Enable<br>
compilation on that platform by using a plain getenv(), as that seems to<br>
be the best we can do.<br>
<br>
Signed-off-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com" target="_blank">laurent.pinchart@ideasonboard.com</a>><br>
---<br>
meson.build | 4 ++++<br>
src/libcamera/utils.cpp | 7 ++++++-<br></blockquote><div><br></div><div>Reviewed-by: Hirokazu Honda <<a href="mailto:hiroh@chromium.org">hiroh@chromium.org</a>></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
2 files changed, 10 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/meson.build b/meson.build<br>
index f6ab7380f1a5..4d7d936f09e2 100644<br>
--- a/meson.build<br>
+++ b/meson.build<br>
@@ -33,6 +33,10 @@ if cc.has_header_symbol('execinfo.h', 'backtrace')<br>
config_h.set('HAVE_BACKTRACE', 1)<br>
endif<br>
<br>
+if cc.has_header_symbol('unistd.h', 'issetugid')<br>
+ config_h.set('HAVE_ISSETUGID', 1)<br>
+endif<br>
+<br>
if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOURCE')<br>
config_h.set('HAVE_SECURE_GETENV', 1)<br>
endif<br>
diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp<br>
index 24a5c9720fbe..ed7e0177ebe1 100644<br>
--- a/src/libcamera/utils.cpp<br>
+++ b/src/libcamera/utils.cpp<br>
@@ -61,6 +61,10 @@ const char *basename(const char *path)<br>
* avoid vulnerabilities that could occur if set-user-ID or set-group-ID<br>
* programs accidentally trust the environment.<br>
*<br>
+ * \note Not all platforms may support the features required to implement the<br>
+ * secure execution check, in which case this function behaves as getenv(). A<br>
+ * notable exception is Android.<br>
+ *<br>
* \return A pointer to the value in the environment or NULL if the requested<br>
* environment variable doesn't exist or if secure execution is required.<br>
*/<br>
@@ -69,9 +73,10 @@ char *secure_getenv(const char *name)<br>
#if HAVE_SECURE_GETENV<br>
return ::secure_getenv(name);<br>
#else<br>
+#if HAVE_ISSETUGID<br>
if (issetugid())<br>
return NULL;<br>
-<br>
+#endif<br>
return getenv(name);<br>
#endif<br>
}<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
<br>
</blockquote></div></div>