SWDEV-369548 - Disallow opening an ipc mem handle in the originating process.

Change-Id: Icce5e41a220566141bd7d92b7199d477f60bed8e


[ROCm/clr commit: 30e740023b]
This commit is contained in:
Ioannis Assiouras
2022-11-29 10:16:54 +00:00
parent f1407eb433
commit f3c412b183
3 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -192,7 +192,7 @@ hipError_t IPCEvent::GetHandle(ihipIpcEventHandle_t* handle) {
return hipErrorInvalidValue;
}
ipc_evt_.ipc_shmem_->owners_device_id = deviceId();
ipc_evt_.ipc_shmem_->owners_process_id = getpid();
ipc_evt_.ipc_shmem_->owners_process_id = amd::Os::getProcessId();
memset(handle->shmem_name, 0, HIP_IPC_HANDLE_SIZE);
ipc_evt_.ipc_name_.copy(handle->shmem_name, std::string::npos);
return hipSuccess;
@@ -206,7 +206,7 @@ hipError_t IPCEvent::OpenHandle(ihipIpcEventHandle_t* handle) {
return hipErrorInvalidValue;
}
if (getpid() == ipc_evt_.ipc_shmem_->owners_process_id.load()) {
if (amd::Os::getProcessId() == ipc_evt_.ipc_shmem_->owners_process_id.load()) {
// If this is in the same process, return error.
return hipErrorInvalidContext;
}