Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.29k stars 3.32k forks source link

Sanitize all the things: test builds with dynamic runtime sanitizers #1601

Closed daniel-j-h closed 1 month ago

daniel-j-h commented 9 years ago

This is a proposal to add instrumented binaries to the CI infrastructure, in order to improve code quality and detect hard to find bugs. The idea is as follows: build instrumented binaries, run tests, check reports.

Sanitizers

Here is a quick overview of what we should use:

For using all the sanitizer's features we need a recent Clang or GCC compiler (GCC lacks a few features compared to Clang). Also note that not all sanitizer combinations are allowed or possible, that is we should build separate instrumented binaries for each sanitizer.

Why not Valgrind

Valgrind only provides a subset of what the sanitizers listed above can detect. Running binaries under valgrind is also orders of magnitude slower than using the sanitizers and may not be feasible at all under the CI environemnt constraints.


Please at least skim the slides to the sanitizers presentation linked below.

References:

daniel-j-h commented 8 years ago

Playground for Travis setup is here: https://github.com/daniel-j-h/cpp-travis-setup (warning: quite noisy).

This is work in progress, but the following are major accomplishments for enabling this ticket's goals:

daniel-j-h commented 8 years ago

This is blocked on Travis CI mainly because of this as of yet unresolved issue: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=779785

Summary: deb packages do not contain all sanitizer libraries we need, this is known to the maintainer and will hopefully change with time.

We could build from source and cache the results, but this would require great efforts.

daniel-j-h commented 8 years ago

The blocking issue seems to be fixed upstream. Cross-referencing @springmeyer's work getting sanitizer builds for tippecanoe working on Travis: https://github.com/mapbox/tippecanoe/pull/224.

Not sure if we want to do this though, as our Travis builds are already really slow.

springmeyer commented 8 years ago

I'm starting to take a look at this - using clang++ 3.5.

daniel-j-h commented 7 years ago

Update: we run the address sanitizer now on Travis:

https://github.com/Project-OSRM/osrm-backend/blob/1ae69fe40d68a15ca978f0a4535d75523b292467/CMakeLists.txt#L283-L286

ubsan and others blocked by not having the capacity on Travis.

github-actions[bot] commented 2 months ago

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.