[compiler-rt] r280875 - [asan] Add openlog() on Android.
Evgeniy Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 7 15:56:02 PDT 2016
Author: eugenis
Date: Wed Sep 7 17:56:02 2016
New Revision: 280875
URL: http://llvm.org/viewvc/llvm-project?rev=280875&view=rev
Log:
[asan] Add openlog() on Android.
Normally, syslog() uses argv[0] for the log tag; bionic, however,
would crash in syslog() before libc constructor unless the log
tag is explicitly set with openlog().
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc?rev=280875&r1=280874&r2=280875&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc Wed Sep 7 17:56:02 2016
@@ -47,12 +47,11 @@
#if SANITIZER_ANDROID
#include <android/api-level.h>
+#include <syslog.h>
#endif
#if SANITIZER_ANDROID && __ANDROID_API__ < 21
#include <android/log.h>
-#else
-#include <syslog.h>
#endif
#if !SANITIZER_ANDROID
@@ -521,6 +520,7 @@ uptr GetRSS() {
static atomic_uint8_t android_log_initialized;
void AndroidLogInit() {
+ openlog(GetProcessName(), 0, LOG_USER);
atomic_store(&android_log_initialized, 1, memory_order_release);
}
More information about the llvm-commits
mailing list