[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
Fri Jan 24 16:06:05 PST 2025


================
@@ -460,6 +492,13 @@ static bool AsanInitInternal() {
   allocator_options.SetFrom(flags(), common_flags());
   InitializeAllocator(allocator_options);
 
+  // Apply ASan flags.
+  // NOTE: In order for options specified through `__asan_default_options` to be
+  // honored on Windows, it is necessary for those options to be configured
+  // inside the `ApplyOptions` method. See the function-level comment for
+  // `ApplyFlags` for more details.
+  ApplyFlags();
----------------
davidmrdavid wrote:

Possibly, but only if I also move the allocator initialization block:

https://github.com/llvm/llvm-project/blob/ba740aa73d052e7e68ccdea1d9531bc71eaad53c/compiler-rt/lib/asan/asan_rtl.cpp#L487-L489

Right below `AvoidCVE_2016_2143` as well.

`ApplyFlags` depends on the allocator machinery being initialized, so it has to happen after the fact. I sense it might be safer to keep it in it's current position, but I'm willing to move it if it seems like a non-problem to you.

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


More information about the llvm-commits mailing list