OSDN Git Service

[ASan] Change fake stack and local variables handling.
authorAlexey Samsonov <vonosmas@gmail.com>
Thu, 11 Dec 2014 21:53:03 +0000 (21:53 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Thu, 11 Dec 2014 21:53:03 +0000 (21:53 +0000)
commit05e5839d4f31851387989cc9a182f9d19f02df25
treeebbb7fb8afe7f1fb20e6cd28511ebc962922153e
parentf88e4c8e9171045454b2c8e05054c2af8da3fe4f
[ASan] Change fake stack and local variables handling.

This commit changes the way we get fake stack from ASan runtime
(to find use-after-return errors) and the way we represent local
variables:
  - __asan_stack_malloc function now returns pointer to newly allocated
    fake stack frame, or NULL if frame cannot be allocated. It doesn't
    take pointer to real stack as an input argument, it is calculated
    inside the runtime.
  - __asan_stack_free function doesn't take pointer to real stack as
    an input argument. Now this function is never called if fake stack
    frame wasn't allocated.
  - __asan_init version is bumped to reflect changes in the ABI.
  - new flag "-asan-stack-dynamic-alloca" allows to store all the
    function local variables in a dynamic alloca, instead of the static
    one. It reduces the stack space usage in use-after-return mode
    (dynamic alloca will not be called if the local variables are stored
    in a fake stack), and improves the debug info quality for local
    variables (they will not be described relatively to %rbp/%rsp, which
    are assumed to be clobbered by function calls). This flag is turned
    off by default for now, but I plan to turn it on after more
    testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224062 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/AddressSanitizer.cpp
test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll [new file with mode: 0644]
test/Instrumentation/AddressSanitizer/stack_layout.ll