Skip to content

Commit

Permalink
NRN_OVERRIDE_LD_PRELOAD can fix AddressSanitizer: CHECK failed: asan_…
Browse files Browse the repository at this point in the history
…interceptors.cpp (#3116)

* NRN_OVERRIDE_LD_PRELOAD env var sets NRN_SANITIZER_LIBRARY_PATH

* Some documentation for NRN_OVERRIDE_LD_PRELOAD
  • Loading branch information
nrnhines authored Oct 3, 2024
1 parent 19dbd47 commit ab0a571
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cmake/SanitizerHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ set(${CODING_CONV_PREFIX}_SANITIZERS_UNDEFINED_EXCLUSIONS
include("${CODING_CONV_CMAKE}/sanitizers.cmake")
include(${CODING_CONV_CMAKE}/build-time-copy.cmake)

# If there is an issue with the automatically determined LD_PRELOAD then force with an environment
# variable when running cmake.
if(DEFINED ENV{NRN_OVERRIDE_LD_PRELOAD})
set(NRN_SANITIZER_LIBRARY_PATH "$ENV{NRN_OVERRIDE_LD_PRELOAD}")
endif()

# Propagate the sanitizer flags to the NEURON sources
list(APPEND NRN_COMPILE_FLAGS ${NRN_SANITIZER_COMPILER_FLAGS})
list(APPEND NRN_LINK_FLAGS ${NRN_SANITIZER_COMPILER_FLAGS})
Expand Down
10 changes: 9 additions & 1 deletion docs/install/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ use `nrn-enable-sanitizer special -python path/to/script.py` or
because the `python` binary is (presumably) not linked against the sanitizer
runtime library.

If ctest or nrn-enable-sanitizer runs generate a sanitizer error like
`AddressSanitizer: CHECK failed: asan_interceptors.cpp`
it might be that the automatically determined `LD_PRELOAD` is insufficient.
(It happened to me with ubuntu 24.04 + gcc 13.2.0). In this case you
can temporarily set the `NRN_OVERRIDE_LD_PRELOAD` environment variable before
running cmake. In my case,
`NRN_OVERRIDE_LD_PRELOAD="$(realpath "$(gcc -print-file-name=libasan.so)"):$realpath
"$(gcc -print-file-name=libstdc++.so)")" cmake ...` sufficed.

LSan, TSan and UBSan support suppression files, which can be used to prevent
tests failing due to known issues.
NEURON includes a suppression file for TSan under `.sanitizers/thread.supp` and
Expand Down Expand Up @@ -792,4 +801,3 @@ Unlike VTune, LIKWID doesn't support direct comparison of profile data. However,
for code regions, and since the profile results are provided as text output, comparing results from two runs is straightforward.
For instance, the screenshot below shows FLOPS instructions side by side between two runs:

![VTune Comparison](images/nrn_likwid_presoa_master_comparison.png)

0 comments on commit ab0a571

Please sign in to comment.