Skip to content

Commit

Permalink
Merge pull request #1914 from AllanZyne/review/yang/dsan_nullpointer
Browse files Browse the repository at this point in the history
[DeviceSanitizer] Support nullpointer detection
  • Loading branch information
omarahmed1111 committed Sep 18, 2024
2 parents 6298474 + 3dbb7a2 commit 4517290
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source/loader/layers/sanitizer/asan_interceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,18 @@ ur_result_t DeviceInfo::allocShadowMemory(ur_context_handle_t Context) {
}
getContext()->logger.info("ShadowMemory(Global): {} - {}",
(void *)ShadowOffset, (void *)ShadowOffsetEnd);

// Set shadow memory for null pointer
ManagedQueue Queue(Context, Handle);

auto DI = getContext()->interceptor->getDeviceInfo(Handle);
auto URes =
enqueueMemSetShadow(Context, DI, Queue, 0, 1, kNullPointerRedzoneMagic);
if (URes != UR_RESULT_SUCCESS) {
getContext()->logger.error("enqueueMemSetShadow(NullPointerRZ): {}",
URes);
return URes;
}
return UR_RESULT_SUCCESS;
}

Expand Down

0 comments on commit 4517290

Please sign in to comment.