From: Evgeniy Stepanov Date: Sat, 3 Feb 2018 01:06:21 +0000 (+0000) Subject: [hwasan] Add a paragraph on stack instrumentation. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2c8a84180c1274baff0cde2d19938d7a6c84a25;p=clang [hwasan] Add a paragraph on stack instrumentation. Reviewers: kcc Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42874 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324163 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/HardwareAssistedAddressSanitizerDesign.rst b/docs/HardwareAssistedAddressSanitizerDesign.rst index 5904cceaea..423ec6f889 100644 --- a/docs/HardwareAssistedAddressSanitizerDesign.rst +++ b/docs/HardwareAssistedAddressSanitizerDesign.rst @@ -77,11 +77,18 @@ This can be based on any malloc that forces all objects to be N-aligned. Stack ----- -Special compiler instrumentation is required to align the local variables -by N, tag the memory and the pointers. +Stack frames are instrumented by aligning all non-promotable allocas +by `N` and tagging stack memory in function prologue and epilogue. + +Tags for different allocas in one function are **not** generated +independently; doing that in a function with `M` allocas would require +maintaining `M` live stack pointers, significantly increasing register +pressure. Instead we generate a single base tag value in the prologue, +and build the tag for alloca number `M` as `ReTag(BaseTag, M)`, where +ReTag can be as simple as exclusive-or with constant `M`. + Stack instrumentation is expected to be a major source of overhead, but could be optional. -TODO: details. Globals -------