Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DeviceSanitizer] Support nullpointer detection #1914

Merged
merged 6 commits into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading