commit | 00f59067541ec2a497d37fd7338c8f87856f6035 | [log] [tgz] |
---|---|---|
author | Kalesh Singh <kaleshsingh@google.com> | Wed Aug 23 13:59:53 2023 -0700 |
committer | Kalesh Singh <kaleshsingh@google.com> | Wed Aug 23 13:59:57 2023 -0700 |
tree | ecf33465fd4bbfc9d44097bf6a01a06bdf56384d | |
parent | e219a4179fa58d4b553910ca26ed85b7d2f59461 [diff] [blame] |
bionic: CFIShadow: Remove use of PAGE_SIZE macro. The alignment of kShadowSize to a page sized multiple is not explicitly needed, since mmap() will return a page-sized multiple mapping. kCfiCheckAlign remains 4k as this is chosen by the clang compiler. [1] [2] [1] https://github.com/llvm/llvm-project/blob/3568976375e305a7a41d62b9164ede7571ee16c5/clang/lib/CodeGen/CGExpr.cpp#L3433 [2] https://clang.llvm.org/docs/ControlFlowIntegrityDesign.html#cfi-shadow Bug: 296275298 Test: Boot 16kb device, check no cfi failures. Test: atest -c bionic-unit-tests Change-Id: Iac0c129c413afe01389f529f5c64051c4ffff2df Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
diff --git a/libc/private/CFIShadow.h b/libc/private/CFIShadow.h index ec87e3c..cbdf0f7 100644 --- a/libc/private/CFIShadow.h +++ b/libc/private/CFIShadow.h
@@ -68,8 +68,7 @@ #endif // Shadow is 2 -> 2**kShadowGranularity. - static constexpr uintptr_t kShadowSize = - align_up((kMaxTargetAddr >> (kShadowGranularity - 1)), PAGE_SIZE); + static constexpr uintptr_t kShadowSize = kMaxTargetAddr >> (kShadowGranularity - 1); // Returns offset inside the shadow region for an address. static constexpr uintptr_t MemToShadowOffset(uintptr_t x) {