forked from OSchip/llvm-project
[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:
parent
e0fde5c6d0
commit
b99d6c8b2a
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue