aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/secure_getenv.patch
blob: b28b77ef79d6b9787c8aaa503cd85223d0194ae9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff --git a/third_party/angle/src/vulkan_support/BUILD.gn b/third_party/angle/src/vulkan_support/BUILD.gn
index 51c8c10..fb70649 100644
--- third_party/angle/src/vulkan_support/BUILD.gn
+++ third_party/angle/src/vulkan_support/BUILD.gn
@@ -204,8 +204,8 @@ config("vulkan_loader_config") {
     cflags = [ "/wd4201" ]
   }
   if (is_linux) {
-    # assume secure_getenv() is available
-    defines += [ "HAVE_SECURE_GETENV" ]
+    # assume getauxval() is available
+    defines += [ "HAVE_GETAUXVAL" ]
   }
 }
 
diff --git a/third_party/vulkan-validation-layers/src/loader/loader.c b/third_party/vulkan-validation-layers/src/loader/loader.c
index facddc1..b6a8ee9 100644
--- third_party/vulkan-validation-layers/src/loader/loader.c
+++ third_party/vulkan-validation-layers/src/loader/loader.c
@@ -31,6 +31,9 @@
 #include <stdbool.h>
 #include <string.h>
 #include <stddef.h>
+#if defined(HAVE_GETAUXVAL)
+#include <sys/auxv.h>
+#endif
 
 #include <sys/types.h>
 #if defined(_WIN32)
@@ -218,6 +221,8 @@ static inline char *loader_secure_getenv(const char *name, const struct loader_i
     return secure_getenv(name);
 #elif defined(HAVE___SECURE_GETENV)
     return __secure_getenv(name);
+#elif defined(HAVE_GETAUXVAL)
+    return getauxval(AT_SECURE) ? NULL : getenv(name);
 #else
 #pragma message("Warning:  Falling back to non-secure getenv for environmental lookups!  Consider" \
                 " updating to a different libc.")