Improve alloca() memory safety

Now that all the bugs have been wormed out of the ASAN memory module we
can successfully check for underruns on large stack allocations.
This commit is contained in:
Justine Tunney 2022-04-01 22:44:43 -07:00
parent 1ff1854107
commit 38cb6e71ca
4 changed files with 10 additions and 13 deletions

View file

@ -1240,8 +1240,7 @@ void __asan_unpoison_stack_memory(uintptr_t addr, size_t size) {
}
void __asan_alloca_poison(uintptr_t addr, size_t size) {
/* TODO(jart): Make sense of this function. */
/* __asan_poison(addr - 32, 32, kAsanAllocaUnderrun); */
__asan_poison(addr - 32, 32, kAsanAllocaUnderrun);
__asan_poison(ROUNDUP(addr + size, 32), 32, kAsanAllocaOverrun);
__asan_unpoison(addr, ROUNDUP(addr + size, 32) - (addr + size) + 32 + size);
}