CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
111 lines
5.8 KiB
LLVM
111 lines
5.8 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
|
|
; RUN: opt -passes=hwasan -hwasan-use-stack-safety=0 -hwasan-use-after-scope -hwasan-inline-fast-path-checks=0 -S < %s | FileCheck %s
|
|
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
|
|
target triple = "riscv64-unknown-linux"
|
|
|
|
@stackbuf = dso_local local_unnamed_addr global ptr null, align 8
|
|
@jbuf = dso_local global [32 x i64] zeroinitializer, align 8
|
|
|
|
declare void @may_jump()
|
|
|
|
define dso_local noundef i1 @_Z6targetv() sanitize_hwaddress {
|
|
; CHECK-LABEL: define dso_local noundef i1 @_Z6targetv
|
|
; CHECK-SAME: () #[[ATTR0:[0-9]+]] personality ptr @__hwasan_personality_thunk {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__hwasan_tls, align 8
|
|
; CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 72057594037927935
|
|
; CHECK-NEXT: [[TMP2:%.*]] = ashr i64 [[TMP0]], 3
|
|
; CHECK-NEXT: [[TMP3:%.*]] = call ptr @llvm.frameaddress.p0(i32 0)
|
|
; CHECK-NEXT: [[TMP4:%.*]] = ptrtoint ptr [[TMP3]] to i64
|
|
; CHECK-NEXT: [[TMP5:%.*]] = shl i64 [[TMP4]], 44
|
|
; CHECK-NEXT: [[TMP6:%.*]] = or i64 ptrtoint (ptr @_Z6targetv to i64), [[TMP5]]
|
|
; CHECK-NEXT: [[TMP7:%.*]] = inttoptr i64 [[TMP1]] to ptr
|
|
; CHECK-NEXT: store i64 [[TMP6]], ptr [[TMP7]], align 8
|
|
; CHECK-NEXT: [[TMP8:%.*]] = ashr i64 [[TMP0]], 56
|
|
; CHECK-NEXT: [[TMP9:%.*]] = shl nuw nsw i64 [[TMP8]], 12
|
|
; CHECK-NEXT: [[TMP10:%.*]] = xor i64 [[TMP9]], -1
|
|
; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[TMP0]], 8
|
|
; CHECK-NEXT: [[TMP12:%.*]] = and i64 [[TMP11]], [[TMP10]]
|
|
; CHECK-NEXT: store i64 [[TMP12]], ptr @__hwasan_tls, align 8
|
|
; CHECK-NEXT: [[TMP13:%.*]] = or i64 [[TMP1]], 4294967295
|
|
; CHECK-NEXT: [[HWASAN_SHADOW:%.*]] = add i64 [[TMP13]], 1
|
|
; CHECK-NEXT: [[TMP14:%.*]] = inttoptr i64 [[HWASAN_SHADOW]] to ptr
|
|
; CHECK-NEXT: [[HWASAN_UAR_TAG:%.*]] = lshr i64 [[TMP4]], 56
|
|
; CHECK-NEXT: [[BUF:%.*]] = alloca [4096 x i8], align 16
|
|
; CHECK-NEXT: [[TMP15:%.*]] = xor i64 [[TMP2]], 0
|
|
; CHECK-NEXT: [[TMP16:%.*]] = ptrtoint ptr [[BUF]] to i64
|
|
; CHECK-NEXT: [[TMP17:%.*]] = and i64 [[TMP16]], 72057594037927935
|
|
; CHECK-NEXT: [[TMP18:%.*]] = shl i64 [[TMP15]], 56
|
|
; CHECK-NEXT: [[TMP19:%.*]] = or i64 [[TMP17]], [[TMP18]]
|
|
; CHECK-NEXT: [[BUF_HWASAN:%.*]] = inttoptr i64 [[TMP19]] to ptr
|
|
; CHECK-NEXT: [[TMP20:%.*]] = trunc i64 [[TMP15]] to i8
|
|
; CHECK-NEXT: [[TMP21:%.*]] = ptrtoint ptr [[BUF]] to i64
|
|
; CHECK-NEXT: [[TMP22:%.*]] = and i64 [[TMP21]], 72057594037927935
|
|
; CHECK-NEXT: [[TMP23:%.*]] = lshr i64 [[TMP22]], 4
|
|
; CHECK-NEXT: [[TMP24:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP23]]
|
|
; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP24]], i8 [[TMP20]], i64 256, i1 false)
|
|
; CHECK-NEXT: [[CALL:%.*]] = call i32 @setjmp(ptr noundef @jbuf)
|
|
; CHECK-NEXT: switch i32 [[CALL]], label [[WHILE_BODY:%.*]] [
|
|
; CHECK-NEXT: i32 1, label [[RETURN:%.*]]
|
|
; CHECK-NEXT: i32 2, label [[SW_BB1:%.*]]
|
|
; CHECK-NEXT: ]
|
|
; CHECK: sw.bb1:
|
|
; CHECK-NEXT: br label [[RETURN]]
|
|
; CHECK: while.body:
|
|
; CHECK-NEXT: [[TMP25:%.*]] = trunc i64 [[TMP15]] to i8
|
|
; CHECK-NEXT: [[TMP26:%.*]] = ptrtoint ptr [[BUF]] to i64
|
|
; CHECK-NEXT: [[TMP27:%.*]] = and i64 [[TMP26]], 72057594037927935
|
|
; CHECK-NEXT: [[TMP28:%.*]] = lshr i64 [[TMP27]], 4
|
|
; CHECK-NEXT: [[TMP29:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP28]]
|
|
; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP29]], i8 [[TMP25]], i64 256, i1 false)
|
|
; CHECK-NEXT: call void @llvm.hwasan.check.memaccess.shortgranules(ptr [[TMP14]], ptr @stackbuf, i32 19)
|
|
; CHECK-NEXT: store ptr [[BUF_HWASAN]], ptr @stackbuf, align 8
|
|
; CHECK-NEXT: call void @may_jump()
|
|
; CHECK-NEXT: [[TMP30:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
|
|
; CHECK-NEXT: [[TMP31:%.*]] = ptrtoint ptr [[BUF]] to i64
|
|
; CHECK-NEXT: [[TMP32:%.*]] = and i64 [[TMP31]], 72057594037927935
|
|
; CHECK-NEXT: [[TMP33:%.*]] = lshr i64 [[TMP32]], 4
|
|
; CHECK-NEXT: [[TMP34:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP33]]
|
|
; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP34]], i8 [[TMP30]], i64 256, i1 false)
|
|
; CHECK-NEXT: br label [[RETURN]]
|
|
; CHECK: return:
|
|
; CHECK-NEXT: [[RETVAL_0:%.*]] = phi i1 [ true, [[WHILE_BODY]] ], [ true, [[SW_BB1]] ], [ false, [[ENTRY:%.*]] ]
|
|
; CHECK-NEXT: [[TMP35:%.*]] = trunc i64 [[HWASAN_UAR_TAG]] to i8
|
|
; CHECK-NEXT: [[TMP36:%.*]] = ptrtoint ptr [[BUF]] to i64
|
|
; CHECK-NEXT: [[TMP37:%.*]] = and i64 [[TMP36]], 72057594037927935
|
|
; CHECK-NEXT: [[TMP38:%.*]] = lshr i64 [[TMP37]], 4
|
|
; CHECK-NEXT: [[TMP39:%.*]] = getelementptr i8, ptr [[TMP14]], i64 [[TMP38]]
|
|
; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP39]], i8 [[TMP35]], i64 256, i1 false)
|
|
; CHECK-NEXT: ret i1 [[RETVAL_0]]
|
|
;
|
|
entry:
|
|
%buf = alloca [4096 x i8], align 1
|
|
%call = call i32 @setjmp(ptr noundef @jbuf)
|
|
switch i32 %call, label %while.body [
|
|
i32 1, label %return
|
|
i32 2, label %sw.bb1
|
|
]
|
|
|
|
sw.bb1: ; preds = %entry
|
|
br label %return
|
|
|
|
while.body: ; preds = %entry
|
|
call void @llvm.lifetime.start.p0(ptr nonnull %buf) #10
|
|
store ptr %buf, ptr @stackbuf, align 8
|
|
; may_jump may call longjmp, going back to the switch (and then the return),
|
|
; bypassing the lifetime.end. This is why we need to untag on the return,
|
|
; rather than the lifetime.end.
|
|
call void @may_jump()
|
|
call void @llvm.lifetime.end.p0(ptr nonnull %buf) #10
|
|
br label %return
|
|
|
|
return: ; preds = %entry, %while.body, %sw.bb1
|
|
%retval.0 = phi i1 [ true, %while.body ], [ true, %sw.bb1 ], [ false, %entry ]
|
|
ret i1 %retval.0
|
|
}
|
|
|
|
declare i32 @setjmp(ptr noundef) returns_twice
|
|
|
|
declare void @llvm.lifetime.start.p0(ptr nocapture)
|
|
declare void @llvm.lifetime.end.p0(ptr nocapture)
|