Skip to content

Commit 86e5553

Browse files
committed
fix MemToShadow_DG2
1 parent 0972a4d commit 86e5553

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libdevice/sanitizer_utils.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,12 @@ inline uptr MemToShadow_DG2(uptr addr, int32_t as) {
129129
}
130130

131131
if (as == AS_GLOBAL) { // global
132-
addr &= 0x7FFFFFFFFFFFULL;
133-
return __AsanShadowMemoryGlobalStart + (addr >> 3);
132+
if (addr & 0xFFFF000000000000ULL) { // Device USM
133+
return __AsanShadowMemoryGlobalStart + 0x100000000000ULL +
134+
((addr & 0x7FFFFFFFFFFFULL) >> 3);
135+
} else { // Host/Shared USM
136+
return __AsanShadowMemoryGlobalStart + (addr >> 3);
137+
}
134138
} else if (as == AS_LOCAL) { // local
135139
// The size of SLM is 64KB on DG2
136140
constexpr unsigned slm_size = 64 * 1024;

0 commit comments

Comments
 (0)