[PATCH] D53789: [hwasan] optionally right-align heap allocations
Kostya Serebryany via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 7 14:20:21 PST 2018
kcc added a comment.
One more case: https://github.com/google/re2/blob/master/re2/dfa.cc#L758
Here, again, we have a 8-byte object accessed atomically
and the size of the allocation is not necessary divisible by 8 (68 in my this case)
const int kStateCacheOverhead = 40;
int nnext = prog_->bytemap_range() + 1; // + 1 for kByteEndText slot
int mem = sizeof(State) + nnext*sizeof(std::atomic<State*>) +
ninst*sizeof(int);
if (mem_budget_ < mem + kStateCacheOverhead) {
mem_budget_ = -1;
return NULL;
}
mem_budget_ -= mem + kStateCacheOverhead;
This particular case is easy to fix by aligning mem by sizeof(void*)
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D53789
More information about the llvm-commits
mailing list