Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmake] Add a definition to enable clang sanitizers.
This can be useful to detect diverse memory mishandling. Case at hand here is the detection of a memory leak introduced in the past that went undetected for a while. Currently, it may not be possible to enable it as part of the bcc CI as there is a few existing leaks, but long term it may be beneficial to enable this as part of the CI si bus get caught early on. In the meantime, it is still valuable to be able to enable this in an ad-hoc manner. Testing: Ran the building step with: ``` docker run --privileged \ --pid=host \ -v $(pwd):/bcc \ -v /sys/kernel/debug:/sys/kernel/debug:rw \ -v /lib/modules:/lib/modules:ro \ -v /usr/src:/usr/src:ro \ -v /usr/include/linux:/usr/include/linux:ro \ bcc-docker \ /bin/bash -c \ 'mkdir -p /bcc/build && cd /bcc/build && \ cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_LLVM_NATIVECODEGEN=OFF -DCMAKE_SANITIZE_TYPE=leak .. && make -j9' ``` Followed by a test run: ``` docker run -ti \ --privileged \ --network=host \ --pid=host \ -v $(pwd):/bcc \ -v /sys/kernel/debug:/sys/kernel/debug:rw \ -v /lib/modules:/lib/modules:ro \ -v /usr/src:/usr/src:ro \ -e CTEST_OUTPUT_ON_FAILURE=1 \ bcc-docker \ /bin/bash -c \ '/bcc/build/tests/wrapper.sh \ c_test_all sudo /bcc/build/tests/cc/test_libbcc' ``` Test run shows leaks in https://gist.github.com/chantra/ef964a4805d94ea47199e9d62e2231ca
- Loading branch information