[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)
commit4b7f413e3e96cb2c18d6ce3f869a8f4e2b86d061
tree969dffb078b7d5895696cfa77281983a9b96f463
parentd6f8e4b03cb1f33294cfa4da8d1def26ad884e15
[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.

llvm-svn: 224062
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
llvm/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll [new file with mode: 0644]
llvm/test/Instrumentation/AddressSanitizer/stack_layout.ll