Skip to content

Commit 8cc54b0

Browse files
committed
[DevASAN] Only report warning if passing host ptr to kernel
1 parent 9e48f54 commit 8cc54b0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

source/loader/layers/sanitizer/asan/asan_interceptor.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,10 @@ ur_result_t AsanInterceptor::prepareLaunch(
721721
ContextInfo->Handle, DeviceInfo->Handle, (uptr)Ptr)) {
722722
ReportInvalidKernelArgument(Kernel, ArgIndex, (uptr)Ptr,
723723
ValidateResult, PtrPair.second);
724-
exitWithErrors();
724+
if (ValidateResult.Type !=
725+
ValidateUSMResult::MAYBE_HOST_POINTER) {
726+
exitWithErrors();
727+
}
725728
}
726729
}
727730
}
@@ -867,10 +870,12 @@ AsanInterceptor::findAllocInfoByAddress(uptr Address) {
867870
return std::optional<AllocationIterator>{};
868871
}
869872
--It;
870-
// Make sure we got the right AllocInfo
871-
assert(Address >= It->second->AllocBegin &&
872-
Address < It->second->AllocBegin + It->second->AllocSize &&
873-
"Wrong AllocInfo for the address");
873+
874+
// Maybe it's a host pointer
875+
if (Address < It->second->AllocBegin ||
876+
Address >= It->second->AllocBegin + It->second->AllocSize) {
877+
return std::nullopt;
878+
}
874879
return It;
875880
}
876881

0 commit comments

Comments
 (0)