[HWASan] Use hwasan_memalign for aligned new.
authorMatt Morehouse <mascasa@google.com>
Mon, 7 Feb 2022 21:10:06 +0000 (13:10 -0800)
committerMatt Morehouse <mascasa@google.com>
Mon, 7 Feb 2022 21:10:16 +0000 (13:10 -0800)
commit4fb7c120fed504519d167c93ed9d920aeae46fb0
treeb99f370776c89a9ac9a6ecf2f43ea142bc0f3b7c
parented5b42b741881a0a94e65999f0c785ec53b46511
[HWASan] Use hwasan_memalign for aligned new.

Aligned new does not require size to be a multiple of alignment, so
memalign is the correct choice instead of aligned_alloc.

Fixes false reports for unaligned sizes.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D119161
compiler-rt/lib/hwasan/hwasan_new_delete.cpp
compiler-rt/test/hwasan/TestCases/new-test.cpp