File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
llvm/lib/Transforms/Instrumentation
sycl/test-e2e/AddressSanitizer/out-of-bounds/USM Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -1742,19 +1742,21 @@ static bool isUnsupportedAMDGPUAddrspace(Value *Addr) {
17421742}
17431743
17441744static bool isUnsupportedDeviceGlobal (GlobalVariable *G) {
1745- // Non image scope device globals are implemented by device USM, and the
1746- // out-of-bounds check for them will be done by sanitizer USM part. So we
1747- // exclude them here.
1748- if (!G->hasAttribute (" sycl-device-image-scope" ))
1749- return true ;
1750-
17511745 // Skip instrumenting on "__AsanKernelMetadata" etc.
1752- if (G->getName ().starts_with (" __Asan" ))
1746+ if (G->getName ().starts_with (" __Asan" ) || G-> getName (). starts_with ( " __asan " ) )
17531747 return true ;
17541748
17551749 if (G->getAddressSpace () == kSpirOffloadLocalAS )
17561750 return !ClSpirOffloadLocals;
17571751
1752+ // When shadow bounds check is disabled, we need to instrument all global
1753+ // variables that user code can access
1754+ if (ClSpirCheckShadowBounds)
1755+ return false ;
1756+
1757+ // Non image scope device globals are implemented by device USM, and the
1758+ // out-of-bounds check for them will be done by sanitizer USM part. So we
1759+ // exclude them here.
17581760 Attribute Attr = G->getAttribute (" sycl-device-image-scope" );
17591761 return (!Attr.isStringAttribute () || Attr.getValueAsString () == " false" );
17601762}
Original file line number Diff line number Diff line change 11// REQUIRES: linux, gpu && level_zero
2- // RUN: %{build} %device_asan_flags -O0 -g -o %t1.out
2+ // RUN: %{build} %device_asan_flags -Xarch_device -mllvm=-asan-spir-shadow-bounds=1 - O0 -g -o %t1.out
33// RUN: %{run} not %t1.out 2>&1 | FileCheck %s
4- // RUN: %{build} %device_asan_flags -O2 -g -o %t3.out
4+ // RUN: %{build} %device_asan_flags -Xarch_device -mllvm=-asan-spir-shadow-bounds=1 - O2 -g -o %t3.out
55// RUN: %{run} not %t3.out 2>&1 | FileCheck %s
66
77#include < sycl/detail/core.hpp>
You can’t perform that action at this time.
0 commit comments