Skip to content

load DLLs only from safe load list #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

bratpiorka
Copy link
Contributor

@bratpiorka bratpiorka commented Jun 16, 2024

Set /DEPENDENTLOADFLAG to 2000 (LOAD_LIBRARY_SAFE_CURRENT_DIRS) in Windows umf.dll builds (MSVC only).
With this flag, loading a DLL for execution from the current directory is only allowed if it is under a directory in the Safe load list.

In addition, there is a new test written in Power Shell that uses dumpbin.exe to check that this flag is set correctly.

Detailed information about the flag can be found at: https://learn.microsoft.com/en-us/cpp/build/reference/dependentloadflag?view=msvc-170
and: https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa

@bratpiorka bratpiorka force-pushed the rrudnick_dll_safe_load_list branch 30 times, most recently from 1353c92 to 899f11d Compare June 18, 2024 09:56
@bratpiorka bratpiorka force-pushed the rrudnick_dll_safe_load_list branch 7 times, most recently from c143e63 to d8c76c3 Compare June 18, 2024 12:12
@bratpiorka bratpiorka force-pushed the rrudnick_dll_safe_load_list branch 9 times, most recently from 6e9275f to 589bb23 Compare June 18, 2024 19:38
message(STATUS "C_COMPILER_ID: ${C_COMPILER_ID}")
message(STATUS "CXX_COMPILER_ID: ${CXX_COMPILER_ID}")
message(STATUS "CMAKE_C_COMPILER_ID: ${CMAKE_C_COMPILER_ID}")
message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: These messages potentially can be useful for other CMake generators. Could you move them to some common space, maybe in the main CMakeLists.txt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these were only debug prints - removed

@bratpiorka bratpiorka force-pushed the rrudnick_dll_safe_load_list branch 3 times, most recently from c5421f8 to 5b3b0ed Compare June 27, 2024 15:55
@bratpiorka bratpiorka marked this pull request as ready for review June 27, 2024 15:57
@bratpiorka bratpiorka requested a review from a team as a code owner June 27, 2024 15:57
@bratpiorka bratpiorka force-pushed the rrudnick_dll_safe_load_list branch from 5b3b0ed to 0b04e14 Compare June 27, 2024 16:09
@bratpiorka bratpiorka force-pushed the rrudnick_dll_safe_load_list branch from 0b04e14 to 38e126e Compare June 27, 2024 16:22
@bratpiorka bratpiorka merged commit af74d76 into oneapi-src:main Jun 27, 2024
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants