Skip to content

Commit

Permalink
sanitizers: disable calls to pthread_atfork
Browse files Browse the repository at this point in the history
OpenBLAS tries to do bad things in this callback (supposedly to support
use-after-fork), so we disable it entirely for TSAN/ASAN, where it
causes the sanitizers to deadlock.
  • Loading branch information
vtjnash authored and vchuravy committed Jan 6, 2022
1 parent d145e78 commit 7af9220
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cli/loader_exe.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ int main(int argc, char * argv[])
return ret;
}

#if defined(_COMPILER_ASAN_ENABLED_) || defined(_COMPILER_TSAN_ENABLED_)
// fork is generally bad news, but it is better if we prevent applications from
// making it worse as openblas threadpools cause it to hang
int __register_atfork232(void (*prepare)(void), void (*parent)(void), void (*child)(void), void *dso_handle) {
return 0;
}
__asm__ (".symver __register_atfork232, __register_atfork@@GLIBC_2.3.2");
#endif

#ifdef __cplusplus
} // extern "C"
#endif

0 comments on commit 7af9220

Please sign in to comment.