[compiler-rt] [sanitizer] Disable writes to log files for binaries in a secure context. (PR #92593)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 14:00:20 PDT 2024


================
@@ -518,6 +522,15 @@ bool IsStateDetached(int state) {
   return state == PTHREAD_CREATE_DETACHED;
 }
 
+bool ShouldTreatRuntimeSecurely() {
+#  if SANITIZER_LINUX
+  // So we can use weak reference from sanitizer_getauxval.h
+  if (&getauxval)
+    return getauxval(/* AT_SECURE */ 23) != 0;
+#  endif
+  return getuid() != geteuid() || getgid() != getegid();
----------------
fmayer wrote:

This is for older versions of glibc that don't have getauxval, or other posix OS that don't have it.

https://github.com/llvm/llvm-project/pull/92593


More information about the llvm-commits mailing list