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

via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 14:20:17 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 1b58940c88edaad9320bd21eaa7da65f7e791552 eabfad12703841b83b60e2c8e3df201457f479b2 -- compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
index bb70143329..3bccd42b3b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
@@ -20,11 +20,12 @@
 #include "sanitizer_common.h"
 #include "sanitizer_file.h"
 
-#if SANITIZER_LINUX || (SANITIZER_ANDROID && __ANDROID_API__ >= 18)
-// Android API as per https://developer.android.com/ndk/guides/cpu-features#features_using_libcs_getauxval3
-#  include <sys/auxv.h>
-#  define HAS_GETAUXVAL
-#endif
+#  if SANITIZER_LINUX || (SANITIZER_ANDROID && __ANDROID_API__ >= 18)
+// Android API as per
+// https://developer.android.com/ndk/guides/cpu-features#features_using_libcs_getauxval3
+#    include <sys/auxv.h>
+#    define HAS_GETAUXVAL
+#  endif
 
 #  include "sanitizer_interface_internal.h"
 
@@ -111,7 +112,7 @@ void ReportFile::SetReportPath(const char *path) {
     }
   }
 
-#ifdef HAS_GETAUXVAL
+#  ifdef HAS_GETAUXVAL
   if (getauxval(AT_SECURE) != 0 && path &&
       internal_strcmp(path, "stderr") != 0 &&
       internal_strcmp(path, "stdout") != 0) {
@@ -121,7 +122,7 @@ void ReportFile::SetReportPath(const char *path) {
         path);
     Die();
   }
-#endif
+#  endif
 
   SpinMutexLock l(mu);
   if (fd != kStdoutFd && fd != kStderrFd && fd != kInvalidFd)

``````````

</details>


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


More information about the llvm-commits mailing list