Report pointer info queries to released fragments as type UNKNOWN.
We should not leak suballocation info to users. Change-Id: I13b2a22bf5517b523ba04ddc039b49da8378b55f
This commit is contained in:
@@ -778,6 +778,8 @@ hsa_status_t Runtime::PtrInfo(const void* ptr, hsa_amd_pointer_info_t* info, voi
|
||||
bool returnListData =
|
||||
((alloc != nullptr) && (num_agents_accessible != nullptr) && (accessible != nullptr));
|
||||
|
||||
bool allocation_map_entry_found = false;
|
||||
|
||||
{ // memory_lock protects access to the NMappedNodes array and fragment user data since these may
|
||||
// change with calls to memory APIs.
|
||||
ScopedAcquire<KernelSharedMutex> lock(&memory_lock_);
|
||||
@@ -827,10 +829,17 @@ hsa_status_t Runtime::PtrInfo(const void* ptr, hsa_amd_pointer_info_t* info, voi
|
||||
retInfo.hostBaseAddress = retInfo.agentBaseAddress;
|
||||
retInfo.sizeInBytes = fragment->second.size;
|
||||
retInfo.userData = fragment->second.user_ptr;
|
||||
allocation_map_entry_found = true;
|
||||
}
|
||||
}
|
||||
} // end lock scope
|
||||
|
||||
// Return type UNKNOWN for released fragments. Do not report the underlying block info to users!
|
||||
if ((!allocation_map_entry_found) &&
|
||||
((retInfo.type == HSA_EXT_POINTER_TYPE_HSA) || (retInfo.type == HSA_EXT_POINTER_TYPE_IPC))) {
|
||||
retInfo.type = HSA_EXT_POINTER_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
retInfo.size = Min(size_t(info->size), sizeof(hsa_amd_pointer_info_t));
|
||||
|
||||
// IPC and Graphics memory may come from a node that does not have an agent in this process.
|
||||
|
||||
مرجع در شماره جدید
Block a user