mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
855343fa29
We can't use short granules with stack instrumentation when targeting older API levels because the rest of the system won't understand the short granule tags stored in shadow memory. Moreover, we need to be able to let old binaries (which won't understand short granule tags) run on a new system that supports short granule tags. Such binaries will call the __hwasan_tag_mismatch function when their outlined checks fail. We can compensate for the binary's lack of support for short granules by implementing the short granule part of the check in the __hwasan_tag_mismatch function. Unfortunately we can't do anything about inline checks, but I don't believe that we can generate these by default on aarch64, nor did we do so when the ABI was fixed. A new function, __hwasan_tag_mismatch_v2, is introduced that lets code targeting the new runtime avoid redoing the short granule check. Because tag mismatches are rare this isn't important from a performance perspective; the main benefit is that it introduces a symbol dependency that prevents binaries targeting the new runtime from running on older (i.e. incompatible) runtimes. Differential Revision: https://reviews.llvm.org/D68059 llvm-svn: 373035
18 lines
569 B
LLVM
18 lines
569 B
LLVM
; Test that alloca instrumentation with old API levels does not use short granules.
|
|
;
|
|
; 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*)
|
|
|
|
define void @test_alloca() sanitize_hwaddress {
|
|
; CHECK-LABEL: @test_alloca(
|
|
; CHECK: %[[X_TAG:[^ ]*]] = trunc i64 {{.*}} to i8
|
|
; CHECK: call void @llvm.memset.p0i8.i64(i8* align 1 {{.*}}, i8 %[[X_TAG]], i64 1, i1 false)
|
|
%x = alloca i32, align 4
|
|
call void @use32(i32* nonnull %x)
|
|
ret void
|
|
}
|