nqminds / edgesec

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

Compile and test linux presets with AddressSanitizer to catch memory issues #540

Closed aloisklink closed 1 year ago

aloisklink commented 1 year ago

Compile edgesec tests with the -fsanitize=address flag which enables AddressSanitizer (aka ASan).

AddressSanitizer (aka ASan) is a memory error detector for C/C++. It finds:

I've enabled it on on Linux presets by default.

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

(plus, with the OpenWRT SDK presets, we're not running tests, so compiling with address sanitizer on doesn't really do much)

Bugs caught

The following PRs were fixing bugs that address sanitizer caught!

Future work

Address sanitizer is supported on FreeBSD, so we could enable it there too. This will probably also help with CheriBSD support, since some of these are probably causing the CheriBSD tests to fail.