Skip to content

Commit c720f92

Browse files
authored
[HIP] disable sanitizer for __hip_cuid (#141581)
Global variable `__hip_cuid_*` is for identifying purpose and does not need sanitization, therefore disable it for sanitizers.
1 parent 9cf4603 commit c720f92

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,7 @@ void CodeGenModule::Release() {
971971
getModule(), Int8Ty, false, llvm::GlobalValue::ExternalLinkage,
972972
llvm::Constant::getNullValue(Int8Ty),
973973
"__hip_cuid_" + getContext().getCUIDHash());
974+
getSanitizerMetadata()->disableSanitizerForGlobal(GV);
974975
addCompilerUsedGlobal(GV);
975976
}
976977
emitLLVMUsed();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fsanitize=address -fcuda-is-device \
2+
// RUN: -emit-llvm -cuid=abcd -o - %s | FileCheck %s
3+
4+
#include "Inputs/cuda.h"
5+
6+
// CHECK: @__hip_cuid_{{.*}} = {{.*}} no_sanitize_address

0 commit comments

Comments
 (0)