oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
208 stars 90 forks source link

RTLD_DEEPBIND Flag Removal #95

Closed Kerilk closed 2 years ago

Kerilk commented 2 years ago

Hello,

The RTLD_DEEPBIND flag was removed by https://github.com/oneapi-src/level-zero/commit/f2a5dcc7806b89ac992bef07fb17e1a8ac102612

This resurrects issue: https://github.com/oneapi-src/level-zero/issues/39 And the segfault can be easily reproduced.

This will also break any tool that substitute itself to libze_loader.so through LD_PRELOAD mechanism. If RTLD_DEEPBIND is not a viable option for this project, then the loader shouldn't open itself when built as a standalone library.

bmyates commented 2 years ago

Hi, the loader doesn't load itself anymore using default build options.

There is a legacy mode that can be enabled at build time with DYNAMIC_LOAD_LOADER compiler switch in which the loader will still dlopen itself. I did not think this mode was being used and it hasn't been validated for quite some time. Are you using this mode?

Kerilk commented 2 years ago

No, I am not using this mode and you are correct the loader does not loads itself by default anymore. I reran my test from a clean pull and cmake build just to be sure. The segfault does indeed still happens, but at program termination, that's what left me confused.

So the segfault is occurring for another reason. You may want to investigate, the scenario may seem contrived but I still could see it happen. Maybe one of the C++ symbols that are exported are getting picked up.

I'll be closing this one.