[sanitizer] Do not use the alignment-rounded-up size when using the secondary
authorKostya Kortchinsky <kostyak@google.com>
Thu, 8 Dec 2016 19:05:46 +0000 (19:05 +0000)
committerKostya Kortchinsky <kostyak@google.com>
Thu, 8 Dec 2016 19:05:46 +0000 (19:05 +0000)
commit2defe4d9a19d63f4aadfa4f7f379bfec50552921
treeb01a9ab9c14e26cfdeec8e675e98b9e5b15dc2fe
parent235c275b20d44e3aeb8bfe98dc34b2ead704bf32
[sanitizer] Do not use the alignment-rounded-up size when using the secondary

Summary:
The combined allocator rounds up the requested size with regard to the
alignment, which makes sense when being serviced by the primary as it comes
with alignment guarantees, but not with the secondary. For the rare case of
large alignments, it wastes memory, and entices unnecessarily large fields for
the Scudo header. With this patch, we pass the non-alignement-rounded-up size
to the secondary, and adapt the Scudo code for this change.

Reviewers: alekseyshl, kcc

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D27428

llvm-svn: 289088
compiler-rt/lib/sanitizer_common/sanitizer_allocator_combined.h
compiler-rt/lib/scudo/scudo_allocator_secondary.h
compiler-rt/lib/scudo/scudo_utils.cpp