[compiler-rt] [ASan][Windows] Honor asan config flags on windows when set through the user function (PR #122990)

David Justo via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 16:05:21 PST 2025


================
@@ -390,17 +390,57 @@ void PrintAddressSpaceLayout() {
           kHighShadowBeg > kMidMemEnd);
 }
 
+// Apply most options specified either through the ASAN_OPTIONS
----------------
davidmrdavid wrote:

I investigate this even more - when an `.exe` is compiled _without_ `fsanitize=address` and brings in ASan through a dynamic dll load operation (i.e `LoadLibrary(...some asanized dll)`), the mechanisms to register weak functions on Windows don't run (it appears those are configured to run during CRT initialization iff the executable was compiled with `fsanitize=address`).

This is a long way of saying that, in this niche scenario (executable not compiled with `fsanitize`), the `__asan_default_options` user function is not registered, and so any flags set through there will _definitely_ not be parsed. Again, this is a pre-existing gap, so this PR isn't making things worse in that regard.

This wasn't obvious to me before, so my apologies if this seemed obvious. In any case, this is just to say that I think we shouldn't have to worry about whether this PR handles the case where the process starts with ASan starts deactivated.

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


More information about the llvm-commits mailing list