[cfi] Fix shadow sanity check.

The current check may break if the starting address in fill_shadow is
not page-aligned.

llvm-svn: 255725
This commit is contained in:
Evgeniy Stepanov 2015-12-16 00:18:04 +00:00
parent e0fde5c6d0
commit b99d6c8b2a
1 changed files with 5 additions and 4 deletions

View File

@ -88,11 +88,12 @@ static void fill_shadow(uptr begin, uptr end, uptr cfi_check) {
*s = sv;
// Sanity checks.
for (; p < end; p += kShadowAlign) {
assert((uptr)ShadowValue::load(p).get_cfi_check() == cfi_check);
assert((uptr)ShadowValue::load(p + kShadowAlign / 2).get_cfi_check() ==
uptr q = p & ~(kShadowAlign - 1);
for (; q < end; q += kShadowAlign) {
assert((uptr)ShadowValue::load(q).get_cfi_check() == cfi_check);
assert((uptr)ShadowValue::load(q + kShadowAlign / 2).get_cfi_check() ==
cfi_check);
assert((uptr)ShadowValue::load(p + kShadowAlign - 1).get_cfi_check() ==
assert((uptr)ShadowValue::load(q + kShadowAlign - 1).get_cfi_check() ==
cfi_check);
}
}