You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to use address sanitizer in a program that links against compute-runtime #376
I am running an application that links against the compute-runtime that I am trying to run an address sanitizer on. At runtime I get the following error
You are trying to dlopen a libigfxdbgxchg64.so shared library with RTLD_DEEPBIND flag which is incompatibe with sanitizer runtime (see https://github.com/google/sanitizers/issues/611 for details). If you want to run libigfxdbgxchg64.so library under sanitizers please remove RTLD_DEEPBIND from dlopen flags.
I noticed in https://github.com/intel/compute-runtime/blob/master/shared/source/os_interface/linux/os_library_linux.cpp#L37-L42 that you are checking for a SANITIZER_BUILD compile definition and disabling RTLD_DEEPBIND if it is defined. However, this only works if the compute-runtime was compiled with this flag defined. Is it possible to move this check into a header file so that when people wish to use address sanitizers in their applications they don't need to recompile the compute-runtime as well?
With further investigation I have found that this is still broken in a strange way.
When running cmake with -DUSE_ASAN=ON to build the compute runtime any program that either links against or loads (via libOpenCL.so) the compute runtime must either link against libasan.so itself or must have libasan.so preloaded for it (using LD_PRELOAD environment variable). This includes programs like clinfo which will fail to detect the Intel GPU platform if libasan.so is not preloaded for it.
This behaviour is different from the behaviour of every other library that I am working with. With all other libraries I am able to enable address sanitization in my own program without needing to recompile any of the other libraries.
Is there some way to either remove RTLD_DEEPBIND from the compute runtime? The only options I can immediately think of that would allow RTLD_DEEPBIND to be used in the compute runtime library is either an environment variable or a configuration file.
If we consider the scenario of someone linking against the compute runtime library that they obtained from a prebuilt deb package (like the ones provided on the github releases page) and they try to run the address sanitizer on their own code they will meet the error that I received in my original post. The only way they will be able to do this is to download and compile the compute runtime and all of its dependencies from source, which they shouldn't ever have to do.
export NEOReadDebugKeys=1export DisableDeepBind=1dpcpp host_vs_device_code.cpp -g -fsanitize=thread./a.out==6411==You are trying to dlopen a libur_adapter_level_zero.so.0 shared library with RTLD_DEEPBIND flag which is incompatible with sanitizer runtime (see https://github.com/google/sanitizers/issues/611 for details). If you want to run libur_adapter_level_zero.so.0 library under sanitizers please remove RTLD_DEEPBIND from dlopen flags.
Activity
Bidski commentedon Nov 16, 2020
With further investigation I have found that this is still broken in a strange way.
When running cmake with
-DUSE_ASAN=ONto build the compute runtime any program that either links against or loads (vialibOpenCL.so) the compute runtime must either link againstlibasan.soitself or must havelibasan.sopreloaded for it (usingLD_PRELOADenvironment variable). This includes programs likeclinfowhich will fail to detect the Intel GPU platform iflibasan.sois not preloaded for it.This behaviour is different from the behaviour of every other library that I am working with. With all other libraries I am able to enable address sanitization in my own program without needing to recompile any of the other libraries.
Is there some way to either remove
RTLD_DEEPBINDfrom the compute runtime? The only options I can immediately think of that would allowRTLD_DEEPBINDto be used in the compute runtime library is either an environment variable or a configuration file.If we consider the scenario of someone linking against the compute runtime library that they obtained from a prebuilt deb package (like the ones provided on the github releases page) and they try to run the address sanitizer on their own code they will meet the error that I received in my original post. The only way they will be able to do this is to download and compile the compute runtime and all of its dependencies from source, which they shouldn't ever have to do.
HoppeMateusz commentedon Feb 25, 2021
Hello,
Issue with DEEPBIND should be resolved by: 66f4c75
In order to disable passing DEEPBIND flag to dlopen() in NEO, you need to set two environment variables:
NEOReadDebugKeys=1 DisableDeepBind=1
Please let us know if such configuration resolves the issue.
Mateusz
Load UBsan and asan in DEBUG
kallaballa commentedon Nov 11, 2023
It works,. I can run now tsan (and other sanitizers!).
kallaballa commentedon Mar 3, 2025
Still works for me using:
HoppeMateusz commentedon Mar 13, 2025
@MajidAbdelilah - Are you using recent Level zero loader ?
this problem could be related to old loader version - there was change in loader to remove deepbind:
oneapi-src/level-zero@f2a5dcc