[PATCH] D62927: [sanitizers][windows] Rtl-Heap Interception and tests

Matthew G McGovern via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 13:47:29 PDT 2019


mcgov added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_malloc_win.cc:218
+    CHECK(dwFlags == 0 && "unsupported heap flags");
+  }
+  GET_CURRENT_PC_BP_SP;
----------------
vitalybuka wrote:
> mcgov wrote:
> > vitalybuka wrote:
> > > I'd expect this check is needed unconditionally, we can get to asan_malloc_usable_size even "if-then" about was executed.
> > Oh good point, I'll check assertions again file-wide.
> this is marked as done, but I don't see a difference.
> 
> I expected something like:
> ```
> if (flags()->windows_hook_rtl_allocators) {
>   ...
>   REAL...
> }
> CHECK(dwFlags == 0 && "unsupported heap flags");
> ```
> 
> without else
Right, I don't think this is actually the behavior that's needed though. It's the same reason as in HeapFree, when the RTL interception is turned on the check for incomaptible flags occurs only on (re)allocation. If the user is trying to pass unsupported flags to Size or Free for an allocation that's owned by the ASAN allocator we still want that size or free to come back to the user code, reguardless of where it lives. It's a weird situation that comes from juggling the original and asan allocator.


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62927/new/

https://reviews.llvm.org/D62927





More information about the llvm-commits mailing list