1 of 10

Daniel Black

MariaDB Foundation

MariaDB Foundation�7 May 2025

Deep Dive�clang sanitizer testing

2 of 10

2

Credits

������ASAN/UBSAN:

Alexander Barkov�Brandon Nesterenko�Daniel Black�Elena Stepanova�Eugene Kosov�Marko Mäkelä�Michael Widenius�Ramesh Sivaraman�Roel Van de Paar�Sergei Golubchik�Sergei Petrunia�Yuchen Pei

Deep Dive - clang sanitizer testing

https://mariadb.org

MSAN:��Elena Stepanova�Marko Mäkelä

3 of 10

3

Overview

  • Buildbot container reuse and environment
  • MSAN Manual Server Start
  • MSAN Demo 1 - spider
  • MSAN Demo 2 (with rr)
  • MSAN Status
  • MSAN Conclusions
  • UBSAN + ASAN Intro
  • UBSAN + ASAN Demo
  • UBSAN/ASAN Status
  • UBSAN/ASAN Conclusion
  • Sponsor thanks

Deep Dive - clang sanitizer testing

https://mariadb.org

4 of 10

4

  • Container
    • fix /etc/motd
    • instrument few more things (boost for ColumnStore)
  • Continuous Integration (link)
    • almost green ; archive.archive-big fix waiting on merge to main
    • todo - add Debug builder + include Spider
  • Code
    • Improvements to CMake for CMAKE_BUILD_TYPE=Debug to be sufficient
    • remove over-masking
    • more bugs to fix (link) (Find bugs with rr (link))

MSAN Status

Presentation title, if necessary shortened

https://mariadb.org

5 of 10

5

  • Compared to compile warnings, Memory Sanitizer exceptionally accurate
  • Many are quite easy to fix
    • Identifying problem moderately easy, if hard, it's because of the code complexity
  • Don’t fight Memory Sanitizer:
    • It's usually right
    • masking will hide errors later
    • setting a valid initial state of memory is low impact (compared to crash/corruption)

MSAN Conclusions

Presentation title, if necessary shortened

https://mariadb.org

6 of 10

6

  • Utilize MSAN more
    • instrument memory reuse - e.g. MDEV-33245
    • parser state was reused between queries
    • MEM_UNDEFINED on memory that is reused by completed with (e.g parser state at end of query)

MSAN Conclusions

Presentation title, if necessary shortened

https://mariadb.org

7 of 10

7

  • Continuous Integration (link)
    • Blocking bugs:
    • MDEV-36542 Remove compile options for faking initialization under clang
    • MDEV-36708 innodb.innodb-index fails sporadically: use-after-poison on Aria my_pread
    • MDEV-36729 Undefined behaviour: ha_example plugin show_func_example via show_status_array for SHOW_SIM� MDEV-36337 runtime error: call to function (udf_example) netaphon through pointer to incorrect function type
    • Config ready: https://github.com/MariaDB/buildbot/pull/732/files
  • Code
    • Many Many bugs to fix (link)

UBSAN(ASAN) Status

Presentation title, if necessary shortened

https://mariadb.org

8 of 10

8

  • Mainly UBSAN errors
    • Old codebase inherits a lot of things previous tolerated by compilers
    • Only few blockers and filter that will result in a green CI
    • Then need to address outstanding issues

UBSAN(ASAN) Conclusion

Deep Dive - clang sanitizer testing

https://mariadb.org

9 of 10

9

Separation �slide

Deep Dive - clang sanitizer testing

https://mariadb.org

10 of 10

10

Sponsors

Deep Dive - clang sanitizer testing

https://mariadb.org