Skip to content

Unable to use address sanitizer in a program that links against compute-runtime #376

Closed

Description

@Bidski

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?

Activity

  1. reopened this on Nov 16, 2020
  2. Bidski commented on Nov 16, 2020

    @Bidski
    Author

    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.

  3. HoppeMateusz commented on Feb 25, 2021

    @HoppeMateusz
    Contributor

    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

  4. added a commit that references this issue on Feb 23, 2023
  5. kallaballa commented on Nov 11, 2023

    @kallaballa

    It works,. I can run now tsan (and other sanitizers!).

  6. kallaballa commented on Mar 3, 2025

    @kallaballa

    Still works for me using:

    • Linux 6.13.4-1-default: SMP PREEMPT_DYNAMIC Fri Feb 21 17:01:23 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
    • gcc (SUSE Linux) 14.2.1 20250220 [revision 9ffecde121af883b60bbe60d00425036bc873048]
  7. HoppeMateusz commented on Mar 13, 2025

    @HoppeMateusz
    Contributor

    export NEOReadDebugKeys=1 export DisableDeepBind=1 dpcpp 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.

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions