- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My fairly small custom MKL library searches for this dll.
However, I do not want to use custom memory allocation and do not include libimalloc.dll with my application.
So, since the search causes a security vulnerability, I'd like to stop this behavior.
Can anyone tell me how I can compile a custom MKL library that will NOT do this search?
thanks, Scott
However, I do not want to use custom memory allocation and do not include libimalloc.dll with my application.
So, since the search causes a security vulnerability, I'd like to stop this behavior.
Can anyone tell me how I can compile a custom MKL library that will NOT do this search?
thanks, Scott
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Please try to delete the whole line in the makefile which extracts i_malloc_dll.obj
lib .... /EXTRACT:i_malloc_dll.obj ...
And compile/use instead the following source file:
Please try to delete the whole line in the makefile which extracts i_malloc_dll.obj
lib .... /EXTRACT:i_malloc_dll.obj ...
And compile/use instead the following source file:
#include
i_malloc_t i_malloc = malloc;
i_calloc_t i_calloc = calloc;
i_realloc_t i_realloc = realloc;
i_free_t i_free = free;
void i_malloc_init(void) {}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cool, thanks for answering.
I'll give that I try as soon as I get time and let you know how it goes.
I'll give that I try as soon as I get time and let you know how it goes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Victor,
So, I think you intend that I create a.c file containing the source above, compile it to an .obj file and reference it from a link line in the makefile.
Is that right?
So, I made a file called removeimalloc.c.
Created removeimalloc.obj using: cl /c removeimalloc.c
Added "removeimalloc.obj" right before the reference to $(CB_XERBLA) in the ia32 section since that's what I'm building.
Rebuilt mkl_custom.dll/lib.
Rebuilt my application using the new mkl_custom.dll/lib
Ran the application and watched it with Process Monitor.
Sadly, it appears the application is still using libimalloc.dll
Did I do everything the way you think I should?
Why do you think the problem persists?
thanks, Scott
So, I think you intend that I create a
Is that right?
So, I made a file called removeimalloc.c.
Created removeimalloc.obj using: cl /c removeimalloc.c
Added "removeimalloc.obj" right before the reference to $(CB_XERBLA) in the ia32 section since that's what I'm building.
Rebuilt mkl_custom.dll/lib.
Rebuilt my application using the new mkl_custom.dll/lib
Ran the application and watched it with Process Monitor.
Sadly, it appears the application is still using libimalloc.dll
Did I do everything the way you think I should?
Why do you think the problem persists?
thanks, Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Scott,
Did youdelete the following lines in the makefile:
lib .... /EXTRACT:i_malloc_dll.obj ...
Also, it would be correct to delete all obj-file in that directory to not add unneeded stuff to your custom library
Did youdelete the following lines in the makefile:
lib .... /EXTRACT:i_malloc_dll.obj ...
Also, it would be correct to delete all obj-file in that directory to not add unneeded stuff to your custom library
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Victor,
Yup, I deleted:
@lib .\lib\mkl_cdll_ia32.lib /EXTRACT:i_malloc_dll.obj /OUT:.\temp_cdll\i_malloc_dll.obj
And changed:
.\temp_cdll\*.obj $(CB_XERBLA) \
To:
.\temp_cdll\*.obj .\removeimalloc.obj $(CB_XERBLA) \
Also, there are no other obj files the build directory.
thanks, Scott
Yup, I deleted:
@lib .\lib\mkl_cdll_ia32.lib /EXTRACT:i_malloc_dll.obj /OUT:.\temp_cdll\i_malloc_dll.obj
And changed:
.\temp_cdll\*.obj $(CB_XERBLA) \
To:
.\temp_cdll\*.obj .\removeimalloc.obj $(CB_XERBLA) \
Also, there are no other obj files the build directory.
thanks, Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Scott,
Could you please check your changes once more?
Here's output from Dependency Walker when MKL function i_malloc was used:
GetProcAddress(0x0000000077150000 [NTDLL.DLL], "NtQuerySystemInformation") called from "LIBIOMP5MD.DLL" at address 0x000000001006E1E7 and returned 0x00000000771A1670.
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x00000000736F26F4) in "LIBIOMP5MD.DLL" returned 1 (0x1).
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x0000000010071A40) in "MKL_CUSTOM.DLL" called.
LoadLibraryA("libimalloc.dll") called from "MKL_CUSTOM.DLL" at address 0x0000000180001015.
LoadLibraryA("libimalloc.dll") returned NULL. Error: The specified module could not be found (126).
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x0000000010071A40) in "MKL_CUSTOM.DLL" returned 1 (0x1).
And here's output when the library was built withchanges suggested by Victor, there's no libimalloc:
GetProcAddress(0x0000000077150000 [NTDLL.DLL], "NtQuerySystemInformation") called from "LIBIOMP5MD.DLL" at address 0x000000001006E1E7 and returned 0x00000000771A1670.
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x00000000736F26F4) in "LIBIOMP5MD.DLL" returned 1 (0x1).
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x0000000010071A40) in "MKL_CUSTOM.DLL" called.
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x0000000010071A40) in "MKL_CUSTOM.DLL" returned 1 (0x1).
Could you please check your changes once more?
Here's output from Dependency Walker when MKL function i_malloc was used:
GetProcAddress(0x0000000077150000 [NTDLL.DLL], "NtQuerySystemInformation") called from "LIBIOMP5MD.DLL" at address 0x000000001006E1E7 and returned 0x00000000771A1670.
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x00000000736F26F4) in "LIBIOMP5MD.DLL" returned 1 (0x1).
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x0000000010071A40) in "MKL_CUSTOM.DLL" called.
LoadLibraryA("libimalloc.dll") called from "MKL_CUSTOM.DLL" at address 0x0000000180001015.
LoadLibraryA("libimalloc.dll") returned NULL. Error: The specified module could not be found (126).
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x0000000010071A40) in "MKL_CUSTOM.DLL" returned 1 (0x1).
And here's output when the library was built withchanges suggested by Victor, there's no libimalloc:
GetProcAddress(0x0000000077150000 [NTDLL.DLL], "NtQuerySystemInformation") called from "LIBIOMP5MD.DLL" at address 0x000000001006E1E7 and returned 0x00000000771A1670.
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x00000000736F26F4) in "LIBIOMP5MD.DLL" returned 1 (0x1).
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x0000000010071A40) in "MKL_CUSTOM.DLL" called.
DllMain(0x0000000077255468, DLL_PROCESS_DETACH, 0x0000000010071A40) in "MKL_CUSTOM.DLL" returned 1 (0x1).
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page