[compiler-rt] r279108 - [asan] Add one more test for __asan_set_shadow_*

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 14:08:46 PDT 2016


Disabled in r279318

On Fri, Aug 19, 2016 at 1:45 PM Kostya Serebryany <kcc at google.com> wrote:

> this test fails on the windows bot, please fix.
>
> http://lab.llvm.org:8011/builders/sanitizer-windows/builds/27672/steps/run%20tests/logs/stdio
>
> Exit Code: 1
>
> Command Output (stdout):
> --
> $ "C:/b/slave/sanitizer-windows/build/./bin/clang.exe" "-fsanitize=address" "-mno-omit-leaf-frame-pointer" "-fno-omit-frame-pointer" "-fno-optimize-sibling-calls" "-gline-tables-only" "-gcodeview" "-fms-compatibility-version=18.00.31101" "-shared-libasan" "-O0" "C:\b\slave\sanitizer-windows\llvm\projects\compiler-rt\test\asan\TestCases\set_shadow_test.c" "-o" "C:\b\slave\sanitizer-windows\build\projects\compiler-rt\test\asan\I386WindowsDynamicConfig\TestCases\Output\set_shadow_test.c.tmp"
> # command output:
>    Creating library C:\b\slave\sanitizer-windows\build\projects\compiler-rt\test\asan\I386WindowsDynamicConfig\TestCases\Output\set_shadow_test.c.lib and object C:\b\slave\sanitizer-windows\build\projects\compiler-rt\test\asan\I386WindowsDynamicConfig\TestCases\Output\set_shadow_test.c.exp
>
>
> $ "C:\b\slave\sanitizer-windows\build\projects\compiler-rt\test\asan\I386WindowsDynamicConfig\TestCases\Output\set_shadow_test.c.tmp" "0x00"
> $ "FileCheck" "C:\b\slave\sanitizer-windows\llvm\projects\compiler-rt\test\asan\TestCases\set_shadow_test.c" "-check-prefix=X00"
> $ "not" "C:\b\slave\sanitizer-windows\build\projects\compiler-rt\test\asan\I386WindowsDynamicConfig\TestCases\Output\set_shadow_test.c.tmp" "0xf1"
> note: command had no output on stdout or stderr
> error: command failed with exit status: 1
> $ "FileCheck" "C:\b\slave\sanitizer-windows\llvm\projects\compiler-rt\test\asan\TestCases\set_shadow_test.c" "-check-prefix=XF1"
> # command stderr:
> C:\b\slave\sanitizer-windows\llvm\projects\compiler-rt\test\asan\TestCases\set_shadow_test.c:35:10: error: expected string not found in input
>
>  // XF1: AddressSanitizer: stack-buffer-underflow
>
>          ^
>
> <stdin>:1:1: note: scanning from here
>
> PASS
>
> ^
>
> <stdin>:1:2: note: possible intended match here
>
> PASS
>
>  ^
>
>
> error: command failed with exit status: 1
>
>
>
> On Thu, Aug 18, 2016 at 11:15 AM, Vitaly Buka via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: vitalybuka
>> Date: Thu Aug 18 13:15:15 2016
>> New Revision: 279108
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=279108&view=rev
>> Log:
>> [asan] Add one more test for __asan_set_shadow_*
>>
>> Reviewers: eugenis, filcab
>>
>> Subscribers: llvm-commits, kubabrecka
>>
>> Differential Revision: https://reviews.llvm.org/D23676
>>
>> Added:
>>     compiler-rt/trunk/test/asan/TestCases/set_shadow_test.c
>>
>> Added: compiler-rt/trunk/test/asan/TestCases/set_shadow_test.c
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/set_shadow_test.c?rev=279108&view=auto
>>
>> ==============================================================================
>> --- compiler-rt/trunk/test/asan/TestCases/set_shadow_test.c (added)
>> +++ compiler-rt/trunk/test/asan/TestCases/set_shadow_test.c Thu Aug 18
>> 13:15:15 2016
>> @@ -0,0 +1,67 @@
>> +// RUN: %clang_asan -O0 %s -o %t
>> +// RUN: %run %t 0x00 2>&1 | FileCheck %s -check-prefix=X00
>> +// RUN: not %run %t 0xf1 2>&1 | FileCheck %s -check-prefix=XF1
>> +// RUN: not %run %t 0xf2 2>&1 | FileCheck %s -check-prefix=XF2
>> +// RUN: not %run %t 0xf3 2>&1 | FileCheck %s -check-prefix=XF3
>> +// RUN: not %run %t 0xf5 2>&1 | FileCheck %s -check-prefix=XF5
>> +// RUN: not %run %t 0xf8 2>&1 | FileCheck %s -check-prefix=XF8
>> +
>> +#include <assert.h>
>> +#include <sanitizer/asan_interface.h>
>> +#include <stddef.h>
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +
>> +void __asan_set_shadow_00(size_t addr, size_t size);
>> +void __asan_set_shadow_f1(size_t addr, size_t size);
>> +void __asan_set_shadow_f2(size_t addr, size_t size);
>> +void __asan_set_shadow_f3(size_t addr, size_t size);
>> +void __asan_set_shadow_f5(size_t addr, size_t size);
>> +void __asan_set_shadow_f8(size_t addr, size_t size);
>> +
>> +char a __attribute__((aligned(8)));
>> +
>> +void f(long arg) {
>> +  size_t shadow_offset;
>> +  size_t shadow_scale;
>> +  __asan_get_shadow_mapping(&shadow_scale, &shadow_offset);
>> +  size_t addr = (((size_t)&a) >> shadow_scale) + shadow_offset;
>> +
>> +  switch (arg) {
>> +  // X00-NOT: AddressSanitizer
>> +  // X00: PASS
>> +  case 0x00:
>> +    return __asan_set_shadow_00(addr, 1);
>> +  // XF1: AddressSanitizer: stack-buffer-underflow
>> +  // XF1: [f1]
>> +  case 0xf1:
>> +    return __asan_set_shadow_f1(addr, 1);
>> +  // XF2: AddressSanitizer: stack-buffer-overflow
>> +  // XF2: [f2]
>> +  case 0xf2:
>> +    return __asan_set_shadow_f2(addr, 1);
>> +  // XF3: AddressSanitizer: stack-buffer-overflow
>> +  // XF3: [f3]
>> +  case 0xf3:
>> +    return __asan_set_shadow_f3(addr, 1);
>> +  // XF5: AddressSanitizer: stack-use-after-return
>> +  // XF5: [f5]
>> +  case 0xf5:
>> +    return __asan_set_shadow_f5(addr, 1);
>> +  // XF8: AddressSanitizer: stack-use-after-scope
>> +  // XF8: [f8]
>> +  case 0xf8:
>> +    return __asan_set_shadow_f8(addr, 1);
>> +  }
>> +  assert(0);
>> +}
>> +
>> +int main(int argc, char **argv) {
>> +  assert(argc > 1);
>> +
>> +  long arg = strtol(argv[1], 0, 16);
>> +  f(arg);
>> +  a = 1;
>> +  printf("PASS\n");
>> +  return 0;
>> +}
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160819/cefda760/attachment-0001.html>


More information about the llvm-commits mailing list