[compiler-rt] r179286 - [asan] make heavy_uar_test a bit more heavy and fix he fake stack to pass this test

Alexey Samsonov samsonov at google.com
Thu Apr 11 08:01:29 PDT 2013


Our bots bark on this:
==2427==AddressSanitizer CHECK failed:
build/llvm/projects/compiler-rt/lib/asan/asan_fake_stack.h:46
"((n_frames_)) < ((kMaxNumberOfFrames))" (0x3ff, 0x3ff)



On Thu, Apr 11, 2013 at 6:07 PM, Kostya Serebryany <kcc at google.com> wrote:

> Author: kcc
> Date: Thu Apr 11 09:07:02 2013
> New Revision: 179286
>
> URL: http://llvm.org/viewvc/llvm-project?rev=179286&view=rev
> Log:
> [asan] make heavy_uar_test a bit more heavy and fix he fake stack to pass
> this test
>
> Modified:
>     compiler-rt/trunk/lib/asan/asan_fake_stack.h
>     compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc
>
> Modified: compiler-rt/trunk/lib/asan/asan_fake_stack.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_fake_stack.h?rev=179286&r1=179285&r2=179286&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/asan_fake_stack.h (original)
> +++ compiler-rt/trunk/lib/asan/asan_fake_stack.h Thu Apr 11 09:07:02 2013
> @@ -53,7 +53,7 @@ class FakeFrameLifo {
>    FakeFrame *top() {
>      if (n_frames_ == 0)
>        return 0;
> -    return frames_[n_frames_];
> +    return frames_[n_frames_ - 1];
>    }
>   private:
>    uptr n_frames_;
>
> Modified: compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc?rev=179286&r1=179285&r2=179286&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc (original)
> +++ compiler-rt/trunk/lib/asan/lit_tests/Linux/heavy_uar_test.cc Thu Apr
> 11 09:07:02 2013
> @@ -7,6 +7,7 @@
>
>  #include <stdio.h>
>  #include <string.h>
> +#include <stdlib.h>
>
>  __attribute__((noinline))
>  inline char *pretend_to_do_something(char *x) {
> @@ -24,7 +25,7 @@ char *LeakStack() {
>  __attribute__((noinline))
>  void RecuriveFunctionWithStackFrame(int depth) {
>    if (depth <= 0) return;
> -  char x[1000];
> +  char x[1024];
>    memset(x, 0, sizeof(x));
>    pretend_to_do_something(x);
>    RecuriveFunctionWithStackFrame(depth - 1);
> @@ -33,9 +34,11 @@ void RecuriveFunctionWithStackFrame(int
>
>  int main(int argc, char **argv) {
>    char *stale_stack = LeakStack();
> -  RecuriveFunctionWithStackFrame(10);
> -  RecuriveFunctionWithStackFrame(20);
> -  RecuriveFunctionWithStackFrame(30);
> +  int n_iter = argc >= 2 ? atoi(argv[1]) : 1000;
> +  int depth  = argc >= 3 ? atoi(argv[2]) : 1000;
> +  for (int i = 0; i < n_iter; i++) {
> +    RecuriveFunctionWithStackFrame(depth);
> +  }
>    stale_stack[100]++;
>    // CHECK: ERROR: AddressSanitizer: stack-use-after-return on address
>    // CHECK: is located in stack of thread T0 at offset 132 in frame
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130411/a3927e3a/attachment.html>


More information about the llvm-commits mailing list