P4 to Git Change 1138941 by emankov@em-hsa-amd on 2015/04/09 08:28:04
ECR #333753 - ORCA RT: aclCompilerInit usage fix
Passing pointers on CRT memory management functions to dynamically loaded library is unsafe and may lead to memory corruption. But actually the pointers aren't actually passed.
They are cut off by the struct size: sizeof(aclCompilerOptions_0_8) and hence never being called.
P.S.
If it was aclCompilerOptions_0_8_1 the pointers would be taken into account and a heap corruption would occur. So the change intended to liquidate possible misunderstanding of malloc & free functions usage, and doesn't change the behaviour of aclCompilerInit function at all.
Testing: pre check-in
Reviewers: German Andreev, Stanislav Mekhanoshin
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.cpp#271 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#507 edit
[ROCm/clr commit: 45fd651d2f]
Tento commit je obsažen v:
1 rodič
5175ee6b31
revize
e52ffcf972
2 files changed
+4
-12
No files matched your search
@@ -68,9 +68,7 @@ Device::init()
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&::malloc,
|
||||
&::free
|
||||
NULL
|
||||
};
|
||||
acl_error error;
|
||||
compiler_ = aclCompilerInit(&opts, &error);
|
||||
|
||||
@@ -203,9 +203,7 @@ NullDevice::create(CALtarget target)
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
AMD_OCL_SC_LIB,
|
||||
&::malloc,
|
||||
&::free
|
||||
AMD_OCL_SC_LIB
|
||||
};
|
||||
// Initialize the compiler handle
|
||||
acl_error error;
|
||||
@@ -949,9 +947,7 @@ Device::create(CALuint ordinal, CALuint numOfDevices)
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
AMD_OCL_SC_LIB,
|
||||
&::malloc,
|
||||
&::free
|
||||
AMD_OCL_SC_LIB
|
||||
};
|
||||
// Initialize the compiler handle
|
||||
acl_error error;
|
||||
@@ -1259,9 +1255,7 @@ Device::init()
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
AMD_OCL_SC_LIB,
|
||||
&::malloc,
|
||||
&::free
|
||||
AMD_OCL_SC_LIB
|
||||
};
|
||||
|
||||
hsaCompiler_ = NULL;
|
||||
|
||||
Reference in new issue
Zablokovat Uživatele