Open Bug 1576213 Opened 5 years ago Updated 2 years ago

Default asan options do not affect Android.

Categories

(Core :: mozglue, defect, P3)

Unspecified
Android
defect

Tracking

()

People

(Reporter: truber, Unassigned)

References

Details

We set a number of default options for Asan in mozglue/build/AsanOptions.cpp. These don't have any effect on Android.

In bug 1482167 I have added fast_unwind_on_check=1:fast_unwind_on_fatal=1, which are necessary to get a full backtrace on Android, but unless they are also added to ASAN_OPTIONS in the environment, the backtrace is truncated (meaning __asan_default_options() has no effect).

NI to froydnj since he probably has some context here. It looks like __asan_default_options is "magic" in the sense that it's a special symbol that the ASAN libraries know about, and that suggests that something is wrong with the build itself or the library interpolation. Nathan, any thoughts?

Flags: needinfo?(nfroyd)

I'm not entirely sure how __asan_default_options gets interposed, though looking through compiler-rt source code, it seems like the magic should Just Work, as __asan_default_options is a weak function.

So, to verify:

  1. mozglue/build/AsanOptions.o (or whatever unified file it is contained in) contains the __asan_default_options symbol.
  2. Whatever mozglue gets linked into has the __asan_default_options symbol.

If those turn out OK, my only thought is that at the point asan initializes, we don't have the necessary bits loaded to ensure that asan sees the __asan_default_options symbol. I don't know when asan initializes on Android, but probably before we even have libxul or mozglue loaded? I'd try to do some debugging as to when asan gets turned on, and that would tell us approximately where we need to ensure that __asan_default_options is seen. Poke at what chromium does if debugging doesn't look palatable?

Flags: needinfo?(nfroyd)

Yes, the mozglue contains a global __asan_default_options and libclang_rt.asan-x86_64-android.so contains a weak __asan_default_options. Asan is probably loaded with LD_PRELOAD when ART is launched, so I think you're right.

Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.