[PATCH] Implement variable-sized alloca instrumentation (take 2).
tetra2005 at gmail.com
Thu Feb 19 21:23:53 PST 2015
> I did not give much thought to dynamic allocas, but what if we simply replace them with run-time calls somehow?
We could hide Max's linked lists behind an internal API, something like
// Poison redzones and store metadata for new_alloca
void asan_poison_alloca(uptr new_alloca, uptr size, uptr prev_alloca);
// Unpoison all allocas below bound
uptr asan_unpoison_allocas(uptr prev_alloca, uptr bound);
The ugly bound parameter is necessary to model the equally ugly alloca/VLA interwork. From https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html :
If you use both variable-length arrays and alloca in the same function, deallocation of a variable-length array also deallocates anything more recently allocated with alloca.
More information about the llvm-commits