Skip to content

Improvements to the sanitizer workflow for the Github CI#3195

Merged
oskooi merged 4 commits intoNanoComp:masterfrom
oskooi:github_sanitizer_fix
Apr 6, 2026
Merged

Improvements to the sanitizer workflow for the Github CI#3195
oskooi merged 4 commits intoNanoComp:masterfrom
oskooi:github_sanitizer_fix

Conversation

@oskooi
Copy link
Copy Markdown
Collaborator

@oskooi oskooi commented Apr 5, 2026

1. MSAN is impractical for this project

MSAN (Memory Sanitizer) detects uninitialized memory reads, not memory leaks. The real reason it doesn't work (and has been commented out in build-san.yml since #3014) is that MSAN requires all linked code — to be compiled with -fsanitize=memory. The system packages (libfftw3, libhdf5, libgsl, libharminv, etc.) are not MSAN-instrumented, so every call into them produces false positives. Making MSAN work would require building all dependencies from source with MSAN, which is a significant effort. The recommendation is to remove the commented-out MSAN entry entirely rather than leaving it as dead config.

2. Dependency caching

Same as the main CI workflow changes in #3194 — the apt-get install step is fast since it uses pre-built packages, but caching would still help.

@oskooi oskooi added the github_actions Pull requests that update GitHub Actions code label Apr 5, 2026
@oskooi
Copy link
Copy Markdown
Collaborator Author

oskooi commented Apr 5, 2026

Note: it is not necessary to change the argument runs-on from ubuntu-24.04 to ubuntu-latest.

This is because ubuntu-latest is an alias that Github periodically updates to point to a newer version, which can unexpectedly change the clang version, system libraries, and sanitizer runtime behavior — potentially introducing spurious failures unrelated to the Meep code. Pinning to ubuntu-24.04 gives reproducible results, which is especially important for sanitizer workflows where runtime behavior is sensitive to toolchain versions.

@oskooi
Copy link
Copy Markdown
Collaborator Author

oskooi commented Apr 5, 2026

As additional information, UBSAN (Undefined Behavior Sanitizer) detects C/C++ undefined behavior at runtime, such as:

  • Signed integer overflow
  • Null point dereferences
  • Out-of-bounds array access
  • Misaligned pointer access
  • Division by zero
  • Invalid type casts
  • Shift operations past bit width

These are bugs where the C++ standard says "anything can happen" — the code may appear to work on one compiler/platform but crash or produce wrong results on another. UBSAN instruments the code at compile time and reports violations when the tests run.

@oskooi
Copy link
Copy Markdown
Collaborator Author

oskooi commented Apr 6, 2026

The sanitizer checks for ASAN and UBSAN (which were run manually) are passing.

@oskooi oskooi merged commit b910074 into NanoComp:master Apr 6, 2026
5 checks passed
@oskooi oskooi deleted the github_sanitizer_fix branch April 6, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant