diff options
| author | Kostya Serebryany <kcc@google.com> | 2018-10-23 00:50:40 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2018-10-23 00:50:40 +0000 |
| commit | af95597c3c9ecf18a9e66e6a403daf6dc3dd597f (patch) | |
| tree | 788c11dd2645ffa523611aa3d77d0788bd9cc170 /llvm/test | |
| parent | 9d7de097d4f89912e01032bd619b8a8e97cb9376 (diff) | |
| download | bcm5719-llvm-af95597c3c9ecf18a9e66e6a403daf6dc3dd597f.tar.gz bcm5719-llvm-af95597c3c9ecf18a9e66e6a403daf6dc3dd597f.zip | |
[hwasan] add stack frame descriptions.
Summary:
At compile-time, create an array of {PC,HumanReadableStackFrameDescription}
for every function that has an instrumented frame, and pass this array
to the run-time at the module-init time.
Similar to how we handle pc-table in SanitizerCoverage.
The run-time is dummy, will add the actual logic in later commits.
Reviewers: morehouse, eugenis
Reviewed By: eugenis
Subscribers: srhines, llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D53227
llvm-svn: 344985
Diffstat (limited to 'llvm/test')
3 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/basic.ll b/llvm/test/Instrumentation/HWAddressSanitizer/basic.ll index e8010992945..8253016d97b 100644 --- a/llvm/test/Instrumentation/HWAddressSanitizer/basic.ll +++ b/llvm/test/Instrumentation/HWAddressSanitizer/basic.ll @@ -354,5 +354,6 @@ entry: ; CHECK: define internal void @hwasan.module_ctor() { ; CHECK-NEXT: call void @__hwasan_init() +; CHECK-NEXT: call void @__hwasan_init_frames( ; CHECK-NEXT: ret void ; CHECK-NEXT: } diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/frame-descriptor.ll b/llvm/test/Instrumentation/HWAddressSanitizer/frame-descriptor.ll new file mode 100644 index 00000000000..3fd4197d3bb --- /dev/null +++ b/llvm/test/Instrumentation/HWAddressSanitizer/frame-descriptor.ll @@ -0,0 +1,27 @@ +; Test frame descriptors +; +; RUN: opt < %s -hwasan -S | FileCheck %s + +target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" +target triple = "aarch64--linux-android" + +declare void @use32(i32*, i64*) + +define void @test_alloca() sanitize_hwaddress { +entry: + %XYZ = alloca i32, align 4 + %ABC = alloca i64, align 4 + call void @use32(i32* nonnull %XYZ, i64 *nonnull %ABC) + ret void +} + +; CHECK: @[[STR:[0-9]*]] = private unnamed_addr constant [15 x i8] c"4 XYZ; 8 ABC; \00", align 1 +; CHECK: private constant { void ()*, [15 x i8]* } { void ()* @test_alloca, [15 x i8]* @[[STR]] }, section "__hwasan_frames", comdat($test_alloca) + +; CHECK-LABEL: @test_alloca( +; CHECK: ret void + +; CHECK-LABEL: @hwasan.module_ctor +; CHECK: call void @__hwasan_init_frames(i8* @__start___hwasan_frames, i8* @__stop___hwasan_frames) +; CHECK: ret void + diff --git a/llvm/test/Instrumentation/HWAddressSanitizer/with-calls.ll b/llvm/test/Instrumentation/HWAddressSanitizer/with-calls.ll index 768434c5b55..8d6068c3438 100644 --- a/llvm/test/Instrumentation/HWAddressSanitizer/with-calls.ll +++ b/llvm/test/Instrumentation/HWAddressSanitizer/with-calls.ll @@ -199,5 +199,6 @@ entry: ; CHECK: define internal void @hwasan.module_ctor() { ; CHECK-NEXT: call void @__hwasan_init() +; CHECK-NEXT: call void @__hwasan_init_frames( ; CHECK-NEXT: ret void ; CHECK-NEXT: } |

