[PATCH] D54045: Introduce `sanitizer_malloc_introspect_t` for Darwin which is a sub-class of Darwin's `malloc_introspection_t` and use it when setting up the malloc zone.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 5 13:44:35 PST 2018


delcypher added a comment.

@kubamracek

In https://reviews.llvm.org/D54045#1287762, @kubamracek wrote:

> Looks good. I assume the struct definition cannot be moved into the .inc file because we're going to need to access it from other places?


You raise a good point. Right now (in my fork of compiler-rt) the header file exists because in my fork ASan actually subclasses `sanitizer_malloc_introspection_t` so that it can add its own fields. Due to the way this is implemented it means`sanitizer_malloc_introspection_t` needs to be in its own header file. However, ASan's sub class of `sanitizer_malloc_introspection_t` actually **only contains two non-ASan specific fields (pointer to allocator and the size of the allocator)**. This means we could move those fields into `sanitizer_malloc_introspection_t` and remove the ASan specific sub class of `sanitizer_malloc_introspection_t`. If we do this we can move `sanitizer_malloc_introspection_t` into `sanitizer_common/sanitizer_malloc_mac.inc`. However we still need each sanitizer to initialise these fields because they could be different for each sanitizer. Right now initialising these fields is only important for ASan so for other sanitizers we could just leave these set to zero until we actually need to do something different.

What do you think?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54045





More information about the llvm-commits mailing list