nqminds / edgesec

Secure router - reference implementation
https://edgesec.info
MIT License
6 stars 1 forks source link

build(cmake): enable UndefinedBehaviorSanitizer #541

Closed aloisklink closed 1 year ago

aloisklink commented 1 year ago

Enable UndefinedBehaviorSanitizer (UBSan) on Linux presets by default.

UndefinedBehaviorSanitizer (UBSan) is a fast undefined behavior detector. UBSan modifies the program at compile-time to catch various kinds of undefined behavior during program execution, for example:

  • Array subscript out of bounds, where the bounds can be statically determined
  • Bitwise shifts that are out of bounds for their data type
  • Dereferencing misaligned or null pointers
  • Signed integer overflow
  • Conversion to, from, or between floating-point types which would overflow the destination

The OpenWRT SDK presets have it disabled, as old versions of GCC have poor support for running UBSanitizer on non-x86 platforms.

codecov[bot] commented 1 year ago

Codecov Report

Merging #541 (685f7b9) into main (f1826ab) will decrease coverage by 0.04%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #541      +/-   ##
==========================================
- Coverage   54.17%   54.14%   -0.04%     
==========================================
  Files         144      144              
  Lines       21034    21036       +2     
==========================================
- Hits        11395    11389       -6     
- Misses       9639     9647       +8     

see 5 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

aloisklink commented 1 year ago

I added the same lines to my BRSKI code and doesn't seem to find the asn libray.

Do you mean it couldn't find the UBSan library (UndefinedBehaviorSanitizer) the ASan (AddressSanitizer) library? It might not be supported for your cross-compiling configuration, or maybe your configuration (C++) means that ASan and UBSan can't run at the same time?

I know that ThreadSanitizer and MemorySanitizer can't run at the same time as AddressSanitizer, so maybe that could be the issue?