forked from OSchip/llvm-project
[asan] Read extra flags from a system property on activation on Android.
llvm-svn: 200550
This commit is contained in:
parent
36b18dfe64
commit
01cd8ae204
|
@ -57,6 +57,8 @@ void AsanActivate() {
|
|||
common_flags()->malloc_context_size =
|
||||
asan_deactivated_flags.malloc_context_size;
|
||||
|
||||
ParseExtraActivationFlags();
|
||||
|
||||
asan_is_deactivated = false;
|
||||
VReport(
|
||||
1,
|
||||
|
|
|
@ -87,6 +87,8 @@ void PlatformTSDDtor(void *tsd);
|
|||
|
||||
void AppendToErrorMessageBuffer(const char *buffer);
|
||||
|
||||
void ParseExtraActivationFlags();
|
||||
|
||||
// Platfrom-specific options.
|
||||
#if SANITIZER_MAC
|
||||
bool PlatformHasDifferentMemcpyAndMemmove();
|
||||
|
|
|
@ -209,6 +209,17 @@ void InitializeFlags(Flags *f, const char *env) {
|
|||
}
|
||||
}
|
||||
|
||||
// Parse flags that may change between startup and activation.
|
||||
// On Android they come from a system property.
|
||||
// On other platforms this is no-op.
|
||||
void ParseExtraActivationFlags() {
|
||||
char buf[100];
|
||||
GetExtraActivationFlags(buf, sizeof(buf));
|
||||
ParseFlagsFromString(flags(), buf);
|
||||
if (buf[0] != '\0')
|
||||
VReport(1, "Extra activation flags: %s\n", buf);
|
||||
}
|
||||
|
||||
// -------------------------- Globals --------------------- {{{1
|
||||
int asan_inited;
|
||||
bool asan_init_is_running;
|
||||
|
@ -413,6 +424,10 @@ static void AsanInitInternal() {
|
|||
// initialization steps look at flags().
|
||||
const char *options = GetEnv("ASAN_OPTIONS");
|
||||
InitializeFlags(flags(), options);
|
||||
|
||||
if (!flags()->start_deactivated)
|
||||
ParseExtraActivationFlags();
|
||||
|
||||
__sanitizer_set_report_path(common_flags()->log_path);
|
||||
__asan_option_detect_stack_use_after_return =
|
||||
flags()->detect_stack_use_after_return;
|
||||
|
|
|
@ -506,8 +506,10 @@ F IndirectExternCall(F f) {
|
|||
|
||||
#if SANITIZER_ANDROID
|
||||
void AndroidLogWrite(const char *buffer);
|
||||
void GetExtraActivationFlags(char *buf, uptr size);
|
||||
#else
|
||||
INLINE void AndroidLogWrite(const char *buffer_unused) {}
|
||||
INLINE void GetExtraActivationFlags(char *buf, uptr size) { *buf = '\0'; }
|
||||
#endif
|
||||
} // namespace __sanitizer
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
#if SANITIZER_ANDROID
|
||||
#include <android/log.h>
|
||||
#include <sys/system_properties.h>
|
||||
#endif
|
||||
|
||||
// <linux/time.h>
|
||||
|
@ -697,6 +698,11 @@ uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg,
|
|||
void AndroidLogWrite(const char *buffer) {
|
||||
__android_log_write(ANDROID_LOG_INFO, NULL, buffer);
|
||||
}
|
||||
|
||||
void GetExtraActivationFlags(char *buf, uptr size) {
|
||||
CHECK(size > PROP_VALUE_MAX);
|
||||
__system_property_get("asan.options", buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool IsDeadlySignal(int signum) {
|
||||
|
|
Loading…
Reference in New Issue