[scudo] Align objects with alignas
authorVitaly Buka <vitalybuka@google.com>
Tue, 4 May 2021 23:34:59 +0000 (16:34 -0700)
committerVitaly Buka <vitalybuka@google.com>
Wed, 5 May 2021 20:29:21 +0000 (13:29 -0700)
commit1d767b13bfad806bf584e0b054eb7d00a494591d
tree6b3bb4c49f8198839d3746a560d970459d46946c
parent9ea2db2c513534aa63acc087b8dc744c37119d02
[scudo] Align objects with alignas

Operator new must align allocations for types with large alignment.

Before c++17 behavior was implementation defined and both clang and gc++
before 11 ignored alignment. Miss-aligned objects mysteriously crashed
tests on Ubuntu 14.

Alternatives are compile with -std=c++17 or -faligned-new, but they were
discarded as less portable.

Reviewed By: hctim

Differential Revision: https://reviews.llvm.org/D101874
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
compiler-rt/lib/scudo/standalone/tests/primary_test.cpp