Skip to content

Commit 6877561

Browse files
committed
nullpointer detection
1 parent a985a81 commit 6877561

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

source/loader/layers/sanitizer/asan_interceptor.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,18 @@ ur_result_t DeviceInfo::allocShadowMemory(ur_context_handle_t Context) {
425425
}
426426
getContext()->logger.info("ShadowMemory(Global): {} - {}",
427427
(void *)ShadowOffset, (void *)ShadowOffsetEnd);
428+
429+
// Set shadow memory for null pointer
430+
ManagedQueue Queue(Context, Handle);
431+
432+
auto DI = getContext()->interceptor->getDeviceInfo(Handle);
433+
auto URes =
434+
enqueueMemSetShadow(Context, DI, Queue, 0, 1, kNullPointerRedzoneMagic);
435+
if (URes != UR_RESULT_SUCCESS) {
436+
getContext()->logger.error("enqueueMemSetShadow(NullPointerRZ): {}",
437+
URes);
438+
return URes;
439+
}
428440
return UR_RESULT_SUCCESS;
429441
}
430442

0 commit comments

Comments
 (0)