snapd icon indicating copy to clipboard operation
snapd copied to clipboard

cmd: add support for building with address and undefined behavior sanitizers

Open bboozzoo opened this issue 10 months ago • 4 comments

The branch builds on #15045 and adds support for building with asan and ubsan. This is only useful for testing local installation or running unit tests, as otherwise we'd have to ship libasan/libubsan in the snapd snap to make it universally useful in all scenarios.

Note, some binaries which are linked statically, snap-gdb*-shim specifically, had to be skipped, since libasan relies on dlopen().

bboozzoo avatar Feb 11 '25 12:02 bboozzoo

Tue Feb 18 12:09:09 UTC 2025

Spread tests skipped

github-actions[bot] avatar Feb 11 '25 12:02 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.13%. Comparing base (a272aac) to head (76dfa04). Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15059      +/-   ##
==========================================
+ Coverage   78.07%   78.13%   +0.06%     
==========================================
  Files        1182     1172      -10     
  Lines      157743   157622     -121     
==========================================
+ Hits       123154   123156       +2     
+ Misses      26943    26823     -120     
+ Partials     7646     7643       -3     
Flag Coverage Δ
unittests 78.13% <ø> (+0.06%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 11 '25 12:02 codecov[bot]

LGTM but I think perhaps a better option name should be chosen that is more self-explanatory than just sanitize (plus I expect woke etc will complain about the use of the term sanitize as well)

Do you think it makes sense to add ubsan too, even if for unit tests only?

bboozzoo avatar Feb 12 '25 09:02 bboozzoo

Do you think it makes sense to add ubsan too, even if for unit tests only?

Sure, the more the merrier particularly if its just the unit tests.

alexmurray avatar Feb 13 '25 00:02 alexmurray